diff --git a/builtin/providers/aws/import_aws_subnet_test.go b/builtin/providers/aws/import_aws_subnet_test.go new file mode 100644 index 000000000..c08e4f7ed --- /dev/null +++ b/builtin/providers/aws/import_aws_subnet_test.go @@ -0,0 +1,28 @@ +package aws + +import ( + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAWSSubnet_importBasic(t *testing.T) { + resourceName := "aws_subnet.foo" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckSubnetDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccSubnetConfig, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/aws/resource_aws_subnet.go b/builtin/providers/aws/resource_aws_subnet.go index 34937c3c0..b9d6c42ed 100644 --- a/builtin/providers/aws/resource_aws_subnet.go +++ b/builtin/providers/aws/resource_aws_subnet.go @@ -18,6 +18,9 @@ func resourceAwsSubnet() *schema.Resource { Read: resourceAwsSubnetRead, Update: resourceAwsSubnetUpdate, Delete: resourceAwsSubnetDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "vpc_id": &schema.Schema{