generated from hashicorp/terraform-provider-scaffolding
/
access_point_resource_gen.go
320 lines (305 loc) · 16.5 KB
/
access_point_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
317
318
319
320
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
// Code generated by generators/resource/main.go; DO NOT EDIT.
package s3
import (
"context"
"regexp"
"github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"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/objectplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-provider-awscc/internal/generic"
"github.com/hashicorp/terraform-provider-awscc/internal/registry"
)
func init() {
registry.AddResourceFactory("awscc_s3_access_point", accessPointResource)
}
// accessPointResource returns the Terraform awscc_s3_access_point resource.
// This Terraform resource corresponds to the CloudFormation AWS::S3::AccessPoint resource.
func accessPointResource(ctx context.Context) (resource.Resource, error) {
attributes := map[string]schema.Attribute{ /*START SCHEMA*/
// Property: Alias
// CloudFormation resource type schema:
//
// {
// "description": "The alias of this Access Point. This alias can be used for compatibility purposes with other AWS services and third-party applications.",
// "maxLength": 63,
// "minLength": 3,
// "pattern": "^[a-z0-9]([a-z0-9\\-]*[a-z0-9])?$",
// "type": "string"
// }
"alias": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The alias of this Access Point. This alias can be used for compatibility purposes with other AWS services and third-party applications.",
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: Arn
// CloudFormation resource type schema:
//
// {
// "description": "The Amazon Resource Name (ARN) of the specified accesspoint.",
// "type": "string"
// }
"arn": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The Amazon Resource Name (ARN) of the specified accesspoint.",
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: Bucket
// CloudFormation resource type schema:
//
// {
// "description": "The name of the bucket that you want to associate this Access Point with.",
// "maxLength": 255,
// "minLength": 3,
// "type": "string"
// }
"bucket": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The name of the bucket that you want to associate this Access Point with.",
Required: true,
Validators: []validator.String{ /*START VALIDATORS*/
stringvalidator.LengthBetween(3, 255),
}, /*END VALIDATORS*/
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.RequiresReplace(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: BucketAccountId
// CloudFormation resource type schema:
//
// {
// "description": "The AWS account ID associated with the S3 bucket associated with this access point.",
// "maxLength": 64,
// "pattern": "^\\d{12}$",
// "type": "string"
// }
"bucket_account_id": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The AWS account ID associated with the S3 bucket associated with this access point.",
Optional: true,
Computed: true,
Validators: []validator.String{ /*START VALIDATORS*/
stringvalidator.LengthAtMost(64),
stringvalidator.RegexMatches(regexp.MustCompile("^\\d{12}$"), ""),
}, /*END VALIDATORS*/
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
stringplanmodifier.RequiresReplace(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: Name
// CloudFormation resource type schema:
//
// {
// "description": "The name you want to assign to this Access Point. If you don't specify a name, AWS CloudFormation generates a unique ID and uses that ID for the access point name.",
// "maxLength": 50,
// "minLength": 3,
// "pattern": "^[a-z0-9]([a-z0-9\\-]*[a-z0-9])?$",
// "type": "string"
// }
"name": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The name you want to assign to this Access Point. If you don't specify a name, AWS CloudFormation generates a unique ID and uses that ID for the access point name.",
Optional: true,
Computed: true,
Validators: []validator.String{ /*START VALIDATORS*/
stringvalidator.LengthBetween(3, 50),
stringvalidator.RegexMatches(regexp.MustCompile("^[a-z0-9]([a-z0-9\\-]*[a-z0-9])?$"), ""),
}, /*END VALIDATORS*/
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
stringplanmodifier.RequiresReplace(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: NetworkOrigin
// CloudFormation resource type schema:
//
// {
// "description": "Indicates whether this Access Point allows access from the public Internet. If VpcConfiguration is specified for this Access Point, then NetworkOrigin is VPC, and the Access Point doesn't allow access from the public Internet. Otherwise, NetworkOrigin is Internet, and the Access Point allows access from the public Internet, subject to the Access Point and bucket access policies.",
// "enum": [
// "Internet",
// "VPC"
// ],
// "type": "string"
// }
"network_origin": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "Indicates whether this Access Point allows access from the public Internet. If VpcConfiguration is specified for this Access Point, then NetworkOrigin is VPC, and the Access Point doesn't allow access from the public Internet. Otherwise, NetworkOrigin is Internet, and the Access Point allows access from the public Internet, subject to the Access Point and bucket access policies.",
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: Policy
// CloudFormation resource type schema:
//
// {
// "description": "The Access Point Policy you want to apply to this access point.",
// "type": "object"
// }
"policy": schema.StringAttribute{ /*START ATTRIBUTE*/
CustomType: jsontypes.NormalizedType{},
Description: "The Access Point Policy you want to apply to this access point.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: PublicAccessBlockConfiguration
// CloudFormation resource type schema:
//
// {
// "description": "The PublicAccessBlock configuration that you want to apply to this Access Point. You can enable the configuration options in any combination. For more information about when Amazon S3 considers a bucket or object public, see https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status 'The Meaning of Public' in the Amazon Simple Storage Service Developer Guide.",
// "properties": {
// "BlockPublicAcls": {
// "description": "Specifies whether Amazon S3 should block public access control lists (ACLs) for buckets in this account. Setting this element to TRUE causes the following behavior:\n- PUT Bucket acl and PUT Object acl calls fail if the specified ACL is public.\n - PUT Object calls fail if the request includes a public ACL.\n. - PUT Bucket calls fail if the request includes a public ACL.\nEnabling this setting doesn't affect existing policies or ACLs.",
// "type": "boolean"
// },
// "BlockPublicPolicy": {
// "description": "Specifies whether Amazon S3 should block public bucket policies for buckets in this account. Setting this element to TRUE causes Amazon S3 to reject calls to PUT Bucket policy if the specified bucket policy allows public access. Enabling this setting doesn't affect existing bucket policies.",
// "type": "boolean"
// },
// "IgnorePublicAcls": {
// "description": "Specifies whether Amazon S3 should ignore public ACLs for buckets in this account. Setting this element to TRUE causes Amazon S3 to ignore all public ACLs on buckets in this account and any objects that they contain. Enabling this setting doesn't affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set.",
// "type": "boolean"
// },
// "RestrictPublicBuckets": {
// "description": "Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to TRUE restricts access to this bucket to only AWS services and authorized users within this account if the bucket has a public policy.\nEnabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.",
// "type": "boolean"
// }
// },
// "type": "object"
// }
"public_access_block_configuration": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/
Attributes: map[string]schema.Attribute{ /*START SCHEMA*/
// Property: BlockPublicAcls
"block_public_acls": schema.BoolAttribute{ /*START ATTRIBUTE*/
Description: "Specifies whether Amazon S3 should block public access control lists (ACLs) for buckets in this account. Setting this element to TRUE causes the following behavior:\n- PUT Bucket acl and PUT Object acl calls fail if the specified ACL is public.\n - PUT Object calls fail if the request includes a public ACL.\n. - PUT Bucket calls fail if the request includes a public ACL.\nEnabling this setting doesn't affect existing policies or ACLs.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/
boolplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: BlockPublicPolicy
"block_public_policy": schema.BoolAttribute{ /*START ATTRIBUTE*/
Description: "Specifies whether Amazon S3 should block public bucket policies for buckets in this account. Setting this element to TRUE causes Amazon S3 to reject calls to PUT Bucket policy if the specified bucket policy allows public access. Enabling this setting doesn't affect existing bucket policies.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/
boolplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: IgnorePublicAcls
"ignore_public_acls": schema.BoolAttribute{ /*START ATTRIBUTE*/
Description: "Specifies whether Amazon S3 should ignore public ACLs for buckets in this account. Setting this element to TRUE causes Amazon S3 to ignore all public ACLs on buckets in this account and any objects that they contain. Enabling this setting doesn't affect the persistence of any existing ACLs and doesn't prevent new public ACLs from being set.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/
boolplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: RestrictPublicBuckets
"restrict_public_buckets": schema.BoolAttribute{ /*START ATTRIBUTE*/
Description: "Specifies whether Amazon S3 should restrict public bucket policies for this bucket. Setting this element to TRUE restricts access to this bucket to only AWS services and authorized users within this account if the bucket has a public policy.\nEnabling this setting doesn't affect previously stored bucket policies, except that public and cross-account access within any public bucket policy, including non-public delegation to specific accounts, is blocked.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Bool{ /*START PLAN MODIFIERS*/
boolplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
}, /*END SCHEMA*/
Description: "The PublicAccessBlock configuration that you want to apply to this Access Point. You can enable the configuration options in any combination. For more information about when Amazon S3 considers a bucket or object public, see https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status 'The Meaning of Public' in the Amazon Simple Storage Service Developer Guide.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/
objectplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: VpcConfiguration
// CloudFormation resource type schema:
//
// {
// "description": "If you include this field, Amazon S3 restricts access to this Access Point to requests from the specified Virtual Private Cloud (VPC).",
// "properties": {
// "VpcId": {
// "description": "If this field is specified, this access point will only allow connections from the specified VPC ID.",
// "maxLength": 1024,
// "minLength": 1,
// "type": "string"
// }
// },
// "type": "object"
// }
"vpc_configuration": schema.SingleNestedAttribute{ /*START ATTRIBUTE*/
Attributes: map[string]schema.Attribute{ /*START SCHEMA*/
// Property: VpcId
"vpc_id": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "If this field is specified, this access point will only allow connections from the specified VPC ID.",
Optional: true,
Computed: true,
Validators: []validator.String{ /*START VALIDATORS*/
stringvalidator.LengthBetween(1, 1024),
}, /*END VALIDATORS*/
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
}, /*END SCHEMA*/
Description: "If you include this field, Amazon S3 restricts access to this Access Point to requests from the specified Virtual Private Cloud (VPC).",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Object{ /*START PLAN MODIFIERS*/
objectplanmodifier.UseStateForUnknown(),
objectplanmodifier.RequiresReplace(),
}, /*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: "The AWS::S3::AccessPoint resource is an Amazon S3 resource type that you can use to access buckets.",
Version: 1,
Attributes: attributes,
}
var opts generic.ResourceOptions
opts = opts.WithCloudFormationTypeName("AWS::S3::AccessPoint").WithTerraformTypeName("awscc_s3_access_point")
opts = opts.WithTerraformSchema(schema)
opts = opts.WithAttributeNameMap(map[string]string{
"alias": "Alias",
"arn": "Arn",
"block_public_acls": "BlockPublicAcls",
"block_public_policy": "BlockPublicPolicy",
"bucket": "Bucket",
"bucket_account_id": "BucketAccountId",
"ignore_public_acls": "IgnorePublicAcls",
"name": "Name",
"network_origin": "NetworkOrigin",
"policy": "Policy",
"public_access_block_configuration": "PublicAccessBlockConfiguration",
"restrict_public_buckets": "RestrictPublicBuckets",
"vpc_configuration": "VpcConfiguration",
"vpc_id": "VpcId",
})
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
}