We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terraform v0.11.10
data "template_file" "service_task_json" { template = "${file("../../task_definitions/service.json")}" vars { role = "gateway" cpu = "${var.gw_cpu_count}" mem = "${var.gw_memory_size}" region = "${var.region}" project = "${var.project_name}" env = "${var.project_environment}" ecr_url = "${var.ecr_url}" port = 8080 xms = "${var.gw_xms}" xmx = "${var.gw_xmx}" xmn = "${var.gw_xmn}" survivor_ratio = "${var.gw_survivor_ratio}" metaspace_size = "${var.gw_metaspace_size}" } } resource "aws_ecs_task_definition" "service_task" { family = "${var.project_role}-${var.project_environment}-task" execution_role_arn = "${var.exec_role}" network_mode = "awsvpc" container_definitions = "${data.template_file.service_task_json.rendered}" requires_compatibilities = ["FARGATE"] cpu = "${var.desired_cpu}" memory = "${var.desired_memory}" }
service.json
[ { "cpu": ${cpu}, "memory": ${mem}, "name": "${role}", "image": "${ecr_url}/${project}_${role}:${env}", "portMappings": [{ "containerPort": ${port}, "hostPort": ${port}, "protocol": "tcp" }], "essential": true, "environment" : [ { "name": "XMS", "value": "${xms}" }, { "name": "XMX", "value": "${xmx}" }, { "name": "XMN", "value": "${xmn}" }, { "name": "SURVIVOR_RATIO", "value": "${survivor_ratio}" }, { "name": "MAX_METASPACE_SIZE", "value": "${metaspace_size}" }, { "name": "APP_ENV", "value": "${env}" } ], "logConfiguration": { "logDriver" : "awslogs", "options": { "awslogs-create-group" : "true", "awslogs-region" : "${region}", "awslogs-group" : "awslogs-${role}-${env}", "awslogs-stream-prefix" : "${role}-${env}" } }, "mountPoints": [], "volumesFrom": [] } ]
No resources should show as changed
aws_ecs_task_definition shows as modified which in turn rebuild that resource
-/+ module.gateway.aws_ecs_task_definition.service_task (new resource required) container_definitions: "[...]" => "${var.container_definitions}" (forces new resource)
terraform apply
The text was updated successfully, but these errors were encountered:
#5323 is closed, but I am seeing this still on latest.
Sorry, something went wrong.
Would guess it has to do with the string to JSON unmarshaling. I will test without environment set to see if that 'fixes' the issue.
It's not environment, it's logConfiguration.options. The order is changing.
environment
logConfiguration.options
We do have a built-in library for ECS Task Definition equivalence: https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/ecs_task_definition_equivalency.go
It likely requires some additional logic to properly handle that situation. e.g. another sort.Slice()
sort.Slice()
Closing, as this was on me and due to the issue here: hashicorp/terraform#15491
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
No branches or pull requests
Terraform Version
Terraform v0.11.10
Affected Resource(s)
Terraform Configuration Files
service.json
Debug Output
Expected Behavior
No resources should show as changed
Actual Behavior
aws_ecs_task_definition shows as modified which in turn rebuild that resource
Steps to Reproduce
terraform apply
References
The text was updated successfully, but these errors were encountered: