From 0aedb7eae6841c3883b3aa667da897a8d3646854 Mon Sep 17 00:00:00 2001 From: clint shryock Date: Thu, 19 Nov 2015 16:19:49 -0600 Subject: [PATCH 1/3] mark snapshots as computed for ElastiCache clusters --- builtin/providers/aws/resource_aws_elasticache_cluster.go | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/providers/aws/resource_aws_elasticache_cluster.go b/builtin/providers/aws/resource_aws_elasticache_cluster.go index 18a4ddf41..d03ae89e8 100644 --- a/builtin/providers/aws/resource_aws_elasticache_cluster.go +++ b/builtin/providers/aws/resource_aws_elasticache_cluster.go @@ -141,6 +141,7 @@ func resourceAwsElasticacheCluster() *schema.Resource { "snapshot_window": &schema.Schema{ Type: schema.TypeString, Optional: true, + Computed: true, }, "snapshot_retention_limit": &schema.Schema{ From e91381c4e27d43940cfbf26b47070815363a62e3 Mon Sep 17 00:00:00 2001 From: clint shryock Date: Thu, 19 Nov 2015 16:24:17 -0600 Subject: [PATCH 2/3] error test when env var is not supplied --- builtin/providers/aws/resource_aws_flow_log_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtin/providers/aws/resource_aws_flow_log_test.go b/builtin/providers/aws/resource_aws_flow_log_test.go index 9f9ca0570..1ffedc3f0 100644 --- a/builtin/providers/aws/resource_aws_flow_log_test.go +++ b/builtin/providers/aws/resource_aws_flow_log_test.go @@ -34,6 +34,9 @@ func TestAccAWSFlowLog_basic(t *testing.T) { func TestAccAWSFlowLog_subnet(t *testing.T) { var flowLog ec2.FlowLog lgn := os.Getenv("LOG_GROUP_NAME") + if lgn == "" { + t.Fatalf("LOG_GROUP_NAME env var needed for TestAccAWSFlowLog_subnet") + } resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, From 325fd751eb003260bc7fb0402053f930b79db50b Mon Sep 17 00:00:00 2001 From: clint shryock Date: Thu, 19 Nov 2015 16:27:56 -0600 Subject: [PATCH 3/3] update TestAccAWSFlowLog_subnet to use new cloudwatch resource, not needing env var anymore --- builtin/providers/aws/resource_aws_flow_log_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/builtin/providers/aws/resource_aws_flow_log_test.go b/builtin/providers/aws/resource_aws_flow_log_test.go index 1ffedc3f0..02fb3cfd8 100644 --- a/builtin/providers/aws/resource_aws_flow_log_test.go +++ b/builtin/providers/aws/resource_aws_flow_log_test.go @@ -33,10 +33,6 @@ func TestAccAWSFlowLog_basic(t *testing.T) { func TestAccAWSFlowLog_subnet(t *testing.T) { var flowLog ec2.FlowLog - lgn := os.Getenv("LOG_GROUP_NAME") - if lgn == "" { - t.Fatalf("LOG_GROUP_NAME env var needed for TestAccAWSFlowLog_subnet") - } resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, @@ -44,7 +40,7 @@ func TestAccAWSFlowLog_subnet(t *testing.T) { CheckDestroy: testAccCheckFlowLogDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: fmt.Sprintf(testAccFlowLogConfig_subnet, lgn), + Config: testAccFlowLogConfig_subnet, Check: resource.ComposeTestCheckFunc( testAccCheckFlowLogExists("aws_flow_log.test_flow_log_subnet", &flowLog), testAccCheckAWSFlowLogAttributes(&flowLog), @@ -203,11 +199,14 @@ resource "aws_iam_role" "test_role" { } EOF } +resource "aws_cloudwatch_log_group" "foobar" { + name = "foo-bar" +} 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 = "%s" + log_group_name = "${aws_cloudwatch_log_group.foobar.name}" iam_role_arn = "${aws_iam_role.test_role.arn}" subnet_id = "${aws_subnet.test_subnet.id}" traffic_type = "ALL"