-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 fails when removing already destroyed kms key. #12696
Terraform fails when removing already destroyed kms key. #12696
Comments
@natedogith1 I think this is the pattern for most of the resources. When the provider sends the DELETE request to the API, this is the expected response. If you delete the resources outside of the terraform, you may call Does this make sense? |
That's not the behavior I see for other resources. If I delete a VM in the GCP console and then try to remove it from terraform, |
@natedogith1 I need more info for its repo. What did you see from below command before you execute step #4? For step #4, did you call
|
I used I only checked after the failure, and the project has since been deleted, but I believe it said the state was |
@natedogith1 I can't repro the issue. Waited for a day, I deleted the key on a specific version. Then the version shows Without your debug log, it's hard to imagine what happened to yours. |
@edwardmedia terraform shouldn't have created a new version. Did you remove the key/key-ring from the tf file before running the apply? |
I got the same issue, but on key with rotation The last key is active, but the first is deleted, and Terraform try to delete the first version (despite new versions exist) I guess the issue is here terraform-provider-google/google/kms_utils.go Line 177 in b2abd5d
|
Hmmmm, I thought this was fixed recently but I can't seem to find it. I think we need to check if the key is in the destroyed state already and remove it from state if it is. This should happen when the resource refreshes, so it should be fairly easy to handle in the read method. @edwardmedia can you look into adding this? |
I'm not sure |
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. |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
v1.2.3 on linux_amd64
Affected Resource(s)
Panic Output
Expected Behavior
Terraform continues, since key is already destroyed
Actual Behavior
Terraform apply fails.
Steps to Reproduce
References
The text was updated successfully, but these errors were encountered: