From 8071c80a6a3a83e37f9e41177933888b0b1179a3 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Mon, 16 Jun 2025 12:13:18 -0700 Subject: [PATCH 1/5] remove datadog lookup --- src/README.md | 481 ------------------------------------------- src/cloud-map.tf | 4 +- src/context.tf | 4 +- src/datadog-agent.tf | 44 +++- src/main.tf | 12 +- src/remote-state.tf | 26 +-- 6 files changed, 57 insertions(+), 514 deletions(-) delete mode 100644 src/README.md diff --git a/src/README.md b/src/README.md deleted file mode 100644 index b078e1f..0000000 --- a/src/README.md +++ /dev/null @@ -1,481 +0,0 @@ ---- -tags: - - component/ecs-service - - layer/ecs - - provider/aws ---- - -# Component: `ecs-service` - -This component is responsible for creating an ECS service. - -## Usage - -**Stack Level**: Regional - -Here's an example snippet for how to use this component. - -```yaml -# stacks/catalog/ecs-service/defaults.yaml -components: - terraform: - ecs-service/defaults: - metadata: - component: ecs-service - type: abstract - settings: - spacelift: - workspace_enabled: true - vars: - enabled: true - public_lb_enabled: false - ecr_stage_name: mgmt-automation - task: - launch_type: FARGATE - network_mode: awsvpc - desired_count: 1 - ignore_changes_desired_count: true - ignore_changes_task_definition: false - assign_public_ip: false - propagate_tags: SERVICE - wait_for_steady_state: true - circuit_breaker_deployment_enabled: true - circuit_breaker_rollback_enabled: true -``` - -This will launch a `kong` service using an ecr image from `mgmt-automation` account. - -NOTE: Usage of `ecr_image` instead of `image`. - -```yaml -import: - - catalog/ecs-service/defaults - -components: - terraform: - ecs/b2b/kong/service: - metadata: - component: ecs-service - inherits: - - ecs-service/defaults - vars: - name: kong - public_lb_enabled: true - cluster_attributes: [b2b] - containers: - service: - name: "kong-gateway" - ecr_image: kong:latest - map_environment: - KONG_DECLARATIVE_CONFIG: /home/kong/production.yml - port_mappings: - - containerPort: 8000 - hostPort: 8000 - protocol: tcp - task: - desired_count: 1 - task_memory: 512 - task_cpu: 256 -``` - -This will launch a `httpd` service using an external image from dockerhub - -NOTE: Usage of `image` instead of `ecr_image`. - -```yaml -# stacks/catalog/ecs-service/httpd.yaml -import: - - catalog/ecs-service/defaults - -components: - terraform: - ecs/platform/httpd/service: - metadata: - component: ecs-service - inherits: - - ecs-service/defaults - vars: - enabled: true - name: httpd - public_lb_enabled: true - cluster_attributes: [platform] - containers: - service: - name: "Hello" - image: httpd:2.4 - port_mappings: - - containerPort: 80 - hostPort: 80 - protocol: tcp - command: - - '/bin/sh -c "echo '' Amazon ECS Sample App

Amazon ECS - Sample App

Congratulations!

Your application is now running on a container in Amazon - ECS.

