diff --git a/.changelog/4767.txt b/.changelog/4767.txt new file mode 100644 index 00000000000..92fcbe80435 --- /dev/null +++ b/.changelog/4767.txt @@ -0,0 +1,4 @@ +```release-note:bug +plugin/ecs: Set health check timeout and interval values to compatible default +values. +``` \ No newline at end of file diff --git a/builtin/aws/ecs/components/platform/aws-ecs-platform/parameters.hcl b/builtin/aws/ecs/components/platform/aws-ecs-platform/parameters.hcl index 4af1d28ffd0..8b5dc3ddd80 100644 --- a/builtin/aws/ecs/components/platform/aws-ecs-platform/parameters.hcl +++ b/builtin/aws/ecs/components/platform/aws-ecs-platform/parameters.hcl @@ -123,7 +123,7 @@ parameter { parameter { key = "health_check" - description = "Health check settings for the app." + description = "Health check settings for the app.\nThese settings configure a health check for the application target group." type = "category" required = false } @@ -151,10 +151,11 @@ parameter { } parameter { - key = "health_check.interval" - description = "The amount of time, in seconds, between health checks." - type = "int64" - required = false + key = "health_check.interval" + description = "The amount of time, in seconds, between health checks." + type = "int64" + required = false + default_value = "30" } parameter { @@ -180,10 +181,11 @@ parameter { } parameter { - key = "health_check.timeout" - description = "The amount of time, in seconds, for which no target response means a failure." - type = "int64" - required = false + key = "health_check.timeout" + description = "The amount of time, in seconds, for which no target response means a failure. Must be lower than the interval." + type = "int64" + required = false + default_value = "5" } parameter { diff --git a/builtin/aws/ecs/platform.go b/builtin/aws/ecs/platform.go index 5c86631021c..55f90c25413 100644 --- a/builtin/aws/ecs/platform.go +++ b/builtin/aws/ecs/platform.go @@ -1339,14 +1339,20 @@ func (p *Platform) resourceTargetGroupCreate( createTargetGroupInput.HealthCheckPath = aws.String(p.config.HealthCheck.Path) } + createTargetGroupInput.HealthCheckTimeoutSeconds = aws.Int64(5) if p.config.HealthCheck.Timeout != 0 { createTargetGroupInput.HealthCheckTimeoutSeconds = aws.Int64(p.config.HealthCheck.Timeout) } + createTargetGroupInput.HealthCheckIntervalSeconds = aws.Int64(30) if p.config.HealthCheck.Interval != 0 { createTargetGroupInput.HealthCheckIntervalSeconds = aws.Int64(p.config.HealthCheck.Interval) } + if *createTargetGroupInput.HealthCheckIntervalSeconds < *createTargetGroupInput.HealthCheckTimeoutSeconds { + return status.Errorf(codes.InvalidArgument, fmt.Sprintf("Health check interval cannot be shorter than the timeout")) + } + if p.config.HealthCheck.HealthyThresholdCount != 0 { createTargetGroupInput.HealthyThresholdCount = aws.Int64(p.config.HealthCheck.HealthyThresholdCount) } else { @@ -3215,6 +3221,9 @@ deploy { doc.SetField("health_check", "Health check settings for the app.", + docs.Summary("These settings configure a health check for the application "+ + "target group."), + docs.SubFields(func(doc *docs.SubFieldDoc) { doc.SetField("protocol", "The protocol for the health check to use.", @@ -3225,10 +3234,12 @@ deploy { doc.SetField("timeout", "The amount of time, in seconds, for which no target response "+ - "means a failure.") + "means a failure. Must be lower than the interval.", + docs.Default("5")) doc.SetField("interval", - "The amount of time, in seconds, between health checks.") + "The amount of time, in seconds, between health checks.", + docs.Default("30")) doc.SetField("healthy_threshold_count", "The number of consecutive successful health checks required to"+