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

Ignore IPv6 Metadata Options and Metadata Tags on aws-iso Partition #25778

Closed
wants to merge 2 commits into from
Closed
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
9 changes: 5 additions & 4 deletions internal/service/ec2/ec2_launch_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
Expand Down Expand Up @@ -1268,7 +1269,7 @@ func expandRequestLaunchTemplateData(conn *ec2.EC2, d *schema.ResourceData) (*ec
}

if v, ok := d.GetOk("metadata_options"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil {
apiObject.MetadataOptions = expandLaunchTemplateInstanceMetadataOptionsRequest(v.([]interface{})[0].(map[string]interface{}))
apiObject.MetadataOptions = expandLaunchTemplateInstanceMetadataOptionsRequest(v.([]interface{})[0].(map[string]interface{}), conn.PartitionID)
}

if v, ok := d.GetOk("monitoring"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil {
Expand Down Expand Up @@ -1886,7 +1887,7 @@ func expandLaunchTemplateLicenseConfigurationRequests(tfList []interface{}) []*e
return apiObjects
}

func expandLaunchTemplateInstanceMetadataOptionsRequest(tfMap map[string]interface{}) *ec2.LaunchTemplateInstanceMetadataOptionsRequest {
func expandLaunchTemplateInstanceMetadataOptionsRequest(tfMap map[string]interface{}, partition string) *ec2.LaunchTemplateInstanceMetadataOptionsRequest {
if tfMap == nil {
return nil
}
Expand All @@ -1906,13 +1907,13 @@ func expandLaunchTemplateInstanceMetadataOptionsRequest(tfMap map[string]interfa
apiObject.HttpPutResponseHopLimit = aws.Int64(int64(v))
}

if v, ok := tfMap["instance_metadata_tags"].(string); ok && v != "" {
if v, ok := tfMap["instance_metadata_tags"].(string); ok && v != "" && partition != endpoints.AwsIsoPartitionID {
apiObject.InstanceMetadataTags = aws.String(v)
}
}
}

if v, ok := tfMap["http_protocol_ipv6"].(string); ok && v != "" {
if v, ok := tfMap["http_protocol_ipv6"].(string); ok && v != "" && partition != endpoints.AwsIsoPartitionID {
apiObject.HttpProtocolIpv6 = aws.String(v)
}

Expand Down