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

Update aws_launch_template schema(ipv6 addr count) #5771

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion aws/resource_aws_launch_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func resourceAwsLaunchTemplate() *schema.Resource {
},
"ipv6_address_count": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
},
"ipv6_addresses": {
Type: schema.TypeSet,
Expand Down
40 changes: 40 additions & 0 deletions aws/resource_aws_launch_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,29 @@ func TestAccAWSLaunchTemplate_networkInterface_ipv6Addresses(t *testing.T) {
})
}

func TestAccAWSLaunchTemplate_networkInterface_ipv6_count(t *testing.T) {
var template ec2.LaunchTemplate
resName := "aws_launch_template.foo"
rInt := acctest.RandInt()

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSLaunchTemplateDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSLaunchTemplateConfig_ipv6_count(rInt),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSLaunchTemplateExists(resName, &template),
resource.TestCheckResourceAttr(resName, "default_version", "1"),
resource.TestCheckResourceAttr(resName, "latest_version", "1"),
resource.TestCheckResourceAttr(resName, "network_interfaces.#", "1"),
),
},
},
})
}

func testAccCheckAWSLaunchTemplateExists(n string, t *ec2.LaunchTemplate) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
Expand Down Expand Up @@ -383,6 +406,23 @@ resource "aws_launch_template" "foo" {
`, rInt)
}

func testAccAWSLaunchTemplateConfig_ipv6_count(rInt int) string {
return fmt.Sprintf(`
resource "aws_launch_template" "foo" {
name = "set_ipv6_count_foo_%d"

network_interfaces {
ipv6_address_count = 1
}

tags {
foo = "bar",
ipv6_count = "1",
}
}
`, rInt)
}

func testAccAWSLaunchTemplateConfig_BlockDeviceMappings_EBS(rName string) string {
return fmt.Sprintf(`
data "aws_ami" "test" {
Expand Down