diff --git a/aws/import_aws_cloudfront_distribution.go b/aws/import_aws_cloudfront_distribution.go deleted file mode 100644 index a2635d47bb14..000000000000 --- a/aws/import_aws_cloudfront_distribution.go +++ /dev/null @@ -1,33 +0,0 @@ -package aws - -import ( - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/cloudfront" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" -) - -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) - d.Set("wait_for_deployment", true) - - conn := meta.(*AWSClient).cloudfrontconn - id := d.Id() - resp, err := conn.GetDistributionConfig(&cloudfront.GetDistributionConfigInput{ - Id: aws.String(id), - }) - - if err != nil { - return nil, err - } - - distConfig := resp.DistributionConfig - results := make([]*schema.ResourceData, 1) - err = flattenDistributionConfig(d, distConfig) - if err != nil { - return nil, err - } - results[0] = d - return results, nil -} diff --git a/aws/import_aws_db_event_subscription.go b/aws/import_aws_db_event_subscription.go deleted file mode 100644 index bdc31bad533f..000000000000 --- a/aws/import_aws_db_event_subscription.go +++ /dev/null @@ -1,17 +0,0 @@ -package aws - -import "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - -func resourceAwsDbEventSubscriptionImport( - d *schema.ResourceData, - meta interface{}) ([]*schema.ResourceData, error) { - - // The db event subscription Read function only needs the "name" of the event subscription - // in order to populate the necessary values. This takes the "id" from the supplied StateFunc - // and sets it as the "name" attribute, as described in the import documentation. This allows - // the Read function to actually succeed and set the ID of the resource - results := make([]*schema.ResourceData, 1) - d.Set("name", d.Id()) - results[0] = d - return results, nil -} diff --git a/aws/resource_aws_cloudfront_distribution.go b/aws/resource_aws_cloudfront_distribution.go index 08a313e1b8a0..c7b7bcfe63bb 100644 --- a/aws/resource_aws_cloudfront_distribution.go +++ b/aws/resource_aws_cloudfront_distribution.go @@ -22,7 +22,12 @@ func resourceAwsCloudFrontDistribution() *schema.Resource { Update: resourceAwsCloudFrontDistributionUpdate, Delete: resourceAwsCloudFrontDistributionDelete, Importer: &schema.ResourceImporter{ - State: resourceAwsCloudFrontDistributionImport, + State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + // Set non API attributes to their Default settings in the schema + d.Set("retain_on_delete", false) + d.Set("wait_for_deployment", true) + return []*schema.ResourceData{d}, nil + }, }, MigrateState: resourceAwsCloudFrontDistributionMigrateState, SchemaVersion: 1, diff --git a/aws/resource_aws_db_event_subscription.go b/aws/resource_aws_db_event_subscription.go index 0cb0edbbb2e4..dbee020bacfc 100644 --- a/aws/resource_aws_db_event_subscription.go +++ b/aws/resource_aws_db_event_subscription.go @@ -19,7 +19,10 @@ func resourceAwsDbEventSubscription() *schema.Resource { Update: resourceAwsDbEventSubscriptionUpdate, Delete: resourceAwsDbEventSubscriptionDelete, Importer: &schema.ResourceImporter{ - State: resourceAwsDbEventSubscriptionImport, + State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + d.Set("name", d.Id()) + return []*schema.ResourceData{d}, nil + }, }, Timeouts: &schema.ResourceTimeout{ Create: schema.DefaultTimeout(40 * time.Minute),