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

terraform 0.12 beta Resource is deleted from state when destroy ends in error #20968

Closed
mark-00 opened this issue Apr 9, 2019 · 2 comments · Fixed by #21033
Closed

terraform 0.12 beta Resource is deleted from state when destroy ends in error #20968

mark-00 opened this issue Apr 9, 2019 · 2 comments · Fixed by #21033
Assignees
Milestone

Comments

@mark-00
Copy link

mark-00 commented Apr 9, 2019

Terraform Version

>terraform -v
Terraform v0.12.0-beta1
+ provider.google (unversioned)
.

Terraform Configuration Files

...

Debug Output

>terraform apply
google_project.myProject: Refreshing state... [id=testproject]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # google_project.myProject will be destroyed
  - resource "google_project" "myProject" {
      - app_engine          = [] -> null
      - auto_create_network = true -> null
      - id                  = "testproject" -> null
      - name                = "testproject" -> null
      - project_id          = "testproject" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

google_project.myProject: Destroying... [id=testproject]

Error: Error deleting project "testproject": googleapi: Error 400: A lien to prevent deletion was placed on the project by [sa-terr@gserviceaccount.com]. Remove the lien to allow deletion., failedPrecondition

>terraform apply
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Crash Output

Expected Behavior

Terraform should keep trying to delete the resource in a next run if the delete fails

Actual Behavior

the recources is deleted from the state
no new delete attempts are made

Steps to Reproduce

  1. create terraform file with google_project
  2. terraform apply
  3. create lien on project
  4. remove project from terraform file
  5. terraform apply -> destroy fails
  6. terraform apply -> no new attempt for destroy

Additional Context

References

@mark-00 mark-00 changed the title terrafrom Resource is delete from state when destroy ends in error terrafrom 0.12 beta Resource is deleted from state when destroy ends in error Apr 9, 2019
@mark-00 mark-00 changed the title terrafrom 0.12 beta Resource is deleted from state when destroy ends in error terraform 0.12 beta Resource is deleted from state when destroy ends in error Apr 9, 2019
@apparentlymart apparentlymart added this to the v0.12.0 milestone Apr 9, 2019
@apparentlymart
Copy link
Contributor

Thanks for reporting this @mark-00!

This issue seems familiar so I think it may already have been addressed since beta1, but I'm not totally sure so we'll use this issue to verify whether it's fixed or if what I'm thinking of was a similar-but-different problem. Thanks again!

@ghost
Copy link

ghost commented Jul 26, 2019

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.

@ghost ghost locked and limited conversation to collaborators Jul 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants