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

[New Resource] aws_default_internet_gateway #37899

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
switcheroo for cp issue
  • Loading branch information
PeterSzegedi committed Jun 7, 2024
commit c605d419479d90e26f144efa20049921d9716abf
42 changes: 21 additions & 21 deletions internal/service/ec2/vpc_default_internet_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"github.com/hashicorp/terraform-provider-aws/names"
)

func TestAccVPCInternetGateway_basic(t *testing.T) {
func TestAccVPCDefaultInternetGateway_basic(t *testing.T) {
ctx := acctest.Context(t)
var v ec2.InternetGateway
resourceName := "aws_internet_gateway.test"
resourceName := "aws_default_internet_gateway.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
Expand All @@ -50,10 +50,10 @@ func TestAccVPCInternetGateway_basic(t *testing.T) {
})
}

func TestAccVPCInternetGateway_disappears(t *testing.T) {
func TestAccVPCDefaultInternetGateway_disappears(t *testing.T) {
ctx := acctest.Context(t)
var v ec2.InternetGateway
resourceName := "aws_internet_gateway.test"
resourceName := "aws_default_internet_gateway.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
Expand All @@ -73,10 +73,10 @@ func TestAccVPCInternetGateway_disappears(t *testing.T) {
})
}

func TestAccVPCInternetGateway_Attachment(t *testing.T) {
func TestAccVPCDefaultInternetGateway_Attachment(t *testing.T) {
ctx := acctest.Context(t)
var v ec2.InternetGateway
resourceName := "aws_internet_gateway.test"
resourceName := "aws_default_internet_gateway.test"
vpc1ResourceName := "aws_vpc.test1"
vpc2ResourceName := "aws_vpc.test2"
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
Expand Down Expand Up @@ -110,10 +110,10 @@ func TestAccVPCInternetGateway_Attachment(t *testing.T) {
})
}

