diff --git a/aws/import_aws_dx_connection_test.go b/aws/import_aws_dx_connection_test.go new file mode 100644 index 00000000000..022da657198 --- /dev/null +++ b/aws/import_aws_dx_connection_test.go @@ -0,0 +1,29 @@ +package aws + +import ( + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAwsDxConnection_importBasic(t *testing.T) { + resourceName := "aws_dx_connection.hoge" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsDxConnectionDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccDxConnectionConfig(acctest.RandString(5)), + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/aws/import_aws_dx_lag_test.go b/aws/import_aws_dx_lag_test.go new file mode 100644 index 00000000000..3417437f9eb --- /dev/null +++ b/aws/import_aws_dx_lag_test.go @@ -0,0 +1,30 @@ +package aws + +import ( + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAwsDxLag_importBasic(t *testing.T) { + resourceName := "aws_dx_lag.hoge" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsDxLagDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccDxLagConfig(acctest.RandString(5)), + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"force_destroy"}, + }, + }, + }) +} diff --git a/aws/resource_aws_dx_connection.go b/aws/resource_aws_dx_connection.go index fa3a955e3fe..0dc1066256b 100644 --- a/aws/resource_aws_dx_connection.go +++ b/aws/resource_aws_dx_connection.go @@ -18,6 +18,9 @@ func resourceAwsDxConnection() *schema.Resource { Read: resourceAwsDxConnectionRead, Update: resourceAwsDxConnectionUpdate, Delete: resourceAwsDxConnectionDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "arn": { diff --git a/aws/resource_aws_dx_lag.go b/aws/resource_aws_dx_lag.go index 7aba3410405..7b426d4b37e 100644 --- a/aws/resource_aws_dx_lag.go +++ b/aws/resource_aws_dx_lag.go @@ -18,6 +18,9 @@ func resourceAwsDxLag() *schema.Resource { Read: resourceAwsDxLagRead, Update: resourceAwsDxLagUpdate, Delete: resourceAwsDxLagDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "arn": { diff --git a/website/docs/r/dx_connection.html.markdown b/website/docs/r/dx_connection.html.markdown index 49c47cee5a4..1e7bacbfd90 100644 --- a/website/docs/r/dx_connection.html.markdown +++ b/website/docs/r/dx_connection.html.markdown @@ -35,3 +35,11 @@ The following attributes are exported: * `id` - The ID of the connection. * `arn` - The ARN of the connection. + +## Import + +Direct Connect connections can be imported using the `connection id`, e.g. + +``` +$ terraform import aws_dx_connection.test_connection dxcon-ffre0ec3 +``` diff --git a/website/docs/r/dx_lag.html.markdown b/website/docs/r/dx_lag.html.markdown index 27c91d745c5..d1c8c2672e2 100644 --- a/website/docs/r/dx_lag.html.markdown +++ b/website/docs/r/dx_lag.html.markdown @@ -39,3 +39,11 @@ The following attributes are exported: * `id` - The ID of the LAG. * `arn` - The ARN of the LAG. + +## Import + +Direct Connect LAGs can be imported using the `lag id`, e.g. + +``` +$ terraform import aws_dx_lag.test_lag dxlag-fgnsp5rq +```