-
Notifications
You must be signed in to change notification settings - Fork 151
/
stackSetInstance.go
350 lines (290 loc) · 14.6 KB
/
stackSetInstance.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
// *** 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 cloudformation
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a CloudFormation StackSet Instance. Instances are managed in the account and region of the StackSet after the target account permissions have been configured. Additional information about StackSets can be found in the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/what-is-cfnstacksets.html).
//
// > **NOTE:** All target accounts must have an IAM Role created that matches the name of the execution role configured in the StackSet (the `executionRoleName` argument in the `cloudformation.StackSet` resource) in a trust relationship with the administrative account or administration IAM Role. The execution role must have appropriate permissions to manage resources defined in the template along with those required for StackSets to operate. See the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacksets-prereqs.html) for more details.
//
// > **NOTE:** To retain the Stack during resource destroy, ensure `retainStack` has been set to `true` in the state first. This must be completed _before_ a deployment that would destroy the resource.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/cloudformation"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := cloudformation.NewStackSetInstance(ctx, "example", &cloudformation.StackSetInstanceArgs{
// AccountId: pulumi.String("123456789012"),
// Region: pulumi.String("us-east-1"),
// StackSetName: pulumi.Any(aws_cloudformation_stack_set.Example.Name),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// CloudFormation StackSet Instances can be imported using the StackSet name, target AWS account ID, and target AWS region separated by commas (`,`) e.g.
//
// ```sh
// $ pulumi import aws:cloudformation/stackSetInstance:StackSetInstance example example,123456789012,us-east-1
// ```
type StackSetInstance struct {
pulumi.CustomResourceState
// Target AWS Account ID to create a Stack based on the StackSet. Defaults to current account.
AccountId pulumi.StringOutput `pulumi:"accountId"`
// Key-value map of input parameters to override from the StackSet for this Instance.
ParameterOverrides pulumi.StringMapOutput `pulumi:"parameterOverrides"`
// Target AWS Region to create a Stack based on the StackSet. Defaults to current region.
Region pulumi.StringOutput `pulumi:"region"`
// During resource destroy, remove Instance from StackSet while keeping the Stack and its associated resources. Must be enabled in the state _before_ destroy operation to take effect. You cannot reassociate a retained Stack or add an existing, saved Stack to a new StackSet. Defaults to `false`.
RetainStack pulumi.BoolPtrOutput `pulumi:"retainStack"`
// Stack identifier
StackId pulumi.StringOutput `pulumi:"stackId"`
// Name of the StackSet.
StackSetName pulumi.StringOutput `pulumi:"stackSetName"`
}
// NewStackSetInstance registers a new resource with the given unique name, arguments, and options.
func NewStackSetInstance(ctx *pulumi.Context,
name string, args *StackSetInstanceArgs, opts ...pulumi.ResourceOption) (*StackSetInstance, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.StackSetName == nil {
return nil, errors.New("invalid value for required argument 'StackSetName'")
}
var resource StackSetInstance
err := ctx.RegisterResource("aws:cloudformation/stackSetInstance:StackSetInstance", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetStackSetInstance gets an existing StackSetInstance 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 GetStackSetInstance(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *StackSetInstanceState, opts ...pulumi.ResourceOption) (*StackSetInstance, error) {
var resource StackSetInstance
err := ctx.ReadResource("aws:cloudformation/stackSetInstance:StackSetInstance", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering StackSetInstance resources.
type stackSetInstanceState struct {
// Target AWS Account ID to create a Stack based on the StackSet. Defaults to current account.
AccountId *string `pulumi:"accountId"`
// Key-value map of input parameters to override from the StackSet for this Instance.
ParameterOverrides map[string]string `pulumi:"parameterOverrides"`
// Target AWS Region to create a Stack based on the StackSet. Defaults to current region.
Region *string `pulumi:"region"`
// During resource destroy, remove Instance from StackSet while keeping the Stack and its associated resources. Must be enabled in the state _before_ destroy operation to take effect. You cannot reassociate a retained Stack or add an existing, saved Stack to a new StackSet. Defaults to `false`.
RetainStack *bool `pulumi:"retainStack"`
// Stack identifier
StackId *string `pulumi:"stackId"`
// Name of the StackSet.
StackSetName *string `pulumi:"stackSetName"`
}
type StackSetInstanceState struct {
// Target AWS Account ID to create a Stack based on the StackSet. Defaults to current account.
AccountId pulumi.StringPtrInput
// Key-value map of input parameters to override from the StackSet for this Instance.
ParameterOverrides pulumi.StringMapInput
// Target AWS Region to create a Stack based on the StackSet. Defaults to current region.
Region pulumi.StringPtrInput
// During resource destroy, remove Instance from StackSet while keeping the Stack and its associated resources. Must be enabled in the state _before_ destroy operation to take effect. You cannot reassociate a retained Stack or add an existing, saved Stack to a new StackSet. Defaults to `false`.
RetainStack pulumi.BoolPtrInput
// Stack identifier
StackId pulumi.StringPtrInput
// Name of the StackSet.
StackSetName pulumi.StringPtrInput
}
func (StackSetInstanceState) ElementType() reflect.Type {
return reflect.TypeOf((*stackSetInstanceState)(nil)).Elem()
}
type stackSetInstanceArgs struct {
// Target AWS Account ID to create a Stack based on the StackSet. Defaults to current account.
AccountId *string `pulumi:"accountId"`
// Key-value map of input parameters to override from the StackSet for this Instance.
ParameterOverrides map[string]string `pulumi:"parameterOverrides"`
// Target AWS Region to create a Stack based on the StackSet. Defaults to current region.
Region *string `pulumi:"region"`
// During resource destroy, remove Instance from StackSet while keeping the Stack and its associated resources. Must be enabled in the state _before_ destroy operation to take effect. You cannot reassociate a retained Stack or add an existing, saved Stack to a new StackSet. Defaults to `false`.
RetainStack *bool `pulumi:"retainStack"`
// Name of the StackSet.
StackSetName string `pulumi:"stackSetName"`
}
// The set of arguments for constructing a StackSetInstance resource.
type StackSetInstanceArgs struct {
// Target AWS Account ID to create a Stack based on the StackSet. Defaults to current account.
AccountId pulumi.StringPtrInput
// Key-value map of input parameters to override from the StackSet for this Instance.
ParameterOverrides pulumi.StringMapInput
// Target AWS Region to create a Stack based on the StackSet. Defaults to current region.
Region pulumi.StringPtrInput
// During resource destroy, remove Instance from StackSet while keeping the Stack and its associated resources. Must be enabled in the state _before_ destroy operation to take effect. You cannot reassociate a retained Stack or add an existing, saved Stack to a new StackSet. Defaults to `false`.
RetainStack pulumi.BoolPtrInput
// Name of the StackSet.
StackSetName pulumi.StringInput
}
func (StackSetInstanceArgs) ElementType() reflect.Type {
return reflect.TypeOf((*stackSetInstanceArgs)(nil)).Elem()
}
type StackSetInstanceInput interface {
pulumi.Input
ToStackSetInstanceOutput() StackSetInstanceOutput
ToStackSetInstanceOutputWithContext(ctx context.Context) StackSetInstanceOutput
}
func (*StackSetInstance) ElementType() reflect.Type {
return reflect.TypeOf((*StackSetInstance)(nil))
}
func (i *StackSetInstance) ToStackSetInstanceOutput() StackSetInstanceOutput {
return i.ToStackSetInstanceOutputWithContext(context.Background())
}
func (i *StackSetInstance) ToStackSetInstanceOutputWithContext(ctx context.Context) StackSetInstanceOutput {
return pulumi.ToOutputWithContext(ctx, i).(StackSetInstanceOutput)
}
func (i *StackSetInstance) ToStackSetInstancePtrOutput() StackSetInstancePtrOutput {
return i.ToStackSetInstancePtrOutputWithContext(context.Background())
}
func (i *StackSetInstance) ToStackSetInstancePtrOutputWithContext(ctx context.Context) StackSetInstancePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(StackSetInstancePtrOutput)
}
type StackSetInstancePtrInput interface {
pulumi.Input
ToStackSetInstancePtrOutput() StackSetInstancePtrOutput
ToStackSetInstancePtrOutputWithContext(ctx context.Context) StackSetInstancePtrOutput
}
type stackSetInstancePtrType StackSetInstanceArgs
func (*stackSetInstancePtrType) ElementType() reflect.Type {
return reflect.TypeOf((**StackSetInstance)(nil))
}
func (i *stackSetInstancePtrType) ToStackSetInstancePtrOutput() StackSetInstancePtrOutput {
return i.ToStackSetInstancePtrOutputWithContext(context.Background())
}
func (i *stackSetInstancePtrType) ToStackSetInstancePtrOutputWithContext(ctx context.Context) StackSetInstancePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(StackSetInstancePtrOutput)
}
// StackSetInstanceArrayInput is an input type that accepts StackSetInstanceArray and StackSetInstanceArrayOutput values.
// You can construct a concrete instance of `StackSetInstanceArrayInput` via:
//
// StackSetInstanceArray{ StackSetInstanceArgs{...} }
type StackSetInstanceArrayInput interface {
pulumi.Input
ToStackSetInstanceArrayOutput() StackSetInstanceArrayOutput
ToStackSetInstanceArrayOutputWithContext(context.Context) StackSetInstanceArrayOutput
}
type StackSetInstanceArray []StackSetInstanceInput
func (StackSetInstanceArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*StackSetInstance)(nil))
}
func (i StackSetInstanceArray) ToStackSetInstanceArrayOutput() StackSetInstanceArrayOutput {
return i.ToStackSetInstanceArrayOutputWithContext(context.Background())
}
func (i StackSetInstanceArray) ToStackSetInstanceArrayOutputWithContext(ctx context.Context) StackSetInstanceArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(StackSetInstanceArrayOutput)
}
// StackSetInstanceMapInput is an input type that accepts StackSetInstanceMap and StackSetInstanceMapOutput values.
// You can construct a concrete instance of `StackSetInstanceMapInput` via:
//
// StackSetInstanceMap{ "key": StackSetInstanceArgs{...} }
type StackSetInstanceMapInput interface {
pulumi.Input
ToStackSetInstanceMapOutput() StackSetInstanceMapOutput
ToStackSetInstanceMapOutputWithContext(context.Context) StackSetInstanceMapOutput
}
type StackSetInstanceMap map[string]StackSetInstanceInput
func (StackSetInstanceMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*StackSetInstance)(nil))
}
func (i StackSetInstanceMap) ToStackSetInstanceMapOutput() StackSetInstanceMapOutput {
return i.ToStackSetInstanceMapOutputWithContext(context.Background())
}
func (i StackSetInstanceMap) ToStackSetInstanceMapOutputWithContext(ctx context.Context) StackSetInstanceMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(StackSetInstanceMapOutput)
}
type StackSetInstanceOutput struct {
*pulumi.OutputState
}
func (StackSetInstanceOutput) ElementType() reflect.Type {
return reflect.TypeOf((*StackSetInstance)(nil))
}
func (o StackSetInstanceOutput) ToStackSetInstanceOutput() StackSetInstanceOutput {
return o
}
func (o StackSetInstanceOutput) ToStackSetInstanceOutputWithContext(ctx context.Context) StackSetInstanceOutput {
return o
}
func (o StackSetInstanceOutput) ToStackSetInstancePtrOutput() StackSetInstancePtrOutput {
return o.ToStackSetInstancePtrOutputWithContext(context.Background())
}
func (o StackSetInstanceOutput) ToStackSetInstancePtrOutputWithContext(ctx context.Context) StackSetInstancePtrOutput {
return o.ApplyT(func(v StackSetInstance) *StackSetInstance {
return &v
}).(StackSetInstancePtrOutput)
}
type StackSetInstancePtrOutput struct {
*pulumi.OutputState
}
func (StackSetInstancePtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**StackSetInstance)(nil))
}
func (o StackSetInstancePtrOutput) ToStackSetInstancePtrOutput() StackSetInstancePtrOutput {
return o
}
func (o StackSetInstancePtrOutput) ToStackSetInstancePtrOutputWithContext(ctx context.Context) StackSetInstancePtrOutput {
return o
}
type StackSetInstanceArrayOutput struct{ *pulumi.OutputState }
func (StackSetInstanceArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]StackSetInstance)(nil))
}
func (o StackSetInstanceArrayOutput) ToStackSetInstanceArrayOutput() StackSetInstanceArrayOutput {
return o
}
func (o StackSetInstanceArrayOutput) ToStackSetInstanceArrayOutputWithContext(ctx context.Context) StackSetInstanceArrayOutput {
return o
}
func (o StackSetInstanceArrayOutput) Index(i pulumi.IntInput) StackSetInstanceOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) StackSetInstance {
return vs[0].([]StackSetInstance)[vs[1].(int)]
}).(StackSetInstanceOutput)
}
type StackSetInstanceMapOutput struct{ *pulumi.OutputState }
func (StackSetInstanceMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]StackSetInstance)(nil))
}
func (o StackSetInstanceMapOutput) ToStackSetInstanceMapOutput() StackSetInstanceMapOutput {
return o
}
func (o StackSetInstanceMapOutput) ToStackSetInstanceMapOutputWithContext(ctx context.Context) StackSetInstanceMapOutput {
return o
}
func (o StackSetInstanceMapOutput) MapIndex(k pulumi.StringInput) StackSetInstanceOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) StackSetInstance {
return vs[0].(map[string]StackSetInstance)[vs[1].(string)]
}).(StackSetInstanceOutput)
}
func init() {
pulumi.RegisterOutputType(StackSetInstanceOutput{})
pulumi.RegisterOutputType(StackSetInstancePtrOutput{})
pulumi.RegisterOutputType(StackSetInstanceArrayOutput{})
pulumi.RegisterOutputType(StackSetInstanceMapOutput{})
}