magic-modules icon indicating copy to clipboard operation
magic-modules copied to clipboard

Add Apigee environment scope KVMs resource support

Open george-peng opened this issue 1 year ago • 51 comments

Adding Apigee KVMs support. Fixes https://github.com/hashicorp/terraform-provider-google/issues/13074

Guide: https://cloud.google.com/apigee/docs/api-platform/cache/key-value-maps#api

Environment scope kvms:

kvms api : https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.keyvaluemaps?hl=en kvms entries api : https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.keyvaluemaps.entries?hl=en

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

  • [x] 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).
  • [x] 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).
  • [x] Generated Terraform providers, and ran make test and make lint in the generated providers to ensure it passes unit and linter tests.
  • [x] Ran relevant acceptance tests using my own Google Cloud project and credentials (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • [x] Read Write release notes before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

`google_apigee_environment_keyvaluemaps`
`google_apigee_environment_keyvaluemaps_entries`

george-peng avatar Aug 31 '23 18:08 george-peng

Hello! I am a robot. It looks like you are a: Community Contributor ~Googler~ ~Core Contributor~. Tests will require approval to run.

@shuyama1, 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.

modular-magician avatar Aug 31 '23 18:08 modular-magician

@george-peng Thanks for making the contribution!

Would it be possible to split this PR? - we generally prefer 1 resource/datasource per PR as it will be much easier for reviewing.

shuyama1 avatar Aug 31 '23 18:08 shuyama1

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.

Terraform GA: Diff ( 19 files changed, 3480 insertions(+), 2 deletions(-)) Terraform Beta: Diff ( 19 files changed, 3480 insertions(+), 2 deletions(-)) TF Conversion: Diff ( 6 files changed, 474 insertions(+))

modular-magician avatar Aug 31 '23 18:08 modular-magician

Tests analytics

Total tests: 3014 Passed tests 2711 Skipped tests: 296 Affected tests: 7

Action taken

Found 7 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccApigeeEnvironmentKeyvaluemaps_apigeeEnvironmentKeyvaluemapsTestExample|TestAccApigeeProxyKeyvaluemapsEntries_apigeeProxyKeyvaluemapsEntriesTestExample|TestAccApigeeOrganizationKeyvaluemapsEntries_apigeeOrganizationKeyvaluemapsEntriesTestExample|TestAccApigeeProxyKeyvaluemaps_apigeeProxyKeyvaluemapsTestExample|TestAccApigeeEnvironmentKeyvaluemapsEntries_apigeeEnvironmentKeyvaluemapsEntriesTestExample|TestAccApigeeOrganizationKeyvaluemaps_apigeeOrganizationKeyvaluemapsTestExample|TestAccBigQueryDataTable_bigtable

Get to know how VCR tests work

modular-magician avatar Aug 31 '23 19:08 modular-magician

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

Rerun these tests in REPLAYING mode to catch issues

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


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$ TestAccApigeeEnvironmentKeyvaluemaps_apigeeEnvironmentKeyvaluemapsTestExample[Error message] [Debug log] TestAccApigeeProxyKeyvaluemapsEntries_apigeeProxyKeyvaluemapsEntriesTestExample[Error message] [Debug log] TestAccApigeeOrganizationKeyvaluemapsEntries_apigeeOrganizationKeyvaluemapsEntriesTestExample[Error message] [Debug log] TestAccApigeeProxyKeyvaluemaps_apigeeProxyKeyvaluemapsTestExample[Error message] [Debug log] TestAccApigeeEnvironmentKeyvaluemapsEntries_apigeeEnvironmentKeyvaluemapsEntriesTestExample[Error message] [Debug log] TestAccApigeeOrganizationKeyvaluemaps_apigeeOrganizationKeyvaluemapsTestExample[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$ View the build log or the debug log for each test

modular-magician avatar Aug 31 '23 20:08 modular-magician

sure , I am spliting this PR into 3.

Implementation wise , both resources below are related. I will keep them together in a single PR. google_apigee_xxxx_keyvaluemaps google_apigee_xxxx_keyvaluemaps_entries

george-peng avatar Aug 31 '23 20:08 george-peng

keeping google_apigee_environment_keyvaluemaps and google_apigee_environment_keyvaluemaps_entries in this PR. Interested to know what is the cause of failing tests before I create PRs for proxy and organization scope kvms. Thank you.

george-peng avatar Aug 31 '23 20:08 george-peng

Yes, I am able to run resource tests locally without any issue. Based on the error mesage , it appears there is problem when creating Apigee test environment.

I have another open PR (#8800) with the exactly the same apigee enviornment test setup. It was able to passed test. Hope this help you trouble the issue. Thanks. @shuyama1

george-peng avatar Sep 01 '23 19:09 george-peng

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.

Terraform GA: Diff ( 7 files changed, 1175 insertions(+), 2 deletions(-)) Terraform Beta: Diff ( 7 files changed, 1175 insertions(+), 2 deletions(-)) TF Conversion: Diff ( 2 files changed, 158 insertions(+))

modular-magician avatar Sep 01 '23 19:09 modular-magician

Tests analytics

Total tests: 3010 Passed tests 2712 Skipped tests: 296 Affected tests: 2

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccApigeeEnvironmentKeyvaluemaps_apigeeEnvironmentKeyvaluemapsTestExample|TestAccApigeeEnvironmentKeyvaluemapsEntries_apigeeEnvironmentKeyvaluemapsEntriesTestExample

Get to know how VCR tests work

modular-magician avatar Sep 01 '23 20:09 modular-magician

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

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$ View the build log or the debug log for each test

modular-magician avatar Sep 01 '23 21:09 modular-magician

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.

Terraform GA: Diff ( 7 files changed, 1219 insertions(+), 2 deletions(-)) Terraform Beta: Diff ( 7 files changed, 1219 insertions(+), 2 deletions(-)) TF Conversion: Diff ( 2 files changed, 158 insertions(+))

modular-magician avatar Sep 05 '23 16:09 modular-magician

Tests analytics

Total tests: 3010 Passed tests 2709 Skipped tests: 296 Affected tests: 5

Action taken

Found 5 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccApigeeEnvironmentKeyvaluemaps_apigeeEnvironmentKeyvaluemapsTestExample|TestAccApigeeEnvironmentKeyvaluemapsEntries_apigeeEnvironmentKeyvaluemapsEntriesTestExample|TestAccBigtableAppProfile_bigtableAppProfileAnyclusterExample|TestAccBigtableAppProfile_bigtableAppProfileSingleclusterExample|TestAccBigtableAppProfile_bigtableAppProfileMulticlusterExample

Get to know how VCR tests work

modular-magician avatar Sep 05 '23 18:09 modular-magician

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

Rerun these tests in REPLAYING mode to catch issues

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


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

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$ View the build log or the debug log for each test

modular-magician avatar Sep 05 '23 19:09 modular-magician

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.

Terraform GA: Diff ( 7 files changed, 1173 insertions(+), 2 deletions(-)) Terraform Beta: Diff ( 7 files changed, 1173 insertions(+), 2 deletions(-)) TF Conversion: Diff ( 2 files changed, 158 insertions(+))

modular-magician avatar Sep 07 '23 15:09 modular-magician

Tests analytics

Total tests: 3019 Passed tests 2719 Skipped tests: 297 Affected tests: 3

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccApigeeEnvironmentKeyvaluemapsEntries_apigeeEnvironmentKeyvaluemapsEntriesTestExample|TestAccApigeeEnvironmentKeyvaluemaps_apigeeEnvironmentKeyvaluemapsTestExample|TestAccDataprocJobIamPolicy

Get to know how VCR tests work

modular-magician avatar Sep 07 '23 17:09 modular-magician

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

Rerun these tests in REPLAYING mode to catch issues

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


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

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$ View the build log or the debug log for each test

modular-magician avatar Sep 07 '23 18:09 modular-magician

@shuyama1 Are we still getting "no connections available from the Apigee connect agent(s)" error ? I am using eval version of apigee for local testing . I don't have access to do full apigee infrastructure provision from end to end which make it hard for troubleshooting .

If still the same error , I wanted to try the test below after reading apigee connect docs , but will beta-provider work in VCR test?

https://github.com/GoogleCloudPlatform/magic-modules/blob/25a0c9172118711805a6cc85c77b67acecd7c65e/mmv1/templates/terraform/examples/apigee_organization_cloud_full_test.tf.erb#L1-L125

george-peng avatar Sep 07 '23 22:09 george-peng

@shuyama1 Are we still getting "no connections available from the Apigee connect agent(s)" error ? I am using eval version of apigee for local testing . I don't have access to do full apigee infrastructure provision from end to end which make it hard for troubleshooting .

If still the same error , I wanted to try the test below after reading apigee connect docs , but will beta-provider work in VCR test?

https://github.com/GoogleCloudPlatform/magic-modules/blob/25a0c9172118711805a6cc85c77b67acecd7c65e/mmv1/templates/terraform/examples/apigee_organization_cloud_full_test.tf.erb#L1-L125

Sorry for the late response on this PR. Yes, it's still the same error no connections available from the Apigee connect agent(s). I remembered you mentioned you had the same apigee enviornment test setup for the other PR and was able to pass the test and was also able to get the test passed locally . Let me dig a bit on this error then.

will beta-provider work in VCR test?

yes, VCR is running test particular in beta provider

shuyama1 avatar Sep 08 '23 21:09 shuyama1

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.

Terraform GA: Diff ( 7 files changed, 1317 insertions(+), 2 deletions(-)) Terraform Beta: Diff ( 7 files changed, 1317 insertions(+), 2 deletions(-)) TF Conversion: Diff ( 2 files changed, 158 insertions(+))

modular-magician avatar Sep 12 '23 04:09 modular-magician

Tests analytics

Total tests: 3029 Passed tests 2730 Skipped tests: 297 Affected tests: 2

Action taken

Found 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccApigeeEnvironmentKeyvaluemaps_apigeeEnvironmentKeyvaluemapsTestExample|TestAccApigeeEnvironmentKeyvaluemapsEntries_apigeeEnvironmentKeyvaluemapsEntriesTestExample

Get to know how VCR tests work

modular-magician avatar Sep 12 '23 06:09 modular-magician

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

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$ View the build log or the debug log for each test

modular-magician avatar Sep 12 '23 06:09 modular-magician

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.

Terraform GA: Diff ( 7 files changed, 1319 insertions(+), 2 deletions(-)) Terraform Beta: Diff ( 7 files changed, 1319 insertions(+), 2 deletions(-)) TF Conversion: Diff ( 2 files changed, 158 insertions(+))

modular-magician avatar Sep 22 '23 04:09 modular-magician

Tests analytics

Total tests: 3079 Passed tests 2777 Skipped tests: 299 Affected tests: 3

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccApigeeEnvironmentKeyvaluemaps_apigeeEnvironmentKeyvaluemapsTestExample|TestAccApigeeEnvironmentKeyvaluemapsEntries_apigeeEnvironmentKeyvaluemapsEntriesTestExample|TestAccDataSourceGoogleServiceAccountJwt

Get to know how VCR tests work

modular-magician avatar Sep 22 '23 05:09 modular-magician

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

Rerun these tests in REPLAYING mode to catch issues

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


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

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$ View the build log or the debug log for each test

modular-magician avatar Sep 22 '23 05:09 modular-magician

@shuyama1 are we stilling get apigee connect error in test ?

george-peng avatar Sep 22 '23 14:09 george-peng

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.

Terraform GA: Diff ( 7 files changed, 1186 insertions(+), 2 deletions(-)) Terraform Beta: Diff ( 7 files changed, 1590 insertions(+), 2 deletions(-)) TF Conversion: Diff ( 2 files changed, 158 insertions(+))

modular-magician avatar Sep 25 '23 17:09 modular-magician

Tests analytics

Total tests: 3084 Passed tests 2779 Skipped tests: 299 Affected tests: 6

Action taken

Found 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccApigeeEnvironmentKeyvaluemaps_apigeeEnvironmentKeyvaluemapsTestExample|TestAccApigeeEnvironmentKeyvaluemapsEntries_apigeeEnvironmentKeyvaluemapsEntriesBetaTestExample|TestAccApigeeEnvironmentKeyvaluemapsEntries_apigeeEnvironmentKeyvaluemapsEntriesTestExample|TestAccApigeeEnvironmentKeyvaluemaps_apigeeEnvironmentKeyvaluemapsBetaTestExample|TestAccWorkstationsWorkstationConfig_update|TestAccWorkstationsWorkstationConfig_updateHostDetails

Get to know how VCR tests work

modular-magician avatar Sep 25 '23 18:09 modular-magician

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

Rerun these tests in REPLAYING mode to catch issues

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


$\textcolor{red}{\textsf{Tests failed during RECORDING mode:}}$ TestAccApigeeEnvironmentKeyvaluemaps_apigeeEnvironmentKeyvaluemapsTestExample[Error message] [Debug log] TestAccApigeeEnvironmentKeyvaluemapsEntries_apigeeEnvironmentKeyvaluemapsEntriesBetaTestExample[Error message] [Debug log] TestAccApigeeEnvironmentKeyvaluemapsEntries_apigeeEnvironmentKeyvaluemapsEntriesTestExample[Error message] [Debug log] TestAccApigeeEnvironmentKeyvaluemaps_apigeeEnvironmentKeyvaluemapsBetaTestExample[Error message] [Debug log]

$\textcolor{red}{\textsf{Please fix these to complete your PR.}}$ View the build log or the debug log for each test

modular-magician avatar Sep 25 '23 19:09 modular-magician

@shuyama1 Hi , I am able to reproduce the apigee connect issue. It looks like VCR test wasn't able to create runtime instance using google_apigee_instance . As per document link here , it indicates that "keyvaluemaps data is stored in an Apigee instance " . Apigee keyvaluemaps has hard dependency with apigee runtime instance.

I was reviewing the test setup for apigee instance below. It looks like all tests are skipped. Can you confirm if VCR supports google_apigee_instance . How should we proceed if VCR doesn't support it ? https://github.com/GoogleCloudPlatform/magic-modules/blob/ffbac62a27c070199cbaf6f3050ff2278786498d/mmv1/products/apigee/Instance.yaml#L48-L131

george-peng avatar Sep 27 '23 04:09 george-peng