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 crash in lb_target_group data source. #19955

Merged
merged 4 commits into from
Jun 24, 2021
Merged

Conversation

bill-rich
Copy link
Contributor

Fixes crash in lb_target_group data source and rearranges app_cookie related attributes.

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

Output from acceptance testing:

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSLBTargetGroup_ -timeout 180m
=== RUN   TestAccAWSLBTargetGroup_basic
=== PAUSE TestAccAWSLBTargetGroup_basic
=== RUN   TestAccAWSLBTargetGroup_basicUdp
=== PAUSE TestAccAWSLBTargetGroup_basicUdp
=== RUN   TestAccAWSLBTargetGroup_ProtocolVersion
=== PAUSE TestAccAWSLBTargetGroup_ProtocolVersion
=== RUN   TestAccAWSLBTargetGroup_withoutHealthcheck
=== PAUSE TestAccAWSLBTargetGroup_withoutHealthcheck
=== RUN   TestAccAWSLBTargetGroup_networkLB_TargetGroup
=== PAUSE TestAccAWSLBTargetGroup_networkLB_TargetGroup
=== RUN   TestAccAWSLBTargetGroup_Protocol_Geneve
=== PAUSE TestAccAWSLBTargetGroup_Protocol_Geneve
=== RUN   TestAccAWSLBTargetGroup_Protocol_Tcp_HealthCheck_Protocol
=== PAUSE TestAccAWSLBTargetGroup_Protocol_Tcp_HealthCheck_Protocol
=== RUN   TestAccAWSLBTargetGroup_Protocol_Tls
=== PAUSE TestAccAWSLBTargetGroup_Protocol_Tls
=== RUN   TestAccAWSLBTargetGroup_ProtocolVersion_GRPC_HealthCheck
=== PAUSE TestAccAWSLBTargetGroup_ProtocolVersion_GRPC_HealthCheck
=== RUN   TestAccAWSLBTargetGroup_ProtocolVersion_HTTP_GRPC_Update
=== PAUSE TestAccAWSLBTargetGroup_ProtocolVersion_HTTP_GRPC_Update
=== RUN   TestAccAWSLBTargetGroup_networkLB_TargetGroupWithProxy
=== PAUSE TestAccAWSLBTargetGroup_networkLB_TargetGroupWithProxy
=== RUN   TestAccAWSLBTargetGroup_TCP_HTTPHealthCheck
=== PAUSE TestAccAWSLBTargetGroup_TCP_HTTPHealthCheck
=== RUN   TestAccAWSLBTargetGroup_BackwardsCompatibility
=== PAUSE TestAccAWSLBTargetGroup_BackwardsCompatibility
=== RUN   TestAccAWSLBTargetGroup_namePrefix
=== PAUSE TestAccAWSLBTargetGroup_namePrefix
=== RUN   TestAccAWSLBTargetGroup_generatedName
=== PAUSE TestAccAWSLBTargetGroup_generatedName
=== RUN   TestAccAWSLBTargetGroup_changeNameForceNew
=== PAUSE TestAccAWSLBTargetGroup_changeNameForceNew
=== RUN   TestAccAWSLBTargetGroup_changeProtocolForceNew
=== PAUSE TestAccAWSLBTargetGroup_changeProtocolForceNew
=== RUN   TestAccAWSLBTargetGroup_changePortForceNew
=== PAUSE TestAccAWSLBTargetGroup_changePortForceNew
=== RUN   TestAccAWSLBTargetGroup_changeVpcForceNew
=== PAUSE TestAccAWSLBTargetGroup_changeVpcForceNew
=== RUN   TestAccAWSLBTargetGroup_tags
=== PAUSE TestAccAWSLBTargetGroup_tags
=== RUN   TestAccAWSLBTargetGroup_enableHealthCheck
=== PAUSE TestAccAWSLBTargetGroup_enableHealthCheck
=== RUN   TestAccAWSLBTargetGroup_updateHealthCheck
=== PAUSE TestAccAWSLBTargetGroup_updateHealthCheck
=== RUN   TestAccAWSLBTargetGroup_updateSticknessEnabled
=== PAUSE TestAccAWSLBTargetGroup_updateSticknessEnabled
=== RUN   TestAccAWSLBTargetGroup_updateAppSticknessEnabled
=== PAUSE TestAccAWSLBTargetGroup_updateAppSticknessEnabled
=== RUN   TestAccAWSLBTargetGroup_defaults_application
=== PAUSE TestAccAWSLBTargetGroup_defaults_application
=== RUN   TestAccAWSLBTargetGroup_defaults_network
=== PAUSE TestAccAWSLBTargetGroup_defaults_network
=== RUN   TestAccAWSLBTargetGroup_stickinessDefaultNLB
=== PAUSE TestAccAWSLBTargetGroup_stickinessDefaultNLB
=== RUN   TestAccAWSLBTargetGroup_stickinessDefaultALB
=== PAUSE TestAccAWSLBTargetGroup_stickinessDefaultALB
=== RUN   TestAccAWSLBTargetGroup_stickinessValidNLB
=== PAUSE TestAccAWSLBTargetGroup_stickinessValidNLB
=== RUN   TestAccAWSLBTargetGroup_stickinessValidALB
=== PAUSE TestAccAWSLBTargetGroup_stickinessValidALB
=== RUN   TestAccAWSLBTargetGroup_stickinessInvalidNLB
=== PAUSE TestAccAWSLBTargetGroup_stickinessInvalidNLB
=== RUN   TestAccAWSLBTargetGroup_stickinessInvalidALB
=== PAUSE TestAccAWSLBTargetGroup_stickinessInvalidALB
=== RUN   TestAccAWSLBTargetGroup_preserveClientIPValid
=== PAUSE TestAccAWSLBTargetGroup_preserveClientIPValid
=== CONT  TestAccAWSLBTargetGroup_basic
=== CONT  TestAccAWSLBTargetGroup_changePortForceNew
=== CONT  TestAccAWSLBTargetGroup_BackwardsCompatibility
=== CONT  TestAccAWSLBTargetGroup_stickinessDefaultNLB
=== CONT  TestAccAWSLBTargetGroup_preserveClientIPValid
=== CONT  TestAccAWSLBTargetGroup_stickinessInvalidALB
=== CONT  TestAccAWSLBTargetGroup_stickinessInvalidNLB
=== CONT  TestAccAWSLBTargetGroup_stickinessValidALB
=== CONT  TestAccAWSLBTargetGroup_stickinessValidNLB
=== CONT  TestAccAWSLBTargetGroup_stickinessDefaultALB
=== CONT  TestAccAWSLBTargetGroup_Protocol_Tls
=== CONT  TestAccAWSLBTargetGroup_ProtocolVersion_GRPC_HealthCheck
=== CONT  TestAccAWSLBTargetGroup_withoutHealthcheck
=== CONT  TestAccAWSLBTargetGroup_networkLB_TargetGroup
=== CONT  TestAccAWSLBTargetGroup_namePrefix
=== CONT  TestAccAWSLBTargetGroup_ProtocolVersion_HTTP_GRPC_Update
=== CONT  TestAccAWSLBTargetGroup_changeProtocolForceNew
=== CONT  TestAccAWSLBTargetGroup_changeNameForceNew
=== CONT  TestAccAWSLBTargetGroup_generatedName
=== CONT  TestAccAWSLBTargetGroup_Protocol_Geneve
--- PASS: TestAccAWSLBTargetGroup_withoutHealthcheck (21.44s)
=== CONT  TestAccAWSLBTargetGroup_updateSticknessEnabled
--- PASS: TestAccAWSLBTargetGroup_basic (35.53s)
=== CONT  TestAccAWSLBTargetGroup_defaults_network
--- PASS: TestAccAWSLBTargetGroup_Protocol_Tls (40.17s)
=== CONT  TestAccAWSLBTargetGroup_defaults_application
--- PASS: TestAccAWSLBTargetGroup_ProtocolVersion_GRPC_HealthCheck (43.34s)
=== CONT  TestAccAWSLBTargetGroup_updateAppSticknessEnabled
--- PASS: TestAccAWSLBTargetGroup_stickinessDefaultALB (45.27s)
=== CONT  TestAccAWSLBTargetGroup_enableHealthCheck
--- PASS: TestAccAWSLBTargetGroup_BackwardsCompatibility (45.91s)
=== CONT  TestAccAWSLBTargetGroup_Protocol_Tcp_HealthCheck_Protocol
--- PASS: TestAccAWSLBTargetGroup_generatedName (48.43s)
=== CONT  TestAccAWSLBTargetGroup_updateHealthCheck
--- PASS: TestAccAWSLBTargetGroup_Protocol_Geneve (49.04s)
=== CONT  TestAccAWSLBTargetGroup_TCP_HTTPHealthCheck
--- PASS: TestAccAWSLBTargetGroup_namePrefix (57.39s)
=== CONT  TestAccAWSLBTargetGroup_networkLB_TargetGroupWithProxy
--- PASS: TestAccAWSLBTargetGroup_stickinessInvalidNLB (58.49s)
=== CONT  TestAccAWSLBTargetGroup_tags
--- PASS: TestAccAWSLBTargetGroup_preserveClientIPValid (61.38s)
=== CONT  TestAccAWSLBTargetGroup_ProtocolVersion
--- PASS: TestAccAWSLBTargetGroup_changeNameForceNew (62.74s)
=== CONT  TestAccAWSLBTargetGroup_basicUdp
--- PASS: TestAccAWSLBTargetGroup_ProtocolVersion_HTTP_GRPC_Update (66.56s)
=== CONT  TestAccAWSLBTargetGroup_changeVpcForceNew
--- PASS: TestAccAWSLBTargetGroup_changePortForceNew (70.98s)
--- PASS: TestAccAWSLBTargetGroup_enableHealthCheck (27.88s)
--- PASS: TestAccAWSLBTargetGroup_stickinessInvalidALB (77.77s)
--- PASS: TestAccAWSLBTargetGroup_defaults_application (44.25s)
--- PASS: TestAccAWSLBTargetGroup_stickinessValidALB (85.50s)
--- PASS: TestAccAWSLBTargetGroup_ProtocolVersion (27.30s)
--- PASS: TestAccAWSLBTargetGroup_defaults_network (59.40s)
--- PASS: TestAccAWSLBTargetGroup_basicUdp (32.31s)
--- PASS: TestAccAWSLBTargetGroup_updateSticknessEnabled (76.80s)
--- PASS: TestAccAWSLBTargetGroup_TCP_HTTPHealthCheck (52.04s)
--- PASS: TestAccAWSLBTargetGroup_stickinessDefaultNLB (101.40s)
--- PASS: TestAccAWSLBTargetGroup_networkLB_TargetGroupWithProxy (46.24s)
--- PASS: TestAccAWSLBTargetGroup_updateHealthCheck (56.67s)
--- PASS: TestAccAWSLBTargetGroup_changeProtocolForceNew (108.97s)
--- PASS: TestAccAWSLBTargetGroup_changeVpcForceNew (58.53s)
--- PASS: TestAccAWSLBTargetGroup_updateAppSticknessEnabled (81.75s)
--- PASS: TestAccAWSLBTargetGroup_tags (66.76s)
--- PASS: TestAccAWSLBTargetGroup_Protocol_Tcp_HealthCheck_Protocol (85.83s)
--- PASS: TestAccAWSLBTargetGroup_networkLB_TargetGroup (145.62s)
--- PASS: TestAccAWSLBTargetGroup_stickinessValidNLB (149.18s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	149.234s

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccDataSourceAWSLBTargetGroup_ -timeout 180m
=== RUN   TestAccDataSourceAWSLBTargetGroup_basic
=== PAUSE TestAccDataSourceAWSLBTargetGroup_basic
=== RUN   TestAccDataSourceAWSLBTargetGroup_appCookie
=== PAUSE TestAccDataSourceAWSLBTargetGroup_appCookie
=== RUN   TestAccDataSourceAWSLBTargetGroup_BackwardsCompatibility
=== PAUSE TestAccDataSourceAWSLBTargetGroup_BackwardsCompatibility
=== CONT  TestAccDataSourceAWSLBTargetGroup_basic
=== CONT  TestAccDataSourceAWSLBTargetGroup_BackwardsCompatibility
=== CONT  TestAccDataSourceAWSLBTargetGroup_appCookie
--- PASS: TestAccDataSourceAWSLBTargetGroup_basic (194.71s)
--- PASS: TestAccDataSourceAWSLBTargetGroup_appCookie (205.75s)
--- PASS: TestAccDataSourceAWSLBTargetGroup_BackwardsCompatibility (235.50s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	235.555s

@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. service/elbv2 Issues and PRs that pertain to the elbv2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/L Managed by automation to categorize the size of a PR. labels Jun 24, 2021
@ewbankkit ewbankkit self-assigned this Jun 24, 2021
@ewbankkit
Copy link
Contributor

ewbankkit commented Jun 24, 2021

Test ended in panic.
------- Stdout: -------
=== RUN   TestAccDataSourceAWSLBTargetGroup_basic
=== PAUSE TestAccDataSourceAWSLBTargetGroup_basic
=== CONT  TestAccDataSourceAWSLBTargetGroup_basic
------- Stderr: -------
panic: Invalid address to set: []string{"stickiness", "0", "app_cookie"}
goroutine 828 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0xc00336f200, 0x847f3ac, 0xa, 0x6c12760, 0xc0025798f0, 0x1, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/resource_data.go:230 +0x371
github.com/terraform-providers/terraform-provider-aws/aws.dataSourceAwsLbTargetGroupRead(0xc00336f200, 0x7628940, 0xc0047e6600, 0xd460970, 0xd430b40)
  /opt/teamcity-agent/work/2e10e023da0c7520/src/github.com/terraform-providers/terraform-provider-aws/aws/data_source_aws_lb_target_group.go:248 +0x162e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0xc001457b20, 0x956bee8, 0xc0035a8280, 0xc00336f200, 0x7628940, 0xc0047e6600, 0x0, 0x0, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/resource.go:335 +0x1ee
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0xc001457b20, 0x956bee8, 0xc0035a8280, 0xc002958ba0, 0x7628940, 0xc0047e6600, 0xc0047e6600, 0xc002958ba0, 0x0, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/resource.go:558 +0xfd
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc0025d2a38, 0x956bee8, 0xc0035a8280, 0xc002958920, 0xc0035a8280, 0x40dba5, 0x7f80da0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.6.1/helper/schema/grpc_provider.go:1105 +0x4d6
github.com/hashicorp/terraform-plugin-go/tfprotov5/server.(*server).ReadDataSource(0xc0036036e0, 0x956bf90, 0xc0035a8280, 0xc000e0eff0, 0xc0036036e0, 0xc0021da4b0, 0xc003594ba0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.3.0/tfprotov5/server/server.go:247 +0xe5
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler(0x8260580, 0xc0036036e0, 0x956bf90, 0xc0021da4b0, 0xc00105bc20, 0x0, 0x956bf90, 0xc0021da4b0, 0xc00391c680, 0x193)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.3.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:416 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0027e5500, 0x95967f8, 0xc004146180, 0xc0036f3200, 0xc0024da450, 0xd3fd1d0, 0x0, 0x0, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc0027e5500, 0x95967f8, 0xc004146180, 0xc0036f3200, 0x0)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc001f3a020, 0xc0027e5500, 0x95967f8, 0xc004146180, 0xc0036f3200)
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:859 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
  /opt/teamcity-agent/work/2e10e023da0c7520/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:857 +0x1fd

Relates: #18102.

Comment on lines 1 to 2
```release-note:bug
data-source/aws_lb_target_group: Add cookie_name attribute for app_cookie support
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a bug before a release 😄.

Suggested change
```release-note:bug
data-source/aws_lb_target_group: Add cookie_name attribute for app_cookie support
```release-note:enhancement
data-source/aws_lb_target_group: Add `cookie_name` argument for application cookie stickiness

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 🚀.

Commercial
% make testacc TEST=./aws TESTARGS='-run=TestAccDataSourceAWSLBTargetGroup_basic\|TestAccAWSLBTargetGroup_updateAppSticknessEnabled\|TestAccAWSLBTargetGroup_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccDataSourceAWSLBTargetGroup_basic\|TestAccAWSLBTargetGroup_updateAppSticknessEnabled\|TestAccAWSLBTargetGroup_basic -timeout 180m
=== RUN   TestAccDataSourceAWSLBTargetGroup_basic
=== PAUSE TestAccDataSourceAWSLBTargetGroup_basic
=== RUN   TestAccAWSLBTargetGroup_basic
=== PAUSE TestAccAWSLBTargetGroup_basic
=== RUN   TestAccAWSLBTargetGroup_basicUdp
=== PAUSE TestAccAWSLBTargetGroup_basicUdp
=== RUN   TestAccAWSLBTargetGroup_updateAppSticknessEnabled
=== PAUSE TestAccAWSLBTargetGroup_updateAppSticknessEnabled
=== CONT  TestAccDataSourceAWSLBTargetGroup_basic
=== CONT  TestAccAWSLBTargetGroup_updateAppSticknessEnabled
=== CONT  TestAccAWSLBTargetGroup_basicUdp
=== CONT  TestAccAWSLBTargetGroup_basic
--- PASS: TestAccAWSLBTargetGroup_basicUdp (23.02s)
--- PASS: TestAccAWSLBTargetGroup_basic (23.05s)
--- PASS: TestAccAWSLBTargetGroup_updateAppSticknessEnabled (58.10s)
--- PASS: TestAccDataSourceAWSLBTargetGroup_basic (224.22s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	227.348s
GovCloud
%  make testacc TEST=./aws TESTARGS='-run=TestAccDataSourceAWSLBTargetGroup_basic\|TestAccAWSLBTargetGroup_updateAppSticknessEnabled\|TestAccAWSLBTargetGroup_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccDataSourceAWSLBTargetGroup_basic\|TestAccAWSLBTargetGroup_updateAppSticknessEnabled\|TestAccAWSLBTargetGroup_basic -timeout 180m
=== RUN   TestAccDataSourceAWSLBTargetGroup_basic
=== PAUSE TestAccDataSourceAWSLBTargetGroup_basic
=== RUN   TestAccAWSLBTargetGroup_basic
=== PAUSE TestAccAWSLBTargetGroup_basic
=== RUN   TestAccAWSLBTargetGroup_basicUdp
=== PAUSE TestAccAWSLBTargetGroup_basicUdp
=== RUN   TestAccAWSLBTargetGroup_updateAppSticknessEnabled
=== PAUSE TestAccAWSLBTargetGroup_updateAppSticknessEnabled
=== CONT  TestAccDataSourceAWSLBTargetGroup_basic
=== CONT  TestAccAWSLBTargetGroup_updateAppSticknessEnabled
=== CONT  TestAccAWSLBTargetGroup_basicUdp
=== CONT  TestAccAWSLBTargetGroup_basic
--- PASS: TestAccAWSLBTargetGroup_basic (24.13s)
--- PASS: TestAccAWSLBTargetGroup_basicUdp (24.18s)
--- PASS: TestAccAWSLBTargetGroup_updateAppSticknessEnabled (61.46s)
--- PASS: TestAccDataSourceAWSLBTargetGroup_basic (173.37s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	176.548s

@bill-rich bill-rich merged commit 5c83591 into main Jun 24, 2021
@bill-rich bill-rich deleted the b-ds_target_group_crash branch June 24, 2021 21:21
@github-actions github-actions bot added this to the v3.47.0 milestone Jun 24, 2021
github-actions bot pushed a commit that referenced this pull request Jun 24, 2021
@github-actions
Copy link

This functionality has been released in v3.47.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. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2021
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/elbv2 Issues and PRs that pertain to the elbv2 service. size/L 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.

2 participants