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

r/aws_launch_tamplate: Allow more resource values for tag specification #20409

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
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