Skip to content

Commit c32a657

Browse files
fix: Allow cluster_settings to be list of maps instead of single map (#157)
1 parent 142f6ff commit c32a657

File tree

7 files changed

+31
-23
lines changed

7 files changed

+31
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ No resources.
188188
| <a name="input_cluster_configuration"></a> [cluster\_configuration](#input\_cluster\_configuration) | The execute command configuration for the cluster | `any` | `{}` | no |
189189
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the cluster (up to 255 letters, numbers, hyphens, and underscores) | `string` | `""` | no |
190190
| <a name="input_cluster_service_connect_defaults"></a> [cluster\_service\_connect\_defaults](#input\_cluster\_service\_connect\_defaults) | Configures a default Service Connect namespace | `map(string)` | `{}` | no |
191-
| <a name="input_cluster_settings"></a> [cluster\_settings](#input\_cluster\_settings) | Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster | `map(string)` | <pre>{<br> "name": "containerInsights",<br> "value": "enabled"<br>}</pre> | no |
191+
| <a name="input_cluster_settings"></a> [cluster\_settings](#input\_cluster\_settings) | List of configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster | `any` | <pre>[<br> {<br> "name": "containerInsights",<br> "value": "enabled"<br> }<br>]</pre> | no |
192192
| <a name="input_cluster_tags"></a> [cluster\_tags](#input\_cluster\_tags) | A map of additional tags to add to the cluster | `map(string)` | `{}` | no |
193193
| <a name="input_create"></a> [create](#input\_create) | Determines whether resources will be created (affects all resources) | `bool` | `true` | no |
194194
| <a name="input_create_cloudwatch_log_group"></a> [create\_cloudwatch\_log\_group](#input\_create\_cloudwatch\_log\_group) | Determines whether a log group is created by this module for the cluster logs. If not, AWS will automatically create one if logging is enabled | `bool` | `true` | no |

modules/cluster/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ No modules.
173173
| <a name="input_cluster_configuration"></a> [cluster\_configuration](#input\_cluster\_configuration) | The execute command configuration for the cluster | `any` | `{}` | no |
174174
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the cluster (up to 255 letters, numbers, hyphens, and underscores) | `string` | `""` | no |
175175
| <a name="input_cluster_service_connect_defaults"></a> [cluster\_service\_connect\_defaults](#input\_cluster\_service\_connect\_defaults) | Configures a default Service Connect namespace | `map(string)` | `{}` | no |
176-
| <a name="input_cluster_settings"></a> [cluster\_settings](#input\_cluster\_settings) | Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster | `map(string)` | <pre>{<br> "name": "containerInsights",<br> "value": "enabled"<br>}</pre> | no |
176+
| <a name="input_cluster_settings"></a> [cluster\_settings](#input\_cluster\_settings) | List of configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster | `any` | <pre>[<br> {<br> "name": "containerInsights",<br> "value": "enabled"<br> }<br>]</pre> | no |
177177
| <a name="input_create"></a> [create](#input\_create) | Determines whether resources will be created (affects all resources) | `bool` | `true` | no |
178178
| <a name="input_create_cloudwatch_log_group"></a> [create\_cloudwatch\_log\_group](#input\_create\_cloudwatch\_log\_group) | Determines whether a log group is created by this module for the cluster logs. If not, AWS will automatically create one if logging is enabled | `bool` | `true` | no |
179179
| <a name="input_create_task_exec_iam_role"></a> [create\_task\_exec\_iam\_role](#input\_create\_task\_exec\_iam\_role) | Determines whether the ECS task definition IAM role should be created | `bool` | `false` | no |

modules/cluster/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ resource "aws_ecs_cluster" "this" {
7979
}
8080

8181
dynamic "setting" {
82-
for_each = [var.cluster_settings]
82+
for_each = flatten([var.cluster_settings])
8383

8484
content {
8585
name = setting.value.name

modules/cluster/variables.tf

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ variable "cluster_configuration" {
2727
}
2828

2929
variable "cluster_settings" {
30-
description = "Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster"
31-
type = map(string)
32-
default = {
33-
name = "containerInsights"
34-
value = "enabled"
35-
}
30+
description = "List of configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster"
31+
type = any
32+
default = [
33+
{
34+
name = "containerInsights"
35+
value = "enabled"
36+
}
37+
]
3638
}
3739

3840
variable "cluster_service_connect_defaults" {

variables.tf

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ variable "cluster_configuration" {
2727
}
2828

2929
variable "cluster_settings" {
30-
description = "Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster"
31-
type = map(string)
32-
default = {
33-
name = "containerInsights"
34-
value = "enabled"
35-
}
30+
description = "List of configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster"
31+
type = any
32+
default = [
33+
{
34+
name = "containerInsights"
35+
value = "enabled"
36+
}
37+
]
3638
}
3739

3840
variable "cluster_service_connect_defaults" {

wrappers/cluster/main.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ module "wrapper" {
1010
cluster_configuration = try(each.value.cluster_configuration, var.defaults.cluster_configuration, {})
1111
cluster_name = try(each.value.cluster_name, var.defaults.cluster_name, "")
1212
cluster_service_connect_defaults = try(each.value.cluster_service_connect_defaults, var.defaults.cluster_service_connect_defaults, {})
13-
cluster_settings = try(each.value.cluster_settings, var.defaults.cluster_settings, {
14-
name = "containerInsights"
15-
value = "enabled"
16-
})
13+
cluster_settings = try(each.value.cluster_settings, var.defaults.cluster_settings, [
14+
{
15+
name = "containerInsights"
16+
value = "enabled"
17+
}
18+
])
1719
create = try(each.value.create, var.defaults.create, true)
1820
create_cloudwatch_log_group = try(each.value.create_cloudwatch_log_group, var.defaults.create_cloudwatch_log_group, true)
1921
create_task_exec_iam_role = try(each.value.create_task_exec_iam_role, var.defaults.create_task_exec_iam_role, false)

wrappers/main.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ module "wrapper" {
1010
cluster_configuration = try(each.value.cluster_configuration, var.defaults.cluster_configuration, {})
1111
cluster_name = try(each.value.cluster_name, var.defaults.cluster_name, "")
1212
cluster_service_connect_defaults = try(each.value.cluster_service_connect_defaults, var.defaults.cluster_service_connect_defaults, {})
13-
cluster_settings = try(each.value.cluster_settings, var.defaults.cluster_settings, {
14-
name = "containerInsights"
15-
value = "enabled"
16-
})
13+
cluster_settings = try(each.value.cluster_settings, var.defaults.cluster_settings, [
14+
{
15+
name = "containerInsights"
16+
value = "enabled"
17+
}
18+
])
1719
cluster_tags = try(each.value.cluster_tags, var.defaults.cluster_tags, {})
1820
create = try(each.value.create, var.defaults.create, true)
1921
create_cloudwatch_log_group = try(each.value.create_cloudwatch_log_group, var.defaults.create_cloudwatch_log_group, true)

0 commit comments

Comments
 (0)