From 0bf127a8057182f90518ddb1ae85895c1c0f4265 Mon Sep 17 00:00:00 2001 From: Clint Shryock Date: Thu, 18 Jun 2015 08:35:45 -0500 Subject: [PATCH] update test; fix import, interpolate ENV var for log name --- builtin/providers/aws/resource_aws_flow_log_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/builtin/providers/aws/resource_aws_flow_log_test.go b/builtin/providers/aws/resource_aws_flow_log_test.go index 697d24539..b938a6fea 100644 --- a/builtin/providers/aws/resource_aws_flow_log_test.go +++ b/builtin/providers/aws/resource_aws_flow_log_test.go @@ -2,16 +2,18 @@ package aws import ( "fmt" + "os" "testing" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/aws-sdk-go/aws" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) func TestAccFlowLog_basic(t *testing.T) { var flowLog ec2.FlowLog + lgn := os.Getenv("LOG_GROUP_NAME") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -19,7 +21,7 @@ func TestAccFlowLog_basic(t *testing.T) { CheckDestroy: testAccCheckFlowLogDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccFlowLogConfig_basic, + Config: fmt.Sprintf(testAccFlowLogConfig_basic, lgn), Check: resource.ComposeTestCheckFunc( testAccCheckFlowLogExists("aws_flow_log.test_flow_log", &flowLog), testAccCheckAWSFlowLogAttributes(&flowLog), @@ -31,6 +33,7 @@ func TestAccFlowLog_basic(t *testing.T) { func TestAccFlowLog_subnet(t *testing.T) { var flowLog ec2.FlowLog + lgn := os.Getenv("LOG_GROUP_NAME") resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -38,7 +41,7 @@ func TestAccFlowLog_subnet(t *testing.T) { CheckDestroy: testAccCheckFlowLogDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccFlowLogConfig_subnet, + Config: fmt.Sprintf(testAccFlowLogConfig_subnet, lgn), Check: resource.ComposeTestCheckFunc( testAccCheckFlowLogExists("aws_flow_log.test_flow_log_subnet", &flowLog), testAccCheckAWSFlowLogAttributes(&flowLog), @@ -152,7 +155,7 @@ resource "aws_flow_log" "test_flow_log" { resource "aws_flow_log" "test_flow_log_subnet" { # log_group_name needs to exist before hand # until we have a CloudWatch Log Group Resource - log_group_name = "tf-test-log-group" + log_group_name = "%s" iam_role_arn = "${aws_iam_role.test_role.arn}" subnet_id = "${aws_subnet.test_subnet.id}" traffic_type = "ALL" @@ -201,7 +204,7 @@ EOF resource "aws_flow_log" "test_flow_log_subnet" { # log_group_name needs to exist before hand # until we have a CloudWatch Log Group Resource - log_group_name = "tf-test-log-group" + log_group_name = "%s" iam_role_arn = "${aws_iam_role.test_role.arn}" subnet_id = "${aws_subnet.test_subnet.id}" traffic_type = "ALL"