Skip to content

Terraform plugin runs 'plan/apply' before 'destroy' #22

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

Open
arm4b opened this issue Dec 7, 2022 · 1 comment
Open

Terraform plugin runs 'plan/apply' before 'destroy' #22

arm4b opened this issue Dec 7, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@arm4b
Copy link
Member

arm4b commented Dec 7, 2022

With the following bitops.config.yaml:

terraform:
    cli:
        stack-action: apply
    options: {}

and ENV variable TERRAFORM_DESTROY=true the plugin runs plan -> apply -> destroy sequence which is undesired.

The expected behavior with TERRAFORM_DESTROY=true is that it'll take precedence over all the terraform stack-actions and just destroy should be executed.

Otherwise, it may lead to apply -> destroy resource recreation which could be not just a waste of time/resources, but harmful in production.


Even with an empty Terraform plugin config (defaults to plan), only destroy should be executed.

@arm4b arm4b added the bug Something isn't working label Dec 7, 2022
@arm4b
Copy link
Member Author

arm4b commented Dec 7, 2022

When using BITOPS_TERRAFORM_COMMAND=destroy, there's a different behavior when apply is executed instead of destroy which is happening on BitOps core side (bug bitovi/bitops#371).

These are two different bugs (one in Terraform config, another in BitOps core), cross-linking for reference.

@mcascone mcascone self-assigned this May 22, 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
Development

No branches or pull requests

2 participants