From 63049c0176ec4892a422c11b3ebda517143be4f6 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Sun, 8 Nov 2015 20:31:18 +0100 Subject: [PATCH] provider/aws: Support scratch volumes in ecs_task_definition --- .../aws/resource_aws_ecs_task_definition.go | 2 +- .../resource_aws_ecs_task_definition_test.go | 39 +++++++++++++++++++ builtin/providers/aws/structure.go | 18 ++++++--- 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/builtin/providers/aws/resource_aws_ecs_task_definition.go b/builtin/providers/aws/resource_aws_ecs_task_definition.go index 4ab0d0b8a..337c2aadf 100644 --- a/builtin/providers/aws/resource_aws_ecs_task_definition.go +++ b/builtin/providers/aws/resource_aws_ecs_task_definition.go @@ -58,7 +58,7 @@ func resourceAwsEcsTaskDefinition() *schema.Resource { "host_path": &schema.Schema{ Type: schema.TypeString, - Required: true, + Optional: true, }, }, }, diff --git a/builtin/providers/aws/resource_aws_ecs_task_definition_test.go b/builtin/providers/aws/resource_aws_ecs_task_definition_test.go index 2cff051c5..de53f597e 100644 --- a/builtin/providers/aws/resource_aws_ecs_task_definition_test.go +++ b/builtin/providers/aws/resource_aws_ecs_task_definition_test.go @@ -32,6 +32,23 @@ func TestAccAWSEcsTaskDefinition_basic(t *testing.T) { }) } +// Regression for https://github.com/hashicorp/terraform/issues/2370 +func TestAccAWSEcsTaskDefinition_withScratchVolume(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSEcsTaskDefinitionDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSEcsTaskDefinitionWithScratchVolume, + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEcsTaskDefinitionExists("aws_ecs_task_definition.sleep"), + ), + }, + }, + }) +} + func testAccCheckAWSEcsTaskDefinitionDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).ecsconn @@ -116,6 +133,28 @@ TASK_DEFINITION } ` +var testAccAWSEcsTaskDefinitionWithScratchVolume = ` +resource "aws_ecs_task_definition" "sleep" { + family = "terraform-acc-sc-volume-test" + container_definitions = <