Skip to content

Commit

Permalink
correct test name and variable type; removed ignored args at import
Browse files Browse the repository at this point in the history
  • Loading branch information
anGie44 committed Nov 19, 2021
1 parent f5ef2a1 commit bc70538
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
8 changes: 8 additions & 0 deletions internal/service/elbv2/load_balancer_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ func DataSourceLoadBalancer() *schema.Resource {
Computed: true,
},

"enable_waf_fail_open": {
Type: schema.TypeBool,
Computed: true,
},

"idle_timeout": {
Type: schema.TypeInt,
Computed: true,
Expand Down Expand Up @@ -287,6 +292,9 @@ func dataSourceLoadBalancerRead(d *schema.ResourceData, meta interface{}) error
case "routing.http2.enabled":
http2Enabled := aws.StringValue(attr.Value) == "true"
d.Set("enable_http2", http2Enabled)
case "waf.fail_open.enabled":
wafFailOpenEnabled := aws.StringValue(attr.Value) == "true"
d.Set("enable_waf_fail_open", wafFailOpenEnabled)
case "load_balancing.cross_zone.enabled":
crossZoneLbEnabled := aws.StringValue(attr.Value) == "true"
d.Set("enable_cross_zone_load_balancing", crossZoneLbEnabled)
Expand Down
3 changes: 3 additions & 0 deletions internal/service/elbv2/load_balancer_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func TestAccELBV2LoadBalancerDataSource_backwardsCompatibility(t *testing.T) {
resource.TestCheckResourceAttrPair(dataSourceName1, "subnet_mapping.#", resourceName, "subnet_mapping.#"),
resource.TestCheckResourceAttrPair(dataSourceName1, "drop_invalid_header_fields", resourceName, "drop_invalid_header_fields"),
resource.TestCheckResourceAttrPair(dataSourceName1, "enable_http2", resourceName, "enable_http2"),
resource.TestCheckResourceAttrPair(dataSourceName1, "enable_waf_fail_open", resourceName, "enable_waf_fail_open"),
resource.TestCheckResourceAttrPair(dataSourceName1, "access_logs.#", resourceName, "access_logs.#"),
resource.TestCheckResourceAttrPair(dataSourceName2, "name", resourceName, "name"),
resource.TestCheckResourceAttrPair(dataSourceName2, "internal", resourceName, "internal"),
Expand All @@ -161,6 +162,7 @@ func TestAccELBV2LoadBalancerDataSource_backwardsCompatibility(t *testing.T) {
resource.TestCheckResourceAttrPair(dataSourceName2, "subnet_mapping.#", resourceName, "subnet_mapping.#"),
resource.TestCheckResourceAttrPair(dataSourceName2, "drop_invalid_header_fields", resourceName, "drop_invalid_header_fields"),
resource.TestCheckResourceAttrPair(dataSourceName2, "enable_http2", resourceName, "enable_http2"),
resource.TestCheckResourceAttrPair(dataSourceName2, "enable_waf_fail_open", resourceName, "enable_waf_fail_open"),
resource.TestCheckResourceAttrPair(dataSourceName2, "access_logs.#", resourceName, "access_logs.#"),
resource.TestCheckResourceAttrPair(dataSourceName3, "name", resourceName, "name"),
resource.TestCheckResourceAttrPair(dataSourceName3, "internal", resourceName, "internal"),
Expand All @@ -179,6 +181,7 @@ func TestAccELBV2LoadBalancerDataSource_backwardsCompatibility(t *testing.T) {
resource.TestCheckResourceAttrPair(dataSourceName3, "subnet_mapping.#", resourceName, "subnet_mapping.#"),
resource.TestCheckResourceAttrPair(dataSourceName3, "drop_invalid_header_fields", resourceName, "drop_invalid_header_fields"),
resource.TestCheckResourceAttrPair(dataSourceName3, "enable_http2", resourceName, "enable_http2"),
resource.TestCheckResourceAttrPair(dataSourceName3, "enable_waf_fail_open", resourceName, "enable_waf_fail_open"),
resource.TestCheckResourceAttrPair(dataSourceName3, "access_logs.#", resourceName, "access_logs.#"),
),
},
Expand Down
18 changes: 13 additions & 5 deletions internal/service/elbv2/load_balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ func TestAccELBV2LoadBalancer_LoadBalancerType_gateway(t *testing.T) {
ImportStateVerifyIgnore: []string{
"drop_invalid_header_fields",
"enable_http2",
"enable_waf_fail_open",
"idle_timeout",
},
},
Expand Down Expand Up @@ -226,7 +225,6 @@ func TestAccELBV2LoadBalancer_LoadBalancerTypeGateway_enableCrossZoneLoadBalanci
ImportStateVerifyIgnore: []string{
"drop_invalid_header_fields",
"enable_http2",
"enable_waf_fail_open",
"idle_timeout",
},
},
Expand Down Expand Up @@ -644,7 +642,7 @@ func TestAccELBV2LoadBalancer_ApplicationLoadBalancer_updateDeletionProtection(t
})
}

func TestAccAWSLB_ApplicationLoadBalancer_updateWafFailOpen(t *testing.T) {
func TestAccELBV2LoadBalancer_ApplicationLoadBalancer_updateWafFailOpen(t *testing.T) {
var pre, mid, post elbv2.LoadBalancer
lbName := fmt.Sprintf("testAccAWSalb-basic-%s", sdkacctest.RandString(10))
resourceName := "aws_lb.lb_test"
Expand All @@ -662,6 +660,11 @@ func TestAccAWSLB_ApplicationLoadBalancer_updateWafFailOpen(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "enable_waf_fail_open", "false"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccLBConfig_enableWafFailOpen(lbName, true),
Check: resource.ComposeAggregateTestCheckFunc(
Expand All @@ -670,10 +673,15 @@ func TestAccAWSLB_ApplicationLoadBalancer_updateWafFailOpen(t *testing.T) {
testAccChecklbARNs(&pre, &mid),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccLBConfig_enableWafFailOpen(lbName, false),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckLoadBalancerExists(resourceName, &mid),
testAccCheckLoadBalancerExists(resourceName, &post),
resource.TestCheckResourceAttr(resourceName, "enable_waf_fail_open", "false"),
testAccChecklbARNs(&mid, &post),
),
Expand Down Expand Up @@ -1882,7 +1890,7 @@ resource "aws_lb" "lb_test" {
variable "subnets" {
default = ["10.0.1.0/24", "10.0.2.0/24"]
type = "list"
type = list(string)
}
resource "aws_vpc" "alb_test" {
Expand Down

0 comments on commit bc70538

Please sign in to comment.