From 3d80fc0ed5ddab8c914f2b54d73ab2d20a7daa34 Mon Sep 17 00:00:00 2001 From: Ben Turbes Date: Fri, 1 Mar 2019 11:39:07 -0600 Subject: [PATCH 1/2] update ecs_service max grace period to 2147483647 --- aws/resource_aws_ecs_service.go | 3 ++- aws/resource_aws_ecs_service_test.go | 3 ++- website/docs/r/ecs_service.html.markdown | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_ecs_service.go b/aws/resource_aws_ecs_service.go index 1740d8ec0ed9..b33419c8f932 100644 --- a/aws/resource_aws_ecs_service.go +++ b/aws/resource_aws_ecs_service.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "log" + "math" "strings" "time" @@ -62,7 +63,7 @@ func resourceAwsEcsService() *schema.Resource { "health_check_grace_period_seconds": { Type: schema.TypeInt, Optional: true, - ValidateFunc: validation.IntBetween(0, 7200), + ValidateFunc: validation.IntBetween(0, math.MaxInt32), }, "launch_type": { diff --git a/aws/resource_aws_ecs_service_test.go b/aws/resource_aws_ecs_service_test.go index 6b0c01ffbfe9..13be9fb641cd 100644 --- a/aws/resource_aws_ecs_service_test.go +++ b/aws/resource_aws_ecs_service_test.go @@ -3,6 +3,7 @@ package aws import ( "fmt" "log" + "math" "regexp" "testing" "time" @@ -323,7 +324,7 @@ func TestAccAWSEcsService_healthCheckGracePeriodSeconds(t *testing.T) { }, { Config: testAccAWSEcsService_healthCheckGracePeriodSeconds(vpcNameTag, clusterName, tdName, - roleName, policyName, lbName, svcName, 7201), + roleName, policyName, lbName, svcName, math.MaxInt32+1), ExpectError: regexp.MustCompile(`expected health_check_grace_period_seconds to be in the range`), }, { diff --git a/website/docs/r/ecs_service.html.markdown b/website/docs/r/ecs_service.html.markdown index 2bc498773574..0abbcfe44e11 100644 --- a/website/docs/r/ecs_service.html.markdown +++ b/website/docs/r/ecs_service.html.markdown @@ -90,7 +90,7 @@ The following arguments are supported: * `enable_ecs_managed_tags` - (Optional) Specifies whether to enable Amazon ECS managed tags for the tasks within the service. * `propagate_tags` - (Optional) Specifies whether to propagate the tags from the task definition or the service to the tasks. The valid values are `SERVICE` and `TASK_DEFINITION`. * `ordered_placement_strategy` - (Optional) Service level strategy rules that are taken into consideration during task placement. List from top to bottom in order of precedence. The maximum number of `ordered_placement_strategy` blocks is `5`. Defined below. -* `health_check_grace_period_seconds` - (Optional) Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 7200. Only valid for services configured to use load balancers. +* `health_check_grace_period_seconds` - (Optional) Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 2147483647. Only valid for services configured to use load balancers. * `load_balancer` - (Optional) A load balancer block. Load balancers documented below. * `placement_constraints` - (Optional) rules that are taken into consideration during task placement. Maximum number of `placement_constraints` is `10`. Defined below. From 6bef5f6b48af951db114120f27988bd8b3e0533f Mon Sep 17 00:00:00 2001 From: Ben Turbes Date: Mon, 4 Mar 2019 11:59:15 -0600 Subject: [PATCH 2/2] add max value to ecs grace period tests --- aws/resource_aws_ecs_service_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aws/resource_aws_ecs_service_test.go b/aws/resource_aws_ecs_service_test.go index 13be9fb641cd..ff72e7473779 100644 --- a/aws/resource_aws_ecs_service_test.go +++ b/aws/resource_aws_ecs_service_test.go @@ -343,6 +343,14 @@ func TestAccAWSEcsService_healthCheckGracePeriodSeconds(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "health_check_grace_period_seconds", "600"), ), }, + { + Config: testAccAWSEcsService_healthCheckGracePeriodSeconds(vpcNameTag, clusterName, tdName, + roleName, policyName, lbName, svcName, math.MaxInt32), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "health_check_grace_period_seconds", "2147483647"), + ), + }, }, }) }