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

fix service port error when protocol is any #884

Closed
wants to merge 8 commits into from
Closed

fix service port error when protocol is any #884

wants to merge 8 commits into from

Conversation

Lance52259
Copy link
Contributor

@Lance52259 Lance52259 commented Jan 29, 2021

What this PR does / why we need it:
Nat dnat rule cannot create which request set with zero service port.
This issue because of isEmptyValue function return false when service port is zero(int) and program will abandom setting data.

Which issue this PR fixes:
(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged)
fixes #880

Special notes for your reviewer:

Release note:

1. remove isEmptyValue function check because service port can be set with zero.

PR Checklist

  • Tests added/passed.
  • Documentation updated.
  • Schema updated.

Acceptance Steps Performed

make testacc TEST='./huaweicloud' TESTARGS='-run=TestAccNatDnat_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./huaweicloud -v -run=TestAccNatDnat_basic -timeout 360m -parallel 4
=== RUN   TestAccNatDnat_basic
=== PAUSE TestAccNatDnat_basic
=== CONT  TestAccNatDnat_basic
--- PASS: TestAccNatDnat_basic (177.79s)
PASS
ok      github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud       177.841s
make testacc TEST='./huaweicloud' TESTARGS='-run=TestAccNatDnat_protocol'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./huaweicloud -v -run=TestAccNatDnat_protocol -timeout 360m -parallel 4
=== RUN   TestAccNatDnat_protocol
=== PAUSE TestAccNatDnat_protocol
=== CONT  TestAccNatDnat_protocol
--- PASS: TestAccNatDnat_protocol (165.52s)
PASS
ok      github.com/huaweicloud/terraform-provider-huaweicloud/huaweicloud       165.575s

Comment on lines 195 to 193
%s
%s
resource "huaweicloud_nat_dnat_rule" "dnat" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

please use empty lines to separate resources.

@@ -112,10 +138,8 @@ func testAccCheckNatDnatExists() resource.TestCheckFunc {
}
}

func testAccNatV2DnatRule_basic(suffix string) string {
func testAccNatV2DnatRule_res(suffix string) string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggest to rename the function as testAccNatV2DnatRule_base

@@ -148,7 +172,13 @@ resource "huaweicloud_compute_instance" "instance_1" {
foo = "bar"
}
}
`, suffix, suffix, HW_AVAILABILITY_ZONE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

we also can put testAccNatPreCondition(suffix) into this function.

@Lance52259 Lance52259 closed this Jan 31, 2021
@Lance52259 Lance52259 deleted the DnatIssuePatch branch January 31, 2021 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't create dnat rule for all ports
2 participants