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

add primary key version #16845

Conversation

modular-magician
Copy link
Collaborator

Fixes #5688

Add primary version attribute for crypto key resource as per https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys

Note: This only adds the name and status attributes of the version object, not the complete version object, as my thinking was that these attributes are unlikely to be used and add unnecessary clutter, but I'm open to input on this.

Allows primary version attributes to be referenced as an attribute of the crypto key as

resource "google_kms_crypto_key" "example-key" {
  name            = "crypto-key-example"
  key_ring        = <some keyring>
}

output "key_primary_version_name" {
  value = google_kms_crypto_key.example-key.primary[0].name
}

output "key_primary_version_state" {
  value = google_kms_crypto_key.example-key.primary[0].state
}

Release Note Template for Downstream PRs (will be copied)

Add output-only `primary` version attribute to `google_kms_crypto_key` resource

Derived from GoogleCloudPlatform/magic-modules#9651

* add primary key version

* Update mmv1/products/kms/CryptoKey.yaml

Co-authored-by: Stephen Lewis (Burrows) <stephen.r.burrows@gmail.com>

* address PR comments

* add resource attribute check

* fix test

* indexed value

* fmt

* 8th time's the charm

---------

Co-authored-by: Stephen Lewis (Burrows) <stephen.r.burrows@gmail.com>
[upstream:79fbafca8d218b26313bd2bb4e353483a3bc5fe4]

Signed-off-by: Modular Magician <magic-modules@google.com>
@modular-magician modular-magician merged commit 28c8195 into hashicorp:main Dec 20, 2023
2 checks passed
@lopezvit
Copy link

I think that this could be used to solve #16738 if it would be added to the data resource as well.
I have a question, is this checked with every execution as with the data resources? If the primary version is changed externally, would this be updated?

Copy link

I'm going to lock this pull request 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 related to this change, 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 Feb 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add 'primary' version of cryptokey to google_kms_crypto_key
2 participants