Skip to content

Commit 7f06510

Browse files
authored
fix: fixed bug in DA (#457)
1 parent c200e37 commit 7f06510

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

solutions/fully-configurable/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ locals {
5252
# Use existing key if set. Else if new key and if a prefix value is passed, add it to the COS key name
5353
cos_key_name = "${local.prefix}${var.cos_key_name}"
5454
# Determine the COS KMS key CRN (new key or existing key). It will only have a value if not using an existing bucket or existing EN instance
55-
cos_kms_key_crn = var.existing_event_notifications_instance_crn != null ? null : var.existing_kms_root_key_crn != null ? var.existing_kms_root_key_crn : module.kms[0].keys[format("%s.%s", local.en_key_ring_name, local.cos_key_name)].crn
55+
cos_kms_key_crn = var.existing_event_notifications_instance_crn != null ? null : var.kms_encryption_enabled ? var.existing_kms_root_key_crn != null ? var.existing_kms_root_key_crn : module.kms[0].keys[format("%s.%s", local.en_key_ring_name, local.cos_key_name)].crn : null
5656
# If existing KMS instance CRN passed, parse the key ID from it
5757
cos_kms_key_id = local.cos_kms_key_crn != null ? module.cos_kms_key_crn_parser[0].resource : null
5858
}

tests/pr_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,35 @@ func setupOptions(t *testing.T, prefix string, dir string) *testhelper.TestOptio
7373
return options
7474
}
7575

76+
func TestBasicFullyConfigurableInSchematics(t *testing.T) {
77+
t.Parallel()
78+
79+
var region = validRegions[rand.Intn(len(validRegions))]
80+
81+
options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
82+
Testing: t,
83+
Prefix: "en-basic",
84+
TarIncludePatterns: []string{
85+
"*.tf",
86+
fullyConfigurableDADir + "/*.tf",
87+
},
88+
ResourceGroup: resourceGroup,
89+
TemplateFolder: fullyConfigurableDADir,
90+
Tags: []string{"test-schematic"},
91+
DeleteWorkspaceOnFail: false,
92+
WaitJobCompleteMinutes: 60,
93+
})
94+
95+
options.TerraformVars = []testschematic.TestSchematicTerraformVar{
96+
{Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true},
97+
{Name: "prefix", Value: options.Prefix, DataType: "string"},
98+
{Name: "region", Value: region, DataType: "string"},
99+
}
100+
101+
err := options.RunSchematicTest()
102+
assert.Nil(t, err, "This should not have errored")
103+
}
104+
76105
func TestCompleteExampleInSchematics(t *testing.T) {
77106
t.Parallel()
78107

0 commit comments

Comments
 (0)