Open UED094 opened 2 years ago
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.
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.
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.
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 ?