Skip to content

Commit a414939

Browse files
authored
Merge pull request #26786 from hashicorp/td-ec2-classic-retirement-phase3
EC2-Classic retirement phase 3: Remove acceptance test configurations
2 parents d24492d + 593fd4b commit a414939

File tree

4 files changed

+0
-308
lines changed

4 files changed

+0
-308
lines changed

internal/acctest/ec2_classic.go

-101
This file was deleted.

internal/service/autoscaling/launch_configuration_test.go

-91
Original file line numberDiff line numberDiff line change
@@ -342,41 +342,6 @@ func TestAccAutoScalingLaunchConfiguration_withSpotPrice(t *testing.T) {
342342
})
343343
}
344344

345-
func TestAccAutoScalingLaunchConfiguration_withVPCClassicLink(t *testing.T) {
346-
var vpc ec2.Vpc
347-
var group ec2.SecurityGroup
348-
var conf autoscaling.LaunchConfiguration
349-
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
350-
resourceName := "aws_launch_configuration.test"
351-
vpcResourceName := "aws_vpc.test"
352-
sgResourceName := "aws_security_group.test"
353-
354-
resource.ParallelTest(t, resource.TestCase{
355-
PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckEC2Classic(t) },
356-
ErrorCheck: acctest.ErrorCheck(t, autoscaling.EndpointsID),
357-
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
358-
CheckDestroy: testAccCheckLaunchConfigurationDestroy,
359-
Steps: []resource.TestStep{
360-
{
361-
Config: testAccLaunchConfigurationConfig_vpcClassicLink(rName),
362-
Check: resource.ComposeTestCheckFunc(
363-
testAccCheckLaunchConfigurationExists(resourceName, &conf),
364-
acctest.CheckVPCExists(vpcResourceName, &vpc),
365-
testAccCheckSecurityGroupExists(sgResourceName, &group),
366-
resource.TestCheckResourceAttrPair(resourceName, "vpc_classic_link_id", vpcResourceName, "id"),
367-
resource.TestCheckResourceAttr(resourceName, "vpc_classic_link_security_groups.#", "1"),
368-
resource.TestCheckTypeSetElemAttrPair(resourceName, "vpc_classic_link_security_groups.*", sgResourceName, "id"),
369-
),
370-
},
371-
{
372-
ResourceName: resourceName,
373-
ImportState: true,
374-
ImportStateVerify: true,
375-
},
376-
},
377-
})
378-
}
379-
380345
func TestAccAutoScalingLaunchConfiguration_withIAMProfile(t *testing.T) {
381346
var conf autoscaling.LaunchConfiguration
382347
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
@@ -873,31 +838,6 @@ func testAccCheckInstanceHasPublicIPAddress(group *autoscaling.Group, idx int, e
873838
}
874839
}
875840

876-
func testAccCheckSecurityGroupExists(n string, v *ec2.SecurityGroup) resource.TestCheckFunc {
877-
return func(s *terraform.State) error {
878-
rs, ok := s.RootModule().Resources[n]
879-
if !ok {
880-
return fmt.Errorf("Not found: %s", n)
881-
}
882-
883-
if rs.Primary.ID == "" {
884-
return fmt.Errorf("No EC2 Security Group ID is set")
885-
}
886-
887-
conn := acctest.Provider.Meta().(*conns.AWSClient).EC2Conn
888-
889-
output, err := tfec2.FindSecurityGroupByID(conn, rs.Primary.ID)
890-
891-
if err != nil {
892-
return err
893-
}
894-
895-
*v = *output
896-
897-
return nil
898-
}
899-
}
900-
901841
func testAccLaunchConfigurationConfig_basic(rName string) string {
902842
return acctest.ConfigCompose(acctest.ConfigLatestAmazonLinuxHVMEBSAMI(), fmt.Sprintf(`
903843
resource "aws_launch_configuration" "test" {
@@ -1056,37 +996,6 @@ resource "aws_launch_configuration" "test" {
1056996
`, rName))
1057997
}
1058998

