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

KMS: add plural data source for resource_google_kms_key_ring #11061

Merged
merged 7 commits into from
Jun 28, 2024

Conversation

BBBmau
Copy link
Collaborator

@BBBmau BBBmau commented Jun 26, 2024

This PR adds a new plural data source google_kms_key_rings.

Note:

  • It's necessary to explicitly add the id field to the schema for each individual key ring. Similar behavior also appears here: Add plural data source google_kms_crypto_keys #11053
  • One attribute is missing which is the createTime. Only reason why this wasn't ended in this PR is due the attribute not being included in resource_google_kms_key_ring.go

Running locally:

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

Release Note Template for Downstream PRs (will be copied)

`google_kms_key_rings`

@modular-magician
Copy link
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.

google provider: Diff ( 3 files changed, 243 insertions(+))
google-beta provider: Diff ( 3 files changed, 243 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 36
Passed tests: 31
Skipped tests: 4
Affected tests: 1

Click here to see the affected service packages
  • kms

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDataSourceGoogleKmsKeyRings_basic

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$
TestAccDataSourceGoogleKmsKeyRings_basic[Error message] [Debug log]

$\textcolor{red}{\textsf{Errors occurred during RECORDING mode. Please fix them to complete your PR.}}$

View the build log or the debug log for each test

@modular-magician
Copy link
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.

google provider: Diff ( 3 files changed, 246 insertions(+))
google-beta provider: Diff ( 3 files changed, 246 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 36
Passed tests: 31
Skipped tests: 4
Affected tests: 1

Click here to see the affected service packages
  • kms

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDataSourceGoogleKmsKeyRings_basic

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccDataSourceGoogleKmsKeyRings_basic[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$

View the build log or the debug log for each test

@modular-magician
Copy link
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.

google provider: Diff ( 3 files changed, 244 insertions(+))
google-beta provider: Diff ( 3 files changed, 244 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 36
Passed tests: 32
Skipped tests: 4
Affected tests: 0

Click here to see the affected service packages
  • kms

$\textcolor{green}{\textsf{All tests passed!}}$

View the build log

@BBBmau
Copy link
Collaborator Author

BBBmau commented Jun 27, 2024

latest commit adds filter into id and also sets the project into state. project wouldn't be set when left empty.

The following is the output as well as the tfconfig that produces it:

tfconfig

data "google_kms_key_rings" "mau" {
  location = "global"
}

output:

...
    {
      "id" = "projects/hc-terraform-testing/locations/global/keyRings/tf-test-keyring-exampleksrf4q2e41"
      "name" = "tf-test-keyring-exampleksrf4q2e41"
    },
    {
      "id" = "projects/hc-terraform-testing/locations/global/keyRings/tf-test-keyring-exampleml7ke81gcw"
      "name" = "tf-test-keyring-exampleml7ke81gcw"
    },
  ])
  "location" = "global"
  "project" = "hc-terraform-testing"
}

@SarahFrench should be ready after VCR tests pass 👍🏼

@modular-magician
Copy link
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.

google provider: Diff ( 3 files changed, 253 insertions(+))
google-beta provider: Diff ( 3 files changed, 253 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 36
Passed tests: 32
Skipped tests: 4
Affected tests: 0

Click here to see the affected service packages
  • kms

$\textcolor{green}{\textsf{All tests passed!}}$

View the build log

@BBBmau BBBmau force-pushed the add-kms-key-rings-data-source branch from e87f656 to ee23c50 Compare June 28, 2024 19:20
@BBBmau
Copy link
Collaborator Author

BBBmau commented Jun 28, 2024

recent commit adds the recent pushes from #11053 which allows the 429 error to be handled.

@BBBmau BBBmau requested a review from SarahFrench June 28, 2024 19:27
@modular-magician
Copy link
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.

google provider: Diff ( 3 files changed, 255 insertions(+))
google-beta provider: Diff ( 3 files changed, 255 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 37
Passed tests: 32
Skipped tests: 4
Affected tests: 1

Click here to see the affected service packages
  • kms

Action taken

Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDataSourceGoogleKmsKeyRings_basic

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccDataSourceGoogleKmsKeyRings_basic[Debug log]

$\textcolor{green}{\textsf{No issues found for passed tests after REPLAYING rerun.}}$


$\textcolor{green}{\textsf{All tests passed!}}$

View the build log or the debug log for each test

Copy link
Contributor

@SarahFrench SarahFrench left a comment

Choose a reason for hiding this comment

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

Approved, but please accept the suggestions and allow tests to finish before merging!

@modular-magician
Copy link
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.

google provider: Diff ( 3 files changed, 248 insertions(+))
google-beta provider: Diff ( 3 files changed, 248 insertions(+))

@modular-magician
Copy link
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.

google provider: Diff ( 3 files changed, 248 insertions(+))
google-beta provider: Diff ( 3 files changed, 248 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 37
Passed tests: 33
Skipped tests: 4
Affected tests: 0

Click here to see the affected service packages
  • kms

$\textcolor{green}{\textsf{All tests passed!}}$

View the build log

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 37
Passed tests: 33
Skipped tests: 4
Affected tests: 0

Click here to see the affected service packages
  • kms

$\textcolor{green}{\textsf{All tests passed!}}$

View the build log

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

Successfully merging this pull request may close these issues.

3 participants