provider/aws: Allow import of KMS key (#7599)

This commit is contained in:
Radek Simko 2016-07-12 08:49:33 +01:00 committed by Paul Stack
parent 40e05ecc33
commit 8fa75ea383
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,29 @@
package aws
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAWSKMSKey_importBasic(t *testing.T) {
resourceName := "aws_kms_key.foo"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSKmsKeyDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccAWSKmsKey,
},
resource.TestStep{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"deletion_window_in_days"},
},
},
})
}

View File

@ -19,6 +19,10 @@ func resourceAwsKmsKey() *schema.Resource {
Update: resourceAwsKmsKeyUpdate, Update: resourceAwsKmsKeyUpdate,
Delete: resourceAwsKmsKeyDelete, Delete: resourceAwsKmsKeyDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"arn": &schema.Schema{ "arn": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,