Skip to content

Commit 9a1e362

Browse files
authored
Merge pull request #26525 from hashicorp/td-ec2-classic-retirement-phase2
EC2-Classic retirement phase 2: Prevent creation of new EC2-Classic resources
2 parents 60ec508 + 86ba57c commit 9a1e362

35 files changed

+1237
-3089
lines changed

.changelog/26525.txt

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
```release-note:note
2+
resource/aws_default_vpc: With AWS's retirement of EC2-Classic the`enable_classiclink` and `enable_classiclink_dns_support` attributes have been deprecated and will be removed in a future version
3+
```
4+
5+
```release-note:note
6+
resource/aws_db_security_group: With AWS's retirement of EC2-Classic no new RDS DB Security Groups can be created
7+
```
8+
9+
```release-note:note
10+
resource/aws_redshift_security_group: With AWS's retirement of EC2-Classic no new Redshift Security Groups can be created
11+
```
12+
13+
```release-note:note
14+
resource/aws_elasticache_security_group: With AWS's retirement of EC2-Classic no new ElastiCache Security Groups can be created
15+
```
16+
17+
```release-note:note
18+
resource/aws_db_instance: With AWS's retirement of EC2-Classic no new RDS DB Instances can be created referencing RDS DB Security Groups
19+
```
20+
21+
```release-note:note
22+
resource/aws_redshift_cluster: With AWS's retirement of EC2-Classic no new Redshift Clusters can be created referencing Redshift Security Groups
23+
```
24+
25+
```release-note:note
26+
resource/aws_elasticache_cluster: With AWS's retirement of EC2-Classic no new ElastiCache Clusters can be created referencing ElastiCache Security Groups
27+
```
28+
29+
```release-note:note
30+
resource/aws_opsworks_stack: With AWS's retirement of EC2-Classic no new OpsWorks Stacks can be created without referencing a VPC
31+
```
32+
33+
```release-note:note
34+
resource/aws_launch_configuration: With AWS's retirement of EC2-Classic no new Auto Scaling Launch Configurations can be created referencing ClassicLink
35+
```
36+
37+
```release-note:note
38+
resource/aws_eip: With AWS's retirement of EC2-Classic no new non-VPC EC2 EIPs can be created
39+
```
40+
41+
```release-note:note
42+
resource/aws_vpc: With AWS's retirement of EC2-Classic no new VPCs can be created with ClassicLink enabled
43+
```
44+
45+
```release-note:note
46+
resource/aws_vpc_peering_connection: With AWS's retirement of EC2-Classic no new VPC Peering Connections can be created with ClassicLink options enabled
47+
```
48+
49+
```release-note:note
50+
resource/aws_vpc_peering_connection_options: With AWS's retirement of EC2-Classic no new VPC Peering Connection Options can be created with ClassicLink options enabled
51+
```
52+
53+
```release-note:note
54+
resource/aws_vpc_peering_connection_accepter: With AWS's retirement of EC2-Classic no VPC Peering Connections can be accepted with ClassicLink options enabled
55+
```
56+
57+
```release-note:note
58+
resource/aws_security_group: With AWS's retirement of EC2-Classic no new Security Groups can be created without referencing a VPC
59+
```

.changelog/26553.txt

-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
11
```release-note:bug
22
resource/aws_security_group: Fix complex dependency violations such as using a security group with an EMR cluster
33
```
4-
5-
```release-note:note
6-
resource/aws_security_group: With AWS's retirement of EC2-Classic, `aws_security_group` has been updated to remove support for EC2-Classic
7-
```
8-
9-
```release-note:note
10-
resource/aws_default_security_group: With AWS's retirement of EC2-Classic, `aws_default_security_group` has been updated to remove support for EC2-Classic
11-
```
12-
13-
```release-note:note
14-
resource/aws_security_group_rule: With AWS's retirement of EC2-Classic, `aws_security_group_rule` has been updated to remove support for EC2-Classic
15-
```

internal/service/autoscaling/launch_configuration.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package autoscaling
22

33
import ( // nosemgrep:ci.aws-sdk-go-multiple-service-imports
4-
54
"crypto/sha1"
65
"encoding/base64"
76
"encoding/hex"
7+
"errors"
88
"fmt"
99
"log"
1010

@@ -326,6 +326,14 @@ func resourceLaunchConfigurationCreate(d *schema.ResourceData, meta interface{})
326326
autoscalingconn := meta.(*conns.AWSClient).AutoScalingConn
327327
ec2conn := meta.(*conns.AWSClient).EC2Conn
328328

329+
if _, ok := d.GetOk("vpc_classic_link_id"); ok {
330+
return errors.New(`with the retirement of EC2-Classic no new Auto Scaling Launch Configurations can be created referencing ClassicLink`)
331+
}
332+
333+
if v, ok := d.GetOk("vpc_classic_link_security_groups"); ok && v.(*schema.Set).Len() > 0 {
334+
return errors.New(`with the retirement of EC2-Classic no new Auto Scaling Launch Configurations can be created referencing ClassicLink`)
335+
}
336+
329337
lcName := create.Name(d.Get("name").(string), d.Get("name_prefix").(string))
330338
input := autoscaling.CreateLaunchConfigurationInput{
331339
EbsOptimized: aws.Bool(d.Get("ebs_optimized").(bool)),
@@ -339,14 +347,6 @@ func resourceLaunchConfigurationCreate(d *schema.ResourceData, meta interface{})
339347
input.AssociatePublicIpAddress = aws.Bool(associatePublicIPAddress.True())
340348
}
341349

342-
if v, ok := d.GetOk("vpc_classic_link_id"); ok {
343-
input.ClassicLinkVPCId = aws.String(v.(string))
344-
}
345-
346-
if v, ok := d.GetOk("vpc_classic_link_security_groups"); ok && v.(*schema.Set).Len() > 0 {
347-
input.ClassicLinkVPCSecurityGroups = flex.ExpandStringSet(v.(*schema.Set))
348-
}
349-
350350
if v, ok := d.GetOk("iam_instance_profile"); ok {
351351
input.IamInstanceProfile = aws.String(v.(string))
352352
}

0 commit comments

Comments
 (0)