Skip to content

Commit

Permalink
Merge pull request #30966 from hashicorp/f-remove-ec2-classic-resourc…
Browse files Browse the repository at this point in the history
…es-and-attributes

EC2-Classic retirement: Remove deprecated resources and attributes
  • Loading branch information
ewbankkit committed Apr 26, 2023
2 parents 8195bc1 + 77c50a2 commit f4ca636
Show file tree
Hide file tree
Showing 57 changed files with 325 additions and 2,133 deletions.
87 changes: 87 additions & 0 deletions .changelog/30966.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
```release-note:breaking-change
provider: With the retirement of EC2-Classic the `aws_db_security_group` resource has been removed
```

```release-note:breaking-change
provider: With the retirement of EC2-Classic the `aws_elasticache_security_group` resource has been removed
```

```release-note:breaking-change
provider: With the retirement of EC2-Classic the `aws_redshift_security_group` resource has been removed
```

```release-note:breaking-change
resource/aws_db_instance: With the retirement of EC2-Classic the `security_group_names` attribute has been removed
```

```release-note:breaking-change
data-source/aws_db_instance: With the retirement of EC2-Classic the `db_security_groups` attribute has been removed
```

```release-note:breaking-change
resource/aws_elasticache_cluster: With the retirement of EC2-Classic the `security_group_names` attribute has been removed
```

```release-note:breaking-change
data-source/aws_elasticache_cluster: With the retirement of EC2-Classic the `security_group_names` attribute has been removed
```

```release-note:breaking-change
resource/aws_redshift_cluster: With the retirement of EC2-Classic the `cluster_security_groups` attribute has been removed
```

```release-note:breaking-change
data-source/aws_redshift_cluster: With the retirement of EC2-Classic the `cluster_security_groups` attribute has been removed
```

```release-note:breaking-change
resource/aws_launch_configuration: With the retirement of EC2-Classic the `vpc_classic_link_id` and `vpc_classic_link_security_groups` attributes have been removed
```

```release-note:breaking-change
data-source/aws_launch_configuration: With the retirement of EC2-Classic the `vpc_classic_link_id` and `vpc_classic_link_security_groups` attributes have been removed
```

```release-note:breaking-change
resource/aws_vpc_peering_connection: With the retirement of EC2-Classic the `allow_classic_link_to_remote_vpc` and `allow_vpc_to_remote_classic_link` attributes have been removed
```

```release-note:breaking-change
resource/aws_vpc_peering_connection_accepter: With the retirement of EC2-Classic the `allow_classic_link_to_remote_vpc` and `allow_vpc_to_remote_classic_link` attributes have been removed
```

```release-note:breaking-change
resource/aws_vpc_peering_connection_options: With the retirement of EC2-Classic the `allow_classic_link_to_remote_vpc` and `allow_vpc_to_remote_classic_link` attributes have been removed
```

```release-note:breaking-change
data-source/aws_vpc_peering_connection: With the retirement of EC2-Classic the `allow_classic_link_to_remote_vpc` and `allow_vpc_to_remote_classic_link` attributes have been removed
```

```release-note:bug
resource/aws_vpc_peering_connection: Fix crash in `vpcPeeringConnectionOptionsEqual`
```

```release-note:breaking-change
resource/aws_vpc: With the retirement of EC2-Classic the `enable_classiclink` and `enable_classiclink_dns_support` attributes have been removed
```

```release-note:breaking-change
resource/aws_default_vpc: With the retirement of EC2-Classic the `enable_classiclink` and `enable_classiclink_dns_support` attributes have been removed
```

```release-note:breaking-change
resource/aws_eip: With the retirement of EC2-Classic the `standard` domain is no longer supported
```

```release-note:breaking-change
resource/aws_eip_association: With the retirement of EC2-Classic the `standard` domain is no longer supported
```

```release-note:breaking-change
resource/aws_security_group: With the retirement of EC2-Classic non-VPC security groups are no longer supported
```

