-
Notifications
You must be signed in to change notification settings - Fork 52
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
Adding support for Terraform Destroy. Adding ConfirmApply customization #251
Conversation
merge in master
This is some great work @jleopold28 ! Thoughts on adding Common Scenario |
@vincentclee thanks for testing! I don't think |
In regards to the |
Oh! I also finally published the new Contributor instructions. Let's do away with long-lived dev branches, and queue work in master instead. It's simpler that way. (Ie: you can make your PR against master, and I'll delete v5.9-dev - there's nothing in there at the moment). https://github.com/manheim/terraform-pipeline#how-to-contribute |
@kmanning I updated the base to |
That would work. However, I don't think that should be the default behavior... |
You don't think "-refresh=false" should be the default behavior, or you don't think users should need to use |
@kmanning I think users should have to use When doing a destroy, I think we should always refresh the state before executing a destroy. If users are hitting a bug that requires them to add |
@@ -14,6 +12,7 @@ class TerraformEnvironmentStage implements Stage { | |||
public static final String PLAN = 'plan' | |||
public static final String CONFIRM = 'confirm' | |||
public static final String APPLY = 'apply' | |||
public static final String DESTROY = 'destroy' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new state of TerraformEnvironmentStage.DESTROY. How will this behavior with the existing plugins that are part of the library (or worse, plugins that are in completely external libraries?)
eg:
terraform-pipeline/src/ParameterStoreExecPlugin.groovy
Lines 14 to 20 in 74de97b
public void apply(TerraformEnvironmentStage stage) { def environment = stage.getEnvironment() def parameterStorePath = pathForEnvironment(environment) stage.decorate(PLAN, addEnvVariables(parameterStorePath)) stage.decorate(APPLY, addEnvVariables(parameterStorePath)) } terraform-pipeline/src/AnsiColorPlugin.groovy
Lines 11 to 14 in 74de97b
public void apply(TerraformEnvironmentStage stage) { stage.decorate(PLAN, addColor()) stage.decorate(APPLY, addColor()) } terraform-pipeline/src/ParameterStoreBuildWrapperPlugin.groovy
Lines 17 to 29 in 817be51
@Override public void apply(TerraformEnvironmentStage stage) { def environment = stage.getEnvironment() def parameterStorePath = pathForEnvironment(environment) def options = [ path: parameterStorePath, credentialsId: "${environment.toUpperCase()}_PARAMETER_STORE_ACCESS" ] stage.decorate(PLAN, addParameterStoreBuildWrapper(options)) stage.decorate(APPLY, addParameterStoreBuildWrapper(options)) } terraform-pipeline/src/CrqPlugin.groovy
Lines 11 to 16 in 00e3eed
@Override public void apply(TerraformEnvironmentStage stage) { def environment = stage.getEnvironment() stage.decorate(TerraformEnvironmentStage.APPLY, addCrq(environment)) }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kmanning I am making some changes now. I will have to add stage.decorate(DESTROY, someMethod(options))
to the above plugins. This will add functionality if DESTROY is enabled. Otherwise this will not change the existing functionality.
When using this plugin, your pipeline will look something like this: | ||
|
||
![DestroyPluginPipeline](../images/destroy-pipeline.png) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice touch on the screenshot - thank you for that.
Thanks for accounting for the other plugins. I'm still concerned about the maintainability of the existing PLAN/APPLY hooks, and I'm concerned about introducing more problems with the new DESTROY hook. But I think that can be tackled in a separate PR/refactor. I'd like to track and tackle that refactor before the Destroy functionality gets released. #255 |
Support for TF destroy (#88)
Also adding support to customize the ConfirmApply messages. (#24)