diff --git a/README.md b/README.md index 38089db..ef2d0a0 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ This module uses Semver. | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 3.74.0 | +| [aws](#provider\_aws) | 5.24.0 | ## Modules @@ -76,6 +76,7 @@ No modules. | [capacity\_providers](#input\_capacity\_providers) | List of short names or full Amazon Resource Names (ARNs) of one or more capacity providers to associate with the cluster. Valid values also include `FARGATE` and `FARGATE_SPOT`. | `list(string)` | `null` | no | | [default\_capacity\_provider\_strategy](#input\_default\_capacity\_provider\_strategy) | The capacity provider strategy to use by default for the cluster. Can be one or more. List of map with corresponding items in docs. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster#default_capacity_provider_strategy) | `list(any)` | `[]` | no | | [enable\_container\_insights](#input\_enable\_container\_insights) | Enable container insights. | `bool` | `false` | no | +| [execute\_command\_configuration](#input\_execute\_command\_configuration) | Map with execute command configuration. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster#execute_command_configuration) | `any` | `null` | no | | [name](#input\_name) | Cluster name. | `string` | n/a | yes | | [settings](#input\_settings) | List of maps with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster#setting) | `list(any)` | `[]` | no | | [tags](#input\_tags) | Key-value mapping of resource tags. | `map(string)` | `{}` | no | diff --git a/main.tf b/main.tf index b5a5aff..3600159 100644 --- a/main.tf +++ b/main.tf @@ -21,6 +21,33 @@ resource "aws_ecs_cluster" "main" { } } + dynamic "configuration" { + for_each = var.execute_command_configuration != null ? [1] : [] + + content { + dynamic "execute_command_configuration" { + for_each = [var.execute_command_configuration] + + content { + kms_key_id = try(execute_command_configuration.value.kms_key_id, null) + logging = try(execute_command_configuration.value.logging, null) + + dynamic "log_configuration" { + for_each = try([execute_command_configuration.value.log_configuration], []) + + content { + cloud_watch_encryption_enabled = try(log_configuration.value.cloud_watch_encryption_enabled, null) + cloud_watch_log_group_name = try(log_configuration.value.cloud_watch_log_group_name, null) + s3_bucket_name = try(log_configuration.value.s3_bucket_name, null) + s3_bucket_encryption_enabled = try(log_configuration.value.s3_bucket_encryption_enabled, null) + s3_key_prefix = try(log_configuration.value.s3_key_prefix, null) + } + } + } + } + } + } + lifecycle { create_before_destroy = true } diff --git a/variables.tf b/variables.tf index 169a41f..c66b531 100644 --- a/variables.tf +++ b/variables.tf @@ -27,6 +27,12 @@ variable "enable_container_insights" { type = bool } +variable "execute_command_configuration" { + description = "Map with execute command configuration. [Terraform Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster#execute_command_configuration)" + default = null + type = any +} + variable "tags" { description = "Key-value mapping of resource tags." default = {}