My goal is simple. Commit a change to the application and have it running live on AWS.
I have built all my infra with Terraform, so I want to only use Terraform to make changes to AWS. The question is, how do I update my ECS Service and keep it in sync with Terraform. The solution I came up with, not sure if I’m reinventing the wheel here, is the following:
circleci/aws-ecrto push the newly built image to ECR.
update-task-definition-from-jsonto update the
- Since I have an updated
task-definition.jsonin the Terraform dir holding the newly built image, it’s only a matter of a
terraform apply. I have set it with backend so it should be possible to run it from circleci with
- I should have the latest container up and running, so the first goal is achieved.
- Now, I need to have it in sync. Circleci made changes to the
task-definition.jsonand also at the terraform state. I can give an access key to my github account for the ci to commit the changes.
Is there an easier way to do this?