Skip to content

Commit fd8c8cf

Browse files
authored
fix: fixed incorrect variable validation for the create_vpc input (#997)
1 parent 9f09a24 commit fd8c8cf

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

tests/pr_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,11 @@ func TestFullyConfigurable(t *testing.T) {
201201
require.True(t, present, checkVariable+" environment variable not set")
202202
require.NotEqual(t, "", val, checkVariable+" environment variable is empty")
203203

204-
// Programmatically determine region to use based on availability
205-
region, _ := testhelper.GetBestVpcRegion(val, "../common-dev-assets/common-go-assets/cloudinfo-region-vpc-gen2-prefs.yaml", "eu-de")
206-
207204
prefix := "vpc-da"
208205

209206
options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
210207
Testing: t,
211-
Region: region,
208+
Region: "eu-de",
212209
Prefix: prefix,
213210
TarIncludePatterns: []string{
214211
"*.tf",
@@ -248,6 +245,7 @@ func TestFullyConfigurableWithFlowLogs(t *testing.T) {
248245

249246
options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
250247
Testing: t,
248+
Region: "eu-de", // Hardcoding region to avoid jp-osa, as jp-osa does not support COS association with HPCS.
251249
Prefix: prefix,
252250
TarIncludePatterns: []string{
253251
"*.tf",
@@ -288,14 +286,11 @@ func TestRunUpgradeFullyConfigurable(t *testing.T) {
288286
require.True(t, present, checkVariable+" environment variable not set")
289287
require.NotEqual(t, "", val, checkVariable+" environment variable is empty")
290288

291-
// Programmatically determine region to use based on availability
292-
region, _ := testhelper.GetBestVpcRegion(val, "../common-dev-assets/common-go-assets/cloudinfo-region-vpc-gen2-prefs.yaml", "eu-de")
293-
294289
prefix := "vpc-upg"
295290

296291
options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
297292
Testing: t,
298-
Region: region,
293+
Region: "eu-de", // Hardcoding region to avoid jp-osa, as jp-osa does not support COS association with HPCS.
299294
Prefix: prefix,
300295
TarIncludePatterns: []string{
301296
"*.tf",

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ variable "create_vpc" {
1313
}
1414

1515
validation {
16-
condition = !(var.create_vpc == false && var.create_subnets == true)
17-
error_message = "You cannot create subnets without creating a VPC. Hence if 'create_vpc' is false, then 'create_subnets' can not be true."
16+
condition = !(var.create_vpc == true && var.create_subnets == false)
17+
error_message = "You must create subnets while creating a VPC. Hence if 'create_vpc' is true, then 'create_subnets' should be true."
1818
}
1919
}
2020

0 commit comments

Comments
 (0)