-
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
Update support for PubSub Topic KMS key #6386
Update support for PubSub Topic KMS key #6386
Comments
I can see updating the location in below HCL will force all three resource recreation. resource "google_pubsub_topic" "example" {
name = "issue6386topic"
kms_key_name = google_kms_crypto_key.crypto_key.self_link
message_storage_policy {
allowed_persistence_regions = [
"europe-west1",
"europe-west2"
]
}
}
resource "google_kms_crypto_key" "crypto_key" {
name = "issue6386key"
key_ring = google_kms_key_ring.key_ring.self_link
}
resource "google_kms_key_ring" "key_ring" {
name = "issue6386keyring"
location = "europe" #### <----- updated location from global to europe
} |
The key is in another project and we have segregated duties between those reponsible for kms admin so creation keyrings and keys vs those using the keys. So it cannot exist in my terraform it is just a reference in my case and the key exists already. So this IMHO is a completely different use case. With CMEK the account setting the key actually requires zero access to the key as that also would be against least privilege only the back end pubub cmek account requires access. see this Security Health Analytics reccomendation as to why this is common and best practice. |
Changing to an enhancement as I believe this is a feature request for update support on kmsKeyName looks like it is supported via the normal PATCH method here: https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/patch |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
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
Terraform v0.12.24
Affected Resource(s)
Terraform Configuration Files
google_pubsub_topic.hgmsBucketUpload must be replaced
-/+ resource "google_pubsub_topic" "hgmsBucketUpload" {
~ id = "projects/methodical-bee-162815/topics/hgmsBucketUpload" -> (known after apply)
~ kms_key_name = "projects/methodical-bee-162815/locations/global/keyRings/pubSub/cryptoKeys/pubSub" -> "projects/methodical-bee-162815/locations/europe/keyRings/pubSub/cryptoKeys/pubSub" # forces replacement
- labels = {} -> null
name = "hgmsBucketUpload"
~ project = "methodical-bee-162815" -> (known after apply)
message_storage_policy {
allowed_persistence_regions = [
"europe-west1",
"europe-west2",
]
}
- timeouts {}
}
see output states km key forces replacement
The patch method here
https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics/patch
how kms key can be patched and replacement is not required.
Panic Output
Expected Behavior
Should update topic in place
Actual Behavior
Terraform states change forces replacement so deletes topic potentially losing data and recreates
Steps to Reproduce
terraform apply
cretae a topic with kms keyform plan then out put shows topic will be replaced not updated in place
Important Factoids
tested with both same behavior
References
The text was updated successfully, but these errors were encountered: