Skip to content

Commit

Permalink
Fix providerlint AWSAT003.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Aug 15, 2024
1 parent 440196b commit fc2d2cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions internal/service/ecs/container_definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ func (cd containerDefinitions) reduce(isAWSVPC bool) {
// Compact any sparse lists.
cd.compactArrays()

// Deal with special fields which have defaults.
// See https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#container_definitions.
for i, def := range cd {
// Deal with special fields which have defaults.
if def.Essential == nil {
cd[i].Essential = aws.Bool(true)
}
// Replace nil HealthCheck values with default values. For each property, the default value can be found
// in the doc comment for this property.

if hc := def.HealthCheck; hc != nil {
if hc.Interval == nil {
hc.Interval = aws.Int32(30)
Expand All @@ -72,6 +72,7 @@ func (cd containerDefinitions) reduce(isAWSVPC bool) {
hc.Timeout = aws.Int32(5)
}
}

for j, pm := range def.PortMappings {
if pm.Protocol == awstypes.TransportProtocolTcp {
cd[i].PortMappings[j].Protocol = ""
Expand Down
4 changes: 2 additions & 2 deletions internal/service/ecs/container_definitions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ func TestContainerDefinitionsAreEquivalent_healthCheck(t *testing.T) {
"logDriver": "awslogs",
"options": {
"awslogs-group": "foo-bar-e196c99",
"awslogs-region": "us-east-1",
"awslogs-region": "region-1",
"awslogs-stream-prefix": "nginx"
}
}
Expand All @@ -674,7 +674,7 @@ func TestContainerDefinitionsAreEquivalent_healthCheck(t *testing.T) {
"logDriver": "awslogs",
"options": {
"awslogs-group": "foo-bar-e196c99",
"awslogs-region": "us-east-1",
"awslogs-region": "region-1",
"awslogs-stream-prefix": "nginx"
}
},
Expand Down

0 comments on commit fc2d2cb

Please sign in to comment.