Skip to content

Commit

Permalink
add test to check change from vpc to domain
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsonaj committed May 25, 2023
1 parent 7a819fc commit f84fc21
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions internal/service/ec2/ec2_eip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,40 @@ func TestAccEC2EIP_disappears(t *testing.T) {
})
}

func TestAccEC2EIP_migrateVPCToDomain(t *testing.T) {
ctx := acctest.Context(t)
var conf ec2.Address
resourceName := "aws_eip.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, ec2.EndpointsID),
CheckDestroy: testAccCheckEIPDestroy(ctx),
Steps: []resource.TestStep{
{
ExternalProviders: map[string]resource.ExternalProvider{
"aws": {
Source: "hashicorp/aws",
VersionConstraint: "4.67.0",
},
},
Config: testAccEIPConfig_vpc,
Check: resource.ComposeTestCheckFunc(
testAccCheckEIPExists(ctx, resourceName, &conf),
resource.TestCheckResourceAttr(resourceName, "domain", "vpc"),
resource.TestCheckResourceAttrSet(resourceName, "public_ip"),
testAccCheckEIPPublicDNS(resourceName),
),
},
{
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
Config: testAccEIPConfig_basic,
PlanOnly: true,
},
},
})
}

func TestAccEC2EIP_noVPC(t *testing.T) {
ctx := acctest.Context(t)
var conf ec2.Address
Expand Down Expand Up @@ -742,6 +776,12 @@ resource "aws_eip" "test" {
}
`

const testAccEIPConfig_vpc = `
resource "aws_eip" "test" {
vpc = true
}
`

const testAccEIPConfig_noVPC = `
resource "aws_eip" "test" {
}
Expand Down

0 comments on commit f84fc21

Please sign in to comment.