Skip to content

Commit

Permalink
Merge pull request #30545 from Indresh2410/remove_default_values_laun…
Browse files Browse the repository at this point in the history
…ch_template

Remove default values present in  launch template
  • Loading branch information
nam054 authored May 23, 2023
2 parents f3d56e3 + 06b540f commit 5675259
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions internal/service/ec2/ec2_launch_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ func ResourceLaunchTemplate() *schema.Resource {
"http_protocol_ipv6": {
Type: schema.TypeString,
Optional: true,
Default: ec2.LaunchTemplateInstanceMetadataProtocolIpv6Disabled,
Computed: true,
ValidateFunc: validation.StringInSlice(ec2.LaunchTemplateInstanceMetadataProtocolIpv6_Values(), false),
},
"http_put_response_hop_limit": {
Expand All @@ -690,7 +690,7 @@ func ResourceLaunchTemplate() *schema.Resource {
"instance_metadata_tags": {
Type: schema.TypeString,
Optional: true,
Default: ec2.LaunchTemplateInstanceMetadataTagsStateDisabled,
Computed: true,
ValidateFunc: validation.StringInSlice(ec2.LaunchTemplateInstanceMetadataTagsState_Values(), false),
},
},
Expand Down
8 changes: 4 additions & 4 deletions internal/service/ec2/ec2_launch_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2930,8 +2930,8 @@ func TestAccEC2LaunchTemplate_metadataOptions(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_endpoint", "enabled"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_tokens", "required"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_put_response_hop_limit", "2"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_protocol_ipv6", "disabled"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.instance_metadata_tags", "disabled"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_protocol_ipv6", ""),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.instance_metadata_tags", ""),
),
},
{
Expand All @@ -2948,7 +2948,7 @@ func TestAccEC2LaunchTemplate_metadataOptions(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_tokens", "required"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_put_response_hop_limit", "2"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_protocol_ipv6", "enabled"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.instance_metadata_tags", "disabled"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.instance_metadata_tags", ""),
),
},
{
Expand Down Expand Up @@ -2981,7 +2981,7 @@ func TestAccEC2LaunchTemplate_metadataOptions(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_endpoint", "enabled"), //Setting any of the values in metadata options will set the http_endpoint to enabled, you will not see it via the Console, but will in the API for any instance made from the template
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_tokens", "required"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_put_response_hop_limit", "2"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_protocol_ipv6", "disabled"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.http_protocol_ipv6", "enabled"),
resource.TestCheckResourceAttr(resourceName, "metadata_options.0.instance_metadata_tags", "enabled"),
),
},
Expand Down
10 changes: 5 additions & 5 deletions website/docs/r/launch_template.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,11 @@ The metadata options for the instances.
The `metadata_options` block supports the following:
* `http_endpoint` - (Optional) Whether the metadata service is available. Can be `enabled` or `disabled`.
* `http_protocol_ipv6` - (Optional) Enables or disables the IPv6 endpoint for the instance metadata service. (Default: `disabled`).
* `http_put_response_hop_limit` - (Optional) The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from `1` to `64`.
* `http_tokens` - (Optional) Whether or not the metadata service requires session tokens, also referred to as _Instance Metadata Service Version 2 (IMDSv2)_. Can be `optional` or `required`.
* `instance_metadata_tags` - (Optional) Enables or disables access to instance tags from the instance metadata service. (Default: `disabled`).
* `http_endpoint` - (Optional) Whether the metadata service is available. Can be `"enabled"` or `"disabled"`. (Default: `"enabled"`).
* `http_tokens` - (Optional) Whether or not the metadata service requires session tokens, also referred to as _Instance Metadata Service Version 2 (IMDSv2)_. Can be `"optional"` or `"required"`. (Default: `"optional"`).
* `http_put_response_hop_limit` - (Optional) The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from `1` to `64`. (Default: `1`).
* `http_protocol_ipv6` - (Optional) Enables or disables the IPv6 endpoint for the instance metadata service. Can be `"enabled"` or `"disabled"`.
* `instance_metadata_tags` - (Optional) Enables or disables access to instance tags from the instance metadata service. Can be `"enabled"` or `"disabled"`.
For more information, see the documentation on the [Instance Metadata Service](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html).
Expand Down

0 comments on commit 5675259

Please sign in to comment.