1059-
func testAccLaunchConfigurationConfig_vpcClassicLink(rName string) string {
1060-
return acctest.ConfigCompose(acctest.ConfigLatestAmazonLinuxHVMEBSAMI(), fmt.Sprintf(`
1061-
resource "aws_vpc" "test" {
1062-
cidr_block = "10.0.0.0/16"
1063-
enable_classiclink = true
1064-
1065-
tags = {
1066-
Name = %[1]q
1067-
}
1068-
}
1069-
1070-
resource "aws_security_group" "test" {
1071-
name = %[1]q
1072-
vpc_id = aws_vpc.test.id
1073-
1074-
tags = {
1075-
Name = %[1]q
1076-
}
1077-
}
1078-
1079-
resource "aws_launch_configuration" "test" {
1080-
name = %[1]q
1081-
image_id = data.aws_ami.amzn-ami-minimal-hvm-ebs.id
1082-
instance_type = "t2.micro"
1083-
1084-
vpc_classic_link_id = aws_vpc.test.id
1085-
vpc_classic_link_security_groups = [aws_security_group.test.id]
1086-
}
1087-
`, rName))
1088-
}
1089-
1090999
func testAccLaunchConfigurationConfig_iamProfile(rName string) string {
10911000
return acctest.ConfigCompose(acctest.ConfigLatestAmazonLinuxHVMEBSAMI(), fmt.Sprintf(`
10921001
resource "aws_iam_role" "test" {

internal/service/ec2/ec2_eip_association_test.go

-61
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"strings"
66
"testing"
77

8-
"github.com/aws/aws-sdk-go/aws/endpoints"
98
"github.com/aws/aws-sdk-go/service/ec2"
109
sdkacctest "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
1110
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -146,43 +145,6 @@ func TestAccEC2EIPAssociation_spotInstance(t *testing.T) {
146145
})
147146
}
148147

149-
func TestAccEC2EIPAssociation_classic(t *testing.T) {
150-
var a ec2.Address
151-
resourceName := "aws_eip_association.test"
152-
153-
resource.ParallelTest(t, resource.TestCase{
154-
PreCheck: func() {
155-
acctest.PreCheck(t)
156-
acctest.PreCheckEC2Classic(t)
157-
// Force to us-east-1 so that testAccCheckEIPAssociationExists/testAccCheckEIPAssociationDestroy work correctly.
158-
acctest.PreCheckRegion(t, endpoints.UsEast1RegionID)
159-
},
160-
ErrorCheck: acctest.ErrorCheck(t, ec2.EndpointsID),
161-
CheckDestroy: testAccCheckEIPAssociationDestroy,
162-
Steps: []resource.TestStep{
163-
// Create the EC2-Classic Instance and ENI with the last version that supports that.
164-
{
165-
ExternalProviders: map[string]resource.ExternalProvider{
166-
"aws": {
167-
Source: "hashicorp/aws",
168-
VersionConstraint: "4.28.0",
169-
},
170-
},
171-
Config: testAccEIPAssociationConfig_classicNoAssociation(),
172-
},
173-
{
174-
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
175-
Config: testAccEIPAssociationConfig_classicWithAssociation(),
176-
Check: resource.ComposeTestCheckFunc(
177-
testAccCheckEIPAssociationExists(resourceName, &a),
178-
resource.TestCheckResourceAttr(resourceName, "allocation_id", ""),
179-
resource.TestCheckResourceAttrSet(resourceName, "public_ip"),
180-
),
181-
},
182-
},
183-
})
184-
}
185-
186148
func testAccCheckEIPAssociationExists(n string, v *ec2.Address) resource.TestCheckFunc {
187149
return func(s *terraform.State) error {
188150
rs, ok := s.RootModule().Resources[n]
@@ -421,26 +383,3 @@ resource "aws_eip_association" "test" {
421383
}
422384
`, rName, publicKey))
423385
}
424-
425-
func testAccEIPAssociationConfig_classicNoAssociation() string {
426-
return acctest.ConfigCompose(
427-
testAccLatestAmazonLinuxPVEBSAMIConfig(),
428-
acctest.AvailableEC2InstanceTypeForRegion("t1.micro", "m3.medium", "m3.large", "c3.large", "r3.large"),
429-
`
430-
resource "aws_instance" "test" {
431-
ami = data.aws_ami.amzn-ami-minimal-pv-ebs.id
432-
instance_type = data.aws_ec2_instance_type_offering.available.instance_type
433-
}
434-
435-
resource "aws_eip" "test" {}
436-
`)
437-
}
438-
439-
func testAccEIPAssociationConfig_classicWithAssociation() string {
440-
return acctest.ConfigCompose(testAccEIPAssociationConfig_classicNoAssociation(), `
441-
resource "aws_eip_association" "test" {
442-
public_ip = aws_eip.test.id
443-
instance_id = aws_instance.test.id
444-
}
445-
`)
446-
}

