diff --git a/aws/resource_aws_dx_gateway.go b/aws/resource_aws_dx_gateway.go index 1fa399070296..563467c800df 100644 --- a/aws/resource_aws_dx_gateway.go +++ b/aws/resource_aws_dx_gateway.go @@ -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{ @@ -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{ diff --git a/aws/resource_aws_dx_gateway_test.go b/aws/resource_aws_dx_gateway_test.go index 4ad53bb19f8c..68f3b39c6974 100644 --- a/aws/resource_aws_dx_gateway_test.go +++ b/aws/resource_aws_dx_gateway_test.go @@ -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) @@ -167,7 +160,6 @@ func TestAccAwsDxGateway_complex(t *testing.T) { { ResourceName: resourceName, ImportState: true, - ImportStateCheck: checkFn, ImportStateVerify: true, }, }, diff --git a/website/docs/guides/version-3-upgrade.html.md b/website/docs/guides/version-3-upgrade.html.md index c0a4bf9b1c23..f2cb57094648 100644 --- a/website/docs/guides/version-3-upgrade.html.md +++ b/website/docs/guides/version-3-upgrade.html.md @@ -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) @@ -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