Problem
Updating an environment variable (e.g., TEST_DEPLOY
) in your Terraform code does not trigger a new ECS task deployment. Terraform shows no changes in the plan, and the service continues running the old task definition.
Cause
Terraform only applies changes that affect managed infrastructure. If the environment variable is not actually used in the ECS task definition (e.g., in container_definitions
), Terraform will not register a change — and ECS will not redeploy the task.
Solution
Ensure your environment variable is explicitly used in the ECS task definition. For example:
container_definitions = jsonencode([
{
name = "my-app"
image = "app-image"
environment = [
{
name = "TEST_DEPLOY"
value = var.test_deploy
}
]
}
])
When applied, Terraform will register a new task definition revision and ECS will redeploy it automatically.
Outcome
Once referenced correctly, any changes to the variable will be detected by Terraform, resulting in an updated ECS task deployment.
Note: If you continue to experience issues, please contact HashiCorp Support.