diff --git a/aws/resource_aws_cloudwatch_event_archive.go b/aws/resource_aws_cloudwatch_event_archive.go index e2b48718056..747d629d452 100644 --- a/aws/resource_aws_cloudwatch_event_archive.go +++ b/aws/resource_aws_cloudwatch_event_archive.go @@ -18,6 +18,9 @@ func resourceAwsCloudWatchEventArchive() *schema.Resource { Read: resourceAwsCloudWatchEventArchiveRead, Update: resourceAwsCloudWatchEventArchiveUpdate, Delete: resourceAwsCloudWatchEventArchiveDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "archive_name": { @@ -82,9 +85,8 @@ func resourceAwsCloudWatchEventArchiveCreate(d *schema.ResourceData, meta interf func resourceAwsCloudWatchEventArchiveRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).cloudwatcheventsconn - archiveName := d.Get("archive_name").(string) input := &events.DescribeArchiveInput{ - ArchiveName: aws.String(archiveName), + ArchiveName: aws.String(d.Id()), } out, err := conn.DescribeArchive(input) diff --git a/aws/resource_aws_cloudwatch_event_archive_test.go b/aws/resource_aws_cloudwatch_event_archive_test.go index 93e28abbbd1..fff44dbc5c2 100644 --- a/aws/resource_aws_cloudwatch_event_archive_test.go +++ b/aws/resource_aws_cloudwatch_event_archive_test.go @@ -89,6 +89,11 @@ func TestAccAWSCloudWatchArchive_basic(t *testing.T) { testAccCheckResourceAttrRegionalARN(resourceName, "arn", "events", fmt.Sprintf("archive/%s", archiveName)), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, }, }) }