Skip to content

Commit

Permalink
feat: add ipv4 & ipv6 prefix options to aws_launch_template resource
Browse files Browse the repository at this point in the history
  • Loading branch information
zachfeld committed Feb 24, 2022
1 parent 8fab69a commit b97edfa
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
28 changes: 28 additions & 0 deletions internal/service/ec2/launch_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,30 @@ func ResourceLaunchTemplate() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"ipv4_prefixes": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.IsIPv4Address,
},
},
"ipv4_prefix_count": {
Type: schema.TypeInt,
Optional: true,
},
"ipv6_prefixes": {
Type: schema.TypeSet,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validation.IsIPv6Address,
},
},
"ipv6_prefix_count": {
Type: schema.TypeInt,
Optional: true,
},
"interface_type": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1208,6 +1232,10 @@ func getNetworkInterfaces(n []*ec2.LaunchTemplateInstanceNetworkInterfaceSpecifi
"network_card_index": aws.Int64Value(v.NetworkCardIndex),
"network_interface_id": aws.StringValue(v.NetworkInterfaceId),
"private_ip_address": aws.StringValue(v.PrivateIpAddress),
"ipv4_prefixes": []*ec2.Ipv4PrefixSpecificationResponse(v.Ipv4Prefixes),
"ipv4_prefix_count": aws.Int64Value(v.Ipv4PrefixCount),
"ipv6_prefixes": []*ec2.Ipv6PrefixSpecificationResponse(v.Ipv6Prefixes),
"ipv6_prefix_count": aws.Int64Value(v.Ipv6PrefixCount),
"subnet_id": aws.StringValue(v.SubnetId),
}

Expand Down
18 changes: 18 additions & 0 deletions internal/service/ec2/launch_template_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,24 @@ func DataSourceLaunchTemplate() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"ipv4_prefixes": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"ipv4_prefix_count": {
Type: schema.TypeInt,
Computed: true,
},
"ipv6_prefixes": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"ipv6_prefix_count": {
Type: schema.TypeInt,
Computed: true,
},
"interface_type": {
Type: schema.TypeString,
Computed: true,
Expand Down

0 comments on commit b97edfa

Please sign in to comment.