From 91d4c37a418974536189a04c53308cba828deb70 Mon Sep 17 00:00:00 2001 From: Ilia Lazebnik Date: Thu, 2 Jan 2020 22:10:32 +0200 Subject: [PATCH] service/elbv2: Refactor to use keyvaluetags package and SDK enums, add plan-time validation (#11419) Output from acceptance testing: ``` --- PASS: TestAccAWSLB_ALB_AccessLogs (290.82s) --- PASS: TestAccAWSLB_ALB_AccessLogs_Prefix (234.28s) --- PASS: TestAccAWSLB_ALB_basic (183.55s) --- PASS: TestAccAWSLB_applicationLoadBalancer_updateDeletionProtection (267.31s) --- PASS: TestAccAWSLB_applicationLoadBalancer_updateHttp2 (237.66s) --- PASS: TestAccAWSLB_generatedName (208.78s) --- PASS: TestAccAWSLB_generatesNameForZeroValue (196.87s) --- PASS: TestAccAWSLB_namePrefix (193.50s) --- PASS: TestAccAWSLB_networkLoadbalancer_subnet_change (216.71s) --- PASS: TestAccAWSLB_networkLoadbalancer_updateCrossZone (325.01s) --- PASS: TestAccAWSLB_networkLoadbalancerEIP (245.80s) --- PASS: TestAccAWSLB_NLB_AccessLogs (331.75s) --- PASS: TestAccAWSLB_NLB_AccessLogs_Prefix (275.50s) --- PASS: TestAccAWSLB_NLB_basic (211.14s) --- PASS: TestAccAWSLB_noSecurityGroup (266.95s) --- PASS: TestAccAWSLB_tags (258.93s) --- PASS: TestAccAWSLB_updatedIpAddressType (215.52s) --- PASS: TestAccAWSLB_updatedSecurityGroups (227.98s) --- PASS: TestAccAWSLBBackwardsCompatibility (175.67s) --- PASS: TestAccDataSourceAWSLB_basic (173.24s) --- PASS: TestAccDataSourceAWSLBBackwardsCompatibility (252.83s) ``` --- aws/data_source_aws_lb_test.go | 101 +++++++------- aws/resource_aws_lb.go | 54 +++++--- aws/resource_aws_lb_test.go | 240 ++++++++++++++++++--------------- 3 files changed, 215 insertions(+), 180 deletions(-) diff --git a/aws/data_source_aws_lb_test.go b/aws/data_source_aws_lb_test.go index 34df27e70e3..425d73add2f 100644 --- a/aws/data_source_aws_lb_test.go +++ b/aws/data_source_aws_lb_test.go @@ -10,6 +10,8 @@ import ( func TestAccDataSourceAWSLB_basic(t *testing.T) { lbName := fmt.Sprintf("testaccawslb-basic-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + dataSourceName := "data.aws_lb.alb_test_with_arn" + dataSourceName2 := "data.aws_lb.alb_test_with_name" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -18,30 +20,30 @@ func TestAccDataSourceAWSLB_basic(t *testing.T) { { Config: testAccDataSourceAWSLBConfigBasic(lbName), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_arn", "name", lbName), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_arn", "internal", "true"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_arn", "subnets.#", "2"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_arn", "security_groups.#", "1"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_arn", "tags.%", "1"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_arn", "tags.TestName", "TestAccAWSALB_basic"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_arn", "enable_deletion_protection", "false"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_arn", "idle_timeout", "30"), - resource.TestCheckResourceAttrSet("data.aws_lb.alb_test_with_arn", "vpc_id"), - resource.TestCheckResourceAttrSet("data.aws_lb.alb_test_with_arn", "zone_id"), - resource.TestCheckResourceAttrSet("data.aws_lb.alb_test_with_arn", "dns_name"), - resource.TestCheckResourceAttrSet("data.aws_lb.alb_test_with_arn", "arn"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_name", "name", lbName), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_name", "internal", "true"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_name", "subnets.#", "2"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_name", "security_groups.#", "1"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_name", "tags.%", "1"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_name", "tags.TestName", "TestAccAWSALB_basic"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_name", "enable_deletion_protection", "false"), - resource.TestCheckResourceAttr("data.aws_lb.alb_test_with_name", "idle_timeout", "30"), - resource.TestCheckResourceAttrSet("data.aws_lb.alb_test_with_name", "vpc_id"), - resource.TestCheckResourceAttrSet("data.aws_lb.alb_test_with_name", "zone_id"), - resource.TestCheckResourceAttrSet("data.aws_lb.alb_test_with_name", "dns_name"), - resource.TestCheckResourceAttrSet("data.aws_lb.alb_test_with_name", "arn"), + resource.TestCheckResourceAttr(dataSourceName, "name", lbName), + resource.TestCheckResourceAttr(dataSourceName, "internal", "true"), + resource.TestCheckResourceAttr(dataSourceName, "subnets.#", "2"), + resource.TestCheckResourceAttr(dataSourceName, "security_groups.#", "1"), + resource.TestCheckResourceAttr(dataSourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(dataSourceName, "tags.TestName", "TestAccAWSALB_basic"), + resource.TestCheckResourceAttr(dataSourceName, "enable_deletion_protection", "false"), + resource.TestCheckResourceAttr(dataSourceName, "idle_timeout", "30"), + resource.TestCheckResourceAttrSet(dataSourceName, "vpc_id"), + resource.TestCheckResourceAttrSet(dataSourceName, "zone_id"), + resource.TestCheckResourceAttrSet(dataSourceName, "dns_name"), + resource.TestCheckResourceAttrSet(dataSourceName, "arn"), + resource.TestCheckResourceAttr(dataSourceName2, "name", lbName), + resource.TestCheckResourceAttr(dataSourceName2, "internal", "true"), + resource.TestCheckResourceAttr(dataSourceName2, "subnets.#", "2"), + resource.TestCheckResourceAttr(dataSourceName2, "security_groups.#", "1"), + resource.TestCheckResourceAttr(dataSourceName2, "tags.%", "1"), + resource.TestCheckResourceAttr(dataSourceName2, "tags.TestName", "TestAccAWSALB_basic"), + resource.TestCheckResourceAttr(dataSourceName2, "enable_deletion_protection", "false"), + resource.TestCheckResourceAttr(dataSourceName2, "idle_timeout", "30"), + resource.TestCheckResourceAttrSet(dataSourceName2, "vpc_id"), + resource.TestCheckResourceAttrSet(dataSourceName2, "zone_id"), + resource.TestCheckResourceAttrSet(dataSourceName2, "dns_name"), + resource.TestCheckResourceAttrSet(dataSourceName2, "arn"), ), }, }, @@ -50,7 +52,8 @@ func TestAccDataSourceAWSLB_basic(t *testing.T) { func TestAccDataSourceAWSLBBackwardsCompatibility(t *testing.T) { lbName := fmt.Sprintf("testaccawsalb-basic-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) - + dataSourceName1 := "data.aws_alb.alb_test_with_arn" + dataSourceName2 := "data.aws_alb.alb_test_with_name" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, @@ -58,30 +61,30 @@ func TestAccDataSourceAWSLBBackwardsCompatibility(t *testing.T) { { Config: testAccDataSourceAWSLBConfigBackardsCompatibility(lbName), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "name", lbName), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "internal", "true"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "subnets.#", "2"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "security_groups.#", "1"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "tags.%", "1"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "tags.TestName", "TestAccAWSALB_basic"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "enable_deletion_protection", "false"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "idle_timeout", "30"), - resource.TestCheckResourceAttrSet("data.aws_alb.alb_test_with_arn", "vpc_id"), - resource.TestCheckResourceAttrSet("data.aws_alb.alb_test_with_arn", "zone_id"), - resource.TestCheckResourceAttrSet("data.aws_alb.alb_test_with_arn", "dns_name"), - resource.TestCheckResourceAttrSet("data.aws_alb.alb_test_with_arn", "arn"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "name", lbName), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "internal", "true"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "subnets.#", "2"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "security_groups.#", "1"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "tags.%", "1"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "tags.TestName", "TestAccAWSALB_basic"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "enable_deletion_protection", "false"), - resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "idle_timeout", "30"), - resource.TestCheckResourceAttrSet("data.aws_alb.alb_test_with_name", "vpc_id"), - resource.TestCheckResourceAttrSet("data.aws_alb.alb_test_with_name", "zone_id"), - resource.TestCheckResourceAttrSet("data.aws_alb.alb_test_with_name", "dns_name"), - resource.TestCheckResourceAttrSet("data.aws_alb.alb_test_with_name", "arn"), + resource.TestCheckResourceAttr(dataSourceName1, "name", lbName), + resource.TestCheckResourceAttr(dataSourceName1, "internal", "true"), + resource.TestCheckResourceAttr(dataSourceName1, "subnets.#", "2"), + resource.TestCheckResourceAttr(dataSourceName1, "security_groups.#", "1"), + resource.TestCheckResourceAttr(dataSourceName1, "tags.%", "1"), + resource.TestCheckResourceAttr(dataSourceName1, "tags.TestName", "TestAccAWSALB_basic"), + resource.TestCheckResourceAttr(dataSourceName1, "enable_deletion_protection", "false"), + resource.TestCheckResourceAttr(dataSourceName1, "idle_timeout", "30"), + resource.TestCheckResourceAttrSet(dataSourceName1, "vpc_id"), + resource.TestCheckResourceAttrSet(dataSourceName1, "zone_id"), + resource.TestCheckResourceAttrSet(dataSourceName1, "dns_name"), + resource.TestCheckResourceAttrSet(dataSourceName1, "arn"), + resource.TestCheckResourceAttr(dataSourceName2, "name", lbName), + resource.TestCheckResourceAttr(dataSourceName2, "internal", "true"), + resource.TestCheckResourceAttr(dataSourceName2, "subnets.#", "2"), + resource.TestCheckResourceAttr(dataSourceName2, "security_groups.#", "1"), + resource.TestCheckResourceAttr(dataSourceName2, "tags.%", "1"), + resource.TestCheckResourceAttr(dataSourceName2, "tags.TestName", "TestAccAWSALB_basic"), + resource.TestCheckResourceAttr(dataSourceName2, "enable_deletion_protection", "false"), + resource.TestCheckResourceAttr(dataSourceName2, "idle_timeout", "30"), + resource.TestCheckResourceAttrSet(dataSourceName2, "vpc_id"), + resource.TestCheckResourceAttrSet(dataSourceName2, "zone_id"), + resource.TestCheckResourceAttrSet(dataSourceName2, "dns_name"), + resource.TestCheckResourceAttrSet(dataSourceName2, "arn"), ), }, }, diff --git a/aws/resource_aws_lb.go b/aws/resource_aws_lb.go index 326eed79168..ab1e84bf2f8 100644 --- a/aws/resource_aws_lb.go +++ b/aws/resource_aws_lb.go @@ -14,6 +14,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/hashcode" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" ) func resourceAwsLb() *schema.Resource { @@ -73,7 +75,11 @@ func resourceAwsLb() *schema.Resource { Type: schema.TypeString, ForceNew: true, Optional: true, - Default: "application", + Default: elbv2.LoadBalancerTypeEnumApplication, + ValidateFunc: validation.StringInSlice([]string{ + elbv2.LoadBalancerTypeEnumApplication, + elbv2.LoadBalancerTypeEnumNetwork, + }, false), }, "security_groups": { @@ -162,27 +168,31 @@ func resourceAwsLb() *schema.Resource { Type: schema.TypeInt, Optional: true, Default: 60, - DiffSuppressFunc: suppressIfLBType("network"), + DiffSuppressFunc: suppressIfLBType(elbv2.LoadBalancerTypeEnumNetwork), }, "enable_cross_zone_load_balancing": { Type: schema.TypeBool, Optional: true, Default: false, - DiffSuppressFunc: suppressIfLBType("application"), + DiffSuppressFunc: suppressIfLBType(elbv2.LoadBalancerTypeEnumApplication), }, "enable_http2": { Type: schema.TypeBool, Optional: true, Default: true, - DiffSuppressFunc: suppressIfLBType("network"), + DiffSuppressFunc: suppressIfLBType(elbv2.LoadBalancerTypeEnumNetwork), }, "ip_address_type": { Type: schema.TypeString, Computed: true, Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + elbv2.IpAddressTypeIpv4, + elbv2.IpAddressTypeDualstack, + }, false), }, "vpc_id": { @@ -213,6 +223,7 @@ func suppressIfLBType(t string) schema.SchemaDiffSuppressFunc { func resourceAwsLbCreate(d *schema.ResourceData, meta interface{}) error { elbconn := meta.(*AWSClient).elbv2conn + tags := keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().Elbv2Tags() var name string if v, ok := d.GetOk("name"); ok { @@ -227,7 +238,10 @@ func resourceAwsLbCreate(d *schema.ResourceData, meta interface{}) error { elbOpts := &elbv2.CreateLoadBalancerInput{ Name: aws.String(name), Type: aws.String(d.Get("load_balancer_type").(string)), - Tags: tagsFromMapELBv2(d.Get("tags").(map[string]interface{})), + } + + if len(tags) > 0 { + elbOpts.Tags = tags } if scheme, ok := d.GetOk("internal"); ok && scheme.(bool) { @@ -338,9 +352,11 @@ func resourceAwsLbRead(d *schema.ResourceData, meta interface{}) error { func resourceAwsLbUpdate(d *schema.ResourceData, meta interface{}) error { elbconn := meta.(*AWSClient).elbv2conn - if !d.IsNewResource() { - if err := setElbV2Tags(elbconn, d); err != nil { - return fmt.Errorf("Error Modifying Tags on ALB: %s", err) + if d.HasChange("tags") { + o, n := d.GetChange("tags") + + if err := keyvaluetags.Elbv2UpdateTags(elbconn, d.Id(), o, n); err != nil { + return fmt.Errorf("error updating ALB (%s) tags: %s", d.Id(), err) } } @@ -379,7 +395,7 @@ func resourceAwsLbUpdate(d *schema.ResourceData, meta interface{}) error { } switch d.Get("load_balancer_type").(string) { - case "application": + case elbv2.LoadBalancerTypeEnumApplication: if d.HasChange("idle_timeout") || d.IsNewResource() { attributes = append(attributes, &elbv2.LoadBalancerAttribute{ Key: aws.String("idle_timeout.timeout_seconds"), @@ -392,7 +408,7 @@ func resourceAwsLbUpdate(d *schema.ResourceData, meta interface{}) error { Value: aws.String(strconv.FormatBool(d.Get("enable_http2").(bool))), }) } - case "network": + case elbv2.LoadBalancerTypeEnumNetwork: if d.HasChange("enable_cross_zone_load_balancing") || d.IsNewResource() { attributes = append(attributes, &elbv2.LoadBalancerAttribute{ Key: aws.String("load_balancing.cross_zone.enabled"), @@ -702,20 +718,14 @@ func flattenAwsLbResource(d *schema.ResourceData, meta interface{}, lb *elbv2.Lo return fmt.Errorf("error setting subnet_mapping: %s", err) } - respTags, err := elbconn.DescribeTags(&elbv2.DescribeTagsInput{ - ResourceArns: []*string{lb.LoadBalancerArn}, - }) - if err != nil { - return fmt.Errorf("Error retrieving LB Tags: %s", err) - } + tags, err := keyvaluetags.Elbv2ListTags(elbconn, d.Id()) - var et []*elbv2.Tag - if len(respTags.TagDescriptions) > 0 { - et = respTags.TagDescriptions[0].Tags + if err != nil { + return fmt.Errorf("error listing tags for (%s): %s", d.Id(), err) } - if err := d.Set("tags", tagsToMapELBv2(et)); err != nil { - log.Printf("[WARN] Error setting tags for AWS LB (%s): %s", d.Id(), err) + if err := d.Set("tags", tags.IgnoreAws().Map()); err != nil { + return fmt.Errorf("error setting tags: %s", err) } attributesResp, err := elbconn.DescribeLoadBalancerAttributes(&elbv2.DescribeLoadBalancerAttributesInput{ @@ -782,7 +792,7 @@ func customizeDiffNLBSubnets(diff *schema.ResourceDiff, v interface{}) error { // Application Load Balancers, so the logic below is simple individual checks. // If other differences arise we'll want to refactor to check other // conditions in combinations, but for now all we handle is subnets - if lbType := diff.Get("load_balancer_type").(string); lbType != "network" { + if lbType := diff.Get("load_balancer_type").(string); lbType != elbv2.LoadBalancerTypeEnumNetwork { return nil } diff --git a/aws/resource_aws_lb_test.go b/aws/resource_aws_lb_test.go index 61d8da6d6c2..acd8b826557 100644 --- a/aws/resource_aws_lb_test.go +++ b/aws/resource_aws_lb_test.go @@ -164,6 +164,7 @@ func TestAccAWSLB_NLB_basic(t *testing.T) { func TestAccAWSLB_networkLoadbalancerEIP(t *testing.T) { var conf elbv2.LoadBalancer + resourceName := "aws_lb.lb_test" lbName := fmt.Sprintf("testaccawslb-basic-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) resource.ParallelTest(t, resource.TestCase{ @@ -174,16 +175,16 @@ func TestAccAWSLB_networkLoadbalancerEIP(t *testing.T) { { Config: testAccAWSLBConfig_networkLoadBalancerEIP(lbName), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &conf), - resource.TestCheckResourceAttr("aws_lb.lb_test", "name", lbName), - resource.TestCheckResourceAttr("aws_lb.lb_test", "internal", "false"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "ip_address_type", "ipv4"), - resource.TestCheckResourceAttrSet("aws_lb.lb_test", "zone_id"), - resource.TestCheckResourceAttrSet("aws_lb.lb_test", "dns_name"), - resource.TestCheckResourceAttrSet("aws_lb.lb_test", "arn"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "load_balancer_type", "network"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "enable_deletion_protection", "false"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "subnet_mapping.#", "2"), + testAccCheckAWSLBExists(resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "name", lbName), + resource.TestCheckResourceAttr(resourceName, "internal", "false"), + resource.TestCheckResourceAttr(resourceName, "ip_address_type", "ipv4"), + resource.TestCheckResourceAttrSet(resourceName, "zone_id"), + resource.TestCheckResourceAttrSet(resourceName, "dns_name"), + resource.TestCheckResourceAttrSet(resourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "load_balancer_type", "network"), + resource.TestCheckResourceAttr(resourceName, "enable_deletion_protection", "false"), + resource.TestCheckResourceAttr(resourceName, "subnet_mapping.#", "2"), ), }, }, @@ -193,31 +194,32 @@ func TestAccAWSLB_networkLoadbalancerEIP(t *testing.T) { func TestAccAWSLBBackwardsCompatibility(t *testing.T) { var conf elbv2.LoadBalancer lbName := fmt.Sprintf("testaccawslb-basic-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + resourceName := "aws_alb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_alb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfigBackwardsCompatibility(lbName), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_alb.lb_test", &conf), - resource.TestCheckResourceAttr("aws_alb.lb_test", "name", lbName), - resource.TestCheckResourceAttr("aws_alb.lb_test", "internal", "true"), - resource.TestCheckResourceAttr("aws_alb.lb_test", "subnets.#", "2"), - resource.TestCheckResourceAttr("aws_alb.lb_test", "security_groups.#", "1"), - resource.TestCheckResourceAttr("aws_alb.lb_test", "tags.%", "1"), - resource.TestCheckResourceAttr("aws_alb.lb_test", "tags.Name", "TestAccAWSALB_basic"), - resource.TestCheckResourceAttr("aws_alb.lb_test", "enable_deletion_protection", "false"), - resource.TestCheckResourceAttr("aws_alb.lb_test", "idle_timeout", "30"), - resource.TestCheckResourceAttr("aws_alb.lb_test", "ip_address_type", "ipv4"), - resource.TestCheckResourceAttr("aws_alb.lb_test", "load_balancer_type", "application"), - resource.TestCheckResourceAttrSet("aws_alb.lb_test", "vpc_id"), - resource.TestCheckResourceAttrSet("aws_alb.lb_test", "zone_id"), - resource.TestCheckResourceAttrSet("aws_alb.lb_test", "dns_name"), - resource.TestCheckResourceAttrSet("aws_alb.lb_test", "arn"), + testAccCheckAWSLBExists(resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "name", lbName), + resource.TestCheckResourceAttr(resourceName, "internal", "true"), + resource.TestCheckResourceAttr(resourceName, "subnets.#", "2"), + resource.TestCheckResourceAttr(resourceName, "security_groups.#", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", "TestAccAWSALB_basic"), + resource.TestCheckResourceAttr(resourceName, "enable_deletion_protection", "false"), + resource.TestCheckResourceAttr(resourceName, "idle_timeout", "30"), + resource.TestCheckResourceAttr(resourceName, "ip_address_type", "ipv4"), + resource.TestCheckResourceAttr(resourceName, "load_balancer_type", "application"), + resource.TestCheckResourceAttrSet(resourceName, "vpc_id"), + resource.TestCheckResourceAttrSet(resourceName, "zone_id"), + resource.TestCheckResourceAttrSet(resourceName, "dns_name"), + resource.TestCheckResourceAttrSet(resourceName, "arn"), ), }, }, @@ -226,18 +228,19 @@ func TestAccAWSLBBackwardsCompatibility(t *testing.T) { func TestAccAWSLB_generatedName(t *testing.T) { var conf elbv2.LoadBalancer + resourceName := "aws_lb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_lb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfig_generatedName(), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &conf), - resource.TestCheckResourceAttrSet("aws_lb.lb_test", "name"), + testAccCheckAWSLBExists(resourceName, &conf), + resource.TestCheckResourceAttrSet(resourceName, "name"), ), }, }, @@ -246,18 +249,19 @@ func TestAccAWSLB_generatedName(t *testing.T) { func TestAccAWSLB_generatesNameForZeroValue(t *testing.T) { var conf elbv2.LoadBalancer + resourceName := "aws_lb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_lb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfig_zeroValueName(), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &conf), - resource.TestCheckResourceAttrSet("aws_lb.lb_test", "name"), + testAccCheckAWSLBExists(resourceName, &conf), + resource.TestCheckResourceAttrSet(resourceName, "name"), ), }, }, @@ -266,19 +270,20 @@ func TestAccAWSLB_generatesNameForZeroValue(t *testing.T) { func TestAccAWSLB_namePrefix(t *testing.T) { var conf elbv2.LoadBalancer + resourceName := "aws_lb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_lb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfig_namePrefix(), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &conf), - resource.TestCheckResourceAttrSet("aws_lb.lb_test", "name"), - resource.TestMatchResourceAttr("aws_lb.lb_test", "name", + testAccCheckAWSLBExists(resourceName, &conf), + resource.TestCheckResourceAttrSet(resourceName, "name"), + resource.TestMatchResourceAttr(resourceName, "name", regexp.MustCompile("^tf-lb-")), ), }, @@ -289,28 +294,37 @@ func TestAccAWSLB_namePrefix(t *testing.T) { func TestAccAWSLB_tags(t *testing.T) { var conf elbv2.LoadBalancer lbName := fmt.Sprintf("testaccawslb-basic-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + resourceName := "aws_lb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_lb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfig_basic(lbName), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &conf), - resource.TestCheckResourceAttr("aws_lb.lb_test", "tags.%", "1"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "tags.Name", "TestAccAWSALB_basic"), + testAccCheckAWSLBExists(resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", "TestAccAWSALB_basic"), ), }, { Config: testAccAWSLBConfig_updatedTags(lbName), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &conf), - resource.TestCheckResourceAttr("aws_lb.lb_test", "tags.%", "2"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "tags.Type", "Sample Type Tag"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "tags.Environment", "Production"), + testAccCheckAWSLBExists(resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.Type", "Sample Type Tag"), + resource.TestCheckResourceAttr(resourceName, "tags.Environment", "Production"), + ), + }, + { + Config: testAccAWSLBConfig_basic(lbName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSLBExists(resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", "TestAccAWSALB_basic"), ), }, }, @@ -320,36 +334,37 @@ func TestAccAWSLB_tags(t *testing.T) { func TestAccAWSLB_networkLoadbalancer_updateCrossZone(t *testing.T) { var pre, mid, post elbv2.LoadBalancer lbName := fmt.Sprintf("testaccawslb-nlbcz-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + resourceName := "aws_lb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_lb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfig_networkLoadbalancer(lbName, true), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &pre), - testAccCheckAWSLBAttribute("aws_lb.lb_test", "load_balancing.cross_zone.enabled", "true"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "enable_cross_zone_load_balancing", "true"), + testAccCheckAWSLBExists(resourceName, &pre), + testAccCheckAWSLBAttribute(resourceName, "load_balancing.cross_zone.enabled", "true"), + resource.TestCheckResourceAttr(resourceName, "enable_cross_zone_load_balancing", "true"), ), }, { Config: testAccAWSLBConfig_networkLoadbalancer(lbName, false), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &mid), - testAccCheckAWSLBAttribute("aws_lb.lb_test", "load_balancing.cross_zone.enabled", "false"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "enable_cross_zone_load_balancing", "false"), + testAccCheckAWSLBExists(resourceName, &mid), + testAccCheckAWSLBAttribute(resourceName, "load_balancing.cross_zone.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "enable_cross_zone_load_balancing", "false"), testAccCheckAWSlbARNs(&pre, &mid), ), }, { Config: testAccAWSLBConfig_networkLoadbalancer(lbName, true), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &post), - testAccCheckAWSLBAttribute("aws_lb.lb_test", "load_balancing.cross_zone.enabled", "true"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "enable_cross_zone_load_balancing", "true"), + testAccCheckAWSLBExists(resourceName, &post), + testAccCheckAWSLBAttribute(resourceName, "load_balancing.cross_zone.enabled", "true"), + resource.TestCheckResourceAttr(resourceName, "enable_cross_zone_load_balancing", "true"), testAccCheckAWSlbARNs(&mid, &post), ), }, @@ -360,36 +375,37 @@ func TestAccAWSLB_networkLoadbalancer_updateCrossZone(t *testing.T) { func TestAccAWSLB_applicationLoadBalancer_updateHttp2(t *testing.T) { var pre, mid, post elbv2.LoadBalancer lbName := fmt.Sprintf("testaccawsalb-http2-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + resourceName := "aws_lb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_lb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfig_enableHttp2(lbName, false), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &pre), - testAccCheckAWSLBAttribute("aws_lb.lb_test", "routing.http2.enabled", "false"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "enable_http2", "false"), + testAccCheckAWSLBExists(resourceName, &pre), + testAccCheckAWSLBAttribute(resourceName, "routing.http2.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "enable_http2", "false"), ), }, { Config: testAccAWSLBConfig_enableHttp2(lbName, true), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &mid), - testAccCheckAWSLBAttribute("aws_lb.lb_test", "routing.http2.enabled", "true"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "enable_http2", "true"), + testAccCheckAWSLBExists(resourceName, &mid), + testAccCheckAWSLBAttribute(resourceName, "routing.http2.enabled", "true"), + resource.TestCheckResourceAttr(resourceName, "enable_http2", "true"), testAccCheckAWSlbARNs(&pre, &mid), ), }, { Config: testAccAWSLBConfig_enableHttp2(lbName, false), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &post), - testAccCheckAWSLBAttribute("aws_lb.lb_test", "routing.http2.enabled", "false"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "enable_http2", "false"), + testAccCheckAWSLBExists(resourceName, &post), + testAccCheckAWSLBAttribute(resourceName, "routing.http2.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "enable_http2", "false"), testAccCheckAWSlbARNs(&mid, &post), ), }, @@ -400,36 +416,37 @@ func TestAccAWSLB_applicationLoadBalancer_updateHttp2(t *testing.T) { func TestAccAWSLB_applicationLoadBalancer_updateDeletionProtection(t *testing.T) { var pre, mid, post elbv2.LoadBalancer lbName := fmt.Sprintf("testaccawsalb-basic-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + resourceName := "aws_lb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_lb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfig_enableDeletionProtection(lbName, false), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &pre), - testAccCheckAWSLBAttribute("aws_lb.lb_test", "deletion_protection.enabled", "false"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "enable_deletion_protection", "false"), + testAccCheckAWSLBExists(resourceName, &pre), + testAccCheckAWSLBAttribute(resourceName, "deletion_protection.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "enable_deletion_protection", "false"), ), }, { Config: testAccAWSLBConfig_enableDeletionProtection(lbName, true), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &mid), - testAccCheckAWSLBAttribute("aws_lb.lb_test", "deletion_protection.enabled", "true"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "enable_deletion_protection", "true"), + testAccCheckAWSLBExists(resourceName, &mid), + testAccCheckAWSLBAttribute(resourceName, "deletion_protection.enabled", "true"), + resource.TestCheckResourceAttr(resourceName, "enable_deletion_protection", "true"), testAccCheckAWSlbARNs(&pre, &mid), ), }, { Config: testAccAWSLBConfig_enableDeletionProtection(lbName, false), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &post), - testAccCheckAWSLBAttribute("aws_lb.lb_test", "deletion_protection.enabled", "false"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "enable_deletion_protection", "false"), + testAccCheckAWSLBExists(resourceName, &post), + testAccCheckAWSLBAttribute(resourceName, "deletion_protection.enabled", "false"), + resource.TestCheckResourceAttr(resourceName, "enable_deletion_protection", "false"), testAccCheckAWSlbARNs(&mid, &post), ), }, @@ -440,25 +457,26 @@ func TestAccAWSLB_applicationLoadBalancer_updateDeletionProtection(t *testing.T) func TestAccAWSLB_updatedSecurityGroups(t *testing.T) { var pre, post elbv2.LoadBalancer lbName := fmt.Sprintf("testaccawslb-basic-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + resourceName := "aws_lb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_lb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfig_basic(lbName), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &pre), - resource.TestCheckResourceAttr("aws_lb.lb_test", "security_groups.#", "1"), + testAccCheckAWSLBExists(resourceName, &pre), + resource.TestCheckResourceAttr(resourceName, "security_groups.#", "1"), ), }, { Config: testAccAWSLBConfig_updateSecurityGroups(lbName), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &post), - resource.TestCheckResourceAttr("aws_lb.lb_test", "security_groups.#", "2"), + testAccCheckAWSLBExists(resourceName, &post), + resource.TestCheckResourceAttr(resourceName, "security_groups.#", "2"), testAccCheckAWSlbARNs(&pre, &post), ), }, @@ -469,25 +487,26 @@ func TestAccAWSLB_updatedSecurityGroups(t *testing.T) { func TestAccAWSLB_updatedSubnets(t *testing.T) { var pre, post elbv2.LoadBalancer lbName := fmt.Sprintf("testaccawslb-basic-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + resourceName := "aws_lb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_lb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfig_basic(lbName), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &pre), - resource.TestCheckResourceAttr("aws_lb.lb_test", "subnets.#", "2"), + testAccCheckAWSLBExists(resourceName, &pre), + resource.TestCheckResourceAttr(resourceName, "subnets.#", "2"), ), }, { Config: testAccAWSLBConfig_updateSubnets(lbName), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &post), - resource.TestCheckResourceAttr("aws_lb.lb_test", "subnets.#", "3"), + testAccCheckAWSLBExists(resourceName, &post), + resource.TestCheckResourceAttr(resourceName, "subnets.#", "3"), testAccCheckAWSlbARNs(&pre, &post), ), }, @@ -498,25 +517,26 @@ func TestAccAWSLB_updatedSubnets(t *testing.T) { func TestAccAWSLB_updatedIpAddressType(t *testing.T) { var pre, post elbv2.LoadBalancer lbName := fmt.Sprintf("testaccawslb-basic-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + resourceName := "aws_lb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_lb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfigWithIpAddressType(lbName), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &pre), - resource.TestCheckResourceAttr("aws_lb.lb_test", "ip_address_type", "ipv4"), + testAccCheckAWSLBExists(resourceName, &pre), + resource.TestCheckResourceAttr(resourceName, "ip_address_type", "ipv4"), ), }, { Config: testAccAWSLBConfigWithIpAddressTypeUpdated(lbName), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &post), - resource.TestCheckResourceAttr("aws_lb.lb_test", "ip_address_type", "dualstack"), + testAccCheckAWSLBExists(resourceName, &post), + resource.TestCheckResourceAttr(resourceName, "ip_address_type", "dualstack"), ), }, }, @@ -529,28 +549,29 @@ func TestAccAWSLB_updatedIpAddressType(t *testing.T) { func TestAccAWSLB_noSecurityGroup(t *testing.T) { var conf elbv2.LoadBalancer lbName := fmt.Sprintf("testaccawslb-nosg-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + resourceName := "aws_lb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_lb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfig_nosg(lbName), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &conf), - resource.TestCheckResourceAttr("aws_lb.lb_test", "name", lbName), - resource.TestCheckResourceAttr("aws_lb.lb_test", "internal", "true"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "subnets.#", "2"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "security_groups.#", "1"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "tags.%", "1"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "tags.Name", "TestAccAWSALB_basic"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "enable_deletion_protection", "false"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "idle_timeout", "30"), - resource.TestCheckResourceAttrSet("aws_lb.lb_test", "vpc_id"), - resource.TestCheckResourceAttrSet("aws_lb.lb_test", "zone_id"), - resource.TestCheckResourceAttrSet("aws_lb.lb_test", "dns_name"), + testAccCheckAWSLBExists(resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "name", lbName), + resource.TestCheckResourceAttr(resourceName, "internal", "true"), + resource.TestCheckResourceAttr(resourceName, "subnets.#", "2"), + resource.TestCheckResourceAttr(resourceName, "security_groups.#", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", "TestAccAWSALB_basic"), + resource.TestCheckResourceAttr(resourceName, "enable_deletion_protection", "false"), + resource.TestCheckResourceAttr(resourceName, "idle_timeout", "30"), + resource.TestCheckResourceAttrSet(resourceName, "vpc_id"), + resource.TestCheckResourceAttrSet(resourceName, "zone_id"), + resource.TestCheckResourceAttrSet(resourceName, "dns_name"), ), }, }, @@ -876,22 +897,23 @@ func TestAccAWSLB_NLB_AccessLogs_Prefix(t *testing.T) { func TestAccAWSLB_networkLoadbalancer_subnet_change(t *testing.T) { var conf elbv2.LoadBalancer lbName := fmt.Sprintf("testaccawslb-basic-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) + resourceName := "aws_lb.lb_test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_lb.lb_test", + IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSLBDestroy, Steps: []resource.TestStep{ { Config: testAccAWSLBConfig_networkLoadbalancer_subnets(lbName), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckAWSLBExists("aws_lb.lb_test", &conf), - resource.TestCheckResourceAttr("aws_lb.lb_test", "name", lbName), - resource.TestCheckResourceAttr("aws_lb.lb_test", "internal", "true"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "tags.%", "1"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "tags.Name", "testAccAWSLBConfig_networkLoadbalancer_subnets"), - resource.TestCheckResourceAttr("aws_lb.lb_test", "load_balancer_type", "network"), + testAccCheckAWSLBExists(resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "name", lbName), + resource.TestCheckResourceAttr(resourceName, "internal", "true"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", "testAccAWSLBConfig_networkLoadbalancer_subnets"), + resource.TestCheckResourceAttr(resourceName, "load_balancer_type", "network"), ), }, },