github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cfg/configurationAggregator.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package cfg
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Manages an AWS Config Configuration Aggregator
    15  //
    16  // ## Example Usage
    17  //
    18  // ### Account Based Aggregation
    19  //
    20  // <!--Start PulumiCodeChooser -->
    21  // ```go
    22  // package main
    23  //
    24  // import (
    25  //
    26  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cfg"
    27  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    28  //
    29  // )
    30  //
    31  //	func main() {
    32  //		pulumi.Run(func(ctx *pulumi.Context) error {
    33  //			_, err := cfg.NewConfigurationAggregator(ctx, "account", &cfg.ConfigurationAggregatorArgs{
    34  //				Name: pulumi.String("example"),
    35  //				AccountAggregationSource: &cfg.ConfigurationAggregatorAccountAggregationSourceArgs{
    36  //					AccountIds: pulumi.StringArray{
    37  //						pulumi.String("123456789012"),
    38  //					},
    39  //					Regions: pulumi.StringArray{
    40  //						pulumi.String("us-west-2"),
    41  //					},
    42  //				},
    43  //			})
    44  //			if err != nil {
    45  //				return err
    46  //			}
    47  //			return nil
    48  //		})
    49  //	}
    50  //
    51  // ```
    52  // <!--End PulumiCodeChooser -->
    53  //
    54  // ### Organization Based Aggregation
    55  //
    56  // <!--Start PulumiCodeChooser -->
    57  // ```go
    58  // package main
    59  //
    60  // import (
    61  //
    62  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cfg"
    63  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    64  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    65  //
    66  // )
    67  //
    68  //	func main() {
    69  //		pulumi.Run(func(ctx *pulumi.Context) error {
    70  //			assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    71  //				Statements: []iam.GetPolicyDocumentStatement{
    72  //					{
    73  //						Effect: pulumi.StringRef("Allow"),
    74  //						Principals: []iam.GetPolicyDocumentStatementPrincipal{
    75  //							{
    76  //								Type: "Service",
    77  //								Identifiers: []string{
    78  //									"config.amazonaws.com",
    79  //								},
    80  //							},
    81  //						},
    82  //						Actions: []string{
    83  //							"sts:AssumeRole",
    84  //						},
    85  //					},
    86  //				},
    87  //			}, nil)
    88  //			if err != nil {
    89  //				return err
    90  //			}
    91  //			organizationRole, err := iam.NewRole(ctx, "organization", &iam.RoleArgs{
    92  //				Name:             pulumi.String("example"),
    93  //				AssumeRolePolicy: pulumi.String(assumeRole.Json),
    94  //			})
    95  //			if err != nil {
    96  //				return err
    97  //			}
    98  //			organizationRolePolicyAttachment, err := iam.NewRolePolicyAttachment(ctx, "organization", &iam.RolePolicyAttachmentArgs{
    99  //				Role:      organizationRole.Name,
   100  //				PolicyArn: pulumi.String("arn:aws:iam::aws:policy/service-role/AWSConfigRoleForOrganizations"),
   101  //			})
   102  //			if err != nil {
   103  //				return err
   104  //			}
   105  //			_, err = cfg.NewConfigurationAggregator(ctx, "organization", &cfg.ConfigurationAggregatorArgs{
   106  //				Name: pulumi.String("example"),
   107  //				OrganizationAggregationSource: &cfg.ConfigurationAggregatorOrganizationAggregationSourceArgs{
   108  //					AllRegions: pulumi.Bool(true),
   109  //					RoleArn:    organizationRole.Arn,
   110  //				},
   111  //			}, pulumi.DependsOn([]pulumi.Resource{
   112  //				organizationRolePolicyAttachment,
   113  //			}))
   114  //			if err != nil {
   115  //				return err
   116  //			}
   117  //			return nil
   118  //		})
   119  //	}
   120  //
   121  // ```
   122  // <!--End PulumiCodeChooser -->
   123  //
   124  // ## Import
   125  //
   126  // Using `pulumi import`, import Configuration Aggregators using the name. For example:
   127  //
   128  // ```sh
   129  // $ pulumi import aws:cfg/configurationAggregator:ConfigurationAggregator example foo
   130  // ```
   131  type ConfigurationAggregator struct {
   132  	pulumi.CustomResourceState
   133  
   134  	// The account(s) to aggregate config data from as documented below.
   135  	AccountAggregationSource ConfigurationAggregatorAccountAggregationSourcePtrOutput `pulumi:"accountAggregationSource"`
   136  	// The ARN of the aggregator
   137  	Arn pulumi.StringOutput `pulumi:"arn"`
   138  	// The name of the configuration aggregator.
   139  	Name pulumi.StringOutput `pulumi:"name"`
   140  	// The organization to aggregate config data from as documented below.
   141  	OrganizationAggregationSource ConfigurationAggregatorOrganizationAggregationSourcePtrOutput `pulumi:"organizationAggregationSource"`
   142  	// 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.
   143  	//
   144  	// Either `accountAggregationSource` or `organizationAggregationSource` must be specified.
   145  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   146  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   147  	//
   148  	// Deprecated: Please use `tags` instead.
   149  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   150  }
   151  
   152  // NewConfigurationAggregator registers a new resource with the given unique name, arguments, and options.
   153  func NewConfigurationAggregator(ctx *pulumi.Context,
   154  	name string, args *ConfigurationAggregatorArgs, opts ...pulumi.ResourceOption) (*ConfigurationAggregator, error) {
   155  	if args == nil {
   156  		args = &ConfigurationAggregatorArgs{}
   157  	}
   158  
   159  	opts = internal.PkgResourceDefaultOpts(opts)
   160  	var resource ConfigurationAggregator
   161  	err := ctx.RegisterResource("aws:cfg/configurationAggregator:ConfigurationAggregator", name, args, &resource, opts...)
   162  	if err != nil {
   163  		return nil, err
   164  	}
   165  	return &resource, nil
   166  }
   167  
   168  // GetConfigurationAggregator gets an existing ConfigurationAggregator resource's state with the given name, ID, and optional
   169  // state properties that are used to uniquely qualify the lookup (nil if not required).
   170  func GetConfigurationAggregator(ctx *pulumi.Context,
   171  	name string, id pulumi.IDInput, state *ConfigurationAggregatorState, opts ...pulumi.ResourceOption) (*ConfigurationAggregator, error) {
   172  	var resource ConfigurationAggregator
   173  	err := ctx.ReadResource("aws:cfg/configurationAggregator:ConfigurationAggregator", name, id, state, &resource, opts...)
   174  	if err != nil {
   175  		return nil, err
   176  	}
   177  	return &resource, nil
   178  }
   179  
   180  // Input properties used for looking up and filtering ConfigurationAggregator resources.
   181  type configurationAggregatorState struct {
   182  	// The account(s) to aggregate config data from as documented below.
   183  	AccountAggregationSource *ConfigurationAggregatorAccountAggregationSource `pulumi:"accountAggregationSource"`
   184  	// The ARN of the aggregator
   185  	Arn *string `pulumi:"arn"`
   186  	// The name of the configuration aggregator.
   187  	Name *string `pulumi:"name"`
   188  	// The organization to aggregate config data from as documented below.
   189  	OrganizationAggregationSource *ConfigurationAggregatorOrganizationAggregationSource `pulumi:"organizationAggregationSource"`
   190  	// 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.
   191  	//
   192  	// Either `accountAggregationSource` or `organizationAggregationSource` must be specified.
   193  	Tags map[string]string `pulumi:"tags"`
   194  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   195  	//
   196  	// Deprecated: Please use `tags` instead.
   197  	TagsAll map[string]string `pulumi:"tagsAll"`
   198  }
   199  
   200  type ConfigurationAggregatorState struct {
   201  	// The account(s) to aggregate config data from as documented below.
   202  	AccountAggregationSource ConfigurationAggregatorAccountAggregationSourcePtrInput
   203  	// The ARN of the aggregator
   204  	Arn pulumi.StringPtrInput
   205  	// The name of the configuration aggregator.
   206  	Name pulumi.StringPtrInput
   207  	// The organization to aggregate config data from as documented below.
   208  	OrganizationAggregationSource ConfigurationAggregatorOrganizationAggregationSourcePtrInput
   209  	// 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.
   210  	//
   211  	// Either `accountAggregationSource` or `organizationAggregationSource` must be specified.
   212  	Tags pulumi.StringMapInput
   213  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   214  	//
   215  	// Deprecated: Please use `tags` instead.
   216  	TagsAll pulumi.StringMapInput
   217  }
   218  
   219  func (ConfigurationAggregatorState) ElementType() reflect.Type {
   220  	return reflect.TypeOf((*configurationAggregatorState)(nil)).Elem()
   221  }
   222  
   223  type configurationAggregatorArgs struct {
   224  	// The account(s) to aggregate config data from as documented below.
   225  	AccountAggregationSource *ConfigurationAggregatorAccountAggregationSource `pulumi:"accountAggregationSource"`
   226  	// The name of the configuration aggregator.
   227  	Name *string `pulumi:"name"`
   228  	// The organization to aggregate config data from as documented below.
   229  	OrganizationAggregationSource *ConfigurationAggregatorOrganizationAggregationSource `pulumi:"organizationAggregationSource"`
   230  	// 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.
   231  	//
   232  	// Either `accountAggregationSource` or `organizationAggregationSource` must be specified.
   233  	Tags map[string]string `pulumi:"tags"`
   234  }
   235  
   236  // The set of arguments for constructing a ConfigurationAggregator resource.
   237  type ConfigurationAggregatorArgs struct {
   238  	// The account(s) to aggregate config data from as documented below.
   239  	AccountAggregationSource ConfigurationAggregatorAccountAggregationSourcePtrInput
   240  	// The name of the configuration aggregator.
   241  	Name pulumi.StringPtrInput
   242  	// The organization to aggregate config data from as documented below.
   243  	OrganizationAggregationSource ConfigurationAggregatorOrganizationAggregationSourcePtrInput
   244  	// 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.
   245  	//
   246  	// Either `accountAggregationSource` or `organizationAggregationSource` must be specified.
   247  	Tags pulumi.StringMapInput
   248  }
   249  
   250  func (ConfigurationAggregatorArgs) ElementType() reflect.Type {
   251  	return reflect.TypeOf((*configurationAggregatorArgs)(nil)).Elem()
   252  }
   253  
   254  type ConfigurationAggregatorInput interface {
   255  	pulumi.Input
   256  
   257  	ToConfigurationAggregatorOutput() ConfigurationAggregatorOutput
   258  	ToConfigurationAggregatorOutputWithContext(ctx context.Context) ConfigurationAggregatorOutput
   259  }
   260  
   261  func (*ConfigurationAggregator) ElementType() reflect.Type {
   262  	return reflect.TypeOf((**ConfigurationAggregator)(nil)).Elem()
   263  }
   264  
   265  func (i *ConfigurationAggregator) ToConfigurationAggregatorOutput() ConfigurationAggregatorOutput {
   266  	return i.ToConfigurationAggregatorOutputWithContext(context.Background())
   267  }
   268  
   269  func (i *ConfigurationAggregator) ToConfigurationAggregatorOutputWithContext(ctx context.Context) ConfigurationAggregatorOutput {
   270  	return pulumi.ToOutputWithContext(ctx, i).(ConfigurationAggregatorOutput)
   271  }
   272  
   273  // ConfigurationAggregatorArrayInput is an input type that accepts ConfigurationAggregatorArray and ConfigurationAggregatorArrayOutput values.
   274  // You can construct a concrete instance of `ConfigurationAggregatorArrayInput` via:
   275  //
   276  //	ConfigurationAggregatorArray{ ConfigurationAggregatorArgs{...} }
   277  type ConfigurationAggregatorArrayInput interface {
   278  	pulumi.Input
   279  
   280  	ToConfigurationAggregatorArrayOutput() ConfigurationAggregatorArrayOutput
   281  	ToConfigurationAggregatorArrayOutputWithContext(context.Context) ConfigurationAggregatorArrayOutput
   282  }
   283  
   284  type ConfigurationAggregatorArray []ConfigurationAggregatorInput
   285  
   286  func (ConfigurationAggregatorArray) ElementType() reflect.Type {
   287  	return reflect.TypeOf((*[]*ConfigurationAggregator)(nil)).Elem()
   288  }
   289  
   290  func (i ConfigurationAggregatorArray) ToConfigurationAggregatorArrayOutput() ConfigurationAggregatorArrayOutput {
   291  	return i.ToConfigurationAggregatorArrayOutputWithContext(context.Background())
   292  }
   293  
   294  func (i ConfigurationAggregatorArray) ToConfigurationAggregatorArrayOutputWithContext(ctx context.Context) ConfigurationAggregatorArrayOutput {
   295  	return pulumi.ToOutputWithContext(ctx, i).(ConfigurationAggregatorArrayOutput)
   296  }
   297  
   298  // ConfigurationAggregatorMapInput is an input type that accepts ConfigurationAggregatorMap and ConfigurationAggregatorMapOutput values.
   299  // You can construct a concrete instance of `ConfigurationAggregatorMapInput` via:
   300  //
   301  //	ConfigurationAggregatorMap{ "key": ConfigurationAggregatorArgs{...} }
   302  type ConfigurationAggregatorMapInput interface {
   303  	pulumi.Input
   304  
   305  	ToConfigurationAggregatorMapOutput() ConfigurationAggregatorMapOutput
   306  	ToConfigurationAggregatorMapOutputWithContext(context.Context) ConfigurationAggregatorMapOutput
   307  }
   308  
   309  type ConfigurationAggregatorMap map[string]ConfigurationAggregatorInput
   310  
   311  func (ConfigurationAggregatorMap) ElementType() reflect.Type {
   312  	return reflect.TypeOf((*map[string]*ConfigurationAggregator)(nil)).Elem()
   313  }
   314  
   315  func (i ConfigurationAggregatorMap) ToConfigurationAggregatorMapOutput() ConfigurationAggregatorMapOutput {
   316  	return i.ToConfigurationAggregatorMapOutputWithContext(context.Background())
   317  }
   318  
   319  func (i ConfigurationAggregatorMap) ToConfigurationAggregatorMapOutputWithContext(ctx context.Context) ConfigurationAggregatorMapOutput {
   320  	return pulumi.ToOutputWithContext(ctx, i).(ConfigurationAggregatorMapOutput)
   321  }
   322  
   323  type ConfigurationAggregatorOutput struct{ *pulumi.OutputState }
   324  
   325  func (ConfigurationAggregatorOutput) ElementType() reflect.Type {
   326  	return reflect.TypeOf((**ConfigurationAggregator)(nil)).Elem()
   327  }
   328  
   329  func (o ConfigurationAggregatorOutput) ToConfigurationAggregatorOutput() ConfigurationAggregatorOutput {
   330  	return o
   331  }
   332  
   333  func (o ConfigurationAggregatorOutput) ToConfigurationAggregatorOutputWithContext(ctx context.Context) ConfigurationAggregatorOutput {
   334  	return o
   335  }
   336  
   337  // The account(s) to aggregate config data from as documented below.
   338  func (o ConfigurationAggregatorOutput) AccountAggregationSource() ConfigurationAggregatorAccountAggregationSourcePtrOutput {
   339  	return o.ApplyT(func(v *ConfigurationAggregator) ConfigurationAggregatorAccountAggregationSourcePtrOutput {
   340  		return v.AccountAggregationSource
   341  	}).(ConfigurationAggregatorAccountAggregationSourcePtrOutput)
   342  }
   343  
   344  // The ARN of the aggregator
   345  func (o ConfigurationAggregatorOutput) Arn() pulumi.StringOutput {
   346  	return o.ApplyT(func(v *ConfigurationAggregator) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   347  }
   348  
   349  // The name of the configuration aggregator.
   350  func (o ConfigurationAggregatorOutput) Name() pulumi.StringOutput {
   351  	return o.ApplyT(func(v *ConfigurationAggregator) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   352  }
   353  
   354  // The organization to aggregate config data from as documented below.
   355  func (o ConfigurationAggregatorOutput) OrganizationAggregationSource() ConfigurationAggregatorOrganizationAggregationSourcePtrOutput {
   356  	return o.ApplyT(func(v *ConfigurationAggregator) ConfigurationAggregatorOrganizationAggregationSourcePtrOutput {
   357  		return v.OrganizationAggregationSource
   358  	}).(ConfigurationAggregatorOrganizationAggregationSourcePtrOutput)
   359  }
   360  
   361  // 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.
   362  //
   363  // Either `accountAggregationSource` or `organizationAggregationSource` must be specified.
   364  func (o ConfigurationAggregatorOutput) Tags() pulumi.StringMapOutput {
   365  	return o.ApplyT(func(v *ConfigurationAggregator) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   366  }
   367  
   368  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   369  //
   370  // Deprecated: Please use `tags` instead.
   371  func (o ConfigurationAggregatorOutput) TagsAll() pulumi.StringMapOutput {
   372  	return o.ApplyT(func(v *ConfigurationAggregator) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   373  }
   374  
   375  type ConfigurationAggregatorArrayOutput struct{ *pulumi.OutputState }
   376  
   377  func (ConfigurationAggregatorArrayOutput) ElementType() reflect.Type {
   378  	return reflect.TypeOf((*[]*ConfigurationAggregator)(nil)).Elem()
   379  }
   380  
   381  func (o ConfigurationAggregatorArrayOutput) ToConfigurationAggregatorArrayOutput() ConfigurationAggregatorArrayOutput {
   382  	return o
   383  }
   384  
   385  func (o ConfigurationAggregatorArrayOutput) ToConfigurationAggregatorArrayOutputWithContext(ctx context.Context) ConfigurationAggregatorArrayOutput {
   386  	return o
   387  }
   388  
   389  func (o ConfigurationAggregatorArrayOutput) Index(i pulumi.IntInput) ConfigurationAggregatorOutput {
   390  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ConfigurationAggregator {
   391  		return vs[0].([]*ConfigurationAggregator)[vs[1].(int)]
   392  	}).(ConfigurationAggregatorOutput)
   393  }
   394  
   395  type ConfigurationAggregatorMapOutput struct{ *pulumi.OutputState }
   396  
   397  func (ConfigurationAggregatorMapOutput) ElementType() reflect.Type {
   398  	return reflect.TypeOf((*map[string]*ConfigurationAggregator)(nil)).Elem()
   399  }
   400  
   401  func (o ConfigurationAggregatorMapOutput) ToConfigurationAggregatorMapOutput() ConfigurationAggregatorMapOutput {
   402  	return o
   403  }
   404  
   405  func (o ConfigurationAggregatorMapOutput) ToConfigurationAggregatorMapOutputWithContext(ctx context.Context) ConfigurationAggregatorMapOutput {
   406  	return o
   407  }
   408  
   409  func (o ConfigurationAggregatorMapOutput) MapIndex(k pulumi.StringInput) ConfigurationAggregatorOutput {
   410  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ConfigurationAggregator {
   411  		return vs[0].(map[string]*ConfigurationAggregator)[vs[1].(string)]
   412  	}).(ConfigurationAggregatorOutput)
   413  }
   414  
   415  func init() {
   416  	pulumi.RegisterInputType(reflect.TypeOf((*ConfigurationAggregatorInput)(nil)).Elem(), &ConfigurationAggregator{})
   417  	pulumi.RegisterInputType(reflect.TypeOf((*ConfigurationAggregatorArrayInput)(nil)).Elem(), ConfigurationAggregatorArray{})
   418  	pulumi.RegisterInputType(reflect.TypeOf((*ConfigurationAggregatorMapInput)(nil)).Elem(), ConfigurationAggregatorMap{})
   419  	pulumi.RegisterOutputType(ConfigurationAggregatorOutput{})
   420  	pulumi.RegisterOutputType(ConfigurationAggregatorArrayOutput{})
   421  	pulumi.RegisterOutputType(ConfigurationAggregatorMapOutput{})
   422  }