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

For Gateway Load Balancer, enable_cross_zone_load_balancing is always false, regardless of what value is chosen #16311

Closed
mabdelghany opened this issue Nov 19, 2020 · 4 comments · Fixed by #16314
Assignees
Labels
bug Addresses a defect in current functionality. service/elbv2 Issues and PRs that pertain to the elbv2 service.
Milestone

Comments

@mabdelghany
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue 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 issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform CLI: v0.13.5
AWS Provider Version: v3.15.0_x5

Affected Resource(s)

  • aws_lb

Terraform Configuration Files

resource "aws_lb" "gwlb" {
  name                             = "${var.prefix}-gateway-lb"
  load_balancer_type               = "gateway"
  subnets                          = var.subnet_ids
  enable_cross_zone_load_balancing = true
}

Deploying this using terraform apply works fine. When you check the gateway load balancer in the console, you will see that the cross zone load balancing is disabled.

Debug Output

I ran another terraform plan after my successful deployment and got this

resource "aws_lb" "gwlb" {
        arn                              = "arn:aws:elasticloadbalancing:us-east-1:xxxxxxxxxxxx:loadbalancer/gwy/xxxxxxxxxxxx-gateway-lb/xxxxxxxxxxxx"
        arn_suffix                       = "gwy/xxxxxxxxxxxx-gateway-lb/xxxxxxxxxxxx"
        drop_invalid_header_fields       = false
      ~ enable_cross_zone_load_balancing = false -> true
        enable_deletion_protection       = false
        enable_http2                     = true
        id                               = "arn:aws:elasticloadbalancing:us-east-1:xxxxxxxxxxxx:loadbalancer/gwy/xxxxxxxxxxxx-gateway-lb/xxxxxxxxxxxx"
        idle_timeout                     = 60
        internal                         = false
        load_balancer_type               = "gateway"
        name                             = "xxxxxxxxxxxx-gateway-lb"
        security_groups                  = []
        subnets                          = [
            "subnet-xxxxxxxxxxxx",
            "subnet-xxxxxxxxxxxx",
        ]
        tags                             = {
            "CreatedBy"   = "xxxxxxxxxxxx"
            "Environment" = "ProdNet"
            "Name"        = "xxxxxxxxxxxx-gateway-lb"
        }
        vpc_id                           = "vpc-xxxxxxxxxxxx"

        access_logs {
            enabled = false
        }

        subnet_mapping {
            subnet_id = "subnet-xxxxxxxxxxxx"
        }
        subnet_mapping {
            subnet_id = "subnet-xxxxxxxxxxxx"
        }
    }

Expected Behavior

The cross zone load balancing should be enabled

Actual Behavior

The cross zone load balancing is always disabled

Steps to Reproduce

  1. terraform apply
  2. terraform plan
@ghost ghost added the service/elbv2 Issues and PRs that pertain to the elbv2 service. label Nov 19, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 19, 2020
@bflad bflad added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 19, 2020
@bflad bflad self-assigned this Nov 19, 2020
bflad added a commit that referenced this issue Nov 19, 2020
…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
Copy link
Contributor

bflad commented Nov 19, 2020

Fix submitted: #16314

bflad added a commit that referenced this issue Nov 19, 2020
…ng with Gateway Load Balancers (#16314)

* resource/aws_lb: Fix enable_cross_zone_load_balancing argument handling 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)
```

* tests/resource/aws_lb: Add PreCheck for 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 bflad added this to the v3.17.0 milestone Nov 19, 2020
@bflad
Copy link
Contributor

bflad commented Nov 19, 2020

The fix for this has been merged and will release with version 3.17.0 of the Terraform AWS Provider, middle of next week. 👍

@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.
Projects
None yet
2 participants