/
parameter.go
410 lines (364 loc) · 19 KB
/
parameter.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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package ssm
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides an SSM Parameter resource.
//
// ## Example Usage
//
// To store a basic string parameter:
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ssm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := ssm.NewParameter(ctx, "foo", &ssm.ParameterArgs{
// Type: pulumi.String("String"),
// Value: pulumi.String("bar"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// To store an encrypted string using the default SSM KMS key:
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/rds"
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ssm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := rds.NewInstance(ctx, "default", &rds.InstanceArgs{
// AllocatedStorage: pulumi.Int(10),
// StorageType: pulumi.String("gp2"),
// Engine: pulumi.String("mysql"),
// EngineVersion: pulumi.String("5.7.16"),
// InstanceClass: pulumi.String("db.t2.micro"),
// Name: pulumi.String("mydb"),
// Username: pulumi.String("foo"),
// Password: pulumi.Any(_var.Database_master_password),
// DbSubnetGroupName: pulumi.String("my_database_subnet_group"),
// ParameterGroupName: pulumi.String("default.mysql5.7"),
// })
// if err != nil {
// return err
// }
// _, err = ssm.NewParameter(ctx, "secret", &ssm.ParameterArgs{
// Description: pulumi.String("The parameter description"),
// Type: pulumi.String("SecureString"),
// Value: pulumi.Any(_var.Database_master_password),
// Tags: pulumi.StringMap{
// "environment": pulumi.String("production"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// SSM Parameters can be imported using the `parameter store name`, e.g.,
//
// ```sh
// $ pulumi import aws:ssm/parameter:Parameter my_param /my_path/my_paramname
// ```
type Parameter struct {
pulumi.CustomResourceState
// A regular expression used to validate the parameter value.
AllowedPattern pulumi.StringPtrOutput `pulumi:"allowedPattern"`
// The ARN of the parameter.
Arn pulumi.StringOutput `pulumi:"arn"`
// The dataType of the parameter. Valid values: text and aws:ec2:image for AMI format, see the [Native parameter support for Amazon Machine Image IDs
// ](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-ec2-aliases.html)
DataType pulumi.StringOutput `pulumi:"dataType"`
// The description of the parameter.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The KMS key id or arn for encrypting a SecureString.
KeyId pulumi.StringOutput `pulumi:"keyId"`
// The name of the parameter. If the name contains a path (e.g., any forward slashes (`/`)), it must be fully qualified with a leading forward slash (`/`). For additional requirements and constraints, see the [AWS SSM User Guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-parameter-name-constraints.html).
Name pulumi.StringOutput `pulumi:"name"`
// Overwrite an existing parameter. If not specified, will default to `false` if the resource has not been created by this provider to avoid overwrite of existing resource and will default to `true` otherwise (lifecycle rules should then be used to manage the update behavior).
Overwrite pulumi.BoolPtrOutput `pulumi:"overwrite"`
// A map of tags to assign to the object. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider .
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
// The tier of the parameter. If not specified, will default to `Standard`. Valid tiers are `Standard`, `Advanced`, and `Intelligent-Tiering`. For more information on parameter tiers, see the [AWS SSM Parameter tier comparison and guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-advanced-parameters.html).
Tier pulumi.StringPtrOutput `pulumi:"tier"`
// The type of the parameter. Valid types are `String`, `StringList` and `SecureString`.
Type pulumi.StringOutput `pulumi:"type"`
// The value of the parameter.
Value pulumi.StringOutput `pulumi:"value"`
// The version of the parameter.
Version pulumi.IntOutput `pulumi:"version"`
}
// NewParameter registers a new resource with the given unique name, arguments, and options.
func NewParameter(ctx *pulumi.Context,
name string, args *ParameterArgs, opts ...pulumi.ResourceOption) (*Parameter, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Type == nil {
return nil, errors.New("invalid value for required argument 'Type'")
}
if args.Value == nil {
return nil, errors.New("invalid value for required argument 'Value'")
}
var resource Parameter
err := ctx.RegisterResource("aws:ssm/parameter:Parameter", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetParameter gets an existing Parameter resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetParameter(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ParameterState, opts ...pulumi.ResourceOption) (*Parameter, error) {
var resource Parameter
err := ctx.ReadResource("aws:ssm/parameter:Parameter", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Parameter resources.
type parameterState struct {
// A regular expression used to validate the parameter value.
AllowedPattern *string `pulumi:"allowedPattern"`
// The ARN of the parameter.
Arn *string `pulumi:"arn"`
// The dataType of the parameter. Valid values: text and aws:ec2:image for AMI format, see the [Native parameter support for Amazon Machine Image IDs
// ](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-ec2-aliases.html)
DataType *string `pulumi:"dataType"`
// The description of the parameter.
Description *string `pulumi:"description"`
// The KMS key id or arn for encrypting a SecureString.
KeyId *string `pulumi:"keyId"`
// The name of the parameter. If the name contains a path (e.g., any forward slashes (`/`)), it must be fully qualified with a leading forward slash (`/`). For additional requirements and constraints, see the [AWS SSM User Guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-parameter-name-constraints.html).
Name *string `pulumi:"name"`
// Overwrite an existing parameter. If not specified, will default to `false` if the resource has not been created by this provider to avoid overwrite of existing resource and will default to `true` otherwise (lifecycle rules should then be used to manage the update behavior).
Overwrite *bool `pulumi:"overwrite"`
// A map of tags to assign to the object. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider .
TagsAll map[string]string `pulumi:"tagsAll"`
// The tier of the parameter. If not specified, will default to `Standard`. Valid tiers are `Standard`, `Advanced`, and `Intelligent-Tiering`. For more information on parameter tiers, see the [AWS SSM Parameter tier comparison and guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-advanced-parameters.html).
Tier *string `pulumi:"tier"`
// The type of the parameter. Valid types are `String`, `StringList` and `SecureString`.
Type *string `pulumi:"type"`
// The value of the parameter.
Value *string `pulumi:"value"`
// The version of the parameter.
Version *int `pulumi:"version"`
}
type ParameterState struct {
// A regular expression used to validate the parameter value.
AllowedPattern pulumi.StringPtrInput
// The ARN of the parameter.
Arn pulumi.StringPtrInput
// The dataType of the parameter. Valid values: text and aws:ec2:image for AMI format, see the [Native parameter support for Amazon Machine Image IDs
// ](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-ec2-aliases.html)
DataType pulumi.StringPtrInput
// The description of the parameter.
Description pulumi.StringPtrInput
// The KMS key id or arn for encrypting a SecureString.
KeyId pulumi.StringPtrInput
// The name of the parameter. If the name contains a path (e.g., any forward slashes (`/`)), it must be fully qualified with a leading forward slash (`/`). For additional requirements and constraints, see the [AWS SSM User Guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-parameter-name-constraints.html).
Name pulumi.StringPtrInput
// Overwrite an existing parameter. If not specified, will default to `false` if the resource has not been created by this provider to avoid overwrite of existing resource and will default to `true` otherwise (lifecycle rules should then be used to manage the update behavior).
Overwrite pulumi.BoolPtrInput
// A map of tags to assign to the object. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// A map of tags assigned to the resource, including those inherited from the provider .
TagsAll pulumi.StringMapInput
// The tier of the parameter. If not specified, will default to `Standard`. Valid tiers are `Standard`, `Advanced`, and `Intelligent-Tiering`. For more information on parameter tiers, see the [AWS SSM Parameter tier comparison and guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-advanced-parameters.html).
Tier pulumi.StringPtrInput
// The type of the parameter. Valid types are `String`, `StringList` and `SecureString`.
Type pulumi.StringPtrInput
// The value of the parameter.
Value pulumi.StringPtrInput
// The version of the parameter.
Version pulumi.IntPtrInput
}
func (ParameterState) ElementType() reflect.Type {
return reflect.TypeOf((*parameterState)(nil)).Elem()
}
type parameterArgs struct {
// A regular expression used to validate the parameter value.
AllowedPattern *string `pulumi:"allowedPattern"`
// The ARN of the parameter.
Arn *string `pulumi:"arn"`
// The dataType of the parameter. Valid values: text and aws:ec2:image for AMI format, see the [Native parameter support for Amazon Machine Image IDs
// ](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-ec2-aliases.html)
DataType *string `pulumi:"dataType"`
// The description of the parameter.
Description *string `pulumi:"description"`
// The KMS key id or arn for encrypting a SecureString.
KeyId *string `pulumi:"keyId"`
// The name of the parameter. If the name contains a path (e.g., any forward slashes (`/`)), it must be fully qualified with a leading forward slash (`/`). For additional requirements and constraints, see the [AWS SSM User Guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-parameter-name-constraints.html).
Name *string `pulumi:"name"`
// Overwrite an existing parameter. If not specified, will default to `false` if the resource has not been created by this provider to avoid overwrite of existing resource and will default to `true` otherwise (lifecycle rules should then be used to manage the update behavior).
Overwrite *bool `pulumi:"overwrite"`
// A map of tags to assign to the object. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
// The tier of the parameter. If not specified, will default to `Standard`. Valid tiers are `Standard`, `Advanced`, and `Intelligent-Tiering`. For more information on parameter tiers, see the [AWS SSM Parameter tier comparison and guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-advanced-parameters.html).
Tier *string `pulumi:"tier"`
// The type of the parameter. Valid types are `String`, `StringList` and `SecureString`.
Type string `pulumi:"type"`
// The value of the parameter.
Value string `pulumi:"value"`
}
// The set of arguments for constructing a Parameter resource.
type ParameterArgs struct {
// A regular expression used to validate the parameter value.
AllowedPattern pulumi.StringPtrInput
// The ARN of the parameter.
Arn pulumi.StringPtrInput
// The dataType of the parameter. Valid values: text and aws:ec2:image for AMI format, see the [Native parameter support for Amazon Machine Image IDs
// ](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-ec2-aliases.html)
DataType pulumi.StringPtrInput
// The description of the parameter.
Description pulumi.StringPtrInput
// The KMS key id or arn for encrypting a SecureString.
KeyId pulumi.StringPtrInput
// The name of the parameter. If the name contains a path (e.g., any forward slashes (`/`)), it must be fully qualified with a leading forward slash (`/`). For additional requirements and constraints, see the [AWS SSM User Guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-parameter-name-constraints.html).
Name pulumi.StringPtrInput
// Overwrite an existing parameter. If not specified, will default to `false` if the resource has not been created by this provider to avoid overwrite of existing resource and will default to `true` otherwise (lifecycle rules should then be used to manage the update behavior).
Overwrite pulumi.BoolPtrInput
// A map of tags to assign to the object. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// The tier of the parameter. If not specified, will default to `Standard`. Valid tiers are `Standard`, `Advanced`, and `Intelligent-Tiering`. For more information on parameter tiers, see the [AWS SSM Parameter tier comparison and guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-advanced-parameters.html).
Tier pulumi.StringPtrInput
// The type of the parameter. Valid types are `String`, `StringList` and `SecureString`.
Type pulumi.StringInput
// The value of the parameter.
Value pulumi.StringInput
}
func (ParameterArgs) ElementType() reflect.Type {
return reflect.TypeOf((*parameterArgs)(nil)).Elem()
}
type ParameterInput interface {
pulumi.Input
ToParameterOutput() ParameterOutput
ToParameterOutputWithContext(ctx context.Context) ParameterOutput
}
func (*Parameter) ElementType() reflect.Type {
return reflect.TypeOf((**Parameter)(nil)).Elem()
}
func (i *Parameter) ToParameterOutput() ParameterOutput {
return i.ToParameterOutputWithContext(context.Background())
}
func (i *Parameter) ToParameterOutputWithContext(ctx context.Context) ParameterOutput {
return pulumi.ToOutputWithContext(ctx, i).(ParameterOutput)
}
// ParameterArrayInput is an input type that accepts ParameterArray and ParameterArrayOutput values.
// You can construct a concrete instance of `ParameterArrayInput` via:
//
// ParameterArray{ ParameterArgs{...} }
type ParameterArrayInput interface {
pulumi.Input
ToParameterArrayOutput() ParameterArrayOutput
ToParameterArrayOutputWithContext(context.Context) ParameterArrayOutput
}
type ParameterArray []ParameterInput
func (ParameterArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Parameter)(nil)).Elem()
}
func (i ParameterArray) ToParameterArrayOutput() ParameterArrayOutput {
return i.ToParameterArrayOutputWithContext(context.Background())
}
func (i ParameterArray) ToParameterArrayOutputWithContext(ctx context.Context) ParameterArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ParameterArrayOutput)
}
// ParameterMapInput is an input type that accepts ParameterMap and ParameterMapOutput values.
// You can construct a concrete instance of `ParameterMapInput` via:
//
// ParameterMap{ "key": ParameterArgs{...} }
type ParameterMapInput interface {
pulumi.Input
ToParameterMapOutput() ParameterMapOutput
ToParameterMapOutputWithContext(context.Context) ParameterMapOutput
}
type ParameterMap map[string]ParameterInput
func (ParameterMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Parameter)(nil)).Elem()
}
func (i ParameterMap) ToParameterMapOutput() ParameterMapOutput {
return i.ToParameterMapOutputWithContext(context.Background())
}
func (i ParameterMap) ToParameterMapOutputWithContext(ctx context.Context) ParameterMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ParameterMapOutput)
}
type ParameterOutput struct{ *pulumi.OutputState }
func (ParameterOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Parameter)(nil)).Elem()
}
func (o ParameterOutput) ToParameterOutput() ParameterOutput {
return o
}
func (o ParameterOutput) ToParameterOutputWithContext(ctx context.Context) ParameterOutput {
return o
}
type ParameterArrayOutput struct{ *pulumi.OutputState }
func (ParameterArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Parameter)(nil)).Elem()
}
func (o ParameterArrayOutput) ToParameterArrayOutput() ParameterArrayOutput {
return o
}
func (o ParameterArrayOutput) ToParameterArrayOutputWithContext(ctx context.Context) ParameterArrayOutput {
return o
}
func (o ParameterArrayOutput) Index(i pulumi.IntInput) ParameterOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Parameter {
return vs[0].([]*Parameter)[vs[1].(int)]
}).(ParameterOutput)
}
type ParameterMapOutput struct{ *pulumi.OutputState }
func (ParameterMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Parameter)(nil)).Elem()
}
func (o ParameterMapOutput) ToParameterMapOutput() ParameterMapOutput {
return o
}
func (o ParameterMapOutput) ToParameterMapOutputWithContext(ctx context.Context) ParameterMapOutput {
return o
}
func (o ParameterMapOutput) MapIndex(k pulumi.StringInput) ParameterOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Parameter {
return vs[0].(map[string]*Parameter)[vs[1].(string)]
}).(ParameterOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ParameterInput)(nil)).Elem(), &Parameter{})
pulumi.RegisterInputType(reflect.TypeOf((*ParameterArrayInput)(nil)).Elem(), ParameterArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ParameterMapInput)(nil)).Elem(), ParameterMap{})
pulumi.RegisterOutputType(ParameterOutput{})
pulumi.RegisterOutputType(ParameterArrayOutput{})
pulumi.RegisterOutputType(ParameterMapOutput{})
}