Skip to content
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

terraform apply --replace method or taint #178

Open
UED094 opened this issue Jun 15, 2022 · 3 comments
Open

terraform apply --replace method or taint #178

UED094 opened this issue Jun 15, 2022 · 3 comments

Comments

@UED094
Copy link

UED094 commented Jun 15, 2022

Is there any support to re-deploy resources on the put command? I mean like taint the resource on state file so that way they will be re-deployed. Other than manually downloading the state file and taint it via a script. However, "taint" is deprecated so terraform will only support " terraform apply --replace" soon. So maybe a feature to add arguments to terraform apply ?

@ljfranklin
Copy link
Owner

Can you give more details about why you want to replace existing resources? Seems like something that should be required rarely if something gets stuck in a bad state rather than something a CI pipeline does every time.

@UED094
Copy link
Author

UED094 commented Jun 28, 2022

I use it for my test structure, like functional, performance etc. and I have trigger next jobs when previous one pass. In some cases, where my tests fail, I need to re-create the ecs services I have or codebuild projects to have a clean environment again. However, since the configuration does not change with the re-run on the pipeline the infra does not create a new ecs task. Solution for this is using "taint" the resource mechanism in terraform. I do that currently, I have automated scripts that pull the statefile and find the resource I need to taint and when re-run the pipeline it recreates the ecs service but the "taint" command is deprecated and will be replace with something like "terraform apply -replace="aws_instance.example[0]". So the feature I am asking is like adding a terraform flag variable or parameter where we can give this replace command. So this solution will be a build in solution. Thank you for your quick answer and your time. I really appreciate your work, it makes my workflow really organized.

@ljfranklin
Copy link
Owner

Makes sense. Okay I'm open to a PR that allows users to specify the replace flag in their pipeline configs. Added the help wanted tag to see if you or something else wants to take a shot at a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants