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

resource/aws_lb: Fix enable_cross_zone_load_balancing argument handling with Gateway Load Balancers #16314

Merged
merged 2 commits into from
Nov 19, 2020

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Nov 19, 2020

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

Closes #16311

Release note for CHANGELOG:

* resource/aws_lb: Fix `enable_cross_zone_load_balancing` argument handling with Gateway Load Balancers

Previously:

=== CONT  TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing
    resource_aws_lb_test.go:202: Step 1/3 error: Check failed: 1 error occurred:
        	* Check 4/4 error: aws_lb.test: Attribute 'enable_cross_zone_load_balancing' expected "true", got "false"

--- FAIL: TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing (108.37s)

Output from acceptance testing:

--- PASS: TestAccAWSLB_ALB_AccessLogs (353.95s)
--- PASS: TestAccAWSLB_ALB_AccessLogs_Prefix (304.17s)
--- PASS: TestAccAWSLB_ALB_basic (179.02s)
--- PASS: TestAccAWSLB_applicationLoadBalancer_updateDeletionProtection (280.99s)
--- PASS: TestAccAWSLB_applicationLoadBalancer_updateDropInvalidHeaderFields (291.94s)
--- PASS: TestAccAWSLB_applicationLoadBalancer_updateHttp2 (336.62s)
--- PASS: TestAccAWSLB_BackwardsCompatibility (227.48s)
--- PASS: TestAccAWSLB_generatedName (218.44s)
--- PASS: TestAccAWSLB_generatesNameForZeroValue (168.08s)
--- PASS: TestAccAWSLB_LoadBalancerType_Gateway (106.07s)
--- PASS: TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing (156.75s)
--- PASS: TestAccAWSLB_namePrefix (163.49s)
--- PASS: TestAccAWSLB_networkLoadbalancer_subnet_change (234.08s)
--- PASS: TestAccAWSLB_networkLoadbalancer_updateCrossZone (313.68s)
--- PASS: TestAccAWSLB_networkLoadbalancerEIP (221.91s)
--- PASS: TestAccAWSLB_NLB_AccessLogs (404.54s)
--- PASS: TestAccAWSLB_NLB_AccessLogs_Prefix (359.52s)
--- PASS: TestAccAWSLB_NLB_basic (216.80s)
--- PASS: TestAccAWSLB_NLB_privateipv4address (228.17s)
--- PASS: TestAccAWSLB_noSecurityGroup (166.60s)
--- PASS: TestAccAWSLB_tags (328.23s)
--- PASS: TestAccAWSLB_updatedIpAddressType (241.45s)
--- PASS: TestAccAWSLB_updatedSecurityGroups (236.45s)
--- PASS: TestAccAWSLB_updatedSubnets (279.80s)
--- SKIP: TestAccAWSLB_ALB_outpost (2.65s)

…ng with Gateway Load Balancers

Reference: #16311

Previously:

```
=== CONT  TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing
    resource_aws_lb_test.go:202: Step 1/3 error: Check failed: 1 error occurred:
        	* Check 4/4 error: aws_lb.test: Attribute 'enable_cross_zone_load_balancing' expected "true", got "false"

--- FAIL: TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing (108.37s)
```

Output from acceptance testing:

```
--- PASS: TestAccAWSLB_ALB_AccessLogs (353.95s)
--- PASS: TestAccAWSLB_ALB_AccessLogs_Prefix (304.17s)
--- PASS: TestAccAWSLB_ALB_basic (179.02s)
--- PASS: TestAccAWSLB_applicationLoadBalancer_updateDeletionProtection (280.99s)
--- PASS: TestAccAWSLB_applicationLoadBalancer_updateDropInvalidHeaderFields (291.94s)
--- PASS: TestAccAWSLB_applicationLoadBalancer_updateHttp2 (336.62s)
--- PASS: TestAccAWSLB_BackwardsCompatibility (227.48s)
--- PASS: TestAccAWSLB_generatedName (218.44s)
--- PASS: TestAccAWSLB_generatesNameForZeroValue (168.08s)
--- PASS: TestAccAWSLB_LoadBalancerType_Gateway (106.07s)
--- PASS: TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing (156.75s)
--- PASS: TestAccAWSLB_namePrefix (163.49s)
--- PASS: TestAccAWSLB_networkLoadbalancer_subnet_change (234.08s)
--- PASS: TestAccAWSLB_networkLoadbalancer_updateCrossZone (313.68s)
--- PASS: TestAccAWSLB_networkLoadbalancerEIP (221.91s)
--- PASS: TestAccAWSLB_NLB_AccessLogs (404.54s)
--- PASS: TestAccAWSLB_NLB_AccessLogs_Prefix (359.52s)
--- PASS: TestAccAWSLB_NLB_basic (216.80s)
--- PASS: TestAccAWSLB_NLB_privateipv4address (228.17s)
--- PASS: TestAccAWSLB_noSecurityGroup (166.60s)
--- PASS: TestAccAWSLB_tags (328.23s)
--- PASS: TestAccAWSLB_updatedIpAddressType (241.45s)
--- PASS: TestAccAWSLB_updatedSecurityGroups (236.45s)
--- PASS: TestAccAWSLB_updatedSubnets (279.80s)
--- SKIP: TestAccAWSLB_ALB_outpost (2.65s)
```
@bflad bflad added the bug Addresses a defect in current functionality. label Nov 19, 2020
@bflad bflad requested a review from a team as a code owner November 19, 2020 15:01
@ghost ghost added size/M Managed by automation to categorize the size of a PR. service/elbv2 Issues and PRs that pertain to the elbv2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Nov 19, 2020
@YakDriver YakDriver self-assigned this Nov 19, 2020
@YakDriver
Copy link
Member

