From a080447471afa28986ef7ed8df19c2a89e8e9710 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Thu, 17 Dec 2015 15:14:17 +0100 Subject: [PATCH] aws: Treat INACTIVE ECS TDs as deleted in acc tests - related to https://github.com/hashicorp/terraform/pull/3924 --- .../resource_aws_ecs_task_definition_test.go | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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 dcc4ef8b3..9972bba7b 100644 --- a/builtin/providers/aws/resource_aws_ecs_task_definition_test.go +++ b/builtin/providers/aws/resource_aws_ecs_task_definition_test.go @@ -82,17 +82,19 @@ func testAccCheckAWSEcsTaskDefinitionDestroy(s *terraform.State) error { continue } - out, err := conn.DescribeTaskDefinition(&ecs.DescribeTaskDefinitionInput{ - TaskDefinition: aws.String(rs.Primary.ID), - }) - - if err == nil { - if out.TaskDefinition != nil { - return fmt.Errorf("ECS task definition still exists:\n%#v", *out.TaskDefinition) - } + input := ecs.DescribeTaskDefinitionInput{ + TaskDefinition: aws.String(rs.Primary.Attributes["arn"]), } - return err + out, err := conn.DescribeTaskDefinition(&input) + + if err != nil { + return err + } + + if out.TaskDefinition != nil && *out.TaskDefinition.Status != "INACTIVE" { + return fmt.Errorf("ECS task definition still exists:\n%#v", *out.TaskDefinition) + } } return nil