provider/aws: Preserve default retain_on_delete in cloudfront import (#13209)

Fixes: #10969
This commit is contained in:
Paul Stack 2017-03-31 14:34:51 +03:00 committed by GitHub
parent 5a37434bf1
commit e4e9d1e073
2 changed files with 6 additions and 5 deletions

View File

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

View File

@ -19,16 +19,13 @@ func TestAccAWSCloudFrontDistribution_importBasic(t *testing.T) {
Providers: testAccProviders, Providers: testAccProviders,
CheckDestroy: testAccCheckCloudFrontDistributionDestroy, CheckDestroy: testAccCheckCloudFrontDistributionDestroy,
Steps: []resource.TestStep{ Steps: []resource.TestStep{
resource.TestStep{ {
Config: testConfig, Config: testConfig,
}, },
resource.TestStep{ {
ResourceName: resourceName, ResourceName: resourceName,
ImportState: true, ImportState: true,
ImportStateVerify: true, ImportStateVerify: true,
// Ignore retain_on_delete since it doesn't come from the AWS
// API.
ImportStateVerifyIgnore: []string{"retain_on_delete"},
}, },
}, },
}) })