```release-note:breaking-change
resource/aws_security_group_rule: With the retirement of EC2-Classic non-VPC security groups are no longer supported
```
23 changes: 0 additions & 23 deletions internal/service/autoscaling/launch_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,19 +309,6 @@ func ResourceLaunchConfiguration() *schema.Resource {
return
},
},
"vpc_classic_link_id": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Deprecated: `With the retirement of EC2-Classic the vpc_classic_link_id attribute has been deprecated and will be removed in a future version.`,
},
"vpc_classic_link_security_groups": {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
Deprecated: `With the retirement of EC2-Classic the vpc_classic_link_security_groups attribute has been deprecated and will be removed in a future version.`,
},
},
}
}
Expand All @@ -331,14 +318,6 @@ func resourceLaunchConfigurationCreate(ctx context.Context, d *schema.ResourceDa
autoscalingconn := meta.(*conns.AWSClient).AutoScalingConn()
ec2conn := meta.(*conns.AWSClient).EC2Conn()

if _, ok := d.GetOk("vpc_classic_link_id"); ok {
return sdkdiag.AppendErrorf(diags, `with the retirement of EC2-Classic no new Auto Scaling Launch Configurations can be created referencing ClassicLink`)
}

if v, ok := d.GetOk("vpc_classic_link_security_groups"); ok && v.(*schema.Set).Len() > 0 {
return sdkdiag.AppendErrorf(diags, `with the retirement of EC2-Classic no new Auto Scaling Launch Configurations can be created referencing ClassicLink`)
}

lcName := create.Name(d.Get("name").(string), d.Get("name_prefix").(string))
input := autoscaling.CreateLaunchConfigurationInput{
EbsOptimized: aws.Bool(d.Get("ebs_optimized").(bool)),
Expand Down Expand Up @@ -497,8 +476,6 @@ func resourceLaunchConfigurationRead(ctx context.Context, d *schema.ResourceData
d.Set("user_data", userDataHashSum(v))
}
}
d.Set("vpc_classic_link_id", lc.ClassicLinkVPCId)
d.Set("vpc_classic_link_security_groups", aws.StringValueSlice(lc.ClassicLinkVPCSecurityGroups))

rootDeviceName, err := findImageRootDeviceName(ctx, ec2conn, d.Get("image_id").(string))

Expand Down
11 changes: 0 additions & 11 deletions internal/service/autoscaling/launch_configuration_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,6 @@ func DataSourceLaunchConfiguration() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"vpc_classic_link_id": {
Type: schema.TypeString,
Computed: true,
},
"vpc_classic_link_security_groups": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
},
}
}
Expand Down Expand Up @@ -232,8 +223,6 @@ func dataSourceLaunchConfigurationRead(ctx context.Context, d *schema.ResourceDa
d.Set("security_groups", aws.StringValueSlice(lc.SecurityGroups))
d.Set("spot_price", lc.SpotPrice)
d.Set("user_data", lc.UserData)
d.Set("vpc_classic_link_id", lc.ClassicLinkVPCId)
d.Set("vpc_classic_link_security_groups", aws.StringValueSlice(lc.ClassicLinkVPCSecurityGroups))

rootDeviceName, err := findImageRootDeviceName(ctx, ec2conn, d.Get("image_id").(string))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ func TestAccAutoScalingLaunchConfigurationDataSource_basic(t *testing.T) {
resource.TestCheckResourceAttrPair(datasourceName, "spot_price", resourceName, "spot_price"),
// Resource and data source user_data have differing representations in state.
resource.TestCheckResourceAttrSet(datasourceName, "user_data"),
resource.TestCheckResourceAttrPair(datasourceName, "vpc_classic_link_id", resourceName, "vpc_classic_link_id"),
resource.TestCheckResourceAttrPair(datasourceName, "vpc_classic_link_security_groups.#", resourceName, "vpc_classic_link_security_groups.#"),
),
},
},
Expand Down
2 changes: 0 additions & 2 deletions internal/service/autoscaling/launch_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ func TestAccAutoScalingLaunchConfiguration_basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "spot_price", ""),
resource.TestCheckNoResourceAttr(resourceName, "user_data"),
resource.TestCheckNoResourceAttr(resourceName, "user_data_base64"),
resource.TestCheckResourceAttr(resourceName, "vpc_classic_link_id", ""),
resource.TestCheckResourceAttr(resourceName, "vpc_classic_link_security_groups.#", "0"),
),
},
{
Expand Down
10 changes: 9 additions & 1 deletion internal/service/ec2/ec2_availability_zone_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"regexp"
"testing"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
Expand Down Expand Up @@ -187,7 +188,7 @@ func TestAccEC2AvailabilityZoneDataSource_zoneID(t *testing.T) {
})
}

func testAccPreCheckLocalZoneAvailable(ctx context.Context, t *testing.T) {
func testAccPreCheckLocalZoneAvailable(ctx context.Context, t *testing.T, groupNames ...string) {
conn := acctest.Provider.Meta().(*conns.AWSClient).EC2Conn()

input := &ec2.DescribeAvailabilityZonesInput{
Expand All @@ -197,6 +198,13 @@ func testAccPreCheckLocalZoneAvailable(ctx context.Context, t *testing.T) {
}),
}

if len(groupNames) > 0 {
input.Filters = append(input.Filters, &ec2.Filter{
Name: aws.String("group-name"),
Values: aws.StringSlice(groupNames),
})
}

output, err := tfec2.FindAvailabilityZones(ctx, conn, input)

if acctest.PreCheckSkipError(err) {
Expand Down
Loading

0 comments on commit f4ca636

Please sign in to comment.