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

Added "disabled" support to firewall endpoint association resource #10246

Conversation

matheusaleixo-cit
Copy link
Contributor

@matheusaleixo-cit matheusaleixo-cit commented Mar 20, 2024

Adds support for optional 'disabled' field to 'google_network_security_firewall_endpoint_association'

Fixes: hashicorp/terraform-provider-google#17610
Fixes: hashicorp/terraform-provider-google#17699

Also fixes to the test 'testAccNetworkSecurityFirewallEndpointAssociation_basic' that started failing due to recent changes to the API, such as the addition of the 'billingProjectId' field to the Firewall Endpoint. (Similar to hashicorp/terraform-provider-google#17396)

Release Note Template for Downstream PRs (will be copied)

networksecurity: Added 'disabled' field to 'google_network_security_firewall_endpoint_association' resource;
networksecurity: fixed an issue where `google_network_security_firewall_endpoint_association` resources could not be created due to a bad parameter

- Fixed create_url sending incorrect parameter (firewallEndpointId ~> firewallEndpointAssociationId);

Tests:
- Added new test for "disabled" field;
- Added "billingProjectId" field to the "google_network_security_firewall_endpoint" resource";
- Changed "parent" attribute in "google_network_security_firewall_endpoint_association";
- Added "disabled" argument to update function;
- Cleaned Sprintf formatting;
Copy link

google-cla bot commented Mar 20, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@matheusaleixo-cit matheusaleixo-cit marked this pull request as ready for review March 21, 2024 12:08
Copy link

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

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

@@ -22,26 +23,86 @@ func TestAccNetworkSecurityFirewallEndpointAssociations_basic(t *testing.T) {

orgId := envvar.GetTestOrgFromEnv(t)
randomSuffix := acctest.RandString(t, 10)
billingProjectId := envvar.GetTestProjectFromEnv()
Copy link
Member

Choose a reason for hiding this comment

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

nit: spacing (spaces -> tabs)

Steps: []resource.TestStep{
{
Config: testAccNetworkSecurityFirewallEndpointAssociation_basic(randomSuffix, orgId, billingProjectId, projectNumberId),
Check: resource.ComposeTestCheckFunc(
Copy link
Member

Choose a reason for hiding this comment

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

nit: spacing (spaces -> tabs)

return fmt.Sprintf(`
resource "google_compute_network" "foobar" {
provider = google-beta
name = "tf-test-my-vpc%s"
provider = google-beta
Copy link
Member

Choose a reason for hiding this comment

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

nit: spacing (tabs -> spaces)

provider = google-beta
name = "tf-test-my-vpc%s"
provider = google-beta
name = "tf-test-my-vpc%[2]s"
Copy link
Member

Choose a reason for hiding this comment

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

Can you switch to context / Nprintfinstead of Sprintf? This will be much easier to read using that formatting instead.

@@ -20,28 +21,91 @@ func TestAccNetworkSecurityFirewallEndpointAssociations_basic(t *testing.T) {
acctest.SkipIfVcr(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be removed I believe. I looked into this resource in #10308 and though I didn't get the test to successfully pass I believe VCR should work for this test.

Copy link
Member

Choose a reason for hiding this comment

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

@matheusaleixo-cit let's apply this change- it'll make our presubmits run the test.

@slevenick
Copy link
Contributor

Added to the PR description that this also fixes hashicorp/terraform-provider-google#17699

@github-actions github-actions bot requested a review from slevenick April 1, 2024 15:18
@slevenick
Copy link
Contributor

/gcbrun

@modular-magician modular-magician added awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests service/network-security-distributed-firewall and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Apr 1, 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 ( 1 file changed, 6 insertions(+))
google-beta provider: Diff ( 3 files changed, 160 insertions(+), 48 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 10 insertions(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 37
Passed tests: 34
Skipped tests: 1
Affected tests: 2

Click here to see the affected service packages
  • networksecurity

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
TestAccNetworkSecurityFirewallEndpointAssociations_basic|TestAccNetworkSecurityFirewallEndpointAssociations_disabled

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

$\textcolor{green}{\textsf{Tests passed during RECORDING mode:}}$
TestAccNetworkSecurityFirewallEndpointAssociations_basic[Debug log]
TestAccNetworkSecurityFirewallEndpointAssociations_disabled[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

@matheusaleixo-cit
Copy link
Contributor Author

Hello @rileykarson @slevenick! Are there any other pending issues preventing the merge of this PR?

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! No further action needed.

@matheusaleixo-cit matheusaleixo-cit deleted the add-disabled-to-firewall_endpoint_association branch April 4, 2024 20:23
cmfeng pushed a commit to cmfeng/cmfeng-magic-modules that referenced this pull request Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants