Skip to content

KMS: add google_kms_crypto_key_latest_version data source #2709

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

Conversation

modular-magician
Copy link
Collaborator

Continuation of GoogleCloudPlatform/magic-modules#11455

Second step where we focus on grabbing the latest crypto key version (singular data source)

This PR depends on the referenced PR, plural data source must be merged before this can be properly reviewed.

The only major difference is once the list of cryptoKeyVersions is set we grab the latest one which is done in this line here:
https://github.com/GoogleCloudPlatform/magic-modules/pull/11456/files#diff-7c2dc734dd72075cca3912ca10f4c3a3736ea934186f1392fc7e0764a37eac53R99-R103

filter is added in since it gives the user the ability to grab the latest in either the enabled state or disabled state.

PR also includes some clean up of the plural cryptoKeyVersions data source such as adding in the missing filter argument in the docs.

Test passing:

└─(13:33:59 on main ✹ ✭)──> envchain GCLOUD make testacc TEST=./google/services/kms TESTARGS='-run TestAccDataSourceGoogleKmsCryptoKeyLatestVersion_basic'                    ──(Fri,Aug23)─┘
TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google/services/kms -v -run TestAccDataSourceGoogleKmsCryptoKeyLatestVersion_basic -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google/version.ProviderVersion=acc"
=== RUN   TestAccDataSourceGoogleKmsCryptoKeyLatestVersion_basic
2024/08/23 13:36:12 [INFO] Authenticating using configured Google JSON 'credentials'...
2024/08/23 13:36:12 [INFO]   -- Scopes: [https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/userinfo.email]
2024/08/23 13:36:12 [INFO] Authenticating using configured Google JSON 'credentials'...
2024/08/23 13:36:12 [INFO]   -- Scopes: [https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/userinfo.email]
2024/08/23 13:36:12 [DEBUG] Waiting for state to become: [success]
2024/08/23 13:36:13 [INFO] Terraform is using this identity: mauricio-alvarezleon@hc-terraform-testing.iam.gserviceaccount.com
2024/08/23 13:36:13 [INFO] Instantiating Google Cloud KMS client for path https://cloudkms.googleapis.com/
2024/08/23 13:36:13 [DEBUG] Retry Transport: starting RoundTrip retry loop
2024/08/23 13:36:13 [DEBUG] Retry Transport: request attempt 0
2024/08/23 13:36:13 [DEBUG] Retry Transport: Stopping retries, last request was successful
2024/08/23 13:36:13 [DEBUG] Retry Transport: Returning after 1 attempts
2024/08/23 13:36:13 [DEBUG] Retry Transport: starting RoundTrip retry loop
2024/08/23 13:36:13 [DEBUG] Retry Transport: request attempt 0
2024/08/23 13:36:13 [DEBUG] Retry Transport: Stopping retries, last request was successful
2024/08/23 13:36:13 [DEBUG] Retry Transport: Returning after 1 attempts
--- PASS: TestAccDataSourceGoogleKmsCryptoKeyLatestVersion_basic (14.10s)
PASS
ok      github.com/hashicorp/terraform-provider-google/google/services/kms      15.502s

Release Note Template for Downstream PRs (will be copied)

`google_kms_crypto_key_latest_version`

Derived from GoogleCloudPlatform/magic-modules#11456

[upstream:cf7fa9d8e33c4bf437b1fcc2225ed1c8ba73cee0]

Signed-off-by: Modular Magician <[email protected]>
@modular-magician modular-magician requested a review from a team as a code owner August 23, 2024 22:38
@modular-magician modular-magician requested review from iyabchen and removed request for a team August 23, 2024 22:38
@modular-magician modular-magician merged commit c341502 into GoogleCloudPlatform:main Aug 23, 2024
4 checks passed
Copy link

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant