Skip to content

Commit

Permalink
Don't run a taint/untaint command unless a resource is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
duckpuppy committed Apr 27, 2021
1 parent 9ef75e1 commit 9016811
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/TerraformTaintPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TerraformTaintPlugin implements TerraformEnvironmentStagePlugin, Terraform
public Closure runTerraformTaintCommand(String environment) {
def taintCommand = TerraformTaintCommand.instanceFor(environment)
return { closure ->
if (shouldApply()) {
if (shouldApply() && Jenkinsfile.instance.getEnv().TAINT_RESOURCE) {
echo "Running '${taintCommand.toString()}'. TerraformTaintPlugin is enabled."
sh taintCommand.toString()
}
Expand All @@ -71,7 +71,7 @@ class TerraformTaintPlugin implements TerraformEnvironmentStagePlugin, Terraform
public Closure runTerraformUntaintCommand(String environment) {
def untaintCommand = TerraformUntaintCommand.instanceFor(environment)
return { closure ->
if (shouldApply()) {
if (shouldApply() && Jenkinsfile.instance.getEnv().UNTAINT_RESOURCE) {
echo "Running '${untaintCommand.toString()}'. TerraformTaintPlugin is enabled."
sh untaintCommand.toString()
}
Expand Down

0 comments on commit 9016811

Please sign in to comment.