apikeys: migrate google_apikeys_key from DCL to MMv1 and add annotations#18328
Open
DrFaust92 wants to merge 4 commits into
Open
apikeys: migrate google_apikeys_key from DCL to MMv1 and add annotations#18328DrFaust92 wants to merge 4 commits into
DrFaust92 wants to merge 4 commits into
Conversation
Reimplements google_apikeys_key as an MMv1 resource (products/apikeys/Key.yaml), replacing the handwritten DCL implementation, and adds support for the mutable `annotations` field. The key_string is fetched from the getKeyString sub-endpoint via a post_read custom-code hook (it is not part of the Key GET response). A decoder treats a soft-deleted key -- which the API keeps returning from GET with a deleteTime set until it is purged -- as gone, so Terraform no longer sees a deleted key as dangling. deletion_policy parity is preserved by MMv1's unified deletion policy.
|
Googlers: For automatic test runs see go/terraform-auto-test-runs. @c2thorn, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reimplements
google_apikeys_keyas an MMv1 resource (products/apikeys/Key.yaml), replacing the handwritten DCL implementation, and adds support for the mutableannotationsfield (a long-standing request — hashicorp/terraform-provider-google#18309). Addingannotationsto the DCL-generated resource was not feasible (DCL is frozen and its schema isn't vendored in magic-modules), so the resource is migrated to MMv1 first, following the established DCL→MMv1 migration path (e.g. eventarc, compute firewall policies, certificate template).Details
products/apikeys/Key.yaml— async (LRO) create withkeyIdcreate param,update_maskPATCH, all existing fields preserved (name,display_name,project,service_account_email,restrictions,key_string,uid), plus the newannotations(KeyValueAnnotations).key_stringis not part of the KeyGETresponse; it is fetched from thegetKeyStringsub-endpoint via apost_readcustom-code hook, mirroring the previous DCL behavior.GET(with adeleteTime) until it is purged. Adecodertreats such keys as gone so Terraform no longer sees a deleted key as dangling. Because the generated destroy check does a plainGET, the example usesexclude_testand a hand-written, soft-delete-aware acceptance test is provided instead.deletion_policyparity is preserved automatically by MMv1's unified deletion policy (ABANDON/DELETE).Testing
Acceptance test run against a real project (create → import → update
annotations/display_name/restrictions→ import → soft-delete-aware destroy):Import round-trips all fields (
annotationsignored on import, as withlabels/effective_annotations). Full provider builds and vets clean.Release Note