aws: Treat INACTIVE ECS TDs as deleted in acc tests

- related to https://github.com/hashicorp/terraform/pull/3924
This commit is contained in:
Radek Simko 2015-12-17 15:14:17 +01:00
parent 99b3bcd280
commit a080447471
1 changed files with 11 additions and 9 deletions

View File

@ -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