Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow cluster_settings to be list of maps instead of single map #157

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ No resources.
| <a name="input_cluster_configuration"></a> [cluster\_configuration](#input\_cluster\_configuration) | The execute command configuration for the cluster | `any` | `{}` | no |
| <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 |
| <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 |
| <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 |
| <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 | `list(map(string))` | <pre>[<br> {<br> "name": "containerInsights",<br> "value": "enabled"<br> }<br>]</pre> | no |
| <a name="input_cluster_tags"></a> [cluster\_tags](#input\_cluster\_tags) | A map of additional tags to add to the cluster | `map(string)` | `{}` | no |
| <a name="input_create"></a> [create](#input\_create) | Determines whether resources will be created (affects all resources) | `bool` | `true` | no |
| <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 |
Expand Down
2 changes: 1 addition & 1 deletion modules/cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ No modules.
| <a name="input_cluster_configuration"></a> [cluster\_configuration](#input\_cluster\_configuration) | The execute command configuration for the cluster | `any` | `{}` | no |
| <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 |
| <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 |
| <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 |
| <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 | `list(map(string))` | <pre>[<br> {<br> "name": "containerInsights",<br> "value": "enabled"<br> }<br>]</pre> | no |
| <a name="input_create"></a> [create](#input\_create) | Determines whether resources will be created (affects all resources) | `bool` | `true` | no |
| <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 |
| <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 |
Expand Down
2 changes: 1 addition & 1 deletion modules/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ resource "aws_ecs_cluster" "this" {
}

dynamic "setting" {
for_each = [var.cluster_settings]
for_each = var.cluster_settings
ivan-sukhomlyn marked this conversation as resolved.
Show resolved Hide resolved

content {
name = setting.value.name
Expand Down
14 changes: 8 additions & 6 deletions modules/cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ variable "cluster_configuration" {
}

variable "cluster_settings" {
description = "Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster"
type = map(string)
default = {
name = "containerInsights"
value = "enabled"
}
description = "List of configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster"
type = list(map(string))
ivan-sukhomlyn marked this conversation as resolved.
Show resolved Hide resolved
default = [
{
name = "containerInsights"
value = "enabled"
}
]
}

variable "cluster_service_connect_defaults" {
Expand Down
14 changes: 8 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ variable "cluster_configuration" {
}

variable "cluster_settings" {
description = "Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster"
type = map(string)
default = {
name = "containerInsights"
value = "enabled"
}
description = "List of configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster"
type = list(map(string))
ivan-sukhomlyn marked this conversation as resolved.
Show resolved Hide resolved
default = [
{
name = "containerInsights"
value = "enabled"
}
]
}

variable "cluster_service_connect_defaults" {
Expand Down
10 changes: 6 additions & 4 deletions wrappers/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ module "wrapper" {
cluster_configuration = try(each.value.cluster_configuration, var.defaults.cluster_configuration, {})
cluster_name = try(each.value.cluster_name, var.defaults.cluster_name, "")
cluster_service_connect_defaults = try(each.value.cluster_service_connect_defaults, var.defaults.cluster_service_connect_defaults, {})
cluster_settings = try(each.value.cluster_settings, var.defaults.cluster_settings, {
name = "containerInsights"
value = "enabled"
})
cluster_settings = try(each.value.cluster_settings, var.defaults.cluster_settings, [
{
name = "containerInsights"
value = "enabled"
}
])
create = try(each.value.create, var.defaults.create, true)
create_cloudwatch_log_group = try(each.value.create_cloudwatch_log_group, var.defaults.create_cloudwatch_log_group, true)
create_task_exec_iam_role = try(each.value.create_task_exec_iam_role, var.defaults.create_task_exec_iam_role, false)
Expand Down
10 changes: 6 additions & 4 deletions wrappers/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ module "wrapper" {
cluster_configuration = try(each.value.cluster_configuration, var.defaults.cluster_configuration, {})
cluster_name = try(each.value.cluster_name, var.defaults.cluster_name, "")
cluster_service_connect_defaults = try(each.value.cluster_service_connect_defaults, var.defaults.cluster_service_connect_defaults, {})
cluster_settings = try(each.value.cluster_settings, var.defaults.cluster_settings, {
name = "containerInsights"
value = "enabled"
})
cluster_settings = try(each.value.cluster_settings, var.defaults.cluster_settings, [
{
name = "containerInsights"
value = "enabled"
}
])
cluster_tags = try(each.value.cluster_tags, var.defaults.cluster_tags, {})
create = try(each.value.create, var.defaults.create, true)
create_cloudwatch_log_group = try(each.value.create_cloudwatch_log_group, var.defaults.create_cloudwatch_log_group, true)
Expand Down
Loading