nimblehq / infrastructure-templates

For IaaS and PaaS as codes
MIT License
10 stars 0 forks source link

Fix: The wrong Task Definition version #119

Closed andyduong1920 closed 1 year ago

andyduong1920 commented 1 year ago

Issue

Currently, the Task definition is created in 2 places.

So for that, the Task definition version in Terraform state cloud is behind the CI as we usually deploy from the CI.

We have faced an issue in the Wo*** project.

When we Apply the changes in Terraform, as the changes don't relate to the ECS/Task definition, the terraform also does the changes for that; what it changes is: It downgrades the app version on Staging 🤯

Expected

  1. The Terraform should know the latest version (made by CI) and also shouldn't downgrade the app version.
  2. The Terraform knows how to create a new Definition revision when introducing a new ENV variable.

Steps to reproduce

  1. Plan, and apply to keep the Terraform state is up to date
  2. Deploy a new version from GitHub CI
  3. Make changes in Terraform (not relative to ECS/Task definition) and plan it
  4. We will see the Terraform downgrade the task revision

image

andyduong1920 commented 1 year ago

@bterone could you help to fix this issue by adjust the skeleton/aws/modules/ecs/main.tf file, the same what we did in the client project 👍

hoangmirs commented 1 year ago

More information about this bug: https://github.com/hashicorp/terraform-provider-aws/issues/632