Allow to provide task_definition_template_vars #46
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds
task_definition_template_vars(map(string)) to the service definition.Doing so, we can pass / or overwrite template variables of the task definition template file.
I needed this to inject secrets and other environment variables into my task definition.
Example:
And in
fargate/backend.json:[ { "portMappings": [ { "hostPort": ${container_port}, "protocol": "tcp", "containerPort": ${container_port} } ], "image": "${repository_url}:latest", "name": "${container_name}", "logConfiguration": { "logDriver": "awslogs", "options": { "awslogs-group": "${log_group}", "awslogs-region": "${region}", "awslogs-stream-prefix": "ecs" } }, "environment": [ { "name": "PUBLIC_DNS", "value": "${public_dns}" } ], "secrets": [ { "name": "DATABASE_URL", "valueFrom": "${aws_ssm_database_url}" }, { "name": "SECRET_KEY_BASE", "valueFrom": "${aws_ssm_secret_key_base}" }, { "name": "GUARDIAN_SECRET_KEY", "valueFrom": "${aws_ssm_guardian_secret_key}" } ] } ]