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

feat(apigee): Add support for NatAddress activation #11698

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

entertvl
Copy link
Contributor

Release Note Template for Downstream PRs (will be copied)

apigee: Add support for NAT Address activation in `google_apigee_nat_address`.

Copy link

Hello! I am a robot. Tests will require approval from a repository maintainer to run.

@trodge, 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 modular-magician added the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Sep 13, 2024
@entertvl
Copy link
Contributor Author

entertvl commented Sep 13, 2024

Trying to set the activate in our custom_import based on state value, but this seems like a wrong approach, d.Get("state").(string) is returning empty.

It doesn’t seem to be mentioned in the guide, but is it necessary to retrieve the state again from the API in rescueApigeeNatAddressImport()...?

func resourceApigeeNatAddressImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
	config := meta.(*transport_tpg.Config)

	(snip)

	state := d.Get("state").(string)

	if err := d.Set("activate", state == "ACTIVE"); err != nil {
		return nil, fmt.Errorf("Error setting NatAddress %s activate: %s", name, err)
	}

	return []*schema.ResourceData{d}, nil
}

@trodge
Copy link
Contributor

trodge commented Sep 13, 2024

Trying to set the activate in our custom_import based on state value, but this seems like a wrong approach, d.Get("state").(string) is returning empty.

It doesn’t seem to be mentioned in the guide, but is it necessary to retrieve the state again from the API in rescueApigeeNatAddressImport()...?

func resourceApigeeNatAddressImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
	config := meta.(*transport_tpg.Config)

	(snip)

	state := d.Get("state").(string)

	if err := d.Set("activate", state == "ACTIVE"); err != nil {
		return nil, fmt.Errorf("Error setting NatAddress %s activate: %s", name, err)
	}

	return []*schema.ResourceData{d}, nil
}

I don't think import will have access to any API-side data about the resource. Is it possible to do what you need to do in the read method?

@entertvl
Copy link
Contributor Author

Is it possible to do what you need to do in the read method?

Resolved using encoder/decoder. Thanks.

PR is ready for review. Could you take a look?

@modular-magician modular-magician added service/apigee and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Sep 16, 2024
@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 ( 5 files changed, 387 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 387 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 43 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 43
Passed tests: 14
Skipped tests: 29
Affected tests: 0

Click here to see the affected service packages
  • apigee
#### Non-exercised tests

Tests were added that are skipped in VCR:

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

View the build log

Copy link

@trodge This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@entertvl
Copy link
Contributor Author

What reason of failed to terraform-google-conversion-test-integration step?
I don't know how the next.

Copy link

@GoogleCloudPlatform/terraform-team @trodge This PR has been waiting for review for 1 week. Please take a look! Use the label disable-review-reminders to disable these notifications.

@trodge
Copy link
Contributor

trodge commented Sep 20, 2024

/gcbrun

@trodge
Copy link
Contributor

trodge commented Sep 20, 2024

My apologies, that test has been a bit flakey since the 6.0.0 changes. I'm trying re-running the tests. If that fails, rebasing this PR may fix it.

@modular-magician modular-magician added awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Sep 20, 2024
@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 ( 5 files changed, 387 insertions(+), 2 deletions(-))
google-beta provider: Diff ( 5 files changed, 387 insertions(+), 2 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 43 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 43
Passed tests: 14
Skipped tests: 29
Affected tests: 0

Click here to see the affected service packages
  • apigee
#### Non-exercised tests

Tests were added that are skipped in VCR:

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

View the build log

@modular-magician modular-magician added the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Sep 21, 2024
@entertvl
Copy link
Contributor Author

Rebased and checked that the re-run tests passed locally.

--- PASS: TestAccApigeeNatAddress_apigeeNatAddressBasicTestExample (2463.60s)
--- PASS: TestAccApigeeNatAddress_apigeeNatAddressUpdateTest (2579.36s)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests service/apigee
Projects
None yet
3 participants