Skip to content

Commit

Permalink
Merge pull request #20409 from gordonbondon/launch-tamplate-tag-spec-…
Browse files Browse the repository at this point in the history
…values

r/aws_launch_tamplate: Allow more resource values for tag specification
  • Loading branch information
ewbankkit authored Aug 4, 2021
2 parents 32fe8c9 + 2b1413b commit bd0c046
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .changelog/20409.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_launch_template: Allow all supported resource types `tag_specifications.resource_type`
```
11 changes: 3 additions & 8 deletions aws/resource_aws_launch_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,14 +595,9 @@ func resourceAwsLaunchTemplate() *schema.Resource {
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"resource_type": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice([]string{
ec2.ResourceTypeInstance,
ec2.ResourceTypeVolume,
ec2.ResourceTypeSpotInstancesRequest,
ec2.ResourceTypeElasticGpu,
}, false),
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringInSlice(ec2.ResourceType_Values(), false),
},
"tags": tagsSchema(),
},
Expand Down
10 changes: 9 additions & 1 deletion aws/resource_aws_launch_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ func TestAccAWSLaunchTemplate_data(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "placement.#", "1"),
resource.TestCheckResourceAttrSet(resourceName, "ram_disk_id"),
resource.TestCheckResourceAttr(resourceName, "vpc_security_group_ids.#", "1"),
resource.TestCheckResourceAttr(resourceName, "tag_specifications.#", "4"),
resource.TestCheckResourceAttr(resourceName, "tag_specifications.#", "5"),
),
},
{
Expand Down Expand Up @@ -1709,6 +1709,14 @@ resource "aws_launch_template" "test" {
Name = "test"
}
}
tag_specifications {
resource_type = "network-interface"
tags = {
Name = "test"
}
}
}
`, rName)) //lintignore:AWSAT002
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/launch_template.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ The tags to apply to the resources during launch. You can tag instances, volumes

Each `tag_specifications` block supports the following:

* `resource_type` - The type of resource to tag. Valid values are `instance`, `volume`, `elastic-gpu` and `spot-instances-request`.
* `resource_type` - The type of resource to tag.
* `tags` - A map of tags to assign to the resource.


Expand Down

0 comments on commit bd0c046

Please sign in to comment.