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

DestroyPlugin & PassPlanFilePlugin - Terraform Destroy can't be called with a plan file #417

Closed
vincentclee opened this issue Feb 2, 2022 · 0 comments · Fixed by #433
Closed
Labels
bug Something isn't working
Milestone

Comments

@vincentclee
Copy link
Contributor

The DestroyPlugin does not play nicely with PassPlanFilePlugin.

Error Message

 + terraform destroy -input=false -auto-approve tfplan-uat
 ╷
 │ Error: Destroy can't be called with a plan file
 │ 
 │ If this plan was created using plan -destroy, apply it using:
 │   terraform apply "tfplan-uat"
 ╵

Jenkinsfile

Jenkinsfile.init(this)
PassPlanFilePlugin.init()
DestroyPlugin.init()

def validate = new TerraformValidateStage()
def destroyUat = new TerraformEnvironmentStage("uat")

validate.then(destroyUat).build()

Terraform Command: destroy

The terraform destroy command accepts most of the options that terraform apply accepts, although it does not accept a plan file argument and forces the selection of the "destroy" planning mode.

https://www.terraform.io/cli/commands/destroy

@kmanning kmanning added the bug Something isn't working label Feb 3, 2022
duckpuppy added a commit that referenced this issue Apr 19, 2022
[Bugfix] Fixes #417 - Force terraform command to `apply` if a plan file is being used
@vincentclee vincentclee added this to the v5.20.0 milestone Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants