diff --git a/builtin/providers/aws/import_aws_cloudwatch_log_destination_policy_test.go b/builtin/providers/aws/import_aws_cloudwatch_log_destination_policy_test.go index a3f4c5b4b5..f7c4a7f35e 100644 --- a/builtin/providers/aws/import_aws_cloudwatch_log_destination_policy_test.go +++ b/builtin/providers/aws/import_aws_cloudwatch_log_destination_policy_test.go @@ -3,19 +3,22 @@ package aws import ( "testing" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" ) func TestAccAWSCloudwatchLogDestinationPolicy_importBasic(t *testing.T) { resourceName := "aws_cloudwatch_log_destination_policy.test" + rstring := acctest.RandString(5) + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudwatchLogDestinationPolicyDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccAWSCloudwatchLogDestinationPolicyConfig(), + Config: testAccAWSCloudwatchLogDestinationPolicyConfig(rstring), }, resource.TestStep{ diff --git a/builtin/providers/aws/import_aws_cloudwatch_log_destination_test.go b/builtin/providers/aws/import_aws_cloudwatch_log_destination_test.go index b974492972..b0c1d25356 100644 --- a/builtin/providers/aws/import_aws_cloudwatch_log_destination_test.go +++ b/builtin/providers/aws/import_aws_cloudwatch_log_destination_test.go @@ -3,19 +3,22 @@ package aws import ( "testing" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" ) func TestAccAWSCloudwatchLogDestination_importBasic(t *testing.T) { resourceName := "aws_cloudwatch_log_destination.test" + rstring := acctest.RandString(5) + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudwatchLogDestinationDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccAWSCloudwatchLogDestinationConfig(), + Config: testAccAWSCloudwatchLogDestinationConfig(rstring), }, resource.TestStep{ diff --git a/builtin/providers/aws/resource_aws_cloudwatch_log_destination.go b/builtin/providers/aws/resource_aws_cloudwatch_log_destination.go index 946b74b2ff..172630648e 100644 --- a/builtin/providers/aws/resource_aws_cloudwatch_log_destination.go +++ b/builtin/providers/aws/resource_aws_cloudwatch_log_destination.go @@ -16,7 +16,6 @@ func resourceAwsCloudWatchLogDestination() *schema.Resource { return &schema.Resource{ Create: resourceAwsCloudWatchLogDestinationPut, Update: resourceAwsCloudWatchLogDestinationPut, - Read: resourceAwsCloudWatchLogDestinationRead, Delete: resourceAwsCloudWatchLogDestinationDelete, diff --git a/builtin/providers/aws/resource_aws_cloudwatch_log_destination_policy.go b/builtin/providers/aws/resource_aws_cloudwatch_log_destination_policy.go index a9a314b67b..704dacf452 100644 --- a/builtin/providers/aws/resource_aws_cloudwatch_log_destination_policy.go +++ b/builtin/providers/aws/resource_aws_cloudwatch_log_destination_policy.go @@ -13,7 +13,6 @@ func resourceAwsCloudWatchLogDestinationPolicy() *schema.Resource { return &schema.Resource{ Create: resourceAwsCloudWatchLogDestinationPolicyPut, Update: resourceAwsCloudWatchLogDestinationPolicyPut, - Read: resourceAwsCloudWatchLogDestinationPolicyRead, Delete: resourceAwsCloudWatchLogDestinationPolicyDelete, diff --git a/builtin/providers/aws/resource_aws_cloudwatch_log_destination_policy_test.go b/builtin/providers/aws/resource_aws_cloudwatch_log_destination_policy_test.go index e612c44070..c1ba60fc1c 100644 --- a/builtin/providers/aws/resource_aws_cloudwatch_log_destination_policy_test.go +++ b/builtin/providers/aws/resource_aws_cloudwatch_log_destination_policy_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/service/cloudwatchlogs" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) @@ -12,13 +13,15 @@ import ( func TestAccAWSCloudwatchLogDestinationPolicy_basic(t *testing.T) { var destination cloudwatchlogs.Destination + rstring := acctest.RandString(5) + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudwatchLogDestinationPolicyDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudwatchLogDestinationPolicyConfig(), + Config: testAccAWSCloudwatchLogDestinationPolicyConfig(rstring), Check: resource.ComposeTestCheckFunc( testAccCheckAWSCloudwatchLogDestinationPolicyExists("aws_cloudwatch_log_destination_policy.test", &destination), ), @@ -70,10 +73,10 @@ func testAccCheckAWSCloudwatchLogDestinationPolicyExists(n string, d *cloudwatch } } -func testAccAWSCloudwatchLogDestinationPolicyConfig() string { +func testAccAWSCloudwatchLogDestinationPolicyConfig(rstring string) string { return fmt.Sprintf(` resource "aws_kinesis_stream" "test" { - name = "RootAccess" + name = "RootAccess_%s" shard_count = 1 } @@ -97,7 +100,7 @@ data "aws_iam_policy_document" "role" { } resource "aws_iam_role" "test" { - name = "CWLtoKinesisRole" + name = "CWLtoKinesisRole_%s" assume_role_policy = "${data.aws_iam_policy_document.role.json}" } @@ -123,13 +126,13 @@ data "aws_iam_policy_document" "policy" { } resource "aws_iam_role_policy" "test" { - name = "Permissions-Policy-For-CWL" + name = "Permissions-Policy-For-CWL_%s" role = "${aws_iam_role.test.id}" policy = "${data.aws_iam_policy_document.policy.json}" } resource "aws_cloudwatch_log_destination" "test" { - name = "testDestination" + name = "testDestination_%s" target_arn = "${aws_kinesis_stream.test.arn}" role_arn = "${aws_iam_role.test.arn}" depends_on = ["aws_iam_role_policy.test"] @@ -157,5 +160,5 @@ resource "aws_cloudwatch_log_destination_policy" "test" { destination_name = "${aws_cloudwatch_log_destination.test.name}" access_policy = "${data.aws_iam_policy_document.access.json}" } -`) +`, rstring, rstring, rstring, rstring) } diff --git a/builtin/providers/aws/resource_aws_cloudwatch_log_destination_test.go b/builtin/providers/aws/resource_aws_cloudwatch_log_destination_test.go index 005b8808f2..2996122feb 100644 --- a/builtin/providers/aws/resource_aws_cloudwatch_log_destination_test.go +++ b/builtin/providers/aws/resource_aws_cloudwatch_log_destination_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/service/cloudwatchlogs" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) @@ -12,13 +13,15 @@ import ( func TestAccAWSCloudwatchLogDestination_basic(t *testing.T) { var destination cloudwatchlogs.Destination + rstring := acctest.RandString(5) + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudwatchLogDestinationDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudwatchLogDestinationConfig(), + Config: testAccAWSCloudwatchLogDestinationConfig(rstring), Check: resource.ComposeTestCheckFunc( testAccCheckAWSCloudwatchLogDestinationExists("aws_cloudwatch_log_destination.test", &destination), ), @@ -70,10 +73,10 @@ func testAccCheckAWSCloudwatchLogDestinationExists(n string, d *cloudwatchlogs.D } } -func testAccAWSCloudwatchLogDestinationConfig() string { +func testAccAWSCloudwatchLogDestinationConfig(rstring string) string { return fmt.Sprintf(` resource "aws_kinesis_stream" "test" { - name = "RootAccess" + name = "RootAccess_%s" shard_count = 1 } @@ -97,7 +100,7 @@ data "aws_iam_policy_document" "role" { } resource "aws_iam_role" "test" { - name = "CWLtoKinesisRole" + name = "CWLtoKinesisRole_%s" assume_role_policy = "${data.aws_iam_policy_document.role.json}" } @@ -123,13 +126,13 @@ data "aws_iam_policy_document" "policy" { } resource "aws_iam_role_policy" "test" { - name = "Permissions-Policy-For-CWL" + name = "Permissions-Policy-For-CWL_%s" role = "${aws_iam_role.test.id}" policy = "${data.aws_iam_policy_document.policy.json}" } resource "aws_cloudwatch_log_destination" "test" { - name = "testDestination" + name = "testDestination_%s" target_arn = "${aws_kinesis_stream.test.arn}" role_arn = "${aws_iam_role.test.arn}" depends_on = ["aws_iam_role_policy.test"] @@ -157,5 +160,5 @@ resource "aws_cloudwatch_log_destination_policy" "test" { destination_name = "${aws_cloudwatch_log_destination.test.name}" access_policy = "${data.aws_iam_policy_document.access.json}" } -`) +`, rstring, rstring, rstring, rstring) }