Skip to content

tfv: Fix kms key ring iam asset name#6762

Merged
roaks3 merged 1 commit into
GoogleCloudPlatform:mainfrom
iyabchen:fix-kms-key-ring-iam
Nov 9, 2022
Merged

tfv: Fix kms key ring iam asset name#6762
roaks3 merged 1 commit into
GoogleCloudPlatform:mainfrom
iyabchen:fix-kms-key-ring-iam

Conversation

@iyabchen

@iyabchen iyabchen commented Nov 1, 2022

Copy link
Copy Markdown
Contributor

b/256892857

Fix google_kms_key_ring_iam asset name

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)


@iyabchen iyabchen requested a review from melinath November 1, 2022 21:43
@modular-magician

Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

TF Validator: Diff ( 10 files changed, 339 insertions(+), 484 deletions(-))

@melinath melinath requested review from roaks3 and removed request for melinath November 8, 2022 17:45

@roaks3 roaks3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me, just had one minor question

Comment on lines +117 to +121
if len(splits) == 3 {
assetNameTemplate = fmt.Sprintf("//cloudkms.googleapis.com/projects/%s/locations/%s/keyRings/%s", splits[0], splits[1], splits[2])
} else if len(splits) == 2 {
assetNameTemplate = fmt.Sprintf("//cloudkms.googleapis.com/projects/{{project}}/locations/%s/keyRings/%s", splits[0], splits[1])
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I can't quite tell what would happen if the key_ring_id is malformed, and we don't reach either of these conditions. Perhaps a schema validation prevents this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key_ring_id is from user input, it can go wrong easily, if neither condition is met, then it uses the original string, and I think the code has tried its best to convert in that case.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 sounds good

@roaks3 roaks3 merged commit 504f1d6 into GoogleCloudPlatform:main Nov 9, 2022
@iyabchen iyabchen deleted the fix-kms-key-ring-iam branch November 9, 2022 20:04
hao-nan-li pushed a commit to hao-nan-li/magic-modules that referenced this pull request Dec 6, 2022
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.

3 participants