From 8f7c41cea26357276bf81dba34516157c39dd13b Mon Sep 17 00:00:00 2001 From: bill-rich Date: Wed, 10 Mar 2021 22:13:53 -0800 Subject: [PATCH] Remove Computed from `forwarded_values` --- .changelog/18042.txt | 3 +++ aws/resource_aws_cloudfront_distribution.go | 2 -- ...source_aws_cloudfront_distribution_test.go | 24 +++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 .changelog/18042.txt diff --git a/.changelog/18042.txt b/.changelog/18042.txt new file mode 100644 index 000000000000..a62ba19d4710 --- /dev/null +++ b/.changelog/18042.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_cloudfront_distribution: Allow `forwarded_values` to be set to empty when values were previously set +``` diff --git a/aws/resource_aws_cloudfront_distribution.go b/aws/resource_aws_cloudfront_distribution.go index 961a9ed6f23e..00c1d947908a 100644 --- a/aws/resource_aws_cloudfront_distribution.go +++ b/aws/resource_aws_cloudfront_distribution.go @@ -80,7 +80,6 @@ func resourceAwsCloudFrontDistribution() *schema.Resource { Type: schema.TypeList, Optional: true, MaxItems: 1, - Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "cookies": { @@ -257,7 +256,6 @@ func resourceAwsCloudFrontDistribution() *schema.Resource { "forwarded_values": { Type: schema.TypeList, Optional: true, - Computed: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ diff --git a/aws/resource_aws_cloudfront_distribution_test.go b/aws/resource_aws_cloudfront_distribution_test.go index b0d1cf3c1baa..86e6cf434263 100644 --- a/aws/resource_aws_cloudfront_distribution_test.go +++ b/aws/resource_aws_cloudfront_distribution_test.go @@ -364,6 +364,30 @@ func TestAccAWSCloudFrontDistribution_orderedCacheBehaviorCachePolicy(t *testing }) } +func TestAccAWSCloudFrontDistribution_forwardedValuesToCachePolicy(t *testing.T) { + var distribution cloudfront.Distribution + resourceName := "aws_cloudfront_distribution.main" + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckCloudFrontDistributionDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSCloudFrontDistributionOrderedCacheBehavior, + Check: resource.ComposeTestCheckFunc( + testAccCheckCloudFrontDistributionExists(resourceName, &distribution), + ), + }, + { + Config: testAccAWSCloudFrontDistributionOrderedCacheBehaviorCachePolicy, + Check: resource.ComposeTestCheckFunc( + testAccCheckCloudFrontDistributionExists(resourceName, &distribution), + ), + }, + }, + }) +} + func TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) },