'' > /usr/local/apache2/htdocs/index.html && httpd-foreground"' - entrypoint: ["sh", "-c"] - task: - desired_count: 1 - task_memory: 512 - task_cpu: 256 -``` - -This will launch google's `echoserver` using an external image from gcr - -NOTE: Usage of `image` instead of `ecr_image`. - -```yaml -# stacks/catalog/ecs-service/echoserver.yaml -import: - - catalog/ecs-service/defaults - -components: - terraform: - ecs/platform/echoserver/service: - metadata: - component: ecs-service - inherits: - - ecs-service/defaults - vars: - enabled: true - name: echoserver - public_lb_enabled: true - cluster_attributes: [platform] - containers: - service: - name: "echoserver" - image: gcr.io/google_containers/echoserver:1.10 - port_mappings: - - containerPort: 8080 - hostPort: 8080 - protocol: tcp - task: - desired_count: 1 - task_memory: 512 - task_cpu: 256 -``` - -#### Other Domains - -This component supports alternate service names for your ECS Service through a couple of variables: - -- `vanity_domain` & `vanity_alias` - This will create a route to the service in the listener rules of the ALB. This will - also create a Route 53 alias record in the hosted zone in this account. The hosted zone is looked up by the - `vanity_domain` input. -- `additional_targets` - This will create a route to the service in the listener rules of the ALB. This will not create - a Route 53 alias record. - -Examples: - -```yaml -ecs/platform/service/echo-server: - vars: - vanity_domain: "dev-acme.com" - vanity_alias: - - "echo-server.dev-acme.com" - additional_targets: - - "echo.acme.com" -``` - -This then creates the following listener rules: - -```text -HTTP Host Header is -echo-server.public-platform.use2.dev.plat.service-discovery.com - OR echo-server.dev-acme.com - OR echo.acme.com -``` - -It will also create the record in Route53 to point `"echo-server.dev-acme.com"` to the ALB. Thus -`"echo-server.dev-acme.com"` should resolve. - -We can then create a pointer to this service in the `acme.come` hosted zone. - -```yaml -dns-primary: - vars: - domain_names: - - acme.com - record_config: - - root_zone: acme.com - name: echo. - type: CNAME - ttl: 60 - records: - - echo-server.dev-acme.com -``` - -This will create a CNAME record in the `acme.com` hosted zone that points `echo.acme.com` to `echo-server.dev-acme.com`. - -### EFS - -EFS is supported by this ecs service, you can use either `efs_volumes` or `efs_component_volumes` in your task -definition. - -This example shows how to use `efs_component_volumes` which remote looks up efs component and uses the `efs_id` to mount -the volume. And how to use `efs_volumes` - -```yaml -components: - terraform: - ecs-services/my-service: - metadata: - component: ecs-service - inherits: - - ecs-services/defaults - vars: - containers: - service: - name: app - image: my-image:latest - log_configuration: - logDriver: awslogs - options: {} - port_mappings: - - containerPort: 8080 - hostPort: 8080 - protocol: tcp - mount_points: - - containerPath: "/var/lib/" - sourceVolume: "my-volume-mount" - - task: - efs_component_volumes: - - name: "my-volume-mount" - host_path: null - efs_volume_configuration: - - component: efs/my-volume-mount - root_directory: "/var/lib/" - transit_encryption: "ENABLED" - transit_encryption_port: 2999 - authorization_config: [] - efs_volumes: - - name: "my-volume-mount-2" - host_path: null - efs_volume_ configuration: - - file_system_id: "fs-1234" - root_directory: "/var/lib/" - transit_encryption: "ENABLED" - transit_encryption_port: 2998 - authorization_config: [] -``` - - - -## Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.0.0 | -| [aws](#requirement\_aws) | >= 4.66.1 | -| [jq](#requirement\_jq) | >=0.2.0 | -| [template](#requirement\_template) | >= 2.2 | - -## Providers - -| Name | Version | -|------|---------| -| [aws](#provider\_aws) | >= 4.66.1 | -| [jq](#provider\_jq) | >=0.2.0 | -| [template](#provider\_template) | >= 2.2 | - -## Modules - -| Name | Source | Version | -|------|--------|---------| -| [alb](#module\_alb) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | -| [alb\_ingress](#module\_alb\_ingress) | cloudposse/alb-ingress/aws | 0.30.0 | -| [cloudmap\_namespace](#module\_cloudmap\_namespace) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | -| [cloudmap\_namespace\_service\_discovery](#module\_cloudmap\_namespace\_service\_discovery) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | -| [container\_definition](#module\_container\_definition) | cloudposse/ecs-container-definition/aws | 0.61.2 | -| [datadog\_configuration](#module\_datadog\_configuration) | github.com/cloudposse-terraform-components/aws-datadog-credentials//src/modules/datadog_keys | tags/v1.535.2 | -| [datadog\_container\_definition](#module\_datadog\_container\_definition) | cloudposse/ecs-container-definition/aws | 0.61.2 | -| [datadog\_fluent\_bit\_container\_definition](#module\_datadog\_fluent\_bit\_container\_definition) | cloudposse/ecs-container-definition/aws | 0.61.2 | -| [datadog\_sidecar\_logs](#module\_datadog\_sidecar\_logs) | cloudposse/cloudwatch-logs/aws | 0.6.9 | -| [ecs\_alb\_service\_task](#module\_ecs\_alb\_service\_task) | cloudposse/ecs-alb-service-task/aws | 0.78.0 | -| [ecs\_cloudwatch\_autoscaling](#module\_ecs\_cloudwatch\_autoscaling) | cloudposse/ecs-cloudwatch-autoscaling/aws | 1.0.0 | -| [ecs\_cloudwatch\_sns\_alarms](#module\_ecs\_cloudwatch\_sns\_alarms) | cloudposse/ecs-cloudwatch-sns-alarms/aws | 0.13.2 | -| [ecs\_cluster](#module\_ecs\_cluster) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | -| [efs](#module\_efs) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | -| [gha\_assume\_role](#module\_gha\_assume\_role) | ../account-map/modules/team-assume-role-policy | n/a | -| [gha\_role\_name](#module\_gha\_role\_name) | cloudposse/label/null | 0.25.0 | -| [iam\_role](#module\_iam\_role) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | -| [iam\_roles](#module\_iam\_roles) | ../account-map/modules/iam-roles | n/a | -| [logs](#module\_logs) | cloudposse/cloudwatch-logs/aws | 0.6.9 | -| [nlb](#module\_nlb) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | -| [rds](#module\_rds) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | -| [roles\_to\_principals](#module\_roles\_to\_principals) | ../account-map/modules/roles-to-principals | n/a | -| [s3](#module\_s3) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | -| [security\_group](#module\_security\_group) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | -| [service\_domain](#module\_service\_domain) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | -| [this](#module\_this) | cloudposse/label/null | 0.25.0 | -| [vanity\_alias](#module\_vanity\_alias) | cloudposse/route53-alias/aws | 0.13.0 | -| [vpc](#module\_vpc) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | - -## Resources - -| Name | Type | -|------|------| -| [aws_iam_policy.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | -| [aws_iam_role.github_actions](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | -| [aws_kinesis_stream.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kinesis_stream) | resource | -| [aws_s3_bucket_object.task_definition_template](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_object) | resource | -| [aws_security_group_rule.custom_sg_rules](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource | -| [aws_service_discovery_service.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/service_discovery_service) | resource | -| [aws_ssm_parameter.full_urls](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_parameter) | resource | -| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | -| [aws_ecs_task_definition.created_task](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecs_task_definition) | data source | -| [aws_iam_policy_document.github_actions_iam_ecspresso_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | -| [aws_iam_policy_document.github_actions_iam_platform_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | -| [aws_iam_policy_document.github_actions_iam_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | -| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | -| [aws_kms_alias.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/kms_alias) | data source | -| [aws_route53_zone.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | -| [aws_route53_zone.selected_vanity](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | -| [aws_s3_object.task_definition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_object) | data source | -| [aws_s3_objects.mirror](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_objects) | data source | -| [aws_ssm_parameters_by_path.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameters_by_path) | data source | -| [jq_query.service_domain_query](https://registry.terraform.io/providers/massdriver-cloud/jq/latest/docs/data-sources/query) | data source | -| [template_file.envs](https://registry.terraform.io/providers/cloudposse/template/latest/docs/data-sources/file) | data source | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.
This is for some rare cases where resources want additional configuration of tags
and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no | -| [additional\_targets](#input\_additional\_targets) | Additional target routes to add to the ALB that point to this service. The only difference between this and `var.vanity_alias` is `var.vanity_alias` will create an alias record in Route 53 in the hosted zone in this account as well. `var.additional_targets` only adds the listener route to this service's target group. | `list(string)` | `[]` | no | -| [alb\_configuration](#input\_alb\_configuration) | The configuration to use for the ALB, specifying which cluster alb configuration to use | `string` | `"default"` | no | -| [alb\_name](#input\_alb\_name) | The name of the ALB this service should attach to | `string` | `null` | no | -| [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,
in the order they appear in the list. New attributes are appended to the
end of the list. The elements of the list are joined by the `delimiter`
and treated as a single ID element. | `list(string)` | `[]` | no | -| [autoscaling\_dimension](#input\_autoscaling\_dimension) | The dimension to use to decide to autoscale | `string` | `"cpu"` | no | -| [autoscaling\_enabled](#input\_autoscaling\_enabled) | Should this service autoscale using SNS alarams | `bool` | `true` | no | -| [chamber\_service](#input\_chamber\_service) | SSM parameter service name for use with chamber. This is used in chamber\_format where /$chamber\_service/$name/$container\_name/$parameter would be the default. | `string` | `"ecs-service"` | no | -| [cluster\_attributes](#input\_cluster\_attributes) | The attributes of the cluster name e.g. if the full name is `namespace-tenant-environment-dev-ecs-b2b` then the `cluster_name` is `ecs` and this value should be `b2b`. | `list(string)` | `[]` | no | -| [containers](#input\_containers) | Feed inputs into container definition module |
map(object({
name = string
ecr_image = optional(string)
image = optional(string)
memory = optional(number)
memory_reservation = optional(number)
cpu = optional(number)
essential = optional(bool, true)
readonly_root_filesystem = optional(bool, null)
privileged = optional(bool, null)
container_depends_on = optional(list(object({
containerName = string
condition = string # START, COMPLETE, SUCCESS, HEALTHY
})), null)

port_mappings = optional(list(object({
containerPort = number
hostPort = optional(number)
protocol = optional(string)
name = optional(string)
appProtocol = optional(string)
})), [])
command = optional(list(string), null)
entrypoint = optional(list(string), null)
healthcheck = optional(object({
command = list(string)
interval = number
retries = number
startPeriod = number
timeout = number
}), null)
ulimits = optional(list(object({
name = string
softLimit = number
hardLimit = number
})), null)
log_configuration = optional(object({
logDriver = string
options = optional(map(string), {})
}))
docker_labels = optional(map(string), null)
map_environment = optional(map(string), {})
map_secrets = optional(map(string), {})
volumes_from = optional(list(object({
sourceContainer = string
readOnly = bool
})), null)
mount_points = optional(list(object({
sourceVolume = optional(string)
containerPath = optional(string)
readOnly = optional(bool)
})), [])
}))
| `{}` | no | -| [context](#input\_context) | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. | `any` |
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"descriptor_formats": {},
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"labels_as_tags": [
"unset"
],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {},
"tenant": null
}
| no | -| [cpu\_utilization\_high\_alarm\_actions](#input\_cpu\_utilization\_high\_alarm\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on CPU Utilization High Alarm action | `list(string)` | `[]` | no | -| [cpu\_utilization\_high\_evaluation\_periods](#input\_cpu\_utilization\_high\_evaluation\_periods) | Number of periods to evaluate for the alarm | `number` | `1` | no | -| [cpu\_utilization\_high\_ok\_actions](#input\_cpu\_utilization\_high\_ok\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on CPU Utilization High OK action | `list(string)` | `[]` | no | -| [cpu\_utilization\_high\_period](#input\_cpu\_utilization\_high\_period) | Duration in seconds to evaluate for the alarm | `number` | `300` | no | -| [cpu\_utilization\_high\_threshold](#input\_cpu\_utilization\_high\_threshold) | The maximum percentage of CPU utilization average | `number` | `80` | no | -| [cpu\_utilization\_low\_alarm\_actions](#input\_cpu\_utilization\_low\_alarm\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on CPU Utilization Low Alarm action | `list(string)` | `[]` | no | -| [cpu\_utilization\_low\_evaluation\_periods](#input\_cpu\_utilization\_low\_evaluation\_periods) | Number of periods to evaluate for the alarm | `number` | `1` | no | -| [cpu\_utilization\_low\_ok\_actions](#input\_cpu\_utilization\_low\_ok\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on CPU Utilization Low OK action | `list(string)` | `[]` | no | -| [cpu\_utilization\_low\_period](#input\_cpu\_utilization\_low\_period) | Duration in seconds to evaluate for the alarm | `number` | `300` | no | -| [cpu\_utilization\_low\_threshold](#input\_cpu\_utilization\_low\_threshold) | The minimum percentage of CPU utilization average | `number` | `20` | no | -| [custom\_security\_group\_rules](#input\_custom\_security\_group\_rules) | The list of custom security group rules to add to the service security group |
list(object({
type = string
from_port = number
to_port = number
protocol = string
cidr_blocks = list(string)
description = optional(string)
}))
| `[]` | no | -| [datadog\_agent\_sidecar\_enabled](#input\_datadog\_agent\_sidecar\_enabled) | Enable the Datadog Agent Sidecar | `bool` | `false` | no | -| [datadog\_log\_method\_is\_firelens](#input\_datadog\_log\_method\_is\_firelens) | Datadog logs can be sent via cloudwatch logs (and lambda) or firelens, set this to true to enable firelens via a sidecar container for fluentbit | `bool` | `false` | no | -| [datadog\_logging\_default\_tags\_enabled](#input\_datadog\_logging\_default\_tags\_enabled) | Add Default tags to all logs sent to Datadog | `bool` | `true` | no | -| [datadog\_logging\_tags](#input\_datadog\_logging\_tags) | Tags to add to all logs sent to Datadog | `map(string)` | `null` | no | -| [datadog\_sidecar\_containers\_logs\_enabled](#input\_datadog\_sidecar\_containers\_logs\_enabled) | Enable the Datadog Agent Sidecar to send logs to aws cloudwatch group, requires `datadog_agent_sidecar_enabled` to be true | `bool` | `true` | no | -| [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no | -| [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.
Map of maps. Keys are names of descriptors. Values are maps of the form
`{
format = string
labels = list(string)
}`
(Type is `any` so the map values can later be enhanced to provide additional options.)
`format` is a Terraform format string to be passed to the `format()` function.
`labels` is a list of labels, in order, to pass to `format()` function.
Label values will be normalized before being passed to `format()` so they will be
identical to how they appear in `id`.
Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no | -| [ecr\_region](#input\_ecr\_region) | The region to use for the fully qualified ECR image URL. Defaults to the current region. | `string` | `""` | no | -| [ecr\_stage\_name](#input\_ecr\_stage\_name) | The ecr stage (account) name to use for the fully qualified ECR image URL. | `string` | `"auto"` | no | -| [ecs\_cluster\_name](#input\_ecs\_cluster\_name) | The name of the ECS Cluster this belongs to | `any` | `"ecs"` | no | -| [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no | -| [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | -| [exec\_enabled](#input\_exec\_enabled) | Specifies whether to enable Amazon ECS Exec for the tasks within the service | `bool` | `false` | no | -| [github\_actions\_allowed\_repos](#input\_github\_actions\_allowed\_repos) | A list of the GitHub repositories that are allowed to assume this role from GitHub Actions. For example,
["cloudposse/infra-live"]. Can contain "*" as wildcard.
If org part of repo name is omitted, "cloudposse" will be assumed. | `list(string)` | `[]` | no | -| [github\_actions\_ecspresso\_enabled](#input\_github\_actions\_ecspresso\_enabled) | Create IAM policies required for deployments with Ecspresso | `bool` | `false` | no | -| [github\_actions\_iam\_role\_attributes](#input\_github\_actions\_iam\_role\_attributes) | Additional attributes to add to the role name | `list(string)` | `[]` | no | -| [github\_actions\_iam\_role\_enabled](#input\_github\_actions\_iam\_role\_enabled) | Flag to toggle creation of an IAM Role that GitHub Actions can assume to access AWS resources | `bool` | `false` | no | -| [github\_oidc\_trusted\_role\_arns](#input\_github\_oidc\_trusted\_role\_arns) | A list of IAM Role ARNs allowed to assume this cluster's GitHub OIDC role | `list(string)` | `[]` | no | -| [health\_check\_healthy\_threshold](#input\_health\_check\_healthy\_threshold) | The number of consecutive health checks successes required before healthy | `number` | `2` | no | -| [health\_check\_interval](#input\_health\_check\_interval) | The duration in seconds in between health checks | `number` | `15` | no | -| [health\_check\_matcher](#input\_health\_check\_matcher) | The HTTP response codes to indicate a healthy check | `string` | `"200-404"` | no | -| [health\_check\_path](#input\_health\_check\_path) | The destination for the health check request | `string` | `"/health"` | no | -| [health\_check\_port](#input\_health\_check\_port) | The port to use to connect with the target. Valid values are either ports 1-65536, or `traffic-port`. Defaults to `traffic-port` | `string` | `"traffic-port"` | no | -| [health\_check\_timeout](#input\_health\_check\_timeout) | The amount of time to wait in seconds before failing a health check request | `number` | `10` | no | -| [health\_check\_unhealthy\_threshold](#input\_health\_check\_unhealthy\_threshold) | The number of consecutive health check failures required before unhealthy | `number` | `2` | no | -| [http\_protocol](#input\_http\_protocol) | Which http protocol to use in outputs and SSM url params. This value is ignored if a load balancer is not used. If it is `null`, the redirect value from the ALB determines the protocol. | `string` | `null` | no | -| [iam\_policy\_enabled](#input\_iam\_policy\_enabled) | If set to true will create IAM policy in AWS | `bool` | `false` | no | -| [iam\_policy\_statements](#input\_iam\_policy\_statements) | Map of IAM policy statements to use in the policy. This can be used with or instead of the `var.iam_source_json_url`. | `any` | `{}` | no | -| [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no | -| [kinesis\_enabled](#input\_kinesis\_enabled) | Enable Kinesis | `bool` | `false` | no | -| [kms\_alias\_name\_ssm](#input\_kms\_alias\_name\_ssm) | KMS alias name for SSM | `string` | `"alias/aws/ssm"` | no | -| [kms\_key\_alias](#input\_kms\_key\_alias) | ID of KMS key | `string` | `"default"` | no | -| [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.
Does not affect keys of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper`.
Default value: `title`. | `string` | `null` | no | -| [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no | -| [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,
set as tag values, and output by this module individually.
Does not affect values of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.
Default value: `lower`. | `string` | `null` | no | -| [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.
Default is to include all labels.
Tags with empty values will not be included in the `tags` output.
Set to `[]` to suppress all generated tags.
**Notes:**
The value of the `name` tag, if included, will be the `id`, not the `name`.
Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be
changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` |
[
"default"
]
| no | -| [lb\_catch\_all](#input\_lb\_catch\_all) | Should this service act as catch all for all subdomain hosts of the vanity domain | `bool` | `false` | no | -| [logs](#input\_logs) | Feed inputs into cloudwatch logs module | `any` | `{}` | no | -| [memory\_utilization\_high\_alarm\_actions](#input\_memory\_utilization\_high\_alarm\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on Memory Utilization High Alarm action | `list(string)` | `[]` | no | -| [memory\_utilization\_high\_evaluation\_periods](#input\_memory\_utilization\_high\_evaluation\_periods) | Number of periods to evaluate for the alarm | `number` | `1` | no | -| [memory\_utilization\_high\_ok\_actions](#input\_memory\_utilization\_high\_ok\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on Memory Utilization High OK action | `list(string)` | `[]` | no | -| [memory\_utilization\_high\_period](#input\_memory\_utilization\_high\_period) | Duration in seconds to evaluate for the alarm | `number` | `300` | no | -| [memory\_utilization\_high\_threshold](#input\_memory\_utilization\_high\_threshold) | The maximum percentage of Memory utilization average | `number` | `80` | no | -| [memory\_utilization\_low\_alarm\_actions](#input\_memory\_utilization\_low\_alarm\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on Memory Utilization Low Alarm action | `list(string)` | `[]` | no | -| [memory\_utilization\_low\_evaluation\_periods](#input\_memory\_utilization\_low\_evaluation\_periods) | Number of periods to evaluate for the alarm | `number` | `1` | no | -| [memory\_utilization\_low\_ok\_actions](#input\_memory\_utilization\_low\_ok\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on Memory Utilization Low OK action | `list(string)` | `[]` | no | -| [memory\_utilization\_low\_period](#input\_memory\_utilization\_low\_period) | Duration in seconds to evaluate for the alarm | `number` | `300` | no | -| [memory\_utilization\_low\_threshold](#input\_memory\_utilization\_low\_threshold) | The minimum percentage of Memory utilization average | `number` | `20` | no | -| [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no | -| [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no | -| [nlb\_name](#input\_nlb\_name) | The name of the NLB this service should attach to | `string` | `null` | no | -| [rds\_name](#input\_rds\_name) | The name of the RDS database this service should allow access to | `any` | `null` | no | -| [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | -| [region](#input\_region) | AWS Region | `string` | n/a | yes | -| [retention\_period](#input\_retention\_period) | Length of time data records are accessible after they are added to the stream | `number` | `48` | no | -| [s3\_mirror\_name](#input\_s3\_mirror\_name) | The name of the S3 mirror component | `string` | `null` | no | -| [service\_connect\_configurations](#input\_service\_connect\_configurations) | The list of Service Connect configurations.
See `service_connect_configuration` docs https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service#service_connect_configuration |
list(object({
enabled = bool
namespace = optional(string, null)
log_configuration = optional(object({
log_driver = string
options = optional(map(string), null)
secret_option = optional(list(object({
name = string
value_from = string
})), [])
}), null)
service = optional(list(object({
client_alias = list(object({
dns_name = string
port = number
}))
discovery_name = optional(string, null)
ingress_port_override = optional(number, null)
port_name = string
})), [])
}))
| `[]` | no | -| [service\_registries](#input\_service\_registries) | The list of Service Registries.
See `service_registries` docs https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service#service_registries |
list(object({
namespace = string
registry_arn = optional(string)
port = optional(number)
container_name = optional(string)
container_port = optional(number)
}))
| `[]` | no | -| [shard\_count](#input\_shard\_count) | Number of shards that the stream will use | `number` | `1` | no | -| [shard\_level\_metrics](#input\_shard\_level\_metrics) | List of shard-level CloudWatch metrics which can be enabled for the stream | `list(string)` |
[
"IncomingBytes",
"IncomingRecords",
"IteratorAgeMilliseconds",
"OutgoingBytes",
"OutgoingRecords",
"ReadProvisionedThroughputExceeded",
"WriteProvisionedThroughputExceeded"
]
| no | -| [ssm\_enabled](#input\_ssm\_enabled) | If `true` create SSM keys for the database user and password. | `bool` | `false` | no | -| [ssm\_key\_format](#input\_ssm\_key\_format) | SSM path format. The values will will be used in the following order: `var.ssm_key_prefix`, `var.name`, `var.ssm_key_*` | `string` | `"/%v/%v/%v"` | no | -| [ssm\_key\_prefix](#input\_ssm\_key\_prefix) | SSM path prefix. Omit the leading forward slash `/`. | `string` | `"ecs-service"` | no | -| [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no | -| [stickiness\_cookie\_duration](#input\_stickiness\_cookie\_duration) | The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds) | `number` | `86400` | no | -| [stickiness\_enabled](#input\_stickiness\_enabled) | Boolean to enable / disable `stickiness`. Default is `true` | `bool` | `true` | no | -| [stickiness\_type](#input\_stickiness\_type) | The type of sticky sessions. The only current possible value is `lb_cookie` | `string` | `"lb_cookie"` | no | -| [stream\_mode](#input\_stream\_mode) | Stream mode details for the Kinesis stream | `string` | `"PROVISIONED"` | no | -| [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no | -| [task](#input\_task) | Feed inputs into ecs\_alb\_service\_task module |
object({
task_cpu = optional(number)
task_memory = optional(number)
task_role_arn = optional(string, "")
pid_mode = optional(string, null)
ipc_mode = optional(string, null)
network_mode = optional(string)
propagate_tags = optional(string)
assign_public_ip = optional(bool, false)
use_alb_security_groups = optional(bool, true)
launch_type = optional(string, "FARGATE")
scheduling_strategy = optional(string, "REPLICA")
capacity_provider_strategies = optional(list(object({
capacity_provider = string
weight = number
base = number
})), [])

deployment_minimum_healthy_percent = optional(number, null)
deployment_maximum_percent = optional(number, null)
desired_count = optional(number, 0)
min_capacity = optional(number, 1)
max_capacity = optional(number, 2)
wait_for_steady_state = optional(bool, true)
circuit_breaker_deployment_enabled = optional(bool, true)
circuit_breaker_rollback_enabled = optional(bool, true)

ecs_service_enabled = optional(bool, true)
bind_mount_volumes = optional(list(object({
name = string
host_path = string
})), [])
efs_volumes = optional(list(object({
host_path = string
name = string
efs_volume_configuration = list(object({
file_system_id = string
root_directory = string
transit_encryption = string
transit_encryption_port = string
authorization_config = list(object({
access_point_id = string
iam = string
}))
}))
})), [])
efs_component_volumes = optional(list(object({
host_path = string
name = string
efs_volume_configuration = list(object({
component = optional(string, "efs")
tenant = optional(string, null)
environment = optional(string, null)
stage = optional(string, null)

root_directory = string
transit_encryption = string
transit_encryption_port = string
authorization_config = list(object({
access_point_id = string
iam = string
}))
}))
})), [])
docker_volumes = optional(list(object({
host_path = string
name = string
docker_volume_configuration = list(object({
autoprovision = bool
driver = string
driver_opts = map(string)
labels = map(string)
scope = string
}))
})), [])
fsx_volumes = optional(list(object({
host_path = string
name = string
fsx_windows_file_server_volume_configuration = list(object({
file_system_id = string
root_directory = string
authorization_config = list(object({
credentials_parameter = string
domain = string
}))
}))
})), [])
})
| `{}` | no | -| [task\_enabled](#input\_task\_enabled) | Whether or not to use the ECS task module | `bool` | `true` | no | -| [task\_exec\_policy\_arns\_map](#input\_task\_exec\_policy\_arns\_map) | A map of name to IAM Policy ARNs to attach to the generated task execution role.
The names are arbitrary, but must be known at plan time. The purpose of the name
is so that changes to one ARN do not cause a ripple effect on the other ARNs.
If you cannot provide unique names known at plan time, use `task_exec_policy_arns` instead. | `map(string)` | `{}` | no | -| [task\_iam\_role\_component](#input\_task\_iam\_role\_component) | A component that outputs an iam\_role module as 'role' for adding to the service as a whole. | `string` | `null` | no | -| [task\_policy\_arns](#input\_task\_policy\_arns) | The IAM policy ARNs to attach to the ECS task IAM role | `list(string)` |
[
"arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly",
"arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess"
]
| no | -| [task\_security\_group\_component](#input\_task\_security\_group\_component) | A component that outputs security\_group\_id for adding to the service as a whole. | `string` | `null` | no | -| [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no | -| [unauthenticated\_paths](#input\_unauthenticated\_paths) | Unauthenticated path pattern to match | `list(string)` | `[]` | no | -| [unauthenticated\_priority](#input\_unauthenticated\_priority) | The priority for the rules without authentication, between 1 and 50000 (1 being highest priority). Must be different from `authenticated_priority` since a listener can't have multiple rules with the same priority | `string` | `0` | no | -| [use\_lb](#input\_use\_lb) | Whether use load balancer for the service | `bool` | `false` | no | -| [use\_rds\_client\_sg](#input\_use\_rds\_client\_sg) | Use the RDS client security group | `bool` | `false` | no | -| [vanity\_alias](#input\_vanity\_alias) | The vanity aliases to use for the public LB. | `list(string)` | `[]` | no | -| [vanity\_domain](#input\_vanity\_domain) | Whether to use the vanity domain alias for the service | `string` | `null` | no | -| [zone\_component](#input\_zone\_component) | The component name to look up service domain remote-state on | `string` | `"dns-delegated"` | no | -| [zone\_component\_output](#input\_zone\_component\_output) | A json query to use to get the zone domain from the remote state. See | `string` | `".default_domain_name"` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| [ecs\_cluster\_arn](#output\_ecs\_cluster\_arn) | Selected ECS cluster ARN | -| [environment\_map](#output\_environment\_map) | Environment variables to pass to the container, this is a map of key/value pairs, where the key is `containerName,variableName` | -| [full\_domain](#output\_full\_domain) | Domain to respond to GET requests | -| [github\_actions\_iam\_role\_arn](#output\_github\_actions\_iam\_role\_arn) | ARN of IAM role for GitHub Actions | -| [github\_actions\_iam\_role\_name](#output\_github\_actions\_iam\_role\_name) | Name of IAM role for GitHub Actions | -| [lb\_arn](#output\_lb\_arn) | Selected LB ARN | -| [lb\_listener\_https](#output\_lb\_listener\_https) | Selected LB HTTPS Listener | -| [lb\_sg\_id](#output\_lb\_sg\_id) | Selected LB SG ID | -| [logs](#output\_logs) | Output of cloudwatch logs module | -| [service\_image](#output\_service\_image) | The image of the service container | -| [ssm\_key\_prefix](#output\_ssm\_key\_prefix) | SSM prefix | -| [ssm\_parameters](#output\_ssm\_parameters) | SSM parameters for the ECS Service | -| [subnet\_ids](#output\_subnet\_ids) | Selected subnet IDs | -| [task\_definition\_arn](#output\_task\_definition\_arn) | The task definition ARN | -| [task\_definition\_revision](#output\_task\_definition\_revision) | The task definition revision | -| [task\_template](#output\_task\_template) | The task template rendered | -| [vpc\_id](#output\_vpc\_id) | Selected VPC ID | -| [vpc\_sg\_id](#output\_vpc\_sg\_id) | Selected VPC SG ID | - - - -## References - -- [cloudposse/terraform-aws-components](https://github.com/cloudposse/terraform-aws-components/tree/main/modules/ecs-service) - - Cloud Posse's upstream component - -[](https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-terraform-components/aws-ecs-service&utm_content=) diff --git a/src/cloud-map.tf b/src/cloud-map.tf index 09185d0..f5d169d 100644 --- a/src/cloud-map.tf +++ b/src/cloud-map.tf @@ -4,7 +4,7 @@ module "cloudmap_namespace" { for_each = { for service_connect in var.service_connect_configurations : service_connect.namespace => service_connect } source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.8.0" + version = "1.5.0" component = each.key @@ -25,7 +25,7 @@ module "cloudmap_namespace_service_discovery" { for_each = { for service_connect in var.service_registries : service_connect.namespace => service_connect } source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.8.0" + version = "1.5.0" component = each.key diff --git a/src/context.tf b/src/context.tf index e7dd3ea..5e0ef88 100644 --- a/src/context.tf +++ b/src/context.tf @@ -264,8 +264,8 @@ variable "descriptor_formats" { Describe additional descriptors to be output in the `descriptors` output map. Map of maps. Keys are names of descriptors. Values are maps of the form `{ - format = string - labels = list(string) + format = string + labels = list(string) }` (Type is `any` so the map values can later be enhanced to provide additional options.) `format` is a Terraform format string to be passed to the `format()` function. diff --git a/src/datadog-agent.tf b/src/datadog-agent.tf index 763b05a..931aee0 100644 --- a/src/datadog-agent.tf +++ b/src/datadog-agent.tf @@ -16,6 +16,24 @@ variable "datadog_sidecar_containers_logs_enabled" { description = "Enable the Datadog Agent Sidecar to send logs to aws cloudwatch group, requires `datadog_agent_sidecar_enabled` to be true" } +variable "datadog_api_key_ssm_parameter_name" { + type = string + default = null + description = "The SSM Parameter Name containing the Datadog API Key" +} + +variable "datadog_site" { + type = string + default = "us5.datadoghq.com" + description = "The Datadog Site to send logs to" +} + +variable "datadog_app_key_ssm_parameter_name" { + type = string + default = null + description = "The SSM Parameter Name containing the Datadog App Key" +} + variable "datadog_logging_tags" { type = map(string) default = null @@ -28,6 +46,18 @@ variable "datadog_logging_default_tags_enabled" { description = "Add Default tags to all logs sent to Datadog" } +data "aws_ssm_parameter" "datadog_api_key" { + count = var.datadog_api_key_ssm_parameter_name != null && var.datadog_agent_sidecar_enabled ? 1 : 0 + + name = var.datadog_api_key_ssm_parameter_name +} + +data "aws_ssm_parameter" "datadog_app_key" { + count = var.datadog_app_key_ssm_parameter_name != null && var.datadog_agent_sidecar_enabled ? 1 : 0 + + name = var.datadog_app_key_ssm_parameter_name +} + locals { default_datadog_tags = var.datadog_logging_default_tags_enabled ? { env = module.this.stage @@ -40,8 +70,8 @@ locals { logDriver = "awsfirelens" options = var.datadog_agent_sidecar_enabled ? { Name = "datadog", - apikey = module.datadog_configuration.datadog_api_key, - Host = format("http-intake.logs.%s", module.datadog_configuration.datadog_site) + apikey = one(data.aws_ssm_parameter.datadog_api_key[*].value), + Host = format("http-intake.logs.%s", var.datadog_site) dd_service = module.this.name, dd_tags = local.all_dd_tags, dd_source = "ecs", @@ -54,7 +84,7 @@ locals { module "datadog_sidecar_logs" { source = "cloudposse/cloudwatch-logs/aws" - version = "0.6.9" + version = "0.6.6" # if we are using datadog firelens we don't need to create a log group count = local.enabled && var.datadog_agent_sidecar_enabled && var.datadog_sidecar_containers_logs_enabled ? 1 : 0 @@ -76,7 +106,7 @@ module "datadog_sidecar_logs" { module "datadog_container_definition" { source = "cloudposse/ecs-container-definition/aws" - version = "0.61.2" + version = "0.58.1" count = local.enabled && var.datadog_agent_sidecar_enabled ? 1 : 0 @@ -87,8 +117,8 @@ module "datadog_container_definition" { essential = true map_environment = { "ECS_FARGATE" = var.task.launch_type == "FARGATE" ? true : false - "DD_API_KEY" = module.datadog_configuration.datadog_api_key - "DD_SITE" = module.datadog_configuration.datadog_site + "DD_API_KEY" = one(data.aws_ssm_parameter.datadog_api_key[*].value) + "DD_SITE" = var.datadog_site "DD_ENV" = module.this.stage "DD_LOGS_ENABLED" = true "DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL" = true @@ -124,7 +154,7 @@ module "datadog_container_definition" { module "datadog_fluent_bit_container_definition" { source = "cloudposse/ecs-container-definition/aws" - version = "0.61.2" + version = "0.58.1" count = local.enabled && var.datadog_agent_sidecar_enabled ? 1 : 0 diff --git a/src/main.tf b/src/main.tf index ad8341b..33914de 100644 --- a/src/main.tf +++ b/src/main.tf @@ -83,7 +83,7 @@ data "aws_s3_object" "task_definition" { module "logs" { source = "cloudposse/cloudwatch-logs/aws" - version = "0.6.9" + version = "0.6.8" # if we are using datadog firelens we don't need to create a log group count = local.enabled && (!var.datadog_agent_sidecar_enabled || !var.datadog_log_method_is_firelens) ? 1 : 0 @@ -182,7 +182,7 @@ locals { module "container_definition" { source = "cloudposse/ecs-container-definition/aws" - version = "0.61.2" + version = "0.61.1" for_each = { for k, v in local.containers_priority_terraform : k => v if local.enabled } @@ -254,7 +254,7 @@ locals { module "ecs_alb_service_task" { source = "cloudposse/ecs-alb-service-task/aws" - version = "0.78.0" + version = "0.72.0" count = local.enabled ? 1 : 0 @@ -342,7 +342,7 @@ resource "aws_security_group_rule" "custom_sg_rules" { module "alb_ingress" { source = "cloudposse/alb-ingress/aws" - version = "0.30.0" + version = "0.28.0" count = local.is_alb ? 1 : 0 @@ -443,7 +443,7 @@ module "vanity_alias" { module "ecs_cloudwatch_autoscaling" { source = "cloudposse/ecs-cloudwatch-autoscaling/aws" - version = "1.0.0" + version = "0.7.3" count = local.enabled && var.task_enabled && var.autoscaling_enabled ? 1 : 0 @@ -475,7 +475,7 @@ locals { module "ecs_cloudwatch_sns_alarms" { source = "cloudposse/ecs-cloudwatch-sns-alarms/aws" - version = "0.13.2" + version = "0.12.3" count = local.enabled && var.autoscaling_enabled ? 1 : 0 cluster_name = module.ecs_cluster.outputs.cluster_name diff --git a/src/remote-state.tf b/src/remote-state.tf index 5b4fb84..08c0122 100644 --- a/src/remote-state.tf +++ b/src/remote-state.tf @@ -55,7 +55,7 @@ locals { module "vpc" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.8.0" + version = "1.5.0" component = "vpc" @@ -65,7 +65,7 @@ module "vpc" { module "security_group" { count = local.enabled && var.task_security_group_component != null ? 1 : 0 source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.8.0" + version = "1.5.0" component = var.task_security_group_component @@ -75,7 +75,7 @@ module "security_group" { module "rds" { count = local.enabled && var.use_rds_client_sg && try(length(var.rds_name), 0) > 0 ? 1 : 0 source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.8.0" + version = "1.5.0" component = var.rds_name @@ -84,7 +84,7 @@ module "rds" { module "ecs_cluster" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.8.0" + version = "1.5.0" component = coalesce(var.ecs_cluster_name, "ecs-cluster") @@ -93,7 +93,7 @@ module "ecs_cluster" { module "alb" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.8.0" + version = "1.5.0" count = local.is_alb && local.use_external_lb ? 1 : 0 @@ -104,7 +104,7 @@ module "alb" { module "nlb" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.8.0" + version = "1.5.0" count = local.is_nlb ? 1 : 0 @@ -115,7 +115,7 @@ module "nlb" { module "s3" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.8.0" + version = "1.5.0" count = local.s3_mirroring_enabled ? 1 : 0 @@ -127,7 +127,7 @@ module "s3" { module "service_domain" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.8.0" + version = "1.5.0" component = var.zone_component @@ -140,12 +140,6 @@ data "jq_query" "service_domain_query" { query = var.zone_component_output } -module "datadog_configuration" { - source = "github.com/cloudposse-terraform-components/aws-datadog-credentials//src/modules/datadog_keys?ref=tags/v1.535.2" - enabled = true - context = module.this.context -} - # This is purely a check to ensure this zone exists # tflint-ignore: terraform_unused_declarations data "aws_route53_zone" "selected" { @@ -169,7 +163,7 @@ data "aws_kms_alias" "selected" { module "iam_role" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.8.0" + version = "1.5.0" count = local.enabled && var.task_iam_role_component != null ? 1 : 0 component = var.task_iam_role_component @@ -181,7 +175,7 @@ module "efs" { for_each = local.efs_component_map source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.8.0" + version = "1.5.0" # Here we can use [0] because aws only allows one efs volume configuration per volume component = each.value.efs_volume_configuration[0].component From 1619273e92450a5f0861cd197e7f3a87af609726 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Mon, 16 Jun 2025 12:17:01 -0700 Subject: [PATCH 2/5] Update remote state to 1.8.0 --- src/cloud-map.tf | 4 ++-- src/remote-state.tf | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/cloud-map.tf b/src/cloud-map.tf index f5d169d..09185d0 100644 --- a/src/cloud-map.tf +++ b/src/cloud-map.tf @@ -4,7 +4,7 @@ module "cloudmap_namespace" { for_each = { for service_connect in var.service_connect_configurations : service_connect.namespace => service_connect } source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.5.0" + version = "1.8.0" component = each.key @@ -25,7 +25,7 @@ module "cloudmap_namespace_service_discovery" { for_each = { for service_connect in var.service_registries : service_connect.namespace => service_connect } source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.5.0" + version = "1.8.0" component = each.key diff --git a/src/remote-state.tf b/src/remote-state.tf index 08c0122..451b064 100644 --- a/src/remote-state.tf +++ b/src/remote-state.tf @@ -55,7 +55,7 @@ locals { module "vpc" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.5.0" + version = "1.8.0" component = "vpc" @@ -65,7 +65,7 @@ module "vpc" { module "security_group" { count = local.enabled && var.task_security_group_component != null ? 1 : 0 source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.5.0" + version = "1.8.0" component = var.task_security_group_component @@ -75,7 +75,7 @@ module "security_group" { module "rds" { count = local.enabled && var.use_rds_client_sg && try(length(var.rds_name), 0) > 0 ? 1 : 0 source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.5.0" + version = "1.8.0" component = var.rds_name @@ -84,7 +84,7 @@ module "rds" { module "ecs_cluster" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.5.0" + version = "1.8.0" component = coalesce(var.ecs_cluster_name, "ecs-cluster") @@ -93,7 +93,7 @@ module "ecs_cluster" { module "alb" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.5.0" + version = "1.8.0" count = local.is_alb && local.use_external_lb ? 1 : 0 @@ -104,7 +104,7 @@ module "alb" { module "nlb" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.5.0" + version = "1.8.0" count = local.is_nlb ? 1 : 0 @@ -115,7 +115,7 @@ module "nlb" { module "s3" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.5.0" + version = "1.8.0" count = local.s3_mirroring_enabled ? 1 : 0 @@ -127,7 +127,7 @@ module "s3" { module "service_domain" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.5.0" + version = "1.8.0" component = var.zone_component @@ -163,7 +163,7 @@ data "aws_kms_alias" "selected" { module "iam_role" { source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.5.0" + version = "1.8.0" count = local.enabled && var.task_iam_role_component != null ? 1 : 0 component = var.task_iam_role_component @@ -175,7 +175,7 @@ module "efs" { for_each = local.efs_component_map source = "cloudposse/stack-config/yaml//modules/remote-state" - version = "1.5.0" + version = "1.8.0" # Here we can use [0] because aws only allows one efs volume configuration per volume component = each.value.efs_volume_configuration[0].component From a02e40b76539d1ed55a1180388b1584b81f5d626 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Mon, 16 Jun 2025 12:18:37 -0700 Subject: [PATCH 3/5] README.md --- src/README.md | 481 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 481 insertions(+) create mode 100644 src/README.md diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..b078e1f --- /dev/null +++ b/src/README.md @@ -0,0 +1,481 @@ +--- +tags: + - component/ecs-service + - layer/ecs + - provider/aws +--- + +# Component: `ecs-service` + +This component is responsible for creating an ECS service. + +## Usage + +**Stack Level**: Regional + +Here's an example snippet for how to use this component. + +```yaml +# stacks/catalog/ecs-service/defaults.yaml +components: + terraform: + ecs-service/defaults: + metadata: + component: ecs-service + type: abstract + settings: + spacelift: + workspace_enabled: true + vars: + enabled: true + public_lb_enabled: false + ecr_stage_name: mgmt-automation + task: + launch_type: FARGATE + network_mode: awsvpc + desired_count: 1 + ignore_changes_desired_count: true + ignore_changes_task_definition: false + assign_public_ip: false + propagate_tags: SERVICE + wait_for_steady_state: true + circuit_breaker_deployment_enabled: true + circuit_breaker_rollback_enabled: true +``` + +This will launch a `kong` service using an ecr image from `mgmt-automation` account. + +NOTE: Usage of `ecr_image` instead of `image`. + +```yaml +import: + - catalog/ecs-service/defaults + +components: + terraform: + ecs/b2b/kong/service: + metadata: + component: ecs-service + inherits: + - ecs-service/defaults + vars: + name: kong + public_lb_enabled: true + cluster_attributes: [b2b] + containers: + service: + name: "kong-gateway" + ecr_image: kong:latest + map_environment: + KONG_DECLARATIVE_CONFIG: /home/kong/production.yml + port_mappings: + - containerPort: 8000 + hostPort: 8000 + protocol: tcp + task: + desired_count: 1 + task_memory: 512 + task_cpu: 256 +``` + +This will launch a `httpd` service using an external image from dockerhub + +NOTE: Usage of `image` instead of `ecr_image`. + +```yaml +# stacks/catalog/ecs-service/httpd.yaml +import: + - catalog/ecs-service/defaults + +components: + terraform: + ecs/platform/httpd/service: + metadata: + component: ecs-service + inherits: + - ecs-service/defaults + vars: + enabled: true + name: httpd + public_lb_enabled: true + cluster_attributes: [platform] + containers: + service: + name: "Hello" + image: httpd:2.4 + port_mappings: + - containerPort: 80 + hostPort: 80 + protocol: tcp + command: + - '/bin/sh -c "echo '' Amazon ECS Sample App

Amazon ECS + Sample App

Congratulations!

Your application is now running on a container in Amazon + ECS.

'' > /usr/local/apache2/htdocs/index.html && httpd-foreground"' + entrypoint: ["sh", "-c"] + task: + desired_count: 1 + task_memory: 512 + task_cpu: 256 +``` + +This will launch google's `echoserver` using an external image from gcr + +NOTE: Usage of `image` instead of `ecr_image`. + +```yaml +# stacks/catalog/ecs-service/echoserver.yaml +import: + - catalog/ecs-service/defaults + +components: + terraform: + ecs/platform/echoserver/service: + metadata: + component: ecs-service + inherits: + - ecs-service/defaults + vars: + enabled: true + name: echoserver + public_lb_enabled: true + cluster_attributes: [platform] + containers: + service: + name: "echoserver" + image: gcr.io/google_containers/echoserver:1.10 + port_mappings: + - containerPort: 8080 + hostPort: 8080 + protocol: tcp + task: + desired_count: 1 + task_memory: 512 + task_cpu: 256 +``` + +#### Other Domains + +This component supports alternate service names for your ECS Service through a couple of variables: + +- `vanity_domain` & `vanity_alias` - This will create a route to the service in the listener rules of the ALB. This will + also create a Route 53 alias record in the hosted zone in this account. The hosted zone is looked up by the + `vanity_domain` input. +- `additional_targets` - This will create a route to the service in the listener rules of the ALB. This will not create + a Route 53 alias record. + +Examples: + +```yaml +ecs/platform/service/echo-server: + vars: + vanity_domain: "dev-acme.com" + vanity_alias: + - "echo-server.dev-acme.com" + additional_targets: + - "echo.acme.com" +``` + +This then creates the following listener rules: + +```text +HTTP Host Header is +echo-server.public-platform.use2.dev.plat.service-discovery.com + OR echo-server.dev-acme.com + OR echo.acme.com +``` + +It will also create the record in Route53 to point `"echo-server.dev-acme.com"` to the ALB. Thus +`"echo-server.dev-acme.com"` should resolve. + +We can then create a pointer to this service in the `acme.come` hosted zone. + +```yaml +dns-primary: + vars: + domain_names: + - acme.com + record_config: + - root_zone: acme.com + name: echo. + type: CNAME + ttl: 60 + records: + - echo-server.dev-acme.com +``` + +This will create a CNAME record in the `acme.com` hosted zone that points `echo.acme.com` to `echo-server.dev-acme.com`. + +### EFS + +EFS is supported by this ecs service, you can use either `efs_volumes` or `efs_component_volumes` in your task +definition. + +This example shows how to use `efs_component_volumes` which remote looks up efs component and uses the `efs_id` to mount +the volume. And how to use `efs_volumes` + +```yaml +components: + terraform: + ecs-services/my-service: + metadata: + component: ecs-service + inherits: + - ecs-services/defaults + vars: + containers: + service: + name: app + image: my-image:latest + log_configuration: + logDriver: awslogs + options: {} + port_mappings: + - containerPort: 8080 + hostPort: 8080 + protocol: tcp + mount_points: + - containerPath: "/var/lib/" + sourceVolume: "my-volume-mount" + + task: + efs_component_volumes: + - name: "my-volume-mount" + host_path: null + efs_volume_configuration: + - component: efs/my-volume-mount + root_directory: "/var/lib/" + transit_encryption: "ENABLED" + transit_encryption_port: 2999 + authorization_config: [] + efs_volumes: + - name: "my-volume-mount-2" + host_path: null + efs_volume_ configuration: + - file_system_id: "fs-1234" + root_directory: "/var/lib/" + transit_encryption: "ENABLED" + transit_encryption_port: 2998 + authorization_config: [] +``` + + + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.0.0 | +| [aws](#requirement\_aws) | >= 4.66.1 | +| [jq](#requirement\_jq) | >=0.2.0 | +| [template](#requirement\_template) | >= 2.2 | + +## Providers + +| Name | Version | +|------|---------| +| [aws](#provider\_aws) | >= 4.66.1 | +| [jq](#provider\_jq) | >=0.2.0 | +| [template](#provider\_template) | >= 2.2 | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [alb](#module\_alb) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | +| [alb\_ingress](#module\_alb\_ingress) | cloudposse/alb-ingress/aws | 0.30.0 | +| [cloudmap\_namespace](#module\_cloudmap\_namespace) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | +| [cloudmap\_namespace\_service\_discovery](#module\_cloudmap\_namespace\_service\_discovery) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | +| [container\_definition](#module\_container\_definition) | cloudposse/ecs-container-definition/aws | 0.61.2 | +| [datadog\_configuration](#module\_datadog\_configuration) | github.com/cloudposse-terraform-components/aws-datadog-credentials//src/modules/datadog_keys | tags/v1.535.2 | +| [datadog\_container\_definition](#module\_datadog\_container\_definition) | cloudposse/ecs-container-definition/aws | 0.61.2 | +| [datadog\_fluent\_bit\_container\_definition](#module\_datadog\_fluent\_bit\_container\_definition) | cloudposse/ecs-container-definition/aws | 0.61.2 | +| [datadog\_sidecar\_logs](#module\_datadog\_sidecar\_logs) | cloudposse/cloudwatch-logs/aws | 0.6.9 | +| [ecs\_alb\_service\_task](#module\_ecs\_alb\_service\_task) | cloudposse/ecs-alb-service-task/aws | 0.78.0 | +| [ecs\_cloudwatch\_autoscaling](#module\_ecs\_cloudwatch\_autoscaling) | cloudposse/ecs-cloudwatch-autoscaling/aws | 1.0.0 | +| [ecs\_cloudwatch\_sns\_alarms](#module\_ecs\_cloudwatch\_sns\_alarms) | cloudposse/ecs-cloudwatch-sns-alarms/aws | 0.13.2 | +| [ecs\_cluster](#module\_ecs\_cluster) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | +| [efs](#module\_efs) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | +| [gha\_assume\_role](#module\_gha\_assume\_role) | ../account-map/modules/team-assume-role-policy | n/a | +| [gha\_role\_name](#module\_gha\_role\_name) | cloudposse/label/null | 0.25.0 | +| [iam\_role](#module\_iam\_role) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | +| [iam\_roles](#module\_iam\_roles) | ../account-map/modules/iam-roles | n/a | +| [logs](#module\_logs) | cloudposse/cloudwatch-logs/aws | 0.6.9 | +| [nlb](#module\_nlb) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | +| [rds](#module\_rds) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | +| [roles\_to\_principals](#module\_roles\_to\_principals) | ../account-map/modules/roles-to-principals | n/a | +| [s3](#module\_s3) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | +| [security\_group](#module\_security\_group) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | +| [service\_domain](#module\_service\_domain) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | +| [this](#module\_this) | cloudposse/label/null | 0.25.0 | +| [vanity\_alias](#module\_vanity\_alias) | cloudposse/route53-alias/aws | 0.13.0 | +| [vpc](#module\_vpc) | cloudposse/stack-config/yaml//modules/remote-state | 1.8.0 | + +## Resources + +| Name | Type | +|------|------| +| [aws_iam_policy.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | +| [aws_iam_role.github_actions](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource | +| [aws_kinesis_stream.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kinesis_stream) | resource | +| [aws_s3_bucket_object.task_definition_template](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_object) | resource | +| [aws_security_group_rule.custom_sg_rules](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource | +| [aws_service_discovery_service.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/service_discovery_service) | resource | +| [aws_ssm_parameter.full_urls](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_parameter) | resource | +| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source | +| [aws_ecs_task_definition.created_task](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecs_task_definition) | data source | +| [aws_iam_policy_document.github_actions_iam_ecspresso_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | +| [aws_iam_policy_document.github_actions_iam_platform_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | +| [aws_iam_policy_document.github_actions_iam_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | +| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source | +| [aws_kms_alias.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/kms_alias) | data source | +| [aws_route53_zone.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | +| [aws_route53_zone.selected_vanity](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source | +| [aws_s3_object.task_definition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_object) | data source | +| [aws_s3_objects.mirror](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_objects) | data source | +| [aws_ssm_parameters_by_path.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameters_by_path) | data source | +| [jq_query.service_domain_query](https://registry.terraform.io/providers/massdriver-cloud/jq/latest/docs/data-sources/query) | data source | +| [template_file.envs](https://registry.terraform.io/providers/cloudposse/template/latest/docs/data-sources/file) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [additional\_tag\_map](#input\_additional\_tag\_map) | Additional key-value pairs to add to each map in `tags_as_list_of_maps`. Not added to `tags` or `id`.
This is for some rare cases where resources want additional configuration of tags
and therefore take a list of maps with tag key, value, and additional configuration. | `map(string)` | `{}` | no | +| [additional\_targets](#input\_additional\_targets) | Additional target routes to add to the ALB that point to this service. The only difference between this and `var.vanity_alias` is `var.vanity_alias` will create an alias record in Route 53 in the hosted zone in this account as well. `var.additional_targets` only adds the listener route to this service's target group. | `list(string)` | `[]` | no | +| [alb\_configuration](#input\_alb\_configuration) | The configuration to use for the ALB, specifying which cluster alb configuration to use | `string` | `"default"` | no | +| [alb\_name](#input\_alb\_name) | The name of the ALB this service should attach to | `string` | `null` | no | +| [attributes](#input\_attributes) | ID element. Additional attributes (e.g. `workers` or `cluster`) to add to `id`,
in the order they appear in the list. New attributes are appended to the
end of the list. The elements of the list are joined by the `delimiter`
and treated as a single ID element. | `list(string)` | `[]` | no | +| [autoscaling\_dimension](#input\_autoscaling\_dimension) | The dimension to use to decide to autoscale | `string` | `"cpu"` | no | +| [autoscaling\_enabled](#input\_autoscaling\_enabled) | Should this service autoscale using SNS alarams | `bool` | `true` | no | +| [chamber\_service](#input\_chamber\_service) | SSM parameter service name for use with chamber. This is used in chamber\_format where /$chamber\_service/$name/$container\_name/$parameter would be the default. | `string` | `"ecs-service"` | no | +| [cluster\_attributes](#input\_cluster\_attributes) | The attributes of the cluster name e.g. if the full name is `namespace-tenant-environment-dev-ecs-b2b` then the `cluster_name` is `ecs` and this value should be `b2b`. | `list(string)` | `[]` | no | +| [containers](#input\_containers) | Feed inputs into container definition module |
map(object({
name = string
ecr_image = optional(string)
image = optional(string)
memory = optional(number)
memory_reservation = optional(number)
cpu = optional(number)
essential = optional(bool, true)
readonly_root_filesystem = optional(bool, null)
privileged = optional(bool, null)
container_depends_on = optional(list(object({
containerName = string
condition = string # START, COMPLETE, SUCCESS, HEALTHY
})), null)

port_mappings = optional(list(object({
containerPort = number
hostPort = optional(number)
protocol = optional(string)
name = optional(string)
appProtocol = optional(string)
})), [])
command = optional(list(string), null)
entrypoint = optional(list(string), null)
healthcheck = optional(object({
command = list(string)
interval = number
retries = number
startPeriod = number
timeout = number
}), null)
ulimits = optional(list(object({
name = string
softLimit = number
hardLimit = number
})), null)
log_configuration = optional(object({
logDriver = string
options = optional(map(string), {})
}))
docker_labels = optional(map(string), null)
map_environment = optional(map(string), {})
map_secrets = optional(map(string), {})
volumes_from = optional(list(object({
sourceContainer = string
readOnly = bool
})), null)
mount_points = optional(list(object({
sourceVolume = optional(string)
containerPath = optional(string)
readOnly = optional(bool)
})), [])
}))
| `{}` | no | +| [context](#input\_context) | Single object for setting entire context at once.
See description of individual variables for details.
Leave string and numeric variables as `null` to use default value.
Individual variable settings (non-null) override settings in context object,
except for attributes, tags, and additional\_tag\_map, which are merged. | `any` |
{
"additional_tag_map": {},
"attributes": [],
"delimiter": null,
"descriptor_formats": {},
"enabled": true,
"environment": null,
"id_length_limit": null,
"label_key_case": null,
"label_order": [],
"label_value_case": null,
"labels_as_tags": [
"unset"
],
"name": null,
"namespace": null,
"regex_replace_chars": null,
"stage": null,
"tags": {},
"tenant": null
}
| no | +| [cpu\_utilization\_high\_alarm\_actions](#input\_cpu\_utilization\_high\_alarm\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on CPU Utilization High Alarm action | `list(string)` | `[]` | no | +| [cpu\_utilization\_high\_evaluation\_periods](#input\_cpu\_utilization\_high\_evaluation\_periods) | Number of periods to evaluate for the alarm | `number` | `1` | no | +| [cpu\_utilization\_high\_ok\_actions](#input\_cpu\_utilization\_high\_ok\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on CPU Utilization High OK action | `list(string)` | `[]` | no | +| [cpu\_utilization\_high\_period](#input\_cpu\_utilization\_high\_period) | Duration in seconds to evaluate for the alarm | `number` | `300` | no | +| [cpu\_utilization\_high\_threshold](#input\_cpu\_utilization\_high\_threshold) | The maximum percentage of CPU utilization average | `number` | `80` | no | +| [cpu\_utilization\_low\_alarm\_actions](#input\_cpu\_utilization\_low\_alarm\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on CPU Utilization Low Alarm action | `list(string)` | `[]` | no | +| [cpu\_utilization\_low\_evaluation\_periods](#input\_cpu\_utilization\_low\_evaluation\_periods) | Number of periods to evaluate for the alarm | `number` | `1` | no | +| [cpu\_utilization\_low\_ok\_actions](#input\_cpu\_utilization\_low\_ok\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on CPU Utilization Low OK action | `list(string)` | `[]` | no | +| [cpu\_utilization\_low\_period](#input\_cpu\_utilization\_low\_period) | Duration in seconds to evaluate for the alarm | `number` | `300` | no | +| [cpu\_utilization\_low\_threshold](#input\_cpu\_utilization\_low\_threshold) | The minimum percentage of CPU utilization average | `number` | `20` | no | +| [custom\_security\_group\_rules](#input\_custom\_security\_group\_rules) | The list of custom security group rules to add to the service security group |
list(object({
type = string
from_port = number
to_port = number
protocol = string
cidr_blocks = list(string)
description = optional(string)
}))
| `[]` | no | +| [datadog\_agent\_sidecar\_enabled](#input\_datadog\_agent\_sidecar\_enabled) | Enable the Datadog Agent Sidecar | `bool` | `false` | no | +| [datadog\_log\_method\_is\_firelens](#input\_datadog\_log\_method\_is\_firelens) | Datadog logs can be sent via cloudwatch logs (and lambda) or firelens, set this to true to enable firelens via a sidecar container for fluentbit | `bool` | `false` | no | +| [datadog\_logging\_default\_tags\_enabled](#input\_datadog\_logging\_default\_tags\_enabled) | Add Default tags to all logs sent to Datadog | `bool` | `true` | no | +| [datadog\_logging\_tags](#input\_datadog\_logging\_tags) | Tags to add to all logs sent to Datadog | `map(string)` | `null` | no | +| [datadog\_sidecar\_containers\_logs\_enabled](#input\_datadog\_sidecar\_containers\_logs\_enabled) | Enable the Datadog Agent Sidecar to send logs to aws cloudwatch group, requires `datadog_agent_sidecar_enabled` to be true | `bool` | `true` | no | +| [delimiter](#input\_delimiter) | Delimiter to be used between ID elements.
Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no | +| [descriptor\_formats](#input\_descriptor\_formats) | Describe additional descriptors to be output in the `descriptors` output map.
Map of maps. Keys are names of descriptors. Values are maps of the form
`{
format = string
labels = list(string)
}`
(Type is `any` so the map values can later be enhanced to provide additional options.)
`format` is a Terraform format string to be passed to the `format()` function.
`labels` is a list of labels, in order, to pass to `format()` function.
Label values will be normalized before being passed to `format()` so they will be
identical to how they appear in `id`.
Default is `{}` (`descriptors` output will be empty). | `any` | `{}` | no | +| [ecr\_region](#input\_ecr\_region) | The region to use for the fully qualified ECR image URL. Defaults to the current region. | `string` | `""` | no | +| [ecr\_stage\_name](#input\_ecr\_stage\_name) | The ecr stage (account) name to use for the fully qualified ECR image URL. | `string` | `"auto"` | no | +| [ecs\_cluster\_name](#input\_ecs\_cluster\_name) | The name of the ECS Cluster this belongs to | `any` | `"ecs"` | no | +| [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no | +| [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no | +| [exec\_enabled](#input\_exec\_enabled) | Specifies whether to enable Amazon ECS Exec for the tasks within the service | `bool` | `false` | no | +| [github\_actions\_allowed\_repos](#input\_github\_actions\_allowed\_repos) | A list of the GitHub repositories that are allowed to assume this role from GitHub Actions. For example,
["cloudposse/infra-live"]. Can contain "*" as wildcard.
If org part of repo name is omitted, "cloudposse" will be assumed. | `list(string)` | `[]` | no | +| [github\_actions\_ecspresso\_enabled](#input\_github\_actions\_ecspresso\_enabled) | Create IAM policies required for deployments with Ecspresso | `bool` | `false` | no | +| [github\_actions\_iam\_role\_attributes](#input\_github\_actions\_iam\_role\_attributes) | Additional attributes to add to the role name | `list(string)` | `[]` | no | +| [github\_actions\_iam\_role\_enabled](#input\_github\_actions\_iam\_role\_enabled) | Flag to toggle creation of an IAM Role that GitHub Actions can assume to access AWS resources | `bool` | `false` | no | +| [github\_oidc\_trusted\_role\_arns](#input\_github\_oidc\_trusted\_role\_arns) | A list of IAM Role ARNs allowed to assume this cluster's GitHub OIDC role | `list(string)` | `[]` | no | +| [health\_check\_healthy\_threshold](#input\_health\_check\_healthy\_threshold) | The number of consecutive health checks successes required before healthy | `number` | `2` | no | +| [health\_check\_interval](#input\_health\_check\_interval) | The duration in seconds in between health checks | `number` | `15` | no | +| [health\_check\_matcher](#input\_health\_check\_matcher) | The HTTP response codes to indicate a healthy check | `string` | `"200-404"` | no | +| [health\_check\_path](#input\_health\_check\_path) | The destination for the health check request | `string` | `"/health"` | no | +| [health\_check\_port](#input\_health\_check\_port) | The port to use to connect with the target. Valid values are either ports 1-65536, or `traffic-port`. Defaults to `traffic-port` | `string` | `"traffic-port"` | no | +| [health\_check\_timeout](#input\_health\_check\_timeout) | The amount of time to wait in seconds before failing a health check request | `number` | `10` | no | +| [health\_check\_unhealthy\_threshold](#input\_health\_check\_unhealthy\_threshold) | The number of consecutive health check failures required before unhealthy | `number` | `2` | no | +| [http\_protocol](#input\_http\_protocol) | Which http protocol to use in outputs and SSM url params. This value is ignored if a load balancer is not used. If it is `null`, the redirect value from the ALB determines the protocol. | `string` | `null` | no | +| [iam\_policy\_enabled](#input\_iam\_policy\_enabled) | If set to true will create IAM policy in AWS | `bool` | `false` | no | +| [iam\_policy\_statements](#input\_iam\_policy\_statements) | Map of IAM policy statements to use in the policy. This can be used with or instead of the `var.iam_source_json_url`. | `any` | `{}` | no | +| [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no | +| [kinesis\_enabled](#input\_kinesis\_enabled) | Enable Kinesis | `bool` | `false` | no | +| [kms\_alias\_name\_ssm](#input\_kms\_alias\_name\_ssm) | KMS alias name for SSM | `string` | `"alias/aws/ssm"` | no | +| [kms\_key\_alias](#input\_kms\_key\_alias) | ID of KMS key | `string` | `"default"` | no | +| [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.
Does not affect keys of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper`.
Default value: `title`. | `string` | `null` | no | +| [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no | +| [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,
set as tag values, and output by this module individually.
Does not affect values of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper` and `none` (no transformation).
Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.
Default value: `lower`. | `string` | `null` | no | +| [labels\_as\_tags](#input\_labels\_as\_tags) | Set of labels (ID elements) to include as tags in the `tags` output.
Default is to include all labels.
Tags with empty values will not be included in the `tags` output.
Set to `[]` to suppress all generated tags.
**Notes:**
The value of the `name` tag, if included, will be the `id`, not the `name`.
Unlike other `null-label` inputs, the initial setting of `labels_as_tags` cannot be
changed in later chained modules. Attempts to change it will be silently ignored. | `set(string)` |
[
"default"
]
| no | +| [lb\_catch\_all](#input\_lb\_catch\_all) | Should this service act as catch all for all subdomain hosts of the vanity domain | `bool` | `false` | no | +| [logs](#input\_logs) | Feed inputs into cloudwatch logs module | `any` | `{}` | no | +| [memory\_utilization\_high\_alarm\_actions](#input\_memory\_utilization\_high\_alarm\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on Memory Utilization High Alarm action | `list(string)` | `[]` | no | +| [memory\_utilization\_high\_evaluation\_periods](#input\_memory\_utilization\_high\_evaluation\_periods) | Number of periods to evaluate for the alarm | `number` | `1` | no | +| [memory\_utilization\_high\_ok\_actions](#input\_memory\_utilization\_high\_ok\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on Memory Utilization High OK action | `list(string)` | `[]` | no | +| [memory\_utilization\_high\_period](#input\_memory\_utilization\_high\_period) | Duration in seconds to evaluate for the alarm | `number` | `300` | no | +| [memory\_utilization\_high\_threshold](#input\_memory\_utilization\_high\_threshold) | The maximum percentage of Memory utilization average | `number` | `80` | no | +| [memory\_utilization\_low\_alarm\_actions](#input\_memory\_utilization\_low\_alarm\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on Memory Utilization Low Alarm action | `list(string)` | `[]` | no | +| [memory\_utilization\_low\_evaluation\_periods](#input\_memory\_utilization\_low\_evaluation\_periods) | Number of periods to evaluate for the alarm | `number` | `1` | no | +| [memory\_utilization\_low\_ok\_actions](#input\_memory\_utilization\_low\_ok\_actions) | A list of ARNs (i.e. SNS Topic ARN) to notify on Memory Utilization Low OK action | `list(string)` | `[]` | no | +| [memory\_utilization\_low\_period](#input\_memory\_utilization\_low\_period) | Duration in seconds to evaluate for the alarm | `number` | `300` | no | +| [memory\_utilization\_low\_threshold](#input\_memory\_utilization\_low\_threshold) | The minimum percentage of Memory utilization average | `number` | `20` | no | +| [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.
This is the only ID element not also included as a `tag`.
The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no | +| [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no | +| [nlb\_name](#input\_nlb\_name) | The name of the NLB this service should attach to | `string` | `null` | no | +| [rds\_name](#input\_rds\_name) | The name of the RDS database this service should allow access to | `any` | `null` | no | +| [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no | +| [region](#input\_region) | AWS Region | `string` | n/a | yes | +| [retention\_period](#input\_retention\_period) | Length of time data records are accessible after they are added to the stream | `number` | `48` | no | +| [s3\_mirror\_name](#input\_s3\_mirror\_name) | The name of the S3 mirror component | `string` | `null` | no | +| [service\_connect\_configurations](#input\_service\_connect\_configurations) | The list of Service Connect configurations.
See `service_connect_configuration` docs https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service#service_connect_configuration |
list(object({
enabled = bool
namespace = optional(string, null)
log_configuration = optional(object({
log_driver = string
options = optional(map(string), null)
secret_option = optional(list(object({
name = string
value_from = string
})), [])
}), null)
service = optional(list(object({
client_alias = list(object({
dns_name = string
port = number
}))
discovery_name = optional(string, null)
ingress_port_override = optional(number, null)
port_name = string
})), [])
}))
| `[]` | no | +| [service\_registries](#input\_service\_registries) | The list of Service Registries.
See `service_registries` docs https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service#service_registries |
list(object({
namespace = string
registry_arn = optional(string)
port = optional(number)
container_name = optional(string)
container_port = optional(number)
}))
| `[]` | no | +| [shard\_count](#input\_shard\_count) | Number of shards that the stream will use | `number` | `1` | no | +| [shard\_level\_metrics](#input\_shard\_level\_metrics) | List of shard-level CloudWatch metrics which can be enabled for the stream | `list(string)` |
[
"IncomingBytes",
"IncomingRecords",
"IteratorAgeMilliseconds",
"OutgoingBytes",
"OutgoingRecords",
"ReadProvisionedThroughputExceeded",
"WriteProvisionedThroughputExceeded"
]
| no | +| [ssm\_enabled](#input\_ssm\_enabled) | If `true` create SSM keys for the database user and password. | `bool` | `false` | no | +| [ssm\_key\_format](#input\_ssm\_key\_format) | SSM path format. The values will will be used in the following order: `var.ssm_key_prefix`, `var.name`, `var.ssm_key_*` | `string` | `"/%v/%v/%v"` | no | +| [ssm\_key\_prefix](#input\_ssm\_key\_prefix) | SSM path prefix. Omit the leading forward slash `/`. | `string` | `"ecs-service"` | no | +| [stage](#input\_stage) | ID element. Usually used to indicate role, e.g. 'prod', 'staging', 'source', 'build', 'test', 'deploy', 'release' | `string` | `null` | no | +| [stickiness\_cookie\_duration](#input\_stickiness\_cookie\_duration) | The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). The default value is 1 day (86400 seconds) | `number` | `86400` | no | +| [stickiness\_enabled](#input\_stickiness\_enabled) | Boolean to enable / disable `stickiness`. Default is `true` | `bool` | `true` | no | +| [stickiness\_type](#input\_stickiness\_type) | The type of sticky sessions. The only current possible value is `lb_cookie` | `string` | `"lb_cookie"` | no | +| [stream\_mode](#input\_stream\_mode) | Stream mode details for the Kinesis stream | `string` | `"PROVISIONED"` | no | +| [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no | +| [task](#input\_task) | Feed inputs into ecs\_alb\_service\_task module |
object({
task_cpu = optional(number)
task_memory = optional(number)
task_role_arn = optional(string, "")
pid_mode = optional(string, null)
ipc_mode = optional(string, null)
network_mode = optional(string)
propagate_tags = optional(string)
assign_public_ip = optional(bool, false)
use_alb_security_groups = optional(bool, true)
launch_type = optional(string, "FARGATE")
scheduling_strategy = optional(string, "REPLICA")
capacity_provider_strategies = optional(list(object({
capacity_provider = string
weight = number
base = number
})), [])

deployment_minimum_healthy_percent = optional(number, null)
deployment_maximum_percent = optional(number, null)
desired_count = optional(number, 0)
min_capacity = optional(number, 1)
max_capacity = optional(number, 2)
wait_for_steady_state = optional(bool, true)
circuit_breaker_deployment_enabled = optional(bool, true)
circuit_breaker_rollback_enabled = optional(bool, true)

ecs_service_enabled = optional(bool, true)
bind_mount_volumes = optional(list(object({
name = string
host_path = string
})), [])
efs_volumes = optional(list(object({
host_path = string
name = string
efs_volume_configuration = list(object({
file_system_id = string
root_directory = string
transit_encryption = string
transit_encryption_port = string
authorization_config = list(object({
access_point_id = string
iam = string
}))
}))
})), [])
efs_component_volumes = optional(list(object({
host_path = string
name = string
efs_volume_configuration = list(object({
component = optional(string, "efs")
tenant = optional(string, null)
environment = optional(string, null)
stage = optional(string, null)

root_directory = string
transit_encryption = string
transit_encryption_port = string
authorization_config = list(object({
access_point_id = string
iam = string
}))
}))
})), [])
docker_volumes = optional(list(object({
host_path = string
name = string
docker_volume_configuration = list(object({
autoprovision = bool
driver = string
driver_opts = map(string)
labels = map(string)
scope = string
}))
})), [])
fsx_volumes = optional(list(object({
host_path = string
name = string
fsx_windows_file_server_volume_configuration = list(object({
file_system_id = string
root_directory = string
authorization_config = list(object({
credentials_parameter = string
domain = string
}))
}))
})), [])
})
| `{}` | no | +| [task\_enabled](#input\_task\_enabled) | Whether or not to use the ECS task module | `bool` | `true` | no | +| [task\_exec\_policy\_arns\_map](#input\_task\_exec\_policy\_arns\_map) | A map of name to IAM Policy ARNs to attach to the generated task execution role.
The names are arbitrary, but must be known at plan time. The purpose of the name
is so that changes to one ARN do not cause a ripple effect on the other ARNs.
If you cannot provide unique names known at plan time, use `task_exec_policy_arns` instead. | `map(string)` | `{}` | no | +| [task\_iam\_role\_component](#input\_task\_iam\_role\_component) | A component that outputs an iam\_role module as 'role' for adding to the service as a whole. | `string` | `null` | no | +| [task\_policy\_arns](#input\_task\_policy\_arns) | The IAM policy ARNs to attach to the ECS task IAM role | `list(string)` |
[
"arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly",
"arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess"
]
| no | +| [task\_security\_group\_component](#input\_task\_security\_group\_component) | A component that outputs security\_group\_id for adding to the service as a whole. | `string` | `null` | no | +| [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no | +| [unauthenticated\_paths](#input\_unauthenticated\_paths) | Unauthenticated path pattern to match | `list(string)` | `[]` | no | +| [unauthenticated\_priority](#input\_unauthenticated\_priority) | The priority for the rules without authentication, between 1 and 50000 (1 being highest priority). Must be different from `authenticated_priority` since a listener can't have multiple rules with the same priority | `string` | `0` | no | +| [use\_lb](#input\_use\_lb) | Whether use load balancer for the service | `bool` | `false` | no | +| [use\_rds\_client\_sg](#input\_use\_rds\_client\_sg) | Use the RDS client security group | `bool` | `false` | no | +| [vanity\_alias](#input\_vanity\_alias) | The vanity aliases to use for the public LB. | `list(string)` | `[]` | no | +| [vanity\_domain](#input\_vanity\_domain) | Whether to use the vanity domain alias for the service | `string` | `null` | no | +| [zone\_component](#input\_zone\_component) | The component name to look up service domain remote-state on | `string` | `"dns-delegated"` | no | +| [zone\_component\_output](#input\_zone\_component\_output) | A json query to use to get the zone domain from the remote state. See | `string` | `".default_domain_name"` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [ecs\_cluster\_arn](#output\_ecs\_cluster\_arn) | Selected ECS cluster ARN | +| [environment\_map](#output\_environment\_map) | Environment variables to pass to the container, this is a map of key/value pairs, where the key is `containerName,variableName` | +| [full\_domain](#output\_full\_domain) | Domain to respond to GET requests | +| [github\_actions\_iam\_role\_arn](#output\_github\_actions\_iam\_role\_arn) | ARN of IAM role for GitHub Actions | +| [github\_actions\_iam\_role\_name](#output\_github\_actions\_iam\_role\_name) | Name of IAM role for GitHub Actions | +| [lb\_arn](#output\_lb\_arn) | Selected LB ARN | +| [lb\_listener\_https](#output\_lb\_listener\_https) | Selected LB HTTPS Listener | +| [lb\_sg\_id](#output\_lb\_sg\_id) | Selected LB SG ID | +| [logs](#output\_logs) | Output of cloudwatch logs module | +| [service\_image](#output\_service\_image) | The image of the service container | +| [ssm\_key\_prefix](#output\_ssm\_key\_prefix) | SSM prefix | +| [ssm\_parameters](#output\_ssm\_parameters) | SSM parameters for the ECS Service | +| [subnet\_ids](#output\_subnet\_ids) | Selected subnet IDs | +| [task\_definition\_arn](#output\_task\_definition\_arn) | The task definition ARN | +| [task\_definition\_revision](#output\_task\_definition\_revision) | The task definition revision | +| [task\_template](#output\_task\_template) | The task template rendered | +| [vpc\_id](#output\_vpc\_id) | Selected VPC ID | +| [vpc\_sg\_id](#output\_vpc\_sg\_id) | Selected VPC SG ID | + + + +## References + +- [cloudposse/terraform-aws-components](https://github.com/cloudposse/terraform-aws-components/tree/main/modules/ecs-service) - + Cloud Posse's upstream component + +[](https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-terraform-components/aws-ecs-service&utm_content=) From 24e8bf4998d2cacbfaa30305dbb41f83079edac4 Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Mon, 16 Jun 2025 12:22:46 -0700 Subject: [PATCH 4/5] revert versions --- src/datadog-agent.tf | 12 +++--------- src/main.tf | 12 ++++++------ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/datadog-agent.tf b/src/datadog-agent.tf index 931aee0..f84bcc8 100644 --- a/src/datadog-agent.tf +++ b/src/datadog-agent.tf @@ -28,12 +28,6 @@ variable "datadog_site" { description = "The Datadog Site to send logs to" } -variable "datadog_app_key_ssm_parameter_name" { - type = string - default = null - description = "The SSM Parameter Name containing the Datadog App Key" -} - variable "datadog_logging_tags" { type = map(string) default = null @@ -84,7 +78,7 @@ locals { module "datadog_sidecar_logs" { source = "cloudposse/cloudwatch-logs/aws" - version = "0.6.6" + version = "0.6.9" # if we are using datadog firelens we don't need to create a log group count = local.enabled && var.datadog_agent_sidecar_enabled && var.datadog_sidecar_containers_logs_enabled ? 1 : 0 @@ -106,7 +100,7 @@ module "datadog_sidecar_logs" { module "datadog_container_definition" { source = "cloudposse/ecs-container-definition/aws" - version = "0.58.1" + version = "0.61.2" count = local.enabled && var.datadog_agent_sidecar_enabled ? 1 : 0 @@ -154,7 +148,7 @@ module "datadog_container_definition" { module "datadog_fluent_bit_container_definition" { source = "cloudposse/ecs-container-definition/aws" - version = "0.58.1" + version = "0.61.2" count = local.enabled && var.datadog_agent_sidecar_enabled ? 1 : 0 diff --git a/src/main.tf b/src/main.tf index 33914de..ad8341b 100644 --- a/src/main.tf +++ b/src/main.tf @@ -83,7 +83,7 @@ data "aws_s3_object" "task_definition" { module "logs" { source = "cloudposse/cloudwatch-logs/aws" - version = "0.6.8" + version = "0.6.9" # if we are using datadog firelens we don't need to create a log group count = local.enabled && (!var.datadog_agent_sidecar_enabled || !var.datadog_log_method_is_firelens) ? 1 : 0 @@ -182,7 +182,7 @@ locals { module "container_definition" { source = "cloudposse/ecs-container-definition/aws" - version = "0.61.1" + version = "0.61.2" for_each = { for k, v in local.containers_priority_terraform : k => v if local.enabled } @@ -254,7 +254,7 @@ locals { module "ecs_alb_service_task" { source = "cloudposse/ecs-alb-service-task/aws" - version = "0.72.0" + version = "0.78.0" count = local.enabled ? 1 : 0 @@ -342,7 +342,7 @@ resource "aws_security_group_rule" "custom_sg_rules" { module "alb_ingress" { source = "cloudposse/alb-ingress/aws" - version = "0.28.0" + version = "0.30.0" count = local.is_alb ? 1 : 0 @@ -443,7 +443,7 @@ module "vanity_alias" { module "ecs_cloudwatch_autoscaling" { source = "cloudposse/ecs-cloudwatch-autoscaling/aws" - version = "0.7.3" + version = "1.0.0" count = local.enabled && var.task_enabled && var.autoscaling_enabled ? 1 : 0 @@ -475,7 +475,7 @@ locals { module "ecs_cloudwatch_sns_alarms" { source = "cloudposse/ecs-cloudwatch-sns-alarms/aws" - version = "0.12.3" + version = "0.13.2" count = local.enabled && var.autoscaling_enabled ? 1 : 0 cluster_name = module.ecs_cluster.outputs.cluster_name From 2a14237c6f532d46b7b1a73859e5b17fe6b28e8e Mon Sep 17 00:00:00 2001 From: Benjamin Smith Date: Mon, 16 Jun 2025 12:23:14 -0700 Subject: [PATCH 5/5] context cleanup --- src/context.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/context.tf b/src/context.tf index 5e0ef88..e7dd3ea 100644 --- a/src/context.tf +++ b/src/context.tf @@ -264,8 +264,8 @@ variable "descriptor_formats" { Describe additional descriptors to be output in the `descriptors` output map. Map of maps. Keys are names of descriptors. Values are maps of the form `{ - format = string - labels = list(string) + format = string + labels = list(string) }` (Type is `any` so the map values can later be enhanced to provide additional options.) `format` is a Terraform format string to be passed to the `format()` function.