Skip to content

Commit

Permalink
fix: ignore ipv6 metadata options on aws-iso
Browse files Browse the repository at this point in the history
  • Loading branch information
Casey Vockrodt committed Jul 11, 2022
1 parent f79cc52 commit 13a32c3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 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 @@ -1912,7 +1913,7 @@ func expandLaunchTemplateInstanceMetadataOptionsRequest(tfMap map[string]interfa
}
}

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

0 comments on commit 13a32c3

Please sign in to comment.