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

postconditions prevent destroy #32096

Closed
azrdev opened this issue Oct 27, 2022 · 2 comments
Closed

postconditions prevent destroy #32096

azrdev opened this issue Oct 27, 2022 · 2 comments

Comments

@azrdev
Copy link

azrdev commented Oct 27, 2022

Terraform Version

Terraform v1.3.3
on linux_amd64
+ provider registry.terraform.io/hashicorp/null v3.2.0
+ provider registry.terraform.io/vmware/vra v0.6.0

Terraform Configuration Files

terraform {
  required_version = ">= 1.3.0"
  required_providers {
    vra = {
      source  = "vmware/vra"
      version = ">= 0.5.1"
    }
  }
}
resource "vra_deployment" "vm" {
  name = "test"
  catalog_item_name = "test"
  lifecycle {
    postcondition {
      condition     = self.last_request[0].action_id != "Deployment.Expire"
      error_message = "Machine has been Expired by vRA"
    }
  }
}

Debug Output

│ Error: Resource postcondition failed

Expected Behavior

The postcondition should fail in this case. But it should not prevent destruction of the resource.

Actual Behavior

terraform destroy fails instead of destroying the resource

Steps to Reproduce

  1. terraform init
  2. terraform destroy

Additional Context

Putting the check as a precondition on an output value (which should be calculated after changes to the resource) still fails terraform destroy.

References

@azrdev azrdev added bug new new issue not yet triaged labels Oct 27, 2022
@jbardin jbardin added core and removed new new issue not yet triaged labels Oct 27, 2022
@jbardin
Copy link
Member

jbardin commented Oct 27, 2022

Closed via #32051

@jbardin jbardin closed this as completed Oct 27, 2022
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants