-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added new Apigee resource /v1/organizations/<apigee_org>/environments/<apigee_env>/addonsConfig #12616
Conversation
sharmajai09
commented
Dec 19, 2024
•
edited
Loading
edited
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @melinath, 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. |
Taking this over as the original reviewer of #12417 |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Missing test reportYour PR includes resource fields which are not covered by any test. Resource: resource "google_apigee_environment_addons_config" "primary" {
api_security_enabled = # value needed
}
|
Tests analyticsTotal tests: 52 Click here to see the affected service packages
🔴 Tests were added that are skipped in VCR:
View the build log |
org_id: 'ORG_ID' | ||
billing_account: 'BILLING_ACCT' | ||
exclude_docs: true | ||
skip_vcr: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to double-check that this needs to skip VCR tests? More information on the reasons for doing this (or not): https://googlecloudplatform.github.io/magic-modules/test/test/#skip-tests-in-vcr-replaying-mode
AddonsConfig tests don't seem to need this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i had to add skip_vcr check back due to previously known error
Error waiting for Deleting Organization: error while retrieving operation: googleapi: Error 403: Permission 'apigee.operations.get' denied on resource 'organizations/tf-test-bawr39q93i/operations/55f073f3-0694-4c76-a387-a39b74c30e49' (or it may not exist)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be inclined to remove this for now, since that error doesn't seem like it's inherently a VCR-blocking issue, and it should get resolved at the same time as hashicorp/terraform-provider-google#20668 (hopefully soon!), and I don't want us to forget to remove it later. I'm happy to approve with the failing test in this case since it should be possible to verify it's a problem with the Organization resource, not this one.
'Enable ApiSecurity Add-On': 'https://cloud.google.com/apigee/docs/api-platform/reference/manage-security-add-on' | ||
api: 'https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.addonsConfig/setAddonEnablement' | ||
docs: | ||
base_url: '{{env_id}}/addonsConfig' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addonsConfig
part doesn't need to be in the base_url, since this isn't a "real" resource. Technically the base_url should probably be organizations/{{org_id}}/environments
but I think given the overrides in place this might actually not get used at all.
base_url: '{{env_id}}/addonsConfig' | |
base_url: '{{env_id}}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
mmv1/templates/terraform/custom_import/apigee_env_addons.go.tmpl
Outdated
Show resolved
Hide resolved
nameParts := strings.Split(d.Get("env_id").(string), "/") | ||
if len(nameParts) == 5 { | ||
id := fmt.Sprintf("organizations/%s/environments/%s", nameParts[1], nameParts[3]) | ||
d.SetId(id) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be something like this:
nameParts := strings.Split(d.Get("env_id").(string), "/") | |
if len(nameParts) == 5 { | |
id := fmt.Sprintf("organizations/%s/environments/%s", nameParts[1], nameParts[3]) | |
d.SetId(id) | |
} | |
id := d.Get("env_id").(string) | |
nameParts := strings.Split(id, "/") | |
if len(nameParts) != 4 { // you could be stricter about this check if you want. | |
return nil, fmt.Errorf("env is expected to have shape organizations/{{"{{"}}org_id{{"}}"}}/environments/{{"{{"}}env{{"}}"}}, got %s instead", id) | |
} | |
d.SetId(id) |
Any errors parsing the import id need to be returned - otherwise you might end up with an import that looks like it succeeds but fails to actually set an id (which means the resource won't actually be imported).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 52 Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
…get' denied on resource
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 52 Click here to see the affected service packages
🔴 Tests were added that are skipped in VCR:
View the build log |
org_id: 'ORG_ID' | ||
billing_account: 'BILLING_ACCT' | ||
exclude_docs: true | ||
skip_vcr: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be inclined to remove this for now, since that error doesn't seem like it's inherently a VCR-blocking issue, and it should get resolved at the same time as hashicorp/terraform-provider-google#20668 (hopefully soon!), and I don't want us to forget to remove it later. I'm happy to approve with the failing test in this case since it should be possible to verify it's a problem with the Organization resource, not this one.
@@ -0,0 +1,70 @@ | |||
resource "google_project" "project" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually the purpose of having a docs-only example is to remove extra configuration the users don't necessarily need to know about; for example, apigee_addons_basic only has the google_apigee_addons_config
resource.
If the extra information here is useful for users, you could create docs based on the other example instead of having a second one just for docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done I have kept Org and environment creation steps as this resource is available only when Org is PAYG and environment is COMPREHENSIVE.
mmv1/templates/terraform/custom_import/apigee_env_addons.go.tmpl
Outdated
Show resolved
Hide resolved
@modular-magician reassign-reviewer |
reassigning since I'll be OOO next week. |
@SirGitsalot This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
@GoogleCloudPlatform/terraform-team @SirGitsalot This PR has been waiting for review for 1 week. Please take a look! Use the label |
@GoogleCloudPlatform/terraform-team @SirGitsalot This PR has been waiting for review for 2 weeks. Please take a look! Use the label |
Sorry for the delay on this one; we had a miscommunication regarding the vacation plans! I can take it back over now that I'm back. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple small changes
config := meta.(*transport_tpg.Config) | ||
|
||
// current import_formats cannot import fields with forward slashes in their value | ||
if err := tpgresource.ParseImportId([]string{"(?P<env_id>.+)/addonsConfig"}, d, config); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex here matches what users pass in when using terraform import
& definitely shouldn't contain addonsConfig
if err := tpgresource.ParseImportId([]string{"(?P<env_id>.+)/addonsConfig"}, d, config); err != nil { | |
if err := tpgresource.ParseImportId([]string{"(?P<env_id>.+)"}, d, config); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
somehow when I was running tests locally import worked only when I added /addonsConfig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had you make some other changes (like adding the id_format) so that removing this here would work. I think your local testing may have been before those changes?
id_format: | ||
- '{{env_id}}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I think I had suggested formatting this as a list but it should actually be just a string. This is causing the yaml parsing error.
id_format: | |
- '{{env_id}}' | |
id_format: '{{env_id}}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 52 Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one small change but otherwise LGTM. the test failure is expected and is not due to a problem with this resource AFAICT. The update logic is similar enough to the create logic (even using the same API method) that I feel comfortable with not having an update test.
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 52 Click here to see the affected service packages
Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
🔴 Tests failed during RECORDING mode: 🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR. |