Skip to content

Commit

Permalink
Corrections.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Feb 3, 2025
1 parent 45af483 commit 6e98ee7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .changelog/41184.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
```release-note:enhancement
resource/ec2_launch_template: Add `connection_tracking_specification` argument block to `network_interfaces` block
resource/aws_launch_template: Add `connection_tracking_specification` argument block to `network_interfaces` block
```
66 changes: 33 additions & 33 deletions internal/service/ec2/ec2_launch_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,30 @@ func resourceLaunchTemplate() *schema.Resource {
DiffSuppressFunc: nullable.DiffSuppressNullableBool,
ValidateFunc: nullable.ValidateTypeStringNullableBool,
},
"connection_tracking_specification": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"tcp_established_timeout": {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(60, 432000),
},
"udp_stream_timeout": {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(60, 180),
},
"udp_timeout": {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(30, 60),
},
},
},
},
names.AttrDeleteOnTermination: {
Type: nullable.TypeNullableBool,
Optional: true,
Expand Down Expand Up @@ -850,30 +874,6 @@ func resourceLaunchTemplate() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"connection_tracking_specification": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"tcp_established_timeout": {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(60, 432000),
},
"udp_stream_timeout": {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(60, 180),
},
"udp_timeout": {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(30, 60),
},
},
},
},
},
},
},
Expand Down Expand Up @@ -2027,6 +2027,10 @@ func expandLaunchTemplateInstanceNetworkInterfaceSpecificationRequest(tfMap map[
apiObject.AssociatePublicIpAddress = aws.Bool(v)
}

if v, ok := tfMap["connection_tracking_specification"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
apiObject.ConnectionTrackingSpecification = expandConnectionTrackingSpecificationRequest(v[0].(map[string]interface{}))
}

if v, null, _ := nullable.Bool(tfMap[names.AttrDeleteOnTermination].(string)).ValueBool(); !null {
apiObject.DeleteOnTermination = aws.Bool(v)
}
Expand Down Expand Up @@ -2113,10 +2117,6 @@ func expandLaunchTemplateInstanceNetworkInterfaceSpecificationRequest(tfMap map[
apiObject.SubnetId = aws.String(v)
}

if v, ok := tfMap["connection_tracking_specification"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
apiObject.ConnectionTrackingSpecification = expandConnectionTrackingSpecification(v[0].(map[string]interface{}))
}

return apiObject
}

Expand Down Expand Up @@ -2974,6 +2974,10 @@ func flattenLaunchTemplateInstanceNetworkInterfaceSpecification(apiObject awstyp
tfMap["associate_public_ip_address"] = flex.BoolToStringValue(v)
}

if v := apiObject.ConnectionTrackingSpecification; v != nil {
tfMap["connection_tracking_specification"] = []interface{}{flattenConnectionTrackingSpecification(v)}
}

if v := apiObject.DeleteOnTermination; v != nil {
tfMap[names.AttrDeleteOnTermination] = flex.BoolToStringValue(v)
}
Expand Down Expand Up @@ -3070,10 +3074,6 @@ func flattenLaunchTemplateInstanceNetworkInterfaceSpecification(apiObject awstyp
tfMap[names.AttrSubnetID] = aws.ToString(v)
}

if v := apiObject.ConnectionTrackingSpecification; v != nil {
tfMap["ebs"] = []interface{}{flattenConnectionTrackingSpecification(v)}
}

return tfMap
}

Expand Down Expand Up @@ -3264,7 +3264,7 @@ func expandLaunchTemplateIPv6PrefixSpecificationRequests(tfList []interface{}) [
return apiObjects
}

func expandConnectionTrackingSpecification(tfMap map[string]interface{}) *awstypes.ConnectionTrackingSpecificationRequest {
func expandConnectionTrackingSpecificationRequest(tfMap map[string]interface{}) *awstypes.ConnectionTrackingSpecificationRequest {
if tfMap == nil {
return nil
}
Expand Down

0 comments on commit 6e98ee7

Please sign in to comment.