internal/service/ec2/ec2_eip_test.go

-55
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"strings"
88
"testing"
99

10-
"github.com/aws/aws-sdk-go/aws/endpoints"
1110
"github.com/aws/aws-sdk-go/service/ec2"
1211
sdkacctest "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
1312
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
@@ -622,44 +621,6 @@ func TestAccEC2EIP_BYOIPAddress_customWithPublicIPv4Pool(t *testing.T) {
622621
})
623622
}
624623

625-
func TestAccEC2EIP_Instance_ec2Classic(t *testing.T) {
626-
resourceName := "aws_eip.test"
627-
var conf ec2.Address
628-
629-
resource.ParallelTest(t, resource.TestCase{
630-
PreCheck: func() {
631-
acctest.PreCheck(t)
632-
acctest.PreCheckEC2Classic(t)
633-
// Force to us-east-1 so that testAccCheckEIPExists/testAccCheckEIPDestroy work correctly.
634-
acctest.PreCheckRegion(t, endpoints.UsEast1RegionID)
635-
},
636-
ErrorCheck: acctest.ErrorCheck(t, ec2.EndpointsID),
637-
CheckDestroy: testAccCheckEIPDestroy,
638-
Steps: []resource.TestStep{
639-
// Create the EC2-Classic Instance and ENI with the last version that supports that.
640-
{
641-
ExternalProviders: map[string]resource.ExternalProvider{
642-
"aws": {
643-
Source: "hashicorp/aws",
644-
VersionConstraint: "4.28.0",
645-
},
646-
},
647-
Config: testAccEIPConfig_instanceClassic(),
648-
Check: resource.ComposeTestCheckFunc(
649-
resource.TestCheckResourceAttr(resourceName, "domain", ec2.DomainTypeStandard),
650-
),
651-
},
652-
{
653-
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
654-
Config: testAccEIPConfig_instanceClassic(),
655-
Check: resource.ComposeTestCheckFunc(
656-
testAccCheckEIPExists(resourceName, &conf),
657-
),
658-
},
659-
},
660-
})
661-
}
662-
663624
func testAccCheckEIPExists(n string, v *ec2.Address) resource.TestCheckFunc {
664625
return func(s *terraform.State) error {
665626
rs, ok := s.RootModule().Resources[n]
@@ -1235,19 +1196,3 @@ resource "aws_eip" "test" {
12351196
}
12361197
`, rName, address, poolName)
12371198
}
1238-
1239-
func testAccEIPConfig_instanceClassic() string {
1240-
return acctest.ConfigCompose(
1241-
testAccLatestAmazonLinuxPVEBSAMIConfig(),
1242-
acctest.AvailableEC2InstanceTypeForRegion("t1.micro", "m3.medium", "m3.large", "c3.large", "r3.large"),
1243-
`
1244-
resource "aws_instance" "test" {
1245-
ami = data.aws_ami.amzn-ami-minimal-pv-ebs.id
1246-
instance_type = data.aws_ec2_instance_type_offering.available.instance_type
1247-
}
1248-
1249-
resource "aws_eip" "test" {
1250-
instance = aws_instance.test.id
1251-
}
1252-
`)
1253-
}

0 commit comments

Comments
 (0)