generated from hashicorp/terraform-provider-scaffolding
/
vpc_resource_gen.go
316 lines (301 loc) · 14.8 KB
/
vpc_resource_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
// Code generated by generators/resource/main.go; DO NOT EDIT.
package ec2
import (
"context"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/boolplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-provider-awscc/internal/generic"
"github.com/hashicorp/terraform-provider-awscc/internal/registry"
)
func init() {
registry.AddResourceFactory("awscc_ec2_vpc", vPCResource)
}
// vPCResource returns the Terraform awscc_ec2_vpc resource.
// This Terraform resource corresponds to the CloudFormation AWS::EC2::VPC resource.
func vPCResource(ctx context.Context) (resource.Resource, error) {
attributes := map[string]schema.Attribute{ /*START SCHEMA*/
// Property: CidrBlock
// CloudFormation resource type schema:
//
// {
// "description": "The IPv4 network range for the VPC, in CIDR notation. For example, ``10.0.0.0/16``. We modify the specified CIDR block to its canonical form; for example, if you specify ``100.68.0.18/18``, we modify it to ``100.68.0.0/18``.\n You must specify either``CidrBlock`` or ``Ipv4IpamPoolId``.",
// "type": "string"
// }
"cidr_block": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The IPv4 network range for the VPC, in CIDR notation. For example, ``10.0.0.0/16``. We modify the specified CIDR block to its canonical form; for example, if you specify ``100.68.0.18/18``, we modify it to ``100.68.0.0/18``.\n You must specify either``CidrBlock`` or ``Ipv4IpamPoolId``.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
stringplanmodifier.RequiresReplace(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: CidrBlockAssociations
// CloudFormation resource type schema:
//
// {
// "description": "",
// "insertionOrder": false,
// "items": {
// "type": "string"
// },
// "type": "array",
// "uniqueItems": false
// }
"cidr_block_associations": schema.ListAttribute{ /*START ATTRIBUTE*/
ElementType: types.StringType,
Description: "",
Computed: true,
PlanModifiers: []planmodifier.List{ /*START PLAN MODIFIERS*/
generic.Multiset(),
listplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: DefaultNetworkAcl
// CloudFormation resource type schema:
//
// {
// "description": "",
// "insertionOrder": false,
// "type": "string"
// }
"default_network_acl": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "",
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: DefaultSecurityGroup
// CloudFormation resource type schema:
//
// {
// "description": "",
// "insertionOrder": false,
// "type": "string"
// }
"default_security_group": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "",
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: EnableDnsHostnames
// CloudFormation resource type schema:
//
// {
// "description": "Indicates whether the instances launched in the VPC get DNS hostnames. If enabled, instances in the VPC get DNS hostnames; otherwise, they do not. Disabled by default for nondefault VPCs. For more information, see [DNS attributes in your VPC](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-support).\n You can only enable DNS hostnames if you've enabled DNS support.",
// "type": "boolean"
// }
"enable_dns_hostnames": schema.BoolAttribute{ /*START ATTRIBUTE*/
Description: "Indicates whether the instances launched in the VPC get DNS hostnames. If enabled, instances in the VPC get DNS hostnames; otherwise, they do not. Disabled by default for nondefault VPCs. For more information, see [DNS attributes in your VPC](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-support).\n You can only enable DNS hostnames if you've enabled DNS support.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/
boolplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: EnableDnsSupport
// CloudFormation resource type schema:
//
// {
// "description": "Indicates whether the DNS resolution is supported for the VPC. If enabled, queries to the Amazon provided DNS server at the 169.254.169.253 IP address, or the reserved IP address at the base of the VPC network range \"plus two\" succeed. If disabled, the Amazon provided DNS service in the VPC that resolves public DNS hostnames to IP addresses is not enabled. Enabled by default. For more information, see [DNS attributes in your VPC](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-support).",
// "type": "boolean"
// }
"enable_dns_support": schema.BoolAttribute{ /*START ATTRIBUTE*/
Description: "Indicates whether the DNS resolution is supported for the VPC. If enabled, queries to the Amazon provided DNS server at the 169.254.169.253 IP address, or the reserved IP address at the base of the VPC network range \"plus two\" succeed. If disabled, the Amazon provided DNS service in the VPC that resolves public DNS hostnames to IP addresses is not enabled. Enabled by default. For more information, see [DNS attributes in your VPC](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html#vpc-dns-support).",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/
boolplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: InstanceTenancy
// CloudFormation resource type schema:
//
// {
// "description": "The allowed tenancy of instances launched into the VPC.\n + ``default``: An instance launched into the VPC runs on shared hardware by default, unless you explicitly specify a different tenancy during instance launch.\n + ``dedicated``: An instance launched into the VPC runs on dedicated hardware by default, unless you explicitly specify a tenancy of ``host`` during instance launch. You cannot specify a tenancy of ``default`` during instance launch.\n \n Updating ``InstanceTenancy`` requires no replacement only if you are updating its value from ``dedicated`` to ``default``. Updating ``InstanceTenancy`` from ``default`` to ``dedicated`` requires replacement.",
// "type": "string"
// }
"instance_tenancy": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The allowed tenancy of instances launched into the VPC.\n + ``default``: An instance launched into the VPC runs on shared hardware by default, unless you explicitly specify a different tenancy during instance launch.\n + ``dedicated``: An instance launched into the VPC runs on dedicated hardware by default, unless you explicitly specify a tenancy of ``host`` during instance launch. You cannot specify a tenancy of ``default`` during instance launch.\n \n Updating ``InstanceTenancy`` requires no replacement only if you are updating its value from ``dedicated`` to ``default``. Updating ``InstanceTenancy`` from ``default`` to ``dedicated`` requires replacement.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: Ipv4IpamPoolId
// CloudFormation resource type schema:
//
// {
// "description": "The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. For more information, see [What is IPAM?](https://docs.aws.amazon.com//vpc/latest/ipam/what-is-it-ipam.html) in the *Amazon VPC IPAM User Guide*.\n You must specify either``CidrBlock`` or ``Ipv4IpamPoolId``.",
// "type": "string"
// }
"ipv_4_ipam_pool_id": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. For more information, see [What is IPAM?](https://docs.aws.amazon.com//vpc/latest/ipam/what-is-it-ipam.html) in the *Amazon VPC IPAM User Guide*.\n You must specify either``CidrBlock`` or ``Ipv4IpamPoolId``.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
stringplanmodifier.RequiresReplace(),
}, /*END PLAN MODIFIERS*/
// Ipv4IpamPoolId is a write-only property.
}, /*END ATTRIBUTE*/
// Property: Ipv4NetmaskLength
// CloudFormation resource type schema:
//
// {
// "description": "The netmask length of the IPv4 CIDR you want to allocate to this VPC from an Amazon VPC IP Address Manager (IPAM) pool. For more information about IPAM, see [What is IPAM?](https://docs.aws.amazon.com//vpc/latest/ipam/what-is-it-ipam.html) in the *Amazon VPC IPAM User Guide*.",
// "type": "integer"
// }
"ipv_4_netmask_length": schema.Int64Attribute{ /*START ATTRIBUTE*/
Description: "The netmask length of the IPv4 CIDR you want to allocate to this VPC from an Amazon VPC IP Address Manager (IPAM) pool. For more information about IPAM, see [What is IPAM?](https://docs.aws.amazon.com//vpc/latest/ipam/what-is-it-ipam.html) in the *Amazon VPC IPAM User Guide*.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Int64{ /*START PLAN MODIFIERS*/
int64planmodifier.UseStateForUnknown(),
int64planmodifier.RequiresReplace(),
}, /*END PLAN MODIFIERS*/
// Ipv4NetmaskLength is a write-only property.
}, /*END ATTRIBUTE*/
// Property: Ipv6CidrBlocks
// CloudFormation resource type schema:
//
// {
// "description": "",
// "insertionOrder": false,
// "items": {
// "type": "string"
// },
// "type": "array",
// "uniqueItems": false
// }
"ipv_6_cidr_blocks": schema.ListAttribute{ /*START ATTRIBUTE*/
ElementType: types.StringType,
Description: "",
Computed: true,
PlanModifiers: []planmodifier.List{ /*START PLAN MODIFIERS*/
generic.Multiset(),
listplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: Tags
// CloudFormation resource type schema:
//
// {
// "description": "The tags for the VPC.",
// "insertionOrder": false,
// "items": {
// "additionalProperties": false,
// "description": "Specifies a tag. For more information, see [Add tags to a resource](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#cloudformation-add-tag-specifications).",
// "properties": {
// "Key": {
// "description": "The tag key.",
// "type": "string"
// },
// "Value": {
// "description": "The tag value.",
// "type": "string"
// }
// },
// "required": [
// "Value",
// "Key"
// ],
// "type": "object"
// },
// "type": "array",
// "uniqueItems": false
// }
"tags": schema.ListNestedAttribute{ /*START ATTRIBUTE*/
NestedObject: schema.NestedAttributeObject{ /*START NESTED OBJECT*/
Attributes: map[string]schema.Attribute{ /*START SCHEMA*/
// Property: Key
"key": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The tag key.",
Required: true,
}, /*END ATTRIBUTE*/
// Property: Value
"value": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The tag value.",
Required: true,
}, /*END ATTRIBUTE*/
}, /*END SCHEMA*/
}, /*END NESTED OBJECT*/
Description: "The tags for the VPC.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.List{ /*START PLAN MODIFIERS*/
generic.Multiset(),
listplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: VpcId
// CloudFormation resource type schema:
//
// {
// "description": "",
// "type": "string"
// }
"vpc_id": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "",
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
} /*END SCHEMA*/
// Corresponds to CloudFormation primaryIdentifier.
attributes["id"] = schema.StringAttribute{
Description: "Uniquely identifies the resource.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
}
schema := schema.Schema{
Description: "Specifies a virtual private cloud (VPC).\n You can optionally request an IPv6 CIDR block for the VPC. You can request an Amazon-provided IPv6 CIDR block from Amazon's pool of IPv6 addresses, or an IPv6 CIDR block from an IPv6 address pool that you provisioned through bring your own IP addresses (BYOIP).\n For more information, see [Virtual private clouds (VPC)](https://docs.aws.amazon.com/vpc/latest/userguide/configure-your-vpc.html) in the *Amazon VPC User Guide*.",
Version: 1,
Attributes: attributes,
}
var opts generic.ResourceOptions
opts = opts.WithCloudFormationTypeName("AWS::EC2::VPC").WithTerraformTypeName("awscc_ec2_vpc")
opts = opts.WithTerraformSchema(schema)
opts = opts.WithAttributeNameMap(map[string]string{
"cidr_block": "CidrBlock",
"cidr_block_associations": "CidrBlockAssociations",
"default_network_acl": "DefaultNetworkAcl",
"default_security_group": "DefaultSecurityGroup",
"enable_dns_hostnames": "EnableDnsHostnames",
"enable_dns_support": "EnableDnsSupport",
"instance_tenancy": "InstanceTenancy",
"ipv_4_ipam_pool_id": "Ipv4IpamPoolId",
"ipv_4_netmask_length": "Ipv4NetmaskLength",
"ipv_6_cidr_blocks": "Ipv6CidrBlocks",
"key": "Key",
"tags": "Tags",
"value": "Value",
"vpc_id": "VpcId",
})
opts = opts.WithWriteOnlyPropertyPaths([]string{
"/properties/Ipv4IpamPoolId",
"/properties/Ipv4NetmaskLength",
})
opts = opts.WithCreateTimeoutInMinutes(0).WithDeleteTimeoutInMinutes(0)
opts = opts.WithUpdateTimeoutInMinutes(0)
v, err := generic.NewResource(ctx, opts...)
if err != nil {
return nil, err
}
return v, nil
}