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

ECS Service Connect Fixes #28338

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
26fcacb
fix ingress_port_override being set to 0 when not given
dragondgold Dec 13, 2022
a063a00
fix error when removing `service_connect_configuration` argument
dragondgold Dec 13, 2022
11e3fa2
added changelog
dragondgold Dec 14, 2022
76d319b
Tweak CHANGELOG entries.
ewbankkit Dec 14, 2022
e48392f
ECS: Tidy up 'testAccCapacityProviderConfig_base'.
ewbankkit Dec 14, 2022
4600625
r/aws_ecs_service: Tidy up 'TestAccECSService_loadBalancerChanges'.
ewbankkit Dec 14, 2022
ea02f05
r/aws_ecs_service: Tidy up 'TestAccECSService_LaunchTypeFargate*'.
ewbankkit Dec 14, 2022
a5d4ff5
r/aws_ecs_service: Tidy up 'TestAccECSService_CapacityProviderStrateg…
ewbankkit Dec 14, 2022
2555ac9
r/aws_ecs_service: Tidy up 'TestAccECSService_DeploymentControllerTyp…
ewbankkit Dec 15, 2022
d7b0602
r/aws_ecs_service: Tidy up 'TestAccECSService_ServiceRegistries_*'.
ewbankkit Dec 15, 2022
0dc3394
r/aws_ecs_service: Tidy up 'TestAccECSService_LaunchTypeEC2_network'.
ewbankkit Dec 15, 2022
8103f87
r/aws_ecs_service: Tidy up 'TestAccECSService_multipleTargetGroups' a…
ewbankkit Dec 15, 2022
19a9291
r/aws_ecs_service: Add 'TestAccECSService_ServiceConnect_ingressPortO…
ewbankkit Dec 15, 2022
f1402cb
r/aws_ecs_service: Add 'TestAccECSService_ServiceConnect_remove'.
ewbankkit Dec 15, 2022
a2df45f
Merge commit 'f1402cb88ced974d534763f4d77cdbc933e791a5' into HEAD
ewbankkit Dec 15, 2022
e0cc0cb
r/aws_ecs_service: Additional checks in 'TestAccECSService_ServiceCon…
ewbankkit Dec 15, 2022
f88dc49
r/aws_ecs_service: 'TestAccECSService_ServiceConnect_remove' passes.
ewbankkit Dec 15, 2022
09fc306
Update 28338.txt
ewbankkit Dec 15, 2022
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/28338.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:bug
resource/aws_ecs_service: Fix `service_connect_configuration.service.ingress_port_override` being set to 0 (`InvalidParameterException: IngressPortOverride cannot use ports <= 1024` error) when not configured
```

```release-note:bug
resource/aws_ecs_service: Fix `missing required field, UpdateServiceInput.ServiceConnectConfiguration.Enabled` error when removing `service_connect_configuration` configuration block
```
64 changes: 23 additions & 41 deletions internal/service/ecs/capacity_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,29 +254,13 @@ func testAccCheckCapacityProviderExists(resourceName string, provider *ecs.Capac
}
}

func testAccCapacityProviderBaseConfig(rName string) string {
return fmt.Sprintf(`
data "aws_ami" "test" {
most_recent = true
owners = ["amazon"]

filter {
name = "name"
values = ["amzn-ami-hvm-*-x86_64-gp2"]
}
}

data "aws_availability_zones" "available" {
state = "available"

filter {
name = "opt-in-status"
values = ["opt-in-not-required"]
}
}

