-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
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
ECS resources don't handle OOB deploys well #4663
Comments
You could try applying the Another (admittedly more fiddly) option would be to make a second set of credentials for Terraform when run as part of the CI system, whose IAM policy only allows a very targeted set of permissions needed for this task. Since Terraform likes to refresh everything before it plans, it would need access to read all of the resources that exist in the Terraform state, but it should only need access to write the relevant ECS APIs you'd use when running In your case, where deployment seems specifically limited to ECS, the former is probably the easiest option. I use the latter option in some cases although I must admit I've never actually put into practice my idea of giving Terraform broad read access and only very focused write access, since in our case we're using Terraform to manage quite a broad set of resources when applications are deployed. |
I will close this issue as I don't think there's much we can do on the Terraform's side regarding this (except what is being discussed in other issues already). The mechanism for interacting with other tools ( Besides what @apparentlymart mentioned already, some improvements could be made by introducing new option to the Feel free to reopen or submit new issue if you have more specific suggestions on how the current behaviour should be changed (if it's not covered already in the linked issues). |
Nice, ignore_changes did the trick, thanks! |
With the release of 0.7 and the state import feature, would it be possible to accomplish this without the
I think it would work if your revision was a fixed tag like |
Don't think aws_ecs_service supports import :( |
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I use
aws_ecs_cluster
/aws_ecs_service
/aws_ecs_task_definition
to define a ECS cluster with a service and task definition. This all works great. If I taint the task definition, then apply, it causes the service to redeploy, and since I'm using a latest tag for my image, it picks up the new image during that redeploy.However, we have a CI (travis) process in place for deploying. This process uses a helper ecs-deploy script to trigger the creating of a new task definition revision and update the service. This also works great.
The problem I'm having is that after a CI deploy, the tfstate is understandably out of sync with the state of the running system, and subsequent plans/applys want to revert the service's revision to the one in tfstate. If I taint the task def, and re-apply, things redeploy and everything is ok. However, its an extra deploy, and when I forget to do it, there is the danger of terraform doing a redeploy which reverts my running system to an old revision.
Am I missing something? Is there a better way to do this? I'd like to avoid having my terraform keys (full admin!) exposed to the CI environment, so don't want to do the deploy through terraform. It'd be nice if there was a way for the task def to always just refresh to the latest revision (maybe a flag on aws_ecs_task_definition?)
The text was updated successfully, but these errors were encountered: