diff --git a/internal/service/ec2/ec2_launch_template.go b/internal/service/ec2/ec2_launch_template.go index 0b11c7873b4..324794e68c8 100644 --- a/internal/service/ec2/ec2_launch_template.go +++ b/internal/service/ec2/ec2_launch_template.go @@ -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": { @@ -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), }, }, diff --git a/internal/service/ec2/ec2_launch_template_test.go b/internal/service/ec2/ec2_launch_template_test.go index 2db034581bb..7926425d5c7 100644 --- a/internal/service/ec2/ec2_launch_template_test.go +++ b/internal/service/ec2/ec2_launch_template_test.go @@ -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", ""), ), }, { @@ -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", ""), ), }, { @@ -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"), ), }, diff --git a/website/docs/r/launch_template.html.markdown b/website/docs/r/launch_template.html.markdown index 3da2fcc9dd7..13ae4cd081c 100644 --- a/website/docs/r/launch_template.html.markdown +++ b/website/docs/r/launch_template.html.markdown @@ -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).