Skip to content

Commit

Permalink
add test to check for null tag values
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsonaj committed May 25, 2023
1 parent ee4d376 commit 3576c26
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions internal/service/ec2/vpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,28 @@ func TestAccVPC_tags_computed(t *testing.T) {
})
}

func TestAccVPC_tags_null(t *testing.T) {
ctx := acctest.Context(t)
var vpc ec2.Vpc
resourceName := "aws_vpc.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, ec2.EndpointsID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckVPCDestroy(ctx),
Steps: []resource.TestStep{
{
Config: testAccVPCConfig_tags_null,
Check: resource.ComposeTestCheckFunc(
acctest.CheckVPCExists(ctx, resourceName, &vpc),
resource.TestCheckResourceAttr(resourceName, "tags.%", "0"),
),
},
},
})
}

func TestAccVPC_DefaultTags_zeroValue(t *testing.T) {
ctx := acctest.Context(t)
var vpc ec2.Vpc
Expand Down Expand Up @@ -1139,6 +1161,16 @@ resource "aws_vpc" "test" {
}
`

const testAccVPCConfig_tags_null = `
resource "aws_vpc" "test" {
cidr_block = "10.1.0.0/16"
tags = {
Name = null
}
}
`

func testAccVPCConfig_ignoreChangesDynamicTagsMergedLocals(localTagKey1, localTagValue1 string) string {
return fmt.Sprintf(`
locals {
Expand Down

0 comments on commit 3576c26

Please sign in to comment.