func TestAccVPCInternetGateway_Tags(t *testing.T) {
func TestAccVPCDefaultInternetGateway_Tags(t *testing.T) {
ctx := acctest.Context(t)
var v ec2.InternetGateway
resourceName := "aws_internet_gateway.test"
resourceName := "aws_default_internet_gateway.test"
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)

resource.ParallelTest(t, resource.TestCase{
Expand Down Expand Up @@ -156,12 +156,12 @@ func TestAccVPCInternetGateway_Tags(t *testing.T) {
})
}

func testAccCheckInternetGatewayDestroy(ctx context.Context) resource.TestCheckFunc {
func testAccCheckDefaultInternetGatewayDestroy(ctx context.Context) resource.TestCheckFunc {
return func(s *terraform.State) error {
conn := acctest.Provider.Meta().(*conns.AWSClient).EC2Conn(ctx)

for _, rs := range s.RootModule().Resources {
if rs.Type != "aws_internet_gateway" {
if rs.Type != "aws_default_internet_gateway" {
continue
}

Expand All @@ -182,7 +182,7 @@ func testAccCheckInternetGatewayDestroy(ctx context.Context) resource.TestCheckF
}
}

func testAccCheckInternetGatewayExists(ctx context.Context, n string, v *ec2.InternetGateway) resource.TestCheckFunc {
func testAccCheckDefaultInternetGatewayExists(ctx context.Context, n string, v *ec2.InternetGateway) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
Expand All @@ -207,11 +207,11 @@ func testAccCheckInternetGatewayExists(ctx context.Context, n string, v *ec2.Int
}
}

const testAccVPCInternetGatewayConfig_basic = `
resource "aws_internet_gateway" "test" {}
const testAccVPCDefaultInternetGatewayConfig_basic = `
resource "aws_default_internet_gateway" "test" {}
`

func testAccVPCInternetGatewayConfig_attachment(rName string) string {
func testAccVPCDefaultInternetGatewayConfig_attachment(rName string) string {
return fmt.Sprintf(`
resource "aws_vpc" "test1" {
cidr_block = "10.1.0.0/16"
Expand All @@ -229,7 +229,7 @@ resource "aws_vpc" "test2" {
}
}

resource "aws_internet_gateway" "test" {
resource "aws_default_internet_gateway" "test" {
vpc_id = aws_vpc.test1.id

tags = {
Expand All @@ -239,7 +239,7 @@ resource "aws_internet_gateway" "test" {
`, rName)
}

func testAccVPCInternetGatewayConfig_attachmentUpdated(rName string) string {
func testAccVPCDefaultInternetGatewayConfig_attachmentUpdated(rName string) string {
return fmt.Sprintf(`
resource "aws_vpc" "test1" {
cidr_block = "10.1.0.0/16"
Expand All @@ -257,7 +257,7 @@ resource "aws_vpc" "test2" {
}
}

resource "aws_internet_gateway" "test" {
resource "aws_default_internet_gateway" "test" {
vpc_id = aws_vpc.test2.id

tags = {
Expand All @@ -267,19 +267,19 @@ resource "aws_internet_gateway" "test" {
`, rName)
}

func testAccVPCInternetGatewayConfig_tags1(rName, tagKey1, tagValue1 string) string {
func testAccVPCDefaultInternetGatewayConfig_tags1(rName, tagKey1, tagValue1 string) string {
return fmt.Sprintf(`
resource "aws_internet_gateway" "test" {
resource "aws_default_internet_gateway" "test" {
tags = {
%[2]q = %[3]q
}
}
`, rName, tagKey1, tagValue1)
}

func testAccVPCInternetGatewayConfig_tags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string {
func testAccVPCDefaultInternetGatewayConfig_tags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string {
return fmt.Sprintf(`
resource "aws_internet_gateway" "test" {
resource "aws_default_internet_gateway" "test" {
tags = {
%[2]q = %[3]q
%[4]q = %[5]q
Expand Down
42 changes: 21 additions & 21 deletions internal/service/ec2/vpc_internet_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import (
"github.com/hashicorp/terraform-provider-aws/names"
)

func TestAccVPCDefaultInternetGateway_basic(t *testing.T) {
func TestAccVPCInternetGateway_basic(t *testing.T) {
ctx := acctest.Context(t)
var v ec2.InternetGateway
resourceName := "aws_default_internet_gateway.test"
resourceName := "aws_internet_gateway.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
Expand All @@ -50,10 +50,10 @@ func TestAccVPCDefaultInternetGateway_basic(t *testing.T) {
})
}

func TestAccVPCDefaultInternetGateway_disappears(t *testing.T) {
func TestAccVPCInternetGateway_disappears(t *testing.T) {
ctx := acctest.Context(t)
var v ec2.InternetGateway
resourceName := "aws_default_internet_gateway.test"
resourceName := "aws_internet_gateway.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
Expand All @@ -73,10 +73,10 @@ func TestAccVPCDefaultInternetGateway_disappears(t *testing.T) {
})
}

func TestAccVPCDefaultInternetGateway_Attachment(t *testing.T) {
func TestAccVPCInternetGateway_Attachment(t *testing.T) {
ctx := acctest.Context(t)
var v ec2.InternetGateway
resourceName := "aws_default_internet_gateway.test"
resourceName := "aws_internet_gateway.test"
vpc1ResourceName := "aws_vpc.test1"
vpc2ResourceName := "aws_vpc.test2"
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
Expand Down Expand Up @@ -110,10 +110,10 @@ func TestAccVPCDefaultInternetGateway_Attachment(t *testing.T) {
})
}

func TestAccVPCDefaultInternetGateway_Tags(t *testing.T) {
func TestAccVPCInternetGateway_Tags(t *testing.T) {
ctx := acctest.Context(t)
var v ec2.InternetGateway
resourceName := "aws_default_internet_gateway.test"
resourceName := "aws_internet_gateway.test"
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)

resource.ParallelTest(t, resource.TestCase{
Expand Down Expand Up @@ -156,12 +156,12 @@ func TestAccVPCDefaultInternetGateway_Tags(t *testing.T) {
})
}

func testAccCheckDefaultInternetGatewayDestroy(ctx context.Context) resource.TestCheckFunc {
func testAccCheckInternetGatewayDestroy(ctx context.Context) resource.TestCheckFunc {
return func(s *terraform.State) error {
conn := acctest.Provider.Meta().(*conns.AWSClient).EC2Conn(ctx)

for _, rs := range s.RootModule().Resources {
if rs.Type != "aws_default_internet_gateway" {
if rs.Type != "aws_internet_gateway" {
continue
}

Expand All @@ -182,7 +182,7 @@ func testAccCheckDefaultInternetGatewayDestroy(ctx context.Context) resource.Tes
}
}

func testAccCheckDefaultInternetGatewayExists(ctx context.Context, n string, v *ec2.InternetGateway) resource.TestCheckFunc {
func testAccCheckInternetGatewayExists(ctx context.Context, n string, v *ec2.InternetGateway) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
Expand All @@ -207,11 +207,11 @@ func testAccCheckDefaultInternetGatewayExists(ctx context.Context, n string, v *
}
}

const testAccVPCDefaultInternetGatewayConfig_basic = `
resource "aws_default_internet_gateway" "test" {}
const testAccVPCInternetGatewayConfig_basic = `
resource "aws_internet_gateway" "test" {}
`

func testAccVPCDefaultInternetGatewayConfig_attachment(rName string) string {
func testAccVPCInternetGatewayConfig_attachment(rName string) string {
return fmt.Sprintf(`
resource "aws_vpc" "test1" {
cidr_block = "10.1.0.0/16"
Expand All @@ -229,7 +229,7 @@ resource "aws_vpc" "test2" {
}
}

resource "aws_default_internet_gateway" "test" {
resource "aws_internet_gateway" "test" {
vpc_id = aws_vpc.test1.id

tags = {
Expand All @@ -239,7 +239,7 @@ resource "aws_default_internet_gateway" "test" {
`, rName)
}

func testAccVPCDefaultInternetGatewayConfig_attachmentUpdated(rName string) string {
func testAccVPCInternetGatewayConfig_attachmentUpdated(rName string) string {
return fmt.Sprintf(`
resource "aws_vpc" "test1" {
cidr_block = "10.1.0.0/16"
Expand All @@ -257,7 +257,7 @@ resource "aws_vpc" "test2" {
}
}

resource "aws_default_internet_gateway" "test" {
resource "aws_internet_gateway" "test" {
vpc_id = aws_vpc.test2.id

tags = {
Expand All @@ -267,19 +267,19 @@ resource "aws_default_internet_gateway" "test" {
`, rName)
}

func testAccVPCDefaultInternetGatewayConfig_tags1(rName, tagKey1, tagValue1 string) string {
func testAccVPCInternetGatewayConfig_tags1(rName, tagKey1, tagValue1 string) string {
return fmt.Sprintf(`
resource "aws_default_internet_gateway" "test" {
resource "aws_internet_gateway" "test" {
tags = {
%[2]q = %[3]q
}
}
`, rName, tagKey1, tagValue1)
}

func testAccVPCDefaultInternetGatewayConfig_tags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string {
func testAccVPCInternetGatewayConfig_tags2(rName, tagKey1, tagValue1, tagKey2, tagValue2 string) string {
return fmt.Sprintf(`
resource "aws_default_internet_gateway" "test" {
resource "aws_internet_gateway" "test" {
tags = {
%[2]q = %[3]q
%[4]q = %[5]q
Expand Down