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

Support for load_balancing_algorithm_type = weighted_random and load_balancing_anomaly_mitigation #35083

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changelog/35083.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:enhancement
resource/aws_lb_target_group: Add attribute `load_balancing_anomaly_mitigation`
```

```release-note:enhancement
resource/aws_lb_target_group: Add `weighted_random` as a valid option for attribute `load_balancing_algorithm_type`
```
15 changes: 13 additions & 2 deletions internal/service/elbv2/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,19 @@ func loadBalancingAlgorithmType_Values() []string {
return []string{
loadBalancingAlgorithmTypeRoundRobin,
loadBalancingAlgorithmTypeLeastOutstandingRequests,
// TODO
// loadBalancingAlgorithmTypeWeightedRandom,
loadBalancingAlgorithmTypeWeightedRandom,
}
}

const (
loadBalancingAnomalyMitigationOn = "on"
loadBalancingAnomalyMitigationOff = "off"
)
ewbankkit marked this conversation as resolved.
Show resolved Hide resolved

func loadBalancingAnomalyMitigationType_Values() []string {
return []string{
loadBalancingAnomalyMitigationOn,
loadBalancingAnomalyMitigationOff,
}
}

Expand Down
11 changes: 11 additions & 0 deletions internal/service/elbv2/target_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ func ResourceTargetGroup() *schema.Resource {
Computed: true,
ValidateFunc: validation.StringInSlice(loadBalancingAlgorithmType_Values(), false),
},
"load_balancing_anomaly_mitigation": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice(loadBalancingAnomalyMitigationType_Values(), false),
},
"load_balancing_cross_zone_enabled": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -720,6 +726,11 @@ var targetGroupAttributes = targetGroupAttributeMap(map[string]targetGroupAttrib
tfType: schema.TypeString,
targetTypesSupported: []string{elbv2.TargetTypeEnumInstance, elbv2.TargetTypeEnumIp},
},
"load_balancing_anomaly_mitigation": {
apiAttributeKey: targetGroupAttributeLoadBalancingAlgorithmAnomalyMitigation,
tfType: schema.TypeString,
targetTypesSupported: []string{elbv2.TargetTypeEnumInstance, elbv2.TargetTypeEnumIp},
},
"load_balancing_cross_zone_enabled": {
apiAttributeKey: targetGroupAttributeLoadBalancingCrossZoneEnabled,
tfType: schema.TypeString,
Expand Down
5 changes: 5 additions & 0 deletions internal/service/elbv2/target_group_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ func DataSourceTargetGroup() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"load_balancing_anomaly_mitigation": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"load_balancing_cross_zone_enabled": {
Type: schema.TypeString,
Computed: true,
Expand Down
6 changes: 4 additions & 2 deletions internal/service/elbv2/target_group_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ func TestAccELBV2TargetGroupDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttr(datasourceNameByARN, "protocol", "HTTP"),
resource.TestCheckResourceAttr(datasourceNameByARN, "protocol_version", "HTTP1"),
resource.TestCheckResourceAttrSet(datasourceNameByARN, "vpc_id"),
resource.TestCheckResourceAttrSet(datasourceNameByARN, "load_balancing_algorithm_type"),
resource.TestCheckResourceAttr(datasourceNameByARN, "load_balancing_algorithm_type", "round_robin"),
resource.TestCheckResourceAttr(datasourceNameByARN, "load_balancing_anomaly_mitigation", "off"),
resource.TestCheckResourceAttrSet(datasourceNameByARN, "load_balancing_cross_zone_enabled"),
resource.TestCheckResourceAttr(datasourceNameByARN, "deregistration_delay", "300"),
resource.TestCheckResourceAttr(datasourceNameByARN, "slow_start", "0"),
Expand All @@ -55,7 +56,8 @@ func TestAccELBV2TargetGroupDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttrSet(datasourceNameByName, "arn_suffix"),
resource.TestCheckResourceAttr(datasourceNameByName, "port", "8080"),
resource.TestCheckResourceAttr(datasourceNameByName, "protocol", "HTTP"),
resource.TestCheckResourceAttrSet(datasourceNameByName, "load_balancing_algorithm_type"),
resource.TestCheckResourceAttr(datasourceNameByName, "load_balancing_algorithm_type", "round_robin"),
resource.TestCheckResourceAttr(datasourceNameByName, "load_balancing_anomaly_mitigation", "off"),
resource.TestCheckResourceAttrSet(datasourceNameByName, "load_balancing_cross_zone_enabled"),
resource.TestCheckResourceAttrSet(datasourceNameByName, "vpc_id"),
resource.TestCheckResourceAttr(datasourceNameByName, "deregistration_delay", "300"),
Expand Down
Loading
Loading