YakDriver commented Nov 19, 2020

Ut-oh. I'm getting failures on 0.12.29 and 0.13.5 on GovCloud.

    resource_aws_lb_test.go:170: Step 1/2 error: Error running apply: 2020/11/19 10:37:01 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0
        
        Error: error creating gateway Load Balancer: ValidationError: Type must be one of: 'application, network'
        	status code: 400, request id: 9158955e-0f09-4dcb-818e-4cdee0e077ee
        
--- FAIL: TestAccAWSLB_LoadBalancerType_Gateway (16.39s)

    resource_aws_lb_test.go:202: Step 1/3 error: Error running apply: 2020/11/19 10:37:16 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0
        
        Error: error creating gateway Load Balancer: ValidationError: Type must be one of: 'application, network'
        	status code: 400, request id: ee25ad05-3c71-418a-9044-cdb7a1d7c5ef
        
--- FAIL: TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing (16.07s)


--- SKIP: TestAccAWSLB_ALB_outpost (2.72s)
--- PASS: TestAccAWSLB_noSecurityGroup (176.18s)
--- PASS: TestAccAWSLB_generatesNameForZeroValue (178.97s)
--- PASS: TestAccAWSLB_BackwardsCompatibility (193.80s)
--- PASS: TestAccAWSLB_ALB_basic (206.21s)
--- PASS: TestAccAWSLB_NLB_privateipv4address (220.62s)
--- PASS: TestAccAWSLB_networkLoadbalancer_subnet_change (227.42s)
--- PASS: TestAccAWSLB_namePrefix (240.62s)
--- PASS: TestAccAWSLB_generatedName (247.21s)
--- PASS: TestAccAWSLB_updatedSecurityGroups (256.08s)
--- PASS: TestAccAWSLB_updatedSubnets (275.48s)
--- PASS: TestAccAWSLB_networkLoadbalancerEIP (281.96s)
--- PASS: TestAccAWSLB_applicationLoadBalancer_updateHttp2 (301.62s)
--- PASS: TestAccAWSLB_applicationLoadBalancer_updateDeletionProtection (302.86s)
--- PASS: TestAccAWSLB_tags (312.77s)
--- PASS: TestAccAWSLB_ALB_AccessLogs_Prefix (339.31s)
--- PASS: TestAccAWSLB_applicationLoadBalancer_updateDropInvalidHeaderFields (344.18s)
--- PASS: TestAccAWSLB_networkLoadbalancer_updateCrossZone (349.22s)
--- PASS: TestAccAWSLB_NLB_AccessLogs_Prefix (378.16s)
--- PASS: TestAccAWSLB_ALB_AccessLogs (404.20s)
--- PASS: TestAccAWSLB_NLB_basic (210.64s)
--- PASS: TestAccAWSLB_updatedIpAddressType (241.67s)
--- PASS: TestAccAWSLB_NLB_AccessLogs (462.02s)

@YakDriver
Copy link
Member

And, on 0.13.5 on commercial, it works fine:

--- PASS: TestAccAWSLB_LoadBalancerType_Gateway (110.97s)
--- PASS: TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing (161.94s)

Copy link
Member

@YakDriver YakDriver left a comment

Choose a reason for hiding this comment

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

If crozz zone is not possible on GovCloud, the test should skip. Not sure that's the izzue. In any case, consistently getting GovCloud failz:

--- FAIL: TestAccAWSLB_LoadBalancerType_Gateway (17.52s)
--- FAIL: TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing (17.86s)

@bflad
Copy link
Contributor Author

bflad commented Nov 19, 2020

This validation error is being returned by the API:

ValidationError: Type must be one of: 'application, network'
        	status code: 400, request id: 9158955e-0f09-4dcb-818e-4cdee0e077ee

Gateway Load Balancers are only supported in a few regions currently: https://aws.amazon.com/blogs/aws/introducing-aws-gateway-load-balancer-easy-deployment-scalability-and-high-availability-for-partner-appliances/

AWS Gateway Load Balancer is available in US East (N. Virginia), US West (Oregon), Europe (Ireland), South America (São Paulo), and Asia Pacific (Sydney) regions

It is a little clumsy, but we could do a PreCheck against the DescribeAccountLimits API to determine if the Gateway Load Balancer functionality is available in the region. Will follow up with that.

