-
Notifications
You must be signed in to change notification settings - Fork 151
/
configurationAggregator.go
422 lines (370 loc) · 17.3 KB
/
configurationAggregator.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
411
412
413
414
415
416
417
418
419
420
421
422
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package cfg
import (
"context"
"reflect"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages an AWS Config Configuration Aggregator
//
// ## Example Usage
//
// ### Account Based Aggregation
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cfg"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := cfg.NewConfigurationAggregator(ctx, "account", &cfg.ConfigurationAggregatorArgs{
// Name: pulumi.String("example"),
// AccountAggregationSource: &cfg.ConfigurationAggregatorAccountAggregationSourceArgs{
// AccountIds: pulumi.StringArray{
// pulumi.String("123456789012"),
// },
// Regions: pulumi.StringArray{
// pulumi.String("us-west-2"),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ### Organization Based Aggregation
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cfg"
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
// Statements: []iam.GetPolicyDocumentStatement{
// {
// Effect: pulumi.StringRef("Allow"),
// Principals: []iam.GetPolicyDocumentStatementPrincipal{
// {
// Type: "Service",
// Identifiers: []string{
// "config.amazonaws.com",
// },
// },
// },
// Actions: []string{
// "sts:AssumeRole",
// },
// },
// },
// }, nil)
// if err != nil {
// return err
// }
// organizationRole, err := iam.NewRole(ctx, "organization", &iam.RoleArgs{
// Name: pulumi.String("example"),
// AssumeRolePolicy: pulumi.String(assumeRole.Json),
// })
// if err != nil {
// return err
// }
// organizationRolePolicyAttachment, err := iam.NewRolePolicyAttachment(ctx, "organization", &iam.RolePolicyAttachmentArgs{
// Role: organizationRole.Name,
// PolicyArn: pulumi.String("arn:aws:iam::aws:policy/service-role/AWSConfigRoleForOrganizations"),
// })
// if err != nil {
// return err
// }
// _, err = cfg.NewConfigurationAggregator(ctx, "organization", &cfg.ConfigurationAggregatorArgs{
// Name: pulumi.String("example"),
// OrganizationAggregationSource: &cfg.ConfigurationAggregatorOrganizationAggregationSourceArgs{
// AllRegions: pulumi.Bool(true),
// RoleArn: organizationRole.Arn,
// },
// }, pulumi.DependsOn([]pulumi.Resource{
// organizationRolePolicyAttachment,
// }))
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Using `pulumi import`, import Configuration Aggregators using the name. For example:
//
// ```sh
// $ pulumi import aws:cfg/configurationAggregator:ConfigurationAggregator example foo
// ```
type ConfigurationAggregator struct {
pulumi.CustomResourceState
// The account(s) to aggregate config data from as documented below.
AccountAggregationSource ConfigurationAggregatorAccountAggregationSourcePtrOutput `pulumi:"accountAggregationSource"`
// The ARN of the aggregator
Arn pulumi.StringOutput `pulumi:"arn"`
// The name of the configuration aggregator.
Name pulumi.StringOutput `pulumi:"name"`
// The organization to aggregate config data from as documented below.
OrganizationAggregationSource ConfigurationAggregatorOrganizationAggregationSourcePtrOutput `pulumi:"organizationAggregationSource"`
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
//
// Either `accountAggregationSource` or `organizationAggregationSource` must be specified.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
}
// NewConfigurationAggregator registers a new resource with the given unique name, arguments, and options.
func NewConfigurationAggregator(ctx *pulumi.Context,
name string, args *ConfigurationAggregatorArgs, opts ...pulumi.ResourceOption) (*ConfigurationAggregator, error) {
if args == nil {
args = &ConfigurationAggregatorArgs{}
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource ConfigurationAggregator
err := ctx.RegisterResource("aws:cfg/configurationAggregator:ConfigurationAggregator", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetConfigurationAggregator gets an existing ConfigurationAggregator 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 GetConfigurationAggregator(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ConfigurationAggregatorState, opts ...pulumi.ResourceOption) (*ConfigurationAggregator, error) {
var resource ConfigurationAggregator
err := ctx.ReadResource("aws:cfg/configurationAggregator:ConfigurationAggregator", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ConfigurationAggregator resources.
type configurationAggregatorState struct {
// The account(s) to aggregate config data from as documented below.
AccountAggregationSource *ConfigurationAggregatorAccountAggregationSource `pulumi:"accountAggregationSource"`
// The ARN of the aggregator
Arn *string `pulumi:"arn"`
// The name of the configuration aggregator.
Name *string `pulumi:"name"`
// The organization to aggregate config data from as documented below.
OrganizationAggregationSource *ConfigurationAggregatorOrganizationAggregationSource `pulumi:"organizationAggregationSource"`
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
//
// Either `accountAggregationSource` or `organizationAggregationSource` must be specified.
Tags map[string]string `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
TagsAll map[string]string `pulumi:"tagsAll"`
}
type ConfigurationAggregatorState struct {
// The account(s) to aggregate config data from as documented below.
AccountAggregationSource ConfigurationAggregatorAccountAggregationSourcePtrInput
// The ARN of the aggregator
Arn pulumi.StringPtrInput
// The name of the configuration aggregator.
Name pulumi.StringPtrInput
// The organization to aggregate config data from as documented below.
OrganizationAggregationSource ConfigurationAggregatorOrganizationAggregationSourcePtrInput
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
//
// Either `accountAggregationSource` or `organizationAggregationSource` must be specified.
Tags pulumi.StringMapInput
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
TagsAll pulumi.StringMapInput
}
func (ConfigurationAggregatorState) ElementType() reflect.Type {
return reflect.TypeOf((*configurationAggregatorState)(nil)).Elem()
}
type configurationAggregatorArgs struct {
// The account(s) to aggregate config data from as documented below.
AccountAggregationSource *ConfigurationAggregatorAccountAggregationSource `pulumi:"accountAggregationSource"`
// The name of the configuration aggregator.
Name *string `pulumi:"name"`
// The organization to aggregate config data from as documented below.
OrganizationAggregationSource *ConfigurationAggregatorOrganizationAggregationSource `pulumi:"organizationAggregationSource"`
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
//
// Either `accountAggregationSource` or `organizationAggregationSource` must be specified.
Tags map[string]string `pulumi:"tags"`
}
// The set of arguments for constructing a ConfigurationAggregator resource.
type ConfigurationAggregatorArgs struct {
// The account(s) to aggregate config data from as documented below.
AccountAggregationSource ConfigurationAggregatorAccountAggregationSourcePtrInput
// The name of the configuration aggregator.
Name pulumi.StringPtrInput
// The organization to aggregate config data from as documented below.
OrganizationAggregationSource ConfigurationAggregatorOrganizationAggregationSourcePtrInput
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
//
// Either `accountAggregationSource` or `organizationAggregationSource` must be specified.
Tags pulumi.StringMapInput
}
func (ConfigurationAggregatorArgs) ElementType() reflect.Type {
return reflect.TypeOf((*configurationAggregatorArgs)(nil)).Elem()
}
type ConfigurationAggregatorInput interface {
pulumi.Input
ToConfigurationAggregatorOutput() ConfigurationAggregatorOutput
ToConfigurationAggregatorOutputWithContext(ctx context.Context) ConfigurationAggregatorOutput
}
func (*ConfigurationAggregator) ElementType() reflect.Type {
return reflect.TypeOf((**ConfigurationAggregator)(nil)).Elem()
}
func (i *ConfigurationAggregator) ToConfigurationAggregatorOutput() ConfigurationAggregatorOutput {
return i.ToConfigurationAggregatorOutputWithContext(context.Background())
}
func (i *ConfigurationAggregator) ToConfigurationAggregatorOutputWithContext(ctx context.Context) ConfigurationAggregatorOutput {
return pulumi.ToOutputWithContext(ctx, i).(ConfigurationAggregatorOutput)
}
// ConfigurationAggregatorArrayInput is an input type that accepts ConfigurationAggregatorArray and ConfigurationAggregatorArrayOutput values.
// You can construct a concrete instance of `ConfigurationAggregatorArrayInput` via:
//
// ConfigurationAggregatorArray{ ConfigurationAggregatorArgs{...} }
type ConfigurationAggregatorArrayInput interface {
pulumi.Input
ToConfigurationAggregatorArrayOutput() ConfigurationAggregatorArrayOutput
ToConfigurationAggregatorArrayOutputWithContext(context.Context) ConfigurationAggregatorArrayOutput
}
type ConfigurationAggregatorArray []ConfigurationAggregatorInput
func (ConfigurationAggregatorArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ConfigurationAggregator)(nil)).Elem()
}
func (i ConfigurationAggregatorArray) ToConfigurationAggregatorArrayOutput() ConfigurationAggregatorArrayOutput {
return i.ToConfigurationAggregatorArrayOutputWithContext(context.Background())
}
func (i ConfigurationAggregatorArray) ToConfigurationAggregatorArrayOutputWithContext(ctx context.Context) ConfigurationAggregatorArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ConfigurationAggregatorArrayOutput)
}
// ConfigurationAggregatorMapInput is an input type that accepts ConfigurationAggregatorMap and ConfigurationAggregatorMapOutput values.
// You can construct a concrete instance of `ConfigurationAggregatorMapInput` via:
//
// ConfigurationAggregatorMap{ "key": ConfigurationAggregatorArgs{...} }
type ConfigurationAggregatorMapInput interface {
pulumi.Input
ToConfigurationAggregatorMapOutput() ConfigurationAggregatorMapOutput
ToConfigurationAggregatorMapOutputWithContext(context.Context) ConfigurationAggregatorMapOutput
}
type ConfigurationAggregatorMap map[string]ConfigurationAggregatorInput
func (ConfigurationAggregatorMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ConfigurationAggregator)(nil)).Elem()
}
func (i ConfigurationAggregatorMap) ToConfigurationAggregatorMapOutput() ConfigurationAggregatorMapOutput {
return i.ToConfigurationAggregatorMapOutputWithContext(context.Background())
}
func (i ConfigurationAggregatorMap) ToConfigurationAggregatorMapOutputWithContext(ctx context.Context) ConfigurationAggregatorMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ConfigurationAggregatorMapOutput)
}
type ConfigurationAggregatorOutput struct{ *pulumi.OutputState }
func (ConfigurationAggregatorOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ConfigurationAggregator)(nil)).Elem()
}
func (o ConfigurationAggregatorOutput) ToConfigurationAggregatorOutput() ConfigurationAggregatorOutput {
return o
}
func (o ConfigurationAggregatorOutput) ToConfigurationAggregatorOutputWithContext(ctx context.Context) ConfigurationAggregatorOutput {
return o
}
// The account(s) to aggregate config data from as documented below.
func (o ConfigurationAggregatorOutput) AccountAggregationSource() ConfigurationAggregatorAccountAggregationSourcePtrOutput {
return o.ApplyT(func(v *ConfigurationAggregator) ConfigurationAggregatorAccountAggregationSourcePtrOutput {
return v.AccountAggregationSource
}).(ConfigurationAggregatorAccountAggregationSourcePtrOutput)
}
// The ARN of the aggregator
func (o ConfigurationAggregatorOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v *ConfigurationAggregator) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
}
// The name of the configuration aggregator.
func (o ConfigurationAggregatorOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *ConfigurationAggregator) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The organization to aggregate config data from as documented below.
func (o ConfigurationAggregatorOutput) OrganizationAggregationSource() ConfigurationAggregatorOrganizationAggregationSourcePtrOutput {
return o.ApplyT(func(v *ConfigurationAggregator) ConfigurationAggregatorOrganizationAggregationSourcePtrOutput {
return v.OrganizationAggregationSource
}).(ConfigurationAggregatorOrganizationAggregationSourcePtrOutput)
}
// A map of tags to assign to the resource. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
//
// Either `accountAggregationSource` or `organizationAggregationSource` must be specified.
func (o ConfigurationAggregatorOutput) Tags() pulumi.StringMapOutput {
return o.ApplyT(func(v *ConfigurationAggregator) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
}
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
func (o ConfigurationAggregatorOutput) TagsAll() pulumi.StringMapOutput {
return o.ApplyT(func(v *ConfigurationAggregator) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
}
type ConfigurationAggregatorArrayOutput struct{ *pulumi.OutputState }
func (ConfigurationAggregatorArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ConfigurationAggregator)(nil)).Elem()
}
func (o ConfigurationAggregatorArrayOutput) ToConfigurationAggregatorArrayOutput() ConfigurationAggregatorArrayOutput {
return o
}
func (o ConfigurationAggregatorArrayOutput) ToConfigurationAggregatorArrayOutputWithContext(ctx context.Context) ConfigurationAggregatorArrayOutput {
return o
}
func (o ConfigurationAggregatorArrayOutput) Index(i pulumi.IntInput) ConfigurationAggregatorOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ConfigurationAggregator {
return vs[0].([]*ConfigurationAggregator)[vs[1].(int)]
}).(ConfigurationAggregatorOutput)
}
type ConfigurationAggregatorMapOutput struct{ *pulumi.OutputState }
func (ConfigurationAggregatorMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ConfigurationAggregator)(nil)).Elem()
}
func (o ConfigurationAggregatorMapOutput) ToConfigurationAggregatorMapOutput() ConfigurationAggregatorMapOutput {
return o
}
func (o ConfigurationAggregatorMapOutput) ToConfigurationAggregatorMapOutputWithContext(ctx context.Context) ConfigurationAggregatorMapOutput {
return o
}
func (o ConfigurationAggregatorMapOutput) MapIndex(k pulumi.StringInput) ConfigurationAggregatorOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ConfigurationAggregator {
return vs[0].(map[string]*ConfigurationAggregator)[vs[1].(string)]
}).(ConfigurationAggregatorOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ConfigurationAggregatorInput)(nil)).Elem(), &ConfigurationAggregator{})
pulumi.RegisterInputType(reflect.TypeOf((*ConfigurationAggregatorArrayInput)(nil)).Elem(), ConfigurationAggregatorArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ConfigurationAggregatorMapInput)(nil)).Elem(), ConfigurationAggregatorMap{})
pulumi.RegisterOutputType(ConfigurationAggregatorOutput{})
pulumi.RegisterOutputType(ConfigurationAggregatorArrayOutput{})
pulumi.RegisterOutputType(ConfigurationAggregatorMapOutput{})
}