generated from hashicorp/terraform-provider-scaffolding
/
parameter_resource_gen.go
255 lines (240 loc) · 11.2 KB
/
parameter_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
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
// Code generated by generators/resource/main.go; DO NOT EDIT.
package ssm
import (
"context"
"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/mapplanmodifier"
"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-plugin-framework/types"
"github.com/hashicorp/terraform-provider-awscc/internal/generic"
"github.com/hashicorp/terraform-provider-awscc/internal/registry"
)
func init() {
registry.AddResourceFactory("awscc_ssm_parameter", parameterResource)
}
// parameterResource returns the Terraform awscc_ssm_parameter resource.
// This Terraform resource corresponds to the CloudFormation AWS::SSM::Parameter resource.
func parameterResource(ctx context.Context) (resource.Resource, error) {
attributes := map[string]schema.Attribute{ /*START SCHEMA*/
// Property: AllowedPattern
// CloudFormation resource type schema:
//
// {
// "description": "A regular expression used to validate the parameter value. For example, for ``String`` types with values restricted to numbers, you can specify the following: ``AllowedPattern=^\\d+$``",
// "type": "string"
// }
"allowed_pattern": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "A regular expression used to validate the parameter value. For example, for ``String`` types with values restricted to numbers, you can specify the following: ``AllowedPattern=^\\d+$``",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
// AllowedPattern is a write-only property.
}, /*END ATTRIBUTE*/
// Property: DataType
// CloudFormation resource type schema:
//
// {
// "description": "The data type of the parameter, such as ``text`` or ``aws:ec2:image``. The default is ``text``.",
// "enum": [
// "text",
// "aws:ec2:image"
// ],
// "type": "string"
// }
"data_type": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The data type of the parameter, such as ``text`` or ``aws:ec2:image``. The default is ``text``.",
Optional: true,
Computed: true,
Validators: []validator.String{ /*START VALIDATORS*/
stringvalidator.OneOf(
"text",
"aws:ec2:image",
),
}, /*END VALIDATORS*/
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: Description
// CloudFormation resource type schema:
//
// {
// "description": "Information about the parameter.",
// "type": "string"
// }
"description": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "Information about the parameter.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
// Description is a write-only property.
}, /*END ATTRIBUTE*/
// Property: Name
// CloudFormation resource type schema:
//
// {
// "description": "The name of the parameter.\n The maximum length constraint listed below includes capacity for additional system attributes that aren't part of the name. The maximum length for a parameter name, including the full length of the parameter Amazon Resource Name (ARN), is 1011 characters. For example, the length of the following parameter name is 65 characters, not 20 characters: ``arn:aws:ssm:us-east-2:111222333444:parameter/ExampleParameterName``",
// "type": "string"
// }
"name": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The name of the parameter.\n The maximum length constraint listed below includes capacity for additional system attributes that aren't part of the name. The maximum length for a parameter name, including the full length of the parameter Amazon Resource Name (ARN), is 1011 characters. For example, the length of the following parameter name is 65 characters, not 20 characters: ``arn:aws:ssm:us-east-2:111222333444:parameter/ExampleParameterName``",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
stringplanmodifier.RequiresReplace(),
}, /*END PLAN MODIFIERS*/
}, /*END ATTRIBUTE*/
// Property: Policies
// CloudFormation resource type schema:
//
// {
// "description": "Information about the policies assigned to a parameter.\n [Assigning parameter policies](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-policies.html) in the *User Guide*.",
// "type": "string"
// }
"policies": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "Information about the policies assigned to a parameter.\n [Assigning parameter policies](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-policies.html) in the *User Guide*.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
// Policies is a write-only property.
}, /*END ATTRIBUTE*/
// Property: Tags
// CloudFormation resource type schema:
//
// {
// "additionalProperties": false,
// "description": "Optional metadata that you assign to a resource in the form of an arbitrary set of tags (key-value pairs). Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a SYS parameter to identify the type of resource to which it applies, the environment, or the type of configuration data referenced by the parameter.",
// "patternProperties": {
// "": {
// "type": "string"
// }
// },
// "type": "object"
// }
"tags": // Pattern: ""
schema.MapAttribute{ /*START ATTRIBUTE*/
ElementType: types.StringType,
Description: "Optional metadata that you assign to a resource in the form of an arbitrary set of tags (key-value pairs). Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag a SYS parameter to identify the type of resource to which it applies, the environment, or the type of configuration data referenced by the parameter.",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.Map{ /*START PLAN MODIFIERS*/
mapplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
// Tags is a write-only property.
}, /*END ATTRIBUTE*/
// Property: Tier
// CloudFormation resource type schema:
//
// {
// "description": "The parameter tier.",
// "enum": [
// "Standard",
// "Advanced",
// "Intelligent-Tiering"
// ],
// "type": "string"
// }
"tier": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The parameter tier.",
Optional: true,
Computed: true,
Validators: []validator.String{ /*START VALIDATORS*/
stringvalidator.OneOf(
"Standard",
"Advanced",
"Intelligent-Tiering",
),
}, /*END VALIDATORS*/
PlanModifiers: []planmodifier.String{ /*START PLAN MODIFIERS*/
stringplanmodifier.UseStateForUnknown(),
}, /*END PLAN MODIFIERS*/
// Tier is a write-only property.
}, /*END ATTRIBUTE*/
// Property: Type
// CloudFormation resource type schema:
//
// {
// "description": "The type of parameter.",
// "enum": [
// "String",
// "StringList"
// ],
// "type": "string"
// }
"type": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The type of parameter.",
Required: true,
Validators: []validator.String{ /*START VALIDATORS*/
stringvalidator.OneOf(
"String",
"StringList",
),
}, /*END VALIDATORS*/
}, /*END ATTRIBUTE*/
// Property: Value
// CloudFormation resource type schema:
//
// {
// "description": "The parameter value.\n If type is ``StringList``, the system returns a comma-separated string with no spaces between commas in the ``Value`` field.",
// "type": "string"
// }
"value": schema.StringAttribute{ /*START ATTRIBUTE*/
Description: "The parameter value.\n If type is ``StringList``, the system returns a comma-separated string with no spaces between commas in the ``Value`` field.",
Required: true,
}, /*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::SSM::Parameter`` resource creates an SSM parameter in SYSlong Parameter Store.\n To create an SSM parameter, you must have the IAMlong (IAM) permissions ``ssm:PutParameter`` and ``ssm:AddTagsToResource``. On stack creation, CFNlong adds the following three tags to the parameter: ``aws:cloudformation:stack-name``, ``aws:cloudformation:logical-id``, and ``aws:cloudformation:stack-id``, in addition to any custom tags you specify.\n To add, update, or remove tags during stack update, you must have IAM permissions for both ``ssm:AddTagsToResource`` and ``ssm:RemoveTagsFromResource``. For more information, see [Managing Access Using Policies](https://docs.aws.amazon.com/systems-manager/latest/userguide/security-iam.html#security_iam_access-manage) in the *User Guide*.\n For information about valid values for parameters, see [About requirements and constraints for parameter names](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-su-create.html#sysman-parameter-name-constraints) in the *User Guide* and [PutParameter](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_PutParameter.html) in the *API Reference*.",
Version: 1,
Attributes: attributes,
}
var opts generic.ResourceOptions
opts = opts.WithCloudFormationTypeName("AWS::SSM::Parameter").WithTerraformTypeName("awscc_ssm_parameter")
opts = opts.WithTerraformSchema(schema)
opts = opts.WithAttributeNameMap(map[string]string{
"allowed_pattern": "AllowedPattern",
"data_type": "DataType",
"description": "Description",
"name": "Name",
"policies": "Policies",
"tags": "Tags",
"tier": "Tier",
"type": "Type",
"value": "Value",
})
opts = opts.WithWriteOnlyPropertyPaths([]string{
"/properties/Tags",
"/properties/Description",
"/properties/Tier",
"/properties/AllowedPattern",
"/properties/Policies",
})
opts = opts.WithCreateTimeoutInMinutes(5).WithDeleteTimeoutInMinutes(0)
opts = opts.WithUpdateTimeoutInMinutes(5)
v, err := generic.NewResource(ctx, opts...)
if err != nil {
return nil, err
}
return v, nil
}