From 19e29c29447bcdf6bdd3f1dc05ecd73e51f940c9 Mon Sep 17 00:00:00 2001 From: Jake Champlin Date: Tue, 9 May 2017 12:17:27 -0400 Subject: [PATCH 1/2] provider/aws: Use helper methods for checking partition --- builtin/providers/aws/resource_aws_cloudwatch_log_group.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builtin/providers/aws/resource_aws_cloudwatch_log_group.go b/builtin/providers/aws/resource_aws_cloudwatch_log_group.go index 8e7d09d7a95c..72a868bc52d8 100644 --- a/builtin/providers/aws/resource_aws_cloudwatch_log_group.go +++ b/builtin/providers/aws/resource_aws_cloudwatch_log_group.go @@ -109,7 +109,7 @@ func resourceAwsCloudWatchLogGroupRead(d *schema.ResourceData, meta interface{}) d.Set("retention_in_days", lg.RetentionInDays) } - if meta.(*AWSClient).partition != "aws-us-gov" { + if meta.(*AWSClient).IsChinaCloud() || meta.(*AWSClient).IsGovCloud() { tags, err := flattenCloudWatchTags(d, conn) if err != nil { return err @@ -172,7 +172,9 @@ func resourceAwsCloudWatchLogGroupUpdate(d *schema.ResourceData, meta interface{ } } - if meta.(*AWSClient).partition != "aws-us-gov" && d.HasChange("tags") { + restricted := meta.(*AWSClient).IsChinaCloud() || meta.(*AWSClient).IsGovCloud() + + if !restricted && d.HasChange("tags") { oraw, nraw := d.GetChange("tags") o := oraw.(map[string]interface{}) n := nraw.(map[string]interface{}) From 67ea7a3a0862c60e3a91b398b440cb015c867ee5 Mon Sep 17 00:00:00 2001 From: Jake Champlin Date: Tue, 9 May 2017 12:19:50 -0400 Subject: [PATCH 2/2] reverse if statement --- builtin/providers/aws/resource_aws_cloudwatch_log_group.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/providers/aws/resource_aws_cloudwatch_log_group.go b/builtin/providers/aws/resource_aws_cloudwatch_log_group.go index 72a868bc52d8..886d0a52a461 100644 --- a/builtin/providers/aws/resource_aws_cloudwatch_log_group.go +++ b/builtin/providers/aws/resource_aws_cloudwatch_log_group.go @@ -109,7 +109,7 @@ func resourceAwsCloudWatchLogGroupRead(d *schema.ResourceData, meta interface{}) d.Set("retention_in_days", lg.RetentionInDays) } - if meta.(*AWSClient).IsChinaCloud() || meta.(*AWSClient).IsGovCloud() { + if !meta.(*AWSClient).IsChinaCloud() && !meta.(*AWSClient).IsGovCloud() { tags, err := flattenCloudWatchTags(d, conn) if err != nil { return err