Skip to content

Commit 4124c8f

Browse files
committed
provider/aws: Preserve default retain_on_delete in cloudfront import
Fixes: #10969
1 parent b6a3840 commit 4124c8f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

builtin/providers/aws/import_aws_cloudfront_distribution.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import (
77
)
88

99
func resourceAwsCloudFrontDistributionImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
10+
// This is a non API attribute
11+
// We are merely setting this to the same value as the Default setting in the schema
12+
d.Set("retain_on_delete", false)
13+
1014
conn := meta.(*AWSClient).cloudfrontconn
1115
id := d.Id()
1216
resp, err := conn.GetDistributionConfig(&cloudfront.GetDistributionConfigInput{

builtin/providers/aws/import_aws_cloudfront_distribution_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@ func TestAccAWSCloudFrontDistribution_importBasic(t *testing.T) {
1919
Providers: testAccProviders,
2020
CheckDestroy: testAccCheckCloudFrontDistributionDestroy,
2121
Steps: []resource.TestStep{
22-
resource.TestStep{
22+
{
2323
Config: testConfig,
2424
},
25-
resource.TestStep{
25+
{
2626
ResourceName: resourceName,
2727
ImportState: true,
2828
ImportStateVerify: true,
29-
// Ignore retain_on_delete since it doesn't come from the AWS
30-
// API.
31-
ImportStateVerifyIgnore: []string{"retain_on_delete"},
3229
},
3330
},
3431
})

0 commit comments

Comments
 (0)