Skip to content

Commit 9db53c5

Browse files
committed
chore: add ssm path outputs, validate with tests, and add additional
logic to avoid invalid count
1 parent b09508a commit 9db53c5

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

src/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,8 @@ output "security_group_name" {
9797
value = module.kafka.security_group_name
9898
description = "The name of the created security group"
9999
}
100+
output "ssm_key_paths" {
101+
value = module.parameter_store_write.names
102+
description = "Names (key paths) of all SSM parameters stored for this msk cluster"
103+
}
104+

src/ssm.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ module "parameter_store_write" {
7575

7676
count = var.ssm_parameters_enabled && local.enabled ? 1 : 0
7777

78-
parameter_write = local.kafka_parameters
78+
parameter_write = var.ssm_parameters_enabled && local.enabled ? local.kafka_parameters : []
7979

8080
context = module.this.context
8181
}

test/component_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func (s *ComponentSuite) TestBasic() {
2424
const awsRegion = "us-east-2"
2525

2626
suffix := strings.ToLower(random.UniqueId())
27-
inputs := map[string]interface{}{
27+
inputs := map[string]any{
2828
"name": "msk-" + suffix,
2929
}
3030

@@ -55,6 +55,9 @@ func (s *ComponentSuite) TestBasic() {
5555
// Additional assertions for SASL and Zookeeper
5656
// ...
5757

58+
ssmKeyPaths := atmos.OutputList(s.T(), options, "ssm_key_paths")
59+
assert.Equal(s.T(), 5, len(ssmKeyPaths))
60+
5861
client := awshelper.NewMSKClient(s.T(), awsRegion)
5962
describeClusterOutput, err := client.DescribeCluster(context.Background(), &kafka.DescribeClusterInput{
6063
ClusterArn: &clusterArn,
@@ -100,4 +103,3 @@ func TestRunSuite(t *testing.T) {
100103
suite.AddDependency(t, "dns-delegated", "default-test", &inputs)
101104
helper.Run(t, suite)
102105
}
103-

test/fixtures/stacks/catalog/usecase/basic.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ components:
5555
# A list of IPv4 CIDRs to allow access to the cluster security group
5656
allowed_cidr_blocks: []
5757
# Write connection strings to SSM
58-
ssm_parameters_enabled: false
58+
ssm_parameters_enabled: true

test/fixtures/stacks/catalog/usecase/disabled.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ components:
5555
# A list of IPv4 CIDRs to allow access to the cluster security group
5656
allowed_cidr_blocks: []
5757
# Write connection strings to SSM
58-
ssm_parameters_enabled: false
58+
ssm_parameters_enabled: true

0 commit comments

Comments
 (0)