Skip to content

Commit

Permalink
resource/aws_launch_template: add support for "spot-instances-request…
Browse files Browse the repository at this point in the history
…" and "elastic-gpu" tag spec (#14662)

* add support for more tagging types

* Update website/docs/r/launch_template.html.markdown

Co-authored-by: Kit Ewbank <Kit_Ewbank@hotmail.com>

Co-authored-by: Kit Ewbank <Kit_Ewbank@hotmail.com>
  • Loading branch information
DrFaust92 and ewbankkit authored Aug 18, 2020
1 parent eb925b2 commit fb9bec2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
2 changes: 2 additions & 0 deletions aws/resource_aws_launch_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ func resourceAwsLaunchTemplate() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{
ec2.ResourceTypeInstance,
ec2.ResourceTypeVolume,
ec2.ResourceTypeSpotInstancesRequest,
ec2.ResourceTypeElasticGpu,
}, false),
},
"tags": tagsSchema(),
Expand Down
26 changes: 25 additions & 1 deletion aws/resource_aws_launch_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,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.#", "1"),
resource.TestCheckResourceAttr(resourceName, "tag_specifications.#", "4"),
),
},
{
Expand Down Expand Up @@ -1404,6 +1404,30 @@ resource "aws_launch_template" "test" {
Name = "test"
}
}
tag_specifications {
resource_type = "volume"
tags = {
Name = "test"
}
}
tag_specifications {
resource_type = "spot-instances-request"
tags = {
Name = "test"
}
}
tag_specifications {
resource_type = "elastic-gpu"
tags = {
Name = "test"
}
}
}
`, rName) //lintignore:AWSAT002
}
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/launch_template.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,11 @@ The `hibernation_options` block supports the following:

### Tag Specifications

The tags to apply to the resources during launch. You can tag instances and volumes. More information can be found in the [EC2 API documentation](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_LaunchTemplateTagSpecificationRequest.html).
The tags to apply to the resources during launch. You can tag instances, volumes, elastic GPUs and spot instance requests. More information can be found in the [EC2 API documentation](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_LaunchTemplateTagSpecificationRequest.html).

Each `tag_specifications` block supports the following:

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


Expand Down

0 comments on commit fb9bec2

Please sign in to comment.