From 9cd1dbf6717f8b2fcb52d721449997baa0b358b5 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 11 Apr 2017 10:52:12 -0600 Subject: [PATCH] Fix TestAccAWSEcsService_withAlb --- .../aws/resource_aws_ecs_service_test.go | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/builtin/providers/aws/resource_aws_ecs_service_test.go b/builtin/providers/aws/resource_aws_ecs_service_test.go index 8be48aa95..6440393ba 100644 --- a/builtin/providers/aws/resource_aws_ecs_service_test.go +++ b/builtin/providers/aws/resource_aws_ecs_service_test.go @@ -243,13 +243,14 @@ func TestAccAWSEcsService_withEcsClusterName(t *testing.T) { } func TestAccAWSEcsService_withAlb(t *testing.T) { + rString := acctest.RandString(10) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithAlb, + Config: testAccAWSEcsServiceWithAlb(rString), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists("aws_ecs_service.with_alb"), ), @@ -874,7 +875,8 @@ resource "aws_ecs_service" "jenkins" { } ` -var testAccAWSEcsServiceWithAlb = ` +func testAccAWSEcsServiceWithAlb(rString string) string { + return fmt.Sprintf(` data "aws_availability_zones" "available" {} resource "aws_vpc" "main" { @@ -889,7 +891,7 @@ resource "aws_subnet" "main" { } resource "aws_ecs_cluster" "main" { - name = "terraform_acc_test_ecs_15" + name = "terraform_acc_test_ecs_%s" } resource "aws_ecs_task_definition" "with_lb_changes" { @@ -914,7 +916,7 @@ DEFINITION } resource "aws_iam_role" "ecs_service" { - name = "tf_acc_test_15_role" + name = "tf_acc_test_%s_role" assume_role_policy = <