@@ -12,10 +12,13 @@ import (
12
12
"github.com/aws/aws-sdk-go-v2/service/vpclattice"
13
13
awstypes "github.com/aws/aws-sdk-go-v2/service/vpclattice/types"
14
14
"github.com/hashicorp/terraform-plugin-framework-timeouts/resource/timeouts"
15
+ "github.com/hashicorp/terraform-plugin-framework-validators/int32validator"
15
16
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
16
17
"github.com/hashicorp/terraform-plugin-framework/path"
17
18
"github.com/hashicorp/terraform-plugin-framework/resource"
18
19
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
20
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/int32default"
21
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/int32planmodifier"
19
22
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
20
23
"github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier"
21
24
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
@@ -67,6 +70,17 @@ func (r *resourceGatewayResource) Schema(ctx context.Context, request resource.S
67
70
stringplanmodifier .UseStateForUnknown (),
68
71
},
69
72
},
73
+ "ipv4_addresses_per_eni" : schema.Int32Attribute {
74
+ Optional : true ,
75
+ Validators : []validator.Int32 {
76
+ int32validator .AtLeast (1 ),
77
+ int32validator .AtMost (62 ),
78
+ },
79
+ PlanModifiers : []planmodifier.Int32 {
80
+ int32planmodifier .RequiresReplace (),
81
+ },
82
+ Default : int32default .StaticInt32 (16 ),
83
+ },
70
84
names .AttrName : schema.StringAttribute {
71
85
Required : true ,
72
86
Validators : []validator.String {
@@ -136,6 +150,11 @@ func (r *resourceGatewayResource) Create(ctx context.Context, request resource.C
136
150
input .Tags = getTagsIn (ctx )
137
151
input .VpcIdentifier = fwflex .StringFromFramework (ctx , data .VPCID )
138
152
153
+ // Ipv4AddressesPerEni is irrelevant if IPAddressType is IPv6
154
+ if data .IPAddressType .ValueEnum () != awstypes .ResourceGatewayIpAddressTypeIpv6 {
155
+ input .Ipv4AddressesPerEni = fwflex .Int32FromFramework (ctx , data .Ipv4AddressesPerEni )
156
+ }
157
+
139
158
outputCRG , err := conn .CreateResourceGateway (ctx , & input )
140
159
141
160
if err != nil {
@@ -354,15 +373,16 @@ func waitResourceGatewayDeleted(ctx context.Context, conn *vpclattice.Client, id
354
373
355
374
type resourceGatewayResourceModel struct {
356
375
framework.WithRegionModel
357
- ARN types.String `tfsdk:"arn"`
358
- ID types.String `tfsdk:"id"`
359
- IPAddressType fwtypes.StringEnum [awstypes.ResourceGatewayIpAddressType ] `tfsdk:"ip_address_type"`
360
- Name types.String `tfsdk:"name"`
361
- SecurityGroupIDs fwtypes.SetOfString `tfsdk:"security_group_ids"`
362
- Status fwtypes.StringEnum [awstypes.ResourceGatewayStatus ] `tfsdk:"status"`
363
- SubnetIDs fwtypes.SetOfString `tfsdk:"subnet_ids"`
364
- Tags tftags.Map `tfsdk:"tags"`
365
- TagsAll tftags.Map `tfsdk:"tags_all"`
366
- Timeouts timeouts.Value `tfsdk:"timeouts"`
367
- VPCID types.String `tfsdk:"vpc_id"`
376
+ ARN types.String `tfsdk:"arn"`
377
+ ID types.String `tfsdk:"id"`
378
+ IPAddressType fwtypes.StringEnum [awstypes.ResourceGatewayIpAddressType ] `tfsdk:"ip_address_type"`
379
+ Ipv4AddressesPerEni types.Int32 `tfsdk:"ipv4_addresses_per_eni"`
380
+ Name types.String `tfsdk:"name"`
381
+ SecurityGroupIDs fwtypes.SetOfString `tfsdk:"security_group_ids"`
382
+ Status fwtypes.StringEnum [awstypes.ResourceGatewayStatus ] `tfsdk:"status"`
383
+ SubnetIDs fwtypes.SetOfString `tfsdk:"subnet_ids"`
384
+ Tags tftags.Map `tfsdk:"tags"`
385
+ TagsAll tftags.Map `tfsdk:"tags_all"`
386
+ Timeouts timeouts.Value `tfsdk:"timeouts"`
387
+ VPCID types.String `tfsdk:"vpc_id"`
368
388
}
0 commit comments