Skip to content

Commit

Permalink
Merge pull request #2992 from ewbankkit/issue-2991
Browse files Browse the repository at this point in the history
terraform import aws_dx_lag and aws_dx_connection
  • Loading branch information
radeksimko authored Feb 15, 2018
2 parents 23c24f3 + 96ef187 commit 99241b8
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 0 deletions.
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
```

0 comments on commit 99241b8

Please sign in to comment.