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

resource/aws_dx_gateway: Remove automatic aws_dx_gateway_association import #14124

Merged
merged 1 commit into from
Jul 13, 2020
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
24 changes: 1 addition & 23 deletions aws/resource_aws_dx_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func resourceAwsDxGateway() *schema.Resource {
Read: resourceAwsDxGatewayRead,
Delete: resourceAwsDxGatewayDelete,
Importer: &schema.ResourceImporter{
State: resourceAwsDxGatewayImportState,
State: schema.ImportStatePassthrough,
},

Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -125,28 +125,6 @@ func resourceAwsDxGatewayDelete(d *schema.ResourceData, meta interface{}) error
return nil
}

func resourceAwsDxGatewayImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
conn := meta.(*AWSClient).dxconn

resp, err := conn.DescribeDirectConnectGatewayAssociations(&directconnect.DescribeDirectConnectGatewayAssociationsInput{
DirectConnectGatewayId: aws.String(d.Id()),
})
if err != nil {
return nil, fmt.Errorf("error reading Direct Connect gateway association: %s", err)
}

results := []*schema.ResourceData{d}
for _, assoc := range resp.DirectConnectGatewayAssociations {
d := resourceAwsDxGatewayAssociation().Data(nil)
d.SetType("aws_dx_gateway_association")
d.SetId(dxGatewayAssociationId(aws.StringValue(assoc.DirectConnectGatewayId), aws.StringValue(assoc.AssociatedGateway.Id)))
d.Set("dx_gateway_association_id", assoc.AssociationId)
results = append(results, d)
}

return results, nil
}

func dxGatewayStateRefresh(conn *directconnect.DirectConnect, dxgwId string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
resp, err := conn.DescribeDirectConnectGateways(&directconnect.DescribeDirectConnectGatewaysInput{
Expand Down
8 changes: 0 additions & 8 deletions aws/resource_aws_dx_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,6 @@ func TestAccAwsDxGateway_basic(t *testing.T) {
}

func TestAccAwsDxGateway_complex(t *testing.T) {
checkFn := func(s []*terraform.InstanceState) error {
if len(s) != 3 {
return fmt.Errorf("Got %d resources, expected 3. State: %#v", len(s), s)
}
return nil
}

rName1 := fmt.Sprintf("terraform-testacc-dxgwassoc-%d", acctest.RandInt())
rName2 := fmt.Sprintf("terraform-testacc-dxgwassoc-%d", acctest.RandInt())
rBgpAsn := randIntRange(64512, 65534)
Expand All @@ -167,7 +160,6 @@ func TestAccAwsDxGateway_complex(t *testing.T) {
{
ResourceName: resourceName,
ImportState: true,
ImportStateCheck: checkFn,
ImportStateVerify: true,
},
},
Expand Down
7 changes: 7 additions & 0 deletions website/docs/guides/version-3-upgrade.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Upgrade topics:
- [Provider Version Configuration](#provider-version-configuration)
- [Data Source: aws_availability_zones](#data-source-aws_availability_zones)
- [Data Source: aws_lambda_invocation](#data-source-aws_lambda_invocation)
- [Resource: aws_dx_gateway](#resource-aws_dx_gateway)
- [Resource: aws_emr_cluster](#resource-aws_emr_cluster)

<!-- /TOC -->
Expand Down Expand Up @@ -121,6 +122,12 @@ output "lambda_result" {
}
```

## Resource: aws_dx_gateway

### Removal of Automatic aws_dx_gateway_association Import

Previously when importing the `aws_dx_gateway` resource with the [`terraform import` command](/docs/commands/import.html), the Terraform AWS Provider would automatically attempt to import an associated `aws_dx_gateway_association` resource(s) as well. This automatic resource import has been removed. Use the [`aws_dx_gateway_association` resource import](/docs/providers/aws/r/dx_gateway_association.html#import) to import those resources separately.

## Resource: aws_emr_cluster

### core_instance_count Argument Removal
Expand Down