Skip to content

Commit fce8186

Browse files
authored
fix: update to variable validation (#116)
1 parent c432228 commit fce8186

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

examples/advanced/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ variable "ibmcloud_api_key" {
1111
variable "region" {
1212
type = string
1313
description = "Region to provision all resources created by this example"
14-
default = "us-south"
14+
default = "us-east"
1515
}
1616

1717
variable "prefix" {

examples/basic/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ variable "ibmcloud_api_key" {
1111
variable "region" {
1212
type = string
1313
description = "Region to provision all resources created by this example"
14-
default = "us-south"
14+
default = "us-east"
1515
}
1616

1717
variable "prefix" {

modules/mq-instance/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#
44
# Create an MQ on Cloud SaaS instance
55
##############################################################################
6-
76
locals {
87
# Capacity instance
98
split_capacity_crn = var.existing_mq_capacity_crn != null ? split(":", var.existing_mq_capacity_crn) : []

modules/mq-instance/variables.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ variable "existing_mq_capacity_crn" {
2727
type = string
2828
description = "The CRN of an existing capacity service instance, if not specifed, a new capacity plan will be created."
2929
default = null
30+
31+
validation {
32+
condition = (var.existing_mq_capacity_crn != null && var.subscription_id == null) || (var.existing_mq_capacity_crn == null && var.subscription_id != null)
33+
error_message = "Exactly one of 'existing_mq_capacity_crn' or 'subscription_id' is required."
34+
}
3035
}
3136

3237
variable "subscription_id" {
3338
type = string
3439
description = "The MQ on Cloud subscription id. Required if `existing_mq_capacity_crn` is not specified."
3540
default = null
36-
37-
validation {
38-
condition = (var.subscription_id == null && var.existing_mq_capacity_crn == null) ? false : true
39-
error_message = "Exactly one of 'existing_mq_capacity_crn' or 'subscription_id' is required."
40-
}
4141
}

tests/pr_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func TestRunStandardSolutionSchematics(t *testing.T) {
125125
Prefix: "mqoc-da",
126126
DeleteWorkspaceOnFail: false,
127127
WaitJobCompleteMinutes: 60,
128-
Region: "us-south",
128+
Region: "us-east",
129129
})
130130

131131
options.TerraformVars = []testschematic.TestSchematicTerraformVar{

0 commit comments

Comments
 (0)