$ aws --region us-west-2 elbv2 describe-account-limits | jq '.Limits[] | select(.Name == "gateway-load-balancers")'
{
  "Name": "gateway-load-balancers",
  "Max": "20"
}
$ aws --region us-east-2 elbv2 describe-account-limits | jq '.Limits[] | select(.Name == "gateway-load-balancers")'
$ 
$ aws --region us-gov-west-1 elbv2 describe-account-limits | jq '.Limits[] | select(.Name == "gateway-load-balancers")'
$ 

Reference: #16314 (comment)

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSLB_LoadBalancerType_Gateway (109.15s)
--- PASS: TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing (159.02s)
```

Output from acceptance testing in AWS GovCloud (US):

```
--- SKIP: TestAccAWSLB_LoadBalancerType_Gateway (1.70s)
--- SKIP: TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing (1.70s)
```
@bflad
Copy link
Contributor Author

bflad commented Nov 19, 2020

Added.

Output from acceptance testing in AWS Commercial:

--- PASS: TestAccAWSLB_LoadBalancerType_Gateway (109.15s)
--- PASS: TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing (159.02s)

Output from acceptance testing in AWS GovCloud (US):

--- SKIP: TestAccAWSLB_LoadBalancerType_Gateway (1.70s)
--- SKIP: TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing (1.70s)

For followup, this new PreCheck will need to be added to a few other tests:

=== CONT  TestAccAWSLBTargetGroup_Protocol_Geneve
TestAccAWSLBTargetGroup_Protocol_Geneve: resource_aws_lb_target_group_test.go:279: Step 1/2 error: Error running apply: 2020/11/15 22:58:29 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0
Error: Error creating LB Target Group: ValidationError: Protocol 'GENEVE' must be one of 'TCP,UDP,TCP_UDP,HTTPS,HTTP,TLS'
  status code: 400, request id: f3dee3da-813e-4dd5-abe0-dc576416ffea
--- FAIL: TestAccAWSLBTargetGroup_Protocol_Geneve (5.56s)

=== CONT  TestAccAWSRouteTable_Route_VpcEndpointId
TestAccAWSRouteTable_Route_VpcEndpointId: resource_aws_route_table_test.go:401: Step 1/2 error: Error running apply: 2020/11/16 00:13:50 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0
Error: error creating gateway Load Balancer: ValidationError: Type must be one of: 'application, network'
  status code: 400, request id: f03000d2-fe4f-44df-92e1-16548ef5839d
--- FAIL: TestAccAWSRouteTable_Route_VpcEndpointId (11.38s)

=== CONT  TestAccAWSRoute_VpcEndpointId
TestAccAWSRoute_VpcEndpointId: resource_aws_route_test.go:510: Step 1/2 error: Error running apply: 2020/11/16 00:14:52 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0
Error: error creating gateway Load Balancer: ValidationError: Type must be one of: 'application, network'
  status code: 400, request id: 7de35b3e-4fb9-426a-b3b4-0bb6ea31ed76
--- FAIL: TestAccAWSRoute_VpcEndpointId (10.70s)

=== CONT  TestAccAWSVpcEndpointService_GatewayLoadBalancerArns
TestAccAWSVpcEndpointService_GatewayLoadBalancerArns: resource_aws_vpc_endpoint_service_test.go:186: Step 1/3 error: Error running apply: 2020/11/16 01:10:49 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0
Error: error creating gateway Load Balancer: ValidationError: Type must be one of: 'application, network'
  status code: 400, request id: 97efe2a9-e38f-47ff-b1be-a0d3642fa904
--- FAIL: TestAccAWSVpcEndpointService_GatewayLoadBalancerArns (4.42s)

=== CONT  TestAccAWSVpcEndpoint_VpcEndpointType_GatewayLoadBalancer
TestAccAWSVpcEndpoint_VpcEndpointType_GatewayLoadBalancer: resource_aws_vpc_endpoint_test.go:513: Step 1/2 error: Error running apply: 2020/11/16 01:13:43 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0
Error: error creating gateway Load Balancer: ValidationError: Type must be one of: 'application, network'
  status code: 400, request id: 5371a071-43c6-4976-9b42-9f62cf3d2461
--- FAIL: TestAccAWSVpcEndpoint_VpcEndpointType_GatewayLoadBalancer (6.44s)

@YakDriver
Copy link
Member

YakDriver commented Nov 19, 2020

I added #16322 for follow-up on those tests.

Copy link
Member

@YakDriver YakDriver left a comment

Choose a reason for hiding this comment

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

Looks great 💯

GovCloud:

--- SKIP: TestAccAWSLB_LoadBalancerType_Gateway (2.05s)
--- SKIP: TestAccAWSLB_LoadBalancerType_Gateway_EnableCrossZoneLoadBalancing (2.05s)

@bflad bflad added this to the v3.17.0 milestone Nov 19, 2020
@bflad bflad merged commit 347ef58 into master Nov 19, 2020
@bflad bflad deleted the b-aws_lb-gateway-cross-zone branch November 19, 2020 19:01
bflad added a commit that referenced this pull request Nov 19, 2020
@ghost
Copy link

ghost commented Nov 24, 2020

This has been released in version 3.17.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 Dec 20, 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 as resolved and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/elbv2 Issues and PRs that pertain to the elbv2 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
2 participants