Skip to content

Commit

Permalink
feat: add new attribute reference zookeeper_connect_string_tls and …
Browse files Browse the repository at this point in the history
…variable to configure timeout settings (#1)
  • Loading branch information
bryantbiggs committed Nov 6, 2021
1 parent ed2189f commit d1f690e
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 26 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ Security scanning results provided by Bridgecrew. Bridgecrew is the leading full
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.43 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.60 |

## Providers

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

## Modules

Expand Down Expand Up @@ -187,7 +187,7 @@ No modules.
| <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 |
| <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 |
| <a name="input_kafka_version"></a> [kafka\_version](#input\_kafka\_version) | Specify the desired Kafka software version | `string` | `null` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the MSK cluster | `string` | `""` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the MSK cluster | `string` | `"msk"` | no |
| <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 |
| <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 |
| <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 |
Expand All @@ -200,6 +200,7 @@ No modules.
| <a name="input_schemas"></a> [schemas](#input\_schemas) | A map schemas to be created within the schema registry | `map(any)` | `{}` | no |
| <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 |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to assign to the resources created | `map(string)` | `{}` | no |
| <a name="input_timeouts"></a> [timeouts](#input\_timeouts) | Create, update, and delete timeout configurations for the cluster | `map(string)` | `{}` | no |

## Outputs

Expand All @@ -218,6 +219,7 @@ No modules.
| <a name="output_schemas"></a> [schemas](#output\_schemas) | A map of output attributes for the schemas created |
| <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 |
| <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 |
| <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 |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

## License
Expand Down
3 changes: 2 additions & 1 deletion examples/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.43 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.60 |

## Providers

Expand Down Expand Up @@ -61,6 +61,7 @@ No inputs.
| <a name="output_current_version"></a> [current\_version](#output\_current\_version) | Current version of the MSK Cluster used for updates, e.g. `K13V1IB3VIYZZH` |
| <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 |
| <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 |
| <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 |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

Apache-2.0 Licensed. See [LICENSE](../../LICENSE).
5 changes: 5 additions & 0 deletions examples/basic/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ output "zookeeper_connect_string" {
value = module.msk_cluster.zookeeper_connect_string
}

output "zookeeper_connect_string_tls" {
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"
value = module.msk_cluster.zookeeper_connect_string_tls
}

# Configuration
output "configuration_arn" {
description = "Amazon Resource Name (ARN) of the configuration"
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.43"
version = ">= 3.60"
}
}
}
5 changes: 3 additions & 2 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Note that this example may create resources which will incur monetary charges on
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.43 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.60 |

## Providers

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

## Modules
Expand Down Expand Up @@ -71,6 +71,7 @@ No inputs.
| <a name="output_current_version"></a> [current\_version](#output\_current\_version) | Current version of the MSK Cluster used for updates, e.g. `K13V1IB3VIYZZH` |
| <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 |
| <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 |
| <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 |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

Apache-2.0 Licensed. See [LICENSE](../../LICENSE).
5 changes: 5 additions & 0 deletions examples/complete/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ output "zookeeper_connect_string" {
value = module.msk_cluster.zookeeper_connect_string
}

output "zookeeper_connect_string_tls" {
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"
value = module.msk_cluster.zookeeper_connect_string_tls
}

# Configuration
output "configuration_arn" {
description = "Amazon Resource Name (ARN) of the configuration"
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.43"
version = ">= 3.60"
}
}
}
6 changes: 6 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ resource "aws_msk_cluster" "this" {
}
}

timeouts {
create = lookup(var.timeouts, "create", null)
update = lookup(var.timeouts, "update", null)
delete = lookup(var.timeouts, "delete", null)
}

# required for appautoscaling
lifecycle {
ignore_changes = [broker_node_group_info[0].ebs_volume_size]
Expand Down
37 changes: 21 additions & 16 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,64 +1,69 @@
# Cluster
output "arn" {
description = "Amazon Resource Name (ARN) of the MSK cluster"
value = element(concat(aws_msk_cluster.this[*].arn, [""]), 0)
value = try(aws_msk_cluster.this[0].arn, "")
}

output "bootstrap_brokers" {
description = "Comma separated list of one or more hostname:port pairs of kafka brokers suitable to bootstrap connectivity to the kafka cluster"
value = element(concat(compact([
element(concat(aws_msk_cluster.this[*].bootstrap_brokers, [""]), 0),
element(concat(aws_msk_cluster.this[*].bootstrap_brokers_sasl_iam, [""]), 0),
element(concat(aws_msk_cluster.this[*].bootstrap_brokers_sasl_scram, [""]), 0),
element(concat(aws_msk_cluster.this[*].bootstrap_brokers_tls, [""]), 0),
]), [""]), 0)
value = compact([
try(aws_msk_cluster.this[0].bootstrap_brokers, ""),
try(aws_msk_cluster.this[0].bootstrap_brokers_sasl_iam, ""),
try(aws_msk_cluster.this[0].bootstrap_brokers_sasl_scram, ""),
try(aws_msk_cluster.this[0].bootstrap_brokers_tls, ""),
])
}

output "bootstrap_brokers_plaintext" {
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`"
value = element(concat(aws_msk_cluster.this[*].bootstrap_brokers, [""]), 0)
value = try(aws_msk_cluster.this[0].bootstrap_brokers, "")
}

output "bootstrap_brokers_sasl_iam" {
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`"
value = element(concat(aws_msk_cluster.this[*].bootstrap_brokers_sasl_iam, [""]), 0)
value = try(aws_msk_cluster.this[0].bootstrap_brokers_sasl_iam, "")
}

output "bootstrap_brokers_sasl_scram" {
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`"
value = element(concat(aws_msk_cluster.this[*].bootstrap_brokers_sasl_scram, [""]), 0)
value = try(aws_msk_cluster.this[0].bootstrap_brokers_sasl_scram, "")
}

output "bootstrap_brokers_tls" {
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`"
value = element(concat(aws_msk_cluster.this[*].bootstrap_brokers_tls, [""]), 0)
value = try(aws_msk_cluster.this[0].bootstrap_brokers_tls, "")
}

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

output "zookeeper_connect_string" {
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"
value = element(concat(aws_msk_cluster.this[*].zookeeper_connect_string, [""]), 0)
value = try(aws_msk_cluster.this[0].zookeeper_connect_string, "")
}

output "zookeeper_connect_string_tls" {
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"
value = try(aws_msk_cluster.this[0].zookeeper_connect_string_tls, "")
}

# Configuration
output "configuration_arn" {
description = "Amazon Resource Name (ARN) of the configuration"
value = element(concat(aws_msk_configuration.this[*].arn, [""]), 0)
value = try(aws_msk_configuration.this[0].arn, "")
}

output "configuration_latest_revision" {
description = "Latest revision of the configuration"
value = element(concat(aws_msk_configuration.this[*].latest_revision, [""]), 0)
value = try(aws_msk_configuration.this[0].latest_revision, "")
}

# SCRAM secret association
output "scram_secret_association_id" {
description = "Amazon Resource Name (ARN) of the MSK cluster"
value = element(concat(aws_msk_scram_secret_association.this[*].id, [""]), 0)
value = try(aws_msk_scram_secret_association.this[0].id, "")
}

# Schema registry
Expand Down
8 changes: 7 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ variable "create" {
variable "name" {
description = "Name of the MSK cluster"
type = string
default = ""
default = "msk" # to avoid: Error: cluster_name must be 1 characters or higher
}

variable "kafka_version" {
Expand Down Expand Up @@ -137,6 +137,12 @@ variable "s3_logs_prefix" {
default = null
}

variable "timeouts" {
description = "Create, update, and delete timeout configurations for the cluster"
type = map(string)
default = {}
}

variable "tags" {
description = "A map of tags to assign to the resources created"
type = map(string)
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.43"
version = ">= 3.60"
}
}
}

0 comments on commit d1f690e

Please sign in to comment.