Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.

Commit cad0b21

Browse files
plugin/ecs: Set reasonable defaults for ECS health check timeout.
Prior to this commit, depending on the type of health check configured, the default timeout could have been set to be longer than the default interval, which is not a valid setting in AWS. This commit sets the default timeout to be lower than the interval.
1 parent 6d5a84c commit cad0b21

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

.changelog/4767.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
```release-note:bug
2+
plugin/ecs: Set health check timeout and interval values to compatible default
3+
values.
4+
```

builtin/aws/ecs/components/platform/aws-ecs-platform/parameters.hcl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ parameter {
123123

124124
parameter {
125125
key = "health_check"
126-
description = "Health check settings for the app."
126+
description = "Health check settings for the app.\nThese settings configure a health check for the applicationtarget group."
127127
type = "category"
128128
required = false
129129
}
@@ -151,10 +151,11 @@ parameter {
151151
}
152152

153153
parameter {
154-
key = "health_check.interval"
155-
description = "The amount of time, in seconds, between health checks."
156-
type = "int64"
157-
required = false
154+
key = "health_check.interval"
155+
description = "The amount of time, in seconds, between health checks."
156+
type = "int64"
157+
required = false
158+
default_value = "30"
158159
}
159160

160161
parameter {
@@ -180,10 +181,11 @@ parameter {
180181
}
181182

182183
parameter {
183-
key = "health_check.timeout"
184-
description = "The amount of time, in seconds, for which no target response means a failure."
185-
type = "int64"
186-
required = false
184+
key = "health_check.timeout"
185+
description = "The amount of time, in seconds, for which no target response means a failure. Must be lower than the interval."
186+
type = "int64"
187+
required = false
188+
default_value = "5"
187189
}
188190

189191
parameter {

builtin/aws/ecs/platform.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,10 +1339,12 @@ func (p *Platform) resourceTargetGroupCreate(
13391339
createTargetGroupInput.HealthCheckPath = aws.String(p.config.HealthCheck.Path)
13401340
}
13411341

1342+
createTargetGroupInput.HealthCheckTimeoutSeconds = aws.Int64(5)
13421343
if p.config.HealthCheck.Timeout != 0 {
13431344
createTargetGroupInput.HealthCheckTimeoutSeconds = aws.Int64(p.config.HealthCheck.Timeout)
13441345
}
13451346

1347+
createTargetGroupInput.HealthCheckIntervalSeconds = aws.Int64(30)
13461348
if p.config.HealthCheck.Interval != 0 {
13471349
createTargetGroupInput.HealthCheckIntervalSeconds = aws.Int64(p.config.HealthCheck.Interval)
13481350
}
@@ -3215,6 +3217,9 @@ deploy {
32153217

32163218
doc.SetField("health_check",
32173219
"Health check settings for the app.",
3220+
docs.Summary("These settings configure a health check for the application"+
3221+
"target group."),
3222+
32183223
docs.SubFields(func(doc *docs.SubFieldDoc) {
32193224
doc.SetField("protocol",
32203225
"The protocol for the health check to use.",
@@ -3225,10 +3230,12 @@ deploy {
32253230

32263231
doc.SetField("timeout",
32273232
"The amount of time, in seconds, for which no target response "+
3228-
"means a failure.")
3233+
"means a failure. Must be lower than the interval.",
3234+
docs.Default("5"))
32293235

32303236
doc.SetField("interval",
3231-
"The amount of time, in seconds, between health checks.")
3237+
"The amount of time, in seconds, between health checks.",
3238+
docs.Default("30"))
32323239

32333240
doc.SetField("healthy_threshold_count",
32343241
"The number of consecutive successful health checks required to"+

0 commit comments

Comments
 (0)