func testAccCapacityProviderConfig_base(rName string) string {
return acctest.ConfigCompose(
acctest.ConfigAvailableAZsNoOptInDefaultExclude(),
acctest.ConfigLatestAmazonLinuxHVMEBSAMI(),
fmt.Sprintf(`
resource "aws_launch_template" "test" {
image_id = data.aws_ami.test.id
image_id = data.aws_ami.amzn-ami-minimal-hvm-ebs.id
instance_type = "t3.micro"
name = %[1]q
}
Expand All @@ -292,31 +276,29 @@ resource "aws_autoscaling_group" "test" {
id = aws_launch_template.test.id
}

tags = [
{
key = "foo"
value = "bar"
propagate_at_launch = true
},
]
tags = [{
key = "Name"
value = %[1]q
propagate_at_launch = true
}]
}
`, rName)
`, rName))
}

func testAccCapacityProviderConfig_basic(rName string) string {
return testAccCapacityProviderBaseConfig(rName) + fmt.Sprintf(`
return acctest.ConfigCompose(testAccCapacityProviderConfig_base(rName), fmt.Sprintf(`
resource "aws_ecs_capacity_provider" "test" {
name = %q
name = %[1]q

auto_scaling_group_provider {
auto_scaling_group_arn = aws_autoscaling_group.test.arn
}
}
`, rName)
`, rName))
}

func testAccCapacityProviderConfig_managedScaling(rName, status string, warmup, max, min, cap int) string {
return testAccCapacityProviderBaseConfig(rName) + fmt.Sprintf(`
return acctest.ConfigCompose(testAccCapacityProviderConfig_base(rName), fmt.Sprintf(`
resource "aws_ecs_capacity_provider" "test" {
name = %[1]q

Expand All @@ -332,11 +314,11 @@ resource "aws_ecs_capacity_provider" "test" {
}
}
}
`, rName, warmup, max, min, status, cap)
`, rName, warmup, max, min, status, cap))
}

func testAccCapacityProviderConfig_managedScalingPartial(rName string) string {
return testAccCapacityProviderBaseConfig(rName) + fmt.Sprintf(`
return acctest.ConfigCompose(testAccCapacityProviderConfig_base(rName), fmt.Sprintf(`
resource "aws_ecs_capacity_provider" "test" {
name = %[1]q

Expand All @@ -349,11 +331,11 @@ resource "aws_ecs_capacity_provider" "test" {
}
}
}
`, rName)
`, rName))
}

func testAccCapacityProviderConfig_tags1(rName, tag1Key, tag1Value string) string {
return testAccCapacityProviderBaseConfig(rName) + fmt.Sprintf(`
return acctest.ConfigCompose(testAccCapacityProviderConfig_base(rName), fmt.Sprintf(`
resource "aws_ecs_capacity_provider" "test" {
name = %[1]q

Expand All @@ -365,11 +347,11 @@ resource "aws_ecs_capacity_provider" "test" {
auto_scaling_group_arn = aws_autoscaling_group.test.arn
}
}
`, rName, tag1Key, tag1Value)
`, rName, tag1Key, tag1Value))
}

func testAccCapacityProviderConfig_tags2(rName, tag1Key, tag1Value, tag2Key, tag2Value string) string {
return testAccCapacityProviderBaseConfig(rName) + fmt.Sprintf(`
return acctest.ConfigCompose(testAccCapacityProviderConfig_base(rName), fmt.Sprintf(`
resource "aws_ecs_capacity_provider" "test" {
name = %[1]q

Expand All @@ -382,5 +364,5 @@ resource "aws_ecs_capacity_provider" "test" {
auto_scaling_group_arn = aws_autoscaling_group.test.arn
}
}
`, rName, tag1Key, tag1Value, tag2Key, tag2Value)
`, rName, tag1Key, tag1Value, tag2Key, tag2Value))
}
2 changes: 1 addition & 1 deletion internal/service/ecs/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ resource "aws_ecs_cluster" "test" {
}

func testAccClusterCapacityProviderConfig_base(rName string) string {
return acctest.ConfigCompose(testAccCapacityProviderBaseConfig(rName), fmt.Sprintf(`
return acctest.ConfigCompose(testAccCapacityProviderConfig_base(rName), fmt.Sprintf(`
resource "aws_ecs_capacity_provider" "test" {
name = %[1]q

Expand Down
6 changes: 4 additions & 2 deletions internal/service/ecs/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1287,7 +1287,9 @@ func flattenPlacementStrategy(pss []*ecs.PlacementStrategy) []interface{} {

func expandServiceConnectConfiguration(sc []interface{}) *ecs.ServiceConnectConfiguration {
if len(sc) == 0 {
return &ecs.ServiceConnectConfiguration{}
return &ecs.ServiceConnectConfiguration{
Enabled: aws.Bool(false),
}
}
raw := sc[0].(map[string]interface{})

Expand Down Expand Up @@ -1376,7 +1378,7 @@ func expandServices(srv []interface{}) []*ecs.ServiceConnectService {
if v, ok := raw["discovery_name"].(string); ok && v != "" {
config.DiscoveryName = aws.String(v)
}
if v, ok := raw["ingress_port_override"].(int); ok {
if v, ok := raw["ingress_port_override"].(int); ok && v != 0 {
config.IngressPortOverride = aws.Int64(int64(v))
}
if v, ok := raw["port_name"].(string); ok && v != "" {
Expand Down
Loading