Skip to content

Commit d1f690e

Browse files
authored
feat: add new attribute reference zookeeper_connect_string_tls and variable to configure timeout settings (#1)
1 parent ed2189f commit d1f690e

File tree

11 files changed

+57
-26
lines changed

11 files changed

+57
-26
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ Security scanning results provided by Bridgecrew. Bridgecrew is the leading full
132132
| Name | Version |
133133
|------|---------|
134134
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
135-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.43 |
135+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.60 |
136136

137137
## Providers
138138

139139
| Name | Version |
140140
|------|---------|
141-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.43 |
141+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.60 |
142142

143143
## Modules
144144

@@ -187,7 +187,7 @@ No modules.
187187
| <a name="input_firehose_logs_enabled"></a> [firehose\_logs\_enabled](#input\_firehose\_logs\_enabled) | Indicates whether you want to enable or disable streaming broker logs to Kinesis Data Firehose | `bool` | `false` | no |
188188
| <a name="input_jmx_exporter_enabled"></a> [jmx\_exporter\_enabled](#input\_jmx\_exporter\_enabled) | Indicates whether you want to enable or disable the JMX Exporter | `bool` | `false` | no |
189189
| <a name="input_kafka_version"></a> [kafka\_version](#input\_kafka\_version) | Specify the desired Kafka software version | `string` | `null` | no |
190-
| <a name="input_name"></a> [name](#input\_name) | Name of the MSK cluster | `string` | `""` | no |
190+
| <a name="input_name"></a> [name](#input\_name) | Name of the MSK cluster | `string` | `"msk"` | no |
191191
| <a name="input_node_exporter_enabled"></a> [node\_exporter\_enabled](#input\_node\_exporter\_enabled) | Indicates whether you want to enable or disable the Node Exporter | `bool` | `false` | no |
192192
| <a name="input_number_of_broker_nodes"></a> [number\_of\_broker\_nodes](#input\_number\_of\_broker\_nodes) | The desired total number of broker nodes in the kafka cluster. It must be a multiple of the number of specified client subnets | `number` | `null` | no |
193193
| <a name="input_s3_logs_bucket"></a> [s3\_logs\_bucket](#input\_s3\_logs\_bucket) | Name of the S3 bucket to deliver logs to | `string` | `null` | no |
@@ -200,6 +200,7 @@ No modules.
200200
| <a name="input_schemas"></a> [schemas](#input\_schemas) | A map schemas to be created within the schema registry | `map(any)` | `{}` | no |
201201
| <a name="input_scram_secret_association_secret_arn_list"></a> [scram\_secret\_association\_secret\_arn\_list](#input\_scram\_secret\_association\_secret\_arn\_list) | List of AWS Secrets Manager secret ARNs to associate with SCRAM | `list(string)` | `[]` | no |
202202
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to assign to the resources created | `map(string)` | `{}` | no |
203+
| <a name="input_timeouts"></a> [timeouts](#input\_timeouts) | Create, update, and delete timeout configurations for the cluster | `map(string)` | `{}` | no |
203204

204205
## Outputs
205206

@@ -218,6 +219,7 @@ No modules.
218219
| <a name="output_schemas"></a> [schemas](#output\_schemas) | A map of output attributes for the schemas created |
219220
| <a name="output_scram_secret_association_id"></a> [scram\_secret\_association\_id](#output\_scram\_secret\_association\_id) | Amazon Resource Name (ARN) of the MSK cluster |
220221
| <a name="output_zookeeper_connect_string"></a> [zookeeper\_connect\_string](#output\_zookeeper\_connect\_string) | A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster. The returned values are sorted alphbetically |
222+
| <a name="output_zookeeper_connect_string_tls"></a> [zookeeper\_connect\_string\_tls](#output\_zookeeper\_connect\_string\_tls) | A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster via TLS. The returned values are sorted alphbetically |
221223
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
222224

223225
## License

examples/basic/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Note that this example may create resources which will incur monetary charges on
2323
| Name | Version |
2424
|------|---------|
2525
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
26-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.43 |
26+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.60 |
2727

2828
## Providers
2929

@@ -61,6 +61,7 @@ No inputs.
6161
| <a name="output_current_version"></a> [current\_version](#output\_current\_version) | Current version of the MSK Cluster used for updates, e.g. `K13V1IB3VIYZZH` |
6262
| <a name="output_scram_secret_association_id"></a> [scram\_secret\_association\_id](#output\_scram\_secret\_association\_id) | Amazon Resource Name (ARN) of the MSK cluster |
6363
| <a name="output_zookeeper_connect_string"></a> [zookeeper\_connect\_string](#output\_zookeeper\_connect\_string) | A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster. The returned values are sorted alphbetically |
64+
| <a name="output_zookeeper_connect_string_tls"></a> [zookeeper\_connect\_string\_tls](#output\_zookeeper\_connect\_string\_tls) | A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster via TLS. The returned values are sorted alphbetically |
6465
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
6566

6667
Apache-2.0 Licensed. See [LICENSE](../../LICENSE).

examples/basic/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ output "zookeeper_connect_string" {
4343
value = module.msk_cluster.zookeeper_connect_string
4444
}
4545

46+
output "zookeeper_connect_string_tls" {
47+
description = "A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster via TLS. The returned values are sorted alphbetically"
48+
value = module.msk_cluster.zookeeper_connect_string_tls
49+
}
50+
4651
# Configuration
4752
output "configuration_arn" {
4853
description = "Amazon Resource Name (ARN) of the configuration"

examples/basic/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 3.43"
7+
version = ">= 3.60"
88
}
99
}
1010
}

examples/complete/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ Note that this example may create resources which will incur monetary charges on
2222
| Name | Version |
2323
|------|---------|
2424
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
25-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.43 |
25+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.60 |
2626

2727
## Providers
2828

2929
| Name | Version |
3030
|------|---------|
31-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.43 |
31+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.60 |
3232
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
3333

3434
## Modules
@@ -71,6 +71,7 @@ No inputs.
7171
| <a name="output_current_version"></a> [current\_version](#output\_current\_version) | Current version of the MSK Cluster used for updates, e.g. `K13V1IB3VIYZZH` |
7272
| <a name="output_scram_secret_association_id"></a> [scram\_secret\_association\_id](#output\_scram\_secret\_association\_id) | Amazon Resource Name (ARN) of the MSK cluster |
7373
| <a name="output_zookeeper_connect_string"></a> [zookeeper\_connect\_string](#output\_zookeeper\_connect\_string) | A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster. The returned values are sorted alphbetically |
74+
| <a name="output_zookeeper_connect_string_tls"></a> [zookeeper\_connect\_string\_tls](#output\_zookeeper\_connect\_string\_tls) | A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster via TLS. The returned values are sorted alphbetically |
7475
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
7576

7677
Apache-2.0 Licensed. See [LICENSE](../../LICENSE).

examples/complete/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ output "zookeeper_connect_string" {
4343
value = module.msk_cluster.zookeeper_connect_string
4444
}
4545

46+
output "zookeeper_connect_string_tls" {
47+
description = "A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster via TLS. The returned values are sorted alphbetically"
48+
value = module.msk_cluster.zookeeper_connect_string_tls
49+
}
50+
4651
# Configuration
4752
output "configuration_arn" {
4853
description = "Amazon Resource Name (ARN) of the configuration"

examples/complete/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 3.43"
7+
version = ">= 3.60"
88
}
99
}
1010
}

main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ resource "aws_msk_cluster" "this" {
8686
}
8787
}
8888

89+
timeouts {
90+
create = lookup(var.timeouts, "create", null)
91+
update = lookup(var.timeouts, "update", null)
92+
delete = lookup(var.timeouts, "delete", null)
93+
}
94+
8995
# required for appautoscaling
9096
lifecycle {
9197
ignore_changes = [broker_node_group_info[0].ebs_volume_size]

outputs.tf

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,69 @@
11
# Cluster
22
output "arn" {
33
description = "Amazon Resource Name (ARN) of the MSK cluster"
4-
value = element(concat(aws_msk_cluster.this[*].arn, [""]), 0)
4+
value = try(aws_msk_cluster.this[0].arn, "")
55
}
66

77
output "bootstrap_brokers" {
88
description = "Comma separated list of one or more hostname:port pairs of kafka brokers suitable to bootstrap connectivity to the kafka cluster"
9-
value = element(concat(compact([
10-
element(concat(aws_msk_cluster.this[*].bootstrap_brokers, [""]), 0),
11-
element(concat(aws_msk_cluster.this[*].bootstrap_brokers_sasl_iam, [""]), 0),
12-
element(concat(aws_msk_cluster.this[*].bootstrap_brokers_sasl_scram, [""]), 0),
13-
element(concat(aws_msk_cluster.this[*].bootstrap_brokers_tls, [""]), 0),
14-
]), [""]), 0)
9+
value = compact([
10+
try(aws_msk_cluster.this[0].bootstrap_brokers, ""),
11+
try(aws_msk_cluster.this[0].bootstrap_brokers_sasl_iam, ""),
12+
try(aws_msk_cluster.this[0].bootstrap_brokers_sasl_scram, ""),
13+
try(aws_msk_cluster.this[0].bootstrap_brokers_tls, ""),
14+
])
1515
}
1616

1717
output "bootstrap_brokers_plaintext" {
1818
description = "Comma separated list of one or more hostname:port pairs of kafka brokers suitable to bootstrap connectivity to the kafka cluster. Contains a value if `encryption_in_transit_client_broker` is set to `PLAINTEXT` or `TLS_PLAINTEXT`"
19-
value = element(concat(aws_msk_cluster.this[*].bootstrap_brokers, [""]), 0)
19+
value = try(aws_msk_cluster.this[0].bootstrap_brokers, "")
2020
}
2121

2222
output "bootstrap_brokers_sasl_iam" {
2323
description = "One or more DNS names (or IP addresses) and SASL IAM port pairs. This attribute will have a value if `encryption_in_transit_client_broker` is set to `TLS_PLAINTEXT` or `TLS` and `client_authentication_sasl_iam` is set to `true`"
24-
value = element(concat(aws_msk_cluster.this[*].bootstrap_brokers_sasl_iam, [""]), 0)
24+
value = try(aws_msk_cluster.this[0].bootstrap_brokers_sasl_iam, "")
2525
}
2626

2727
output "bootstrap_brokers_sasl_scram" {
2828
description = "One or more DNS names (or IP addresses) and SASL SCRAM port pairs. This attribute will have a value if `encryption_in_transit_client_broker` is set to `TLS_PLAINTEXT` or `TLS` and `client_authentication_sasl_scram` is set to `true`"
29-
value = element(concat(aws_msk_cluster.this[*].bootstrap_brokers_sasl_scram, [""]), 0)
29+
value = try(aws_msk_cluster.this[0].bootstrap_brokers_sasl_scram, "")
3030
}
3131

3232
output "bootstrap_brokers_tls" {
3333
description = "One or more DNS names (or IP addresses) and TLS port pairs. This attribute will have a value if `encryption_in_transit_client_broker` is set to `TLS_PLAINTEXT` or `TLS`"
34-
value = element(concat(aws_msk_cluster.this[*].bootstrap_brokers_tls, [""]), 0)
34+
value = try(aws_msk_cluster.this[0].bootstrap_brokers_tls, "")
3535
}
3636

3737
output "current_version" {
3838
description = "Current version of the MSK Cluster used for updates, e.g. `K13V1IB3VIYZZH`"
39-
value = element(concat(aws_msk_cluster.this[*].current_version, [""]), 0)
39+
value = try(aws_msk_cluster.this[0].current_version, "")
4040
}
4141

4242
output "zookeeper_connect_string" {
4343
description = "A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster. The returned values are sorted alphbetically"
44-
value = element(concat(aws_msk_cluster.this[*].zookeeper_connect_string, [""]), 0)
44+
value = try(aws_msk_cluster.this[0].zookeeper_connect_string, "")
45+
}
46+
47+
output "zookeeper_connect_string_tls" {
48+
description = "A comma separated list of one or more hostname:port pairs to use to connect to the Apache Zookeeper cluster via TLS. The returned values are sorted alphbetically"
49+
value = try(aws_msk_cluster.this[0].zookeeper_connect_string_tls, "")
4550
}
4651

4752
# Configuration
4853
output "configuration_arn" {
4954
description = "Amazon Resource Name (ARN) of the configuration"
50-
value = element(concat(aws_msk_configuration.this[*].arn, [""]), 0)
55+
value = try(aws_msk_configuration.this[0].arn, "")
5156
}
5257

5358
output "configuration_latest_revision" {
5459
description = "Latest revision of the configuration"
55-
value = element(concat(aws_msk_configuration.this[*].latest_revision, [""]), 0)
60+
value = try(aws_msk_configuration.this[0].latest_revision, "")
5661
}
5762

5863
# SCRAM secret association
5964
output "scram_secret_association_id" {
6065
description = "Amazon Resource Name (ARN) of the MSK cluster"
61-
value = element(concat(aws_msk_scram_secret_association.this[*].id, [""]), 0)
66+
value = try(aws_msk_scram_secret_association.this[0].id, "")
6267
}
6368

6469
# Schema registry

variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ variable "create" {
88
variable "name" {
99
description = "Name of the MSK cluster"
1010
type = string
11-
default = ""
11+
default = "msk" # to avoid: Error: cluster_name must be 1 characters or higher
1212
}
1313

1414
variable "kafka_version" {
@@ -137,6 +137,12 @@ variable "s3_logs_prefix" {
137137
default = null
138138
}
139139

140+
variable "timeouts" {
141+
description = "Create, update, and delete timeout configurations for the cluster"
142+
type = map(string)
143+
default = {}
144+
}
145+
140146
variable "tags" {
141147
description = "A map of tags to assign to the resources created"
142148
type = map(string)

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 3.43"
7+
version = ">= 3.60"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)