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 flipping health_check_path on GA #12271

Closed
wants to merge 1 commit into from
Closed

Fix flipping health_check_path on GA #12271

wants to merge 1 commit into from

Conversation

aquarhead
Copy link

@aquarhead aquarhead commented Mar 5, 2020

  • Remove default value for health_check_path
  • Update documentation
  • Skip setting the resource data field for TCP GAs

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Release note for CHANGELOG:

Remove default value of `health_check_path`

Output from acceptance testing:

❯ make testacc TEST=./aws TESTARGS='-run=TestAccAwsGlobalAcceleratorEndpointGroup_tcp'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsGlobalAcceleratorEndpointGroup_tcp -timeout 120m
=== RUN   TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== PAUSE TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== CONT  TestAccAwsGlobalAcceleratorEndpointGroup_tcp
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_tcp (312.50s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	312.561s

❯ make testacc TEST=./aws TESTARGS='-run=TestAccAwsGlobalAcceleratorEndpointGroup'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsGlobalAcceleratorEndpointGroup -timeout 120m
go: downloading github.com/aws/aws-sdk-go v1.29.16
=== RUN   TestAccAwsGlobalAcceleratorEndpointGroup_basic
=== PAUSE TestAccAwsGlobalAcceleratorEndpointGroup_basic
=== RUN   TestAccAwsGlobalAcceleratorEndpointGroup_update
=== PAUSE TestAccAwsGlobalAcceleratorEndpointGroup_update
=== RUN   TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== PAUSE TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== CONT  TestAccAwsGlobalAcceleratorEndpointGroup_basic
=== CONT  TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== CONT  TestAccAwsGlobalAcceleratorEndpointGroup_update
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_basic (245.99s)
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_tcp (281.40s)
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_update (307.20s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	307.279s

I'm proposing this change because for TCP endpoint groups there's no health_check_path:

スクリーンショット 2020-03-05 11 48 32

With previous code, terraform plan will attempt to add a default / every time:

image

But AWS doesn't care about it so it keeps try to add the field forever.

@aquarhead aquarhead requested a review from a team March 5, 2020 11:59
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/M Managed by automation to categorize the size of a PR. service/globalaccelerator Issues and PRs that pertain to the globalaccelerator service. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Mar 5, 2020
@ewbankkit
Copy link
Contributor

ewbankkit commented Jul 17, 2020

Relates: #9329.
Relates: #12882.

@aquarhead
Copy link
Author

aquarhead commented Jul 17, 2020

Thanks for linking related issues. I wasn't able to find the previous one when I submit my PR. Hopefully there will be some traction now that multiple issues exist.

@ewbankkit
Copy link
Contributor

@aquarhead Yes, we are hoping to make progress on some of the non-Core services.
It may be worth considering bflad's suggestion. I think for HTTP(S) endpoints, removing / as the default health_check_path value will cause any configuration that were assuming that to now show a continual diff.

@aquarhead
Copy link
Author

aquarhead commented Jul 17, 2020

So should Default: "/" be left untouched? And add "Computed: true"? Not sure how the resource update function should behave in that case... Wouldn't it make the statefile think the resource has a health_check_path of / while in reality it does not (for TCP endpoint groups)?

If Computed: true is to replace Default: "/" wouldn't that be the same situation as this one (in regards to causing diff) ? Or does it behave differently for existing resources? (Sorry I'm not familiar with these options)

@ewbankkit
Copy link
Contributor

@aquarhead Remove Default: "/", and add Computed: true. Then if no value is specified by the user in their configuration, whatever value DescribeEndpointGroup returns for health_check_path will not show as a diff.

@aquarhead
Copy link
Author

Added, do I need to change other if statement?

@ewbankkit
Copy link
Contributor

@aquarhead Yes, there should be no need for those additional if statements now, but of course use the acceptance tests to verify. Thanks.

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Jul 21, 2020
@ewbankkit ewbankkit requested review from ewbankkit and removed request for a team July 21, 2020 16:08
@aquarhead
Copy link
Author

Just removed all if and GetOkExists changes and also rebased to current master, now there's an error with acceptance test:

    TestAccAwsGlobalAcceleratorEndpointGroup_tcp: testing.go:684: Step 0 error: Check failed: Check 3/8 error: aws_globalaccelerator_endpoint_group.example: Attribute 'health_check_path' found when not expected
--- FAIL: TestAccAwsGlobalAcceleratorEndpointGroup_tcp (207.73s)

Seems GetOk will inject some value by default? Should I leave GetOkExists in place?

Actually all I care is that TF does not consider itself needs to update any values because of health_check_path is changed. Is there any particular technique I can use to specifically check that health_check_path does not trigger an update? (instead of checking values after apply)

@ewbankkit
Copy link
Contributor

@aquarhead After every acceptance test step effectively a terraform plan is run and by default any reported diffs will report as an error, so a successful test will verify that there is no drift.
For the currently failing test it is OK to have the health_check_path attribute set.
Yes GetOk will return the "zero" value, an empty string.

@aquarhead
Copy link
Author

@ewbankkit Thanks for that information, according to that I think just running a single TCP endpoint group creation test is enough, I've rebased all the changes and onto (this morning's) master. And acceptance test passes too:

<$> make testacc TEST=./aws TESTARGS='-run=TestAccAwsGlobalAcceleratorEndpointGroup_tcp'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsGlobalAcceleratorEndpointGroup_tcp -timeout 120m
=== RUN   TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== PAUSE TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== CONT  TestAccAwsGlobalAcceleratorEndpointGroup_tcp
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_tcp (244.77s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	244.834s

@ewbankkit
Copy link
Contributor

Verified acceptance tests:

$ make testacc TEST=./aws TESTARGS='-run=TestAccAwsGlobalAcceleratorEndpointGroup_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsGlobalAcceleratorEndpointGroup_ -timeout 120m
=== RUN   TestAccAwsGlobalAcceleratorEndpointGroup_basic
=== PAUSE TestAccAwsGlobalAcceleratorEndpointGroup_basic
=== RUN   TestAccAwsGlobalAcceleratorEndpointGroup_update
=== PAUSE TestAccAwsGlobalAcceleratorEndpointGroup_update
=== RUN   TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== PAUSE TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== CONT  TestAccAwsGlobalAcceleratorEndpointGroup_basic
=== CONT  TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== CONT  TestAccAwsGlobalAcceleratorEndpointGroup_update
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_basic (215.15s)
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_tcp (216.12s)
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_update (240.11s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	240.215s

@aquarhead One minor tweak to the documentation and then this looks good. Thanks.

@ewbankkit
Copy link
Contributor

Closes #9329.

@aquarhead
Copy link
Author

Do I need to tweak the "Release note for CHANGELOG:" section in the OP ?

@ewbankkit
Copy link
Contributor

CHANGELOG looks OK.

- Set `health_check_path` to Computed without Default
- Update documentation
@aquarhead
Copy link
Author

@ewbankkit Sorry, in the afternoon I thought I've added the doc change.... Just added now according to our discussion

Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM.

$ make testacc TEST=./aws TESTARGS='-run=TestAccAwsGlobalAcceleratorEndpointGroup_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsGlobalAcceleratorEndpointGroup_ -timeout 120m
=== RUN   TestAccAwsGlobalAcceleratorEndpointGroup_basic
=== PAUSE TestAccAwsGlobalAcceleratorEndpointGroup_basic
=== RUN   TestAccAwsGlobalAcceleratorEndpointGroup_update
=== PAUSE TestAccAwsGlobalAcceleratorEndpointGroup_update
=== RUN   TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== PAUSE TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== CONT  TestAccAwsGlobalAcceleratorEndpointGroup_basic
=== CONT  TestAccAwsGlobalAcceleratorEndpointGroup_tcp
=== CONT  TestAccAwsGlobalAcceleratorEndpointGroup_update
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_tcp (195.20s)
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_basic (196.92s)
--- PASS: TestAccAwsGlobalAcceleratorEndpointGroup_update (231.21s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	231.272s

@bflad
Copy link
Contributor

bflad commented Aug 22, 2020

Please note that the commits from this pull request were included with #14486 and merged for release in version 3.4.0 of the Terraform AWS Provider.

@bflad bflad closed this Aug 22, 2020
@ghost
Copy link

ghost commented Aug 27, 2020

This has been released in version 3.4.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Sep 21, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Sep 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. service/globalaccelerator Issues and PRs that pertain to the globalaccelerator service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants