Terraform module to generate well-formed JSON documents (container definitions) that are passed to the aws_ecs_task_definition Terraform resource
APACHE-2.0 License
Bot releases are visible (Hide)
Published by Gowiem over 4 years ago
Use the same defaults of user and environment as the AWS API defaults
Noticed on subsequent applies that user goes from 0 to null and environment goes from [] to null
https://github.com/cloudposse/terraform-aws-ecs-container-definition/pull/65
Published by Gowiem over 4 years ago
Previous PR https://github.com/cloudposse/terraform-aws-ecs-container-definition/pull/81 forgot to use local.container_definition_without_null
when merging
Published by nitrocode over 4 years ago
var.container_definition
which is an object.Published by nitrocode over 4 years ago
Published by nitrocode over 4 years ago
Published by Gowiem over 4 years ago
Published by nitrocode over 4 years ago
Published by aknysh over 4 years ago
true
but got a string "true"
insteadPublished by aknysh over 4 years ago
environmentFiles
parameter to the container definitionPublished by aknysh almost 5 years ago
linuxParameters
linuxParameters
are Linux-specific modifications that are applied to the container, such as Linux kernel capabilitiesPublished by aknysh almost 5 years ago
container_depends_on
to support newer capabilities as specified here. The dependsOn
attribute is now an array of ContainerDependency objects.Published by aknysh almost 5 years ago
falsy
values into null
and un-quote booleans and numbers since TF 0.12 has first class types for bool
, number
and object
that can be converted directly to JSON, as well as null
value which is supported in JSON. So this is not needed:# The following hacks are required to overcome TF automatic type conversions which lead to issues with the resulting json types.
# Conversion happens by using the built-in `replace` function in this order:
# - Convert `""`, `{}`, `[]`, and `[""]` to `null`
# - Convert `"true"` and `"false"` to `true` and `false`
# - Convert quoted numbers (e.g. `"123"`) to `123`.
terraform apply
on examples/complete
produces a valid JSON with sorted ENV vars containing names and values as strings (as required by ECS)json_map = {"command":null,"cpu":256,"dependsOn":null,"dnsServers":null,"dockerLabels":null,"entryPoint":null,"environment":[{"name":"false_boolean_var","value":"false"},{"name":"integer_var","value":"42"},{"name":"string_var","value":"I am a string"},{"name":"true_boolean_var","value":"true"}],"essential":true,"firelensConfiguration":null,"healthCheck":null,"image":"cloudposse/geodesic","links":null,"logConfiguration":{"logDriver":"json-file","options":{"max-file":"3","max-size":"10m"},"secretOptions":null},"memory":256,"memoryReservation":128,"mountPoints":null,"name":"app","portMappings":[{"containerPort":8080,"hostPort":80,"protocol":"tcp"},{"containerPort":8081,"hostPort":443,"protocol":"udp"}],"privileged":null,"readonlyRootFilesystem":false,"repositoryCredentials":null,"secrets":null,"stopTimeout":30,"systemControls":null,"ulimits":null,"user":null,"volumesFrom":null,"workingDirectory":null}
Published by aknysh almost 5 years ago
bats
and terratest
for the exampleterraform-modules
projectterraform-modules
project contains pipelines for all terraform modulesPublished by aknysh almost 5 years ago
systemControls
Published by aknysh almost 5 years ago
firelensConfiguration
Published by aknysh almost 5 years ago
Published by aknysh almost 5 years ago
""
rather than "false"
so that it becomes "privileged": null
in the JSON output. This is because this parameter is not supported for Windows containers or tasks using the Fargate launch type.Published by aknysh over 5 years ago
stopTimeout
in container definitionSIGTERM
and SIGKILL
to container