Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

terraform import aws_dx_lag and aws_dx_connection #2992

Merged
merged 1 commit into from
Feb 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions aws/import_aws_dx_connection_test.go
Original file line number Diff line number Diff line change
@@ -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,
},
},
})
}
30 changes: 30 additions & 0 deletions aws/import_aws_dx_lag_test.go
Original file line number Diff line number Diff line change
@@ -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"},
},
},
})
}
3 changes: 3 additions & 0 deletions aws/resource_aws_dx_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 3 additions & 0 deletions aws/resource_aws_dx_lag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 8 additions & 0 deletions website/docs/r/dx_connection.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
8 changes: 8 additions & 0 deletions website/docs/r/dx_lag.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
```