File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ # The ternary operators in this module are mandatory. All composite types (e.g., lists and maps) require encoding to
2+ # pass as arguments to the Terraform `template_file`[1] data source The `locals.tf` file contains the encoded values of
3+ # the composite types defined in the ECS Task Definition[2]. Certain variables, such as `healthCheck`, `linuxParameters`
4+ # and `portMappings`, require the `replace` function since they contain numerical values. For example, given the
5+ # following JSON:
6+ #
7+ # -var 'portMappings=[{containerPort = 80, protocol = "TCP"}]'
8+ #
9+ # [
10+ # {
11+ # "containerDefinitions": [
12+ # {
13+ # "portMappings": [
14+ # {
15+ # "containerPort": 80,
16+ # "protocol": "TCP"
17+ # }
18+ # ]
19+ # }
20+ # ]
21+ # }
22+ # ]
23+ #
24+ # Since the `containerPort` and `hostPort`[3] fields are both integer types, then the `replace` function is necessary to
25+ # prevent quoting the value in strings. This issue is a known limitation in the Terraform `jsonencode`[4] function.
26+ #
27+ # - 1. https://www.terraform.io/docs/providers/template/d/file.html
28+ # - 2. https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html
29+ # - 3. https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PortMapping.html
30+ # - 4. https://github.com/hashicorp/terraform/issues/17033
31+
132locals {
233 command = " ${ jsonencode (var. command )} "
334 dnsSearchDomains = " ${ jsonencode (var. dnsSearchDomains )} "
You can’t perform that action at this time.
0 commit comments