provider/aws: Support Import for `aws_vpc_endpoint`

```
make testacc TEST=./builtin/providers/aws
TESTARGS='-run=TestAccAWSVpcEndpoint_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSVpcEndpoint_
-timeout 120m
=== RUN   TestAccAWSVpcEndpoint_importBasic
--- PASS: TestAccAWSVpcEndpoint_importBasic (45.90s)
=== RUN   TestAccAWSVpcEndpoint_basic
--- PASS: TestAccAWSVpcEndpoint_basic (46.64s)
=== RUN   TestAccAWSVpcEndpoint_withRouteTableAndPolicy
--- PASS: TestAccAWSVpcEndpoint_withRouteTableAndPolicy (91.91s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    184.470s
```
This commit is contained in:
stack72 2016-06-23 02:48:59 +01:00
parent 004cec60b3
commit 3332f757cb
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,28 @@
package aws
import (
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAWSVpcEndpoint_importBasic(t *testing.T) {
resourceName := "aws_vpc_endpoint.second-private-s3"
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckVpcEndpointDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccVpcEndpointWithRouteTableAndPolicyConfig,
},
resource.TestStep{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

View File

@ -16,6 +16,10 @@ func resourceAwsVpcEndpoint() *schema.Resource {
Read: resourceAwsVPCEndpointRead, Read: resourceAwsVPCEndpointRead,
Update: resourceAwsVPCEndpointUpdate, Update: resourceAwsVPCEndpointUpdate,
Delete: resourceAwsVPCEndpointDelete, Delete: resourceAwsVPCEndpointDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{ Schema: map[string]*schema.Schema{
"policy": &schema.Schema{ "policy": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,