Skip to content

Commit

Permalink
feat: add import support
Browse files Browse the repository at this point in the history
  • Loading branch information
heitorlessa committed Jan 26, 2021
1 parent 35b22df commit 5ab7d94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions aws/resource_aws_cloudwatch_event_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions aws/resource_aws_cloudwatch_event_archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
})
}
Expand Down

0 comments on commit 5ab7d94

Please sign in to comment.