github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cfg/organizationManagedRule.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 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Manages a Config Organization Managed Rule. More information about these rules can be found in the [Enabling AWS Config Rules Across all Accounts in Your Organization](https://docs.aws.amazon.com/config/latest/developerguide/config-rule-multi-account-deployment.html) and [AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_use-managed-rules.html) documentation. For working with Organization Custom Rules (those invoking a custom Lambda Function), see the `cfg.OrganizationCustomRule` resource. 16 // 17 // > **NOTE:** This resource must be created in the Organization master account and rules will include the master account unless its ID is added to the `excludedAccounts` argument. 18 // 19 // > **NOTE:** Every Organization account except those configured in the `excludedAccounts` argument must have a Configuration Recorder with proper IAM permissions before the rule will successfully create or update. See also the `cfg.Recorder` resource. 20 // 21 // ## Example Usage 22 // 23 // <!--Start PulumiCodeChooser --> 24 // ```go 25 // package main 26 // 27 // import ( 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cfg" 30 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/organizations" 31 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 32 // 33 // ) 34 // 35 // func main() { 36 // pulumi.Run(func(ctx *pulumi.Context) error { 37 // example, err := organizations.NewOrganization(ctx, "example", &organizations.OrganizationArgs{ 38 // AwsServiceAccessPrincipals: pulumi.StringArray{ 39 // pulumi.String("config-multiaccountsetup.amazonaws.com"), 40 // }, 41 // FeatureSet: pulumi.String("ALL"), 42 // }) 43 // if err != nil { 44 // return err 45 // } 46 // _, err = cfg.NewOrganizationManagedRule(ctx, "example", &cfg.OrganizationManagedRuleArgs{ 47 // Name: pulumi.String("example"), 48 // RuleIdentifier: pulumi.String("IAM_PASSWORD_POLICY"), 49 // }, pulumi.DependsOn([]pulumi.Resource{ 50 // example, 51 // })) 52 // if err != nil { 53 // return err 54 // } 55 // return nil 56 // }) 57 // } 58 // 59 // ``` 60 // <!--End PulumiCodeChooser --> 61 // 62 // ## Import 63 // 64 // Using `pulumi import`, import Config Organization Managed Rules using the name. For example: 65 // 66 // ```sh 67 // $ pulumi import aws:cfg/organizationManagedRule:OrganizationManagedRule example example 68 // ``` 69 type OrganizationManagedRule struct { 70 pulumi.CustomResourceState 71 72 // Amazon Resource Name (ARN) of the rule 73 Arn pulumi.StringOutput `pulumi:"arn"` 74 // Description of the rule 75 Description pulumi.StringPtrOutput `pulumi:"description"` 76 // List of AWS account identifiers to exclude from the rule 77 ExcludedAccounts pulumi.StringArrayOutput `pulumi:"excludedAccounts"` 78 // A string in JSON format that is passed to the AWS Config Rule Lambda Function 79 InputParameters pulumi.StringPtrOutput `pulumi:"inputParameters"` 80 // The maximum frequency with which AWS Config runs evaluations for a rule, if the rule is triggered at a periodic frequency. Defaults to `TwentyFour_Hours` for periodic frequency triggered rules. Valid values: `One_Hour`, `Three_Hours`, `Six_Hours`, `Twelve_Hours`, or `TwentyFour_Hours`. 81 MaximumExecutionFrequency pulumi.StringPtrOutput `pulumi:"maximumExecutionFrequency"` 82 // The name of the rule 83 Name pulumi.StringOutput `pulumi:"name"` 84 // Identifier of the AWS resource to evaluate 85 ResourceIdScope pulumi.StringPtrOutput `pulumi:"resourceIdScope"` 86 // List of types of AWS resources to evaluate 87 ResourceTypesScopes pulumi.StringArrayOutput `pulumi:"resourceTypesScopes"` 88 // Identifier of an available AWS Config Managed Rule to call. For available values, see the [List of AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html) documentation 89 RuleIdentifier pulumi.StringOutput `pulumi:"ruleIdentifier"` 90 // Tag key of AWS resources to evaluate 91 TagKeyScope pulumi.StringPtrOutput `pulumi:"tagKeyScope"` 92 // Tag value of AWS resources to evaluate 93 TagValueScope pulumi.StringPtrOutput `pulumi:"tagValueScope"` 94 } 95 96 // NewOrganizationManagedRule registers a new resource with the given unique name, arguments, and options. 97 func NewOrganizationManagedRule(ctx *pulumi.Context, 98 name string, args *OrganizationManagedRuleArgs, opts ...pulumi.ResourceOption) (*OrganizationManagedRule, error) { 99 if args == nil { 100 return nil, errors.New("missing one or more required arguments") 101 } 102 103 if args.RuleIdentifier == nil { 104 return nil, errors.New("invalid value for required argument 'RuleIdentifier'") 105 } 106 opts = internal.PkgResourceDefaultOpts(opts) 107 var resource OrganizationManagedRule 108 err := ctx.RegisterResource("aws:cfg/organizationManagedRule:OrganizationManagedRule", name, args, &resource, opts...) 109 if err != nil { 110 return nil, err 111 } 112 return &resource, nil 113 } 114 115 // GetOrganizationManagedRule gets an existing OrganizationManagedRule resource's state with the given name, ID, and optional 116 // state properties that are used to uniquely qualify the lookup (nil if not required). 117 func GetOrganizationManagedRule(ctx *pulumi.Context, 118 name string, id pulumi.IDInput, state *OrganizationManagedRuleState, opts ...pulumi.ResourceOption) (*OrganizationManagedRule, error) { 119 var resource OrganizationManagedRule 120 err := ctx.ReadResource("aws:cfg/organizationManagedRule:OrganizationManagedRule", name, id, state, &resource, opts...) 121 if err != nil { 122 return nil, err 123 } 124 return &resource, nil 125 } 126 127 // Input properties used for looking up and filtering OrganizationManagedRule resources. 128 type organizationManagedRuleState struct { 129 // Amazon Resource Name (ARN) of the rule 130 Arn *string `pulumi:"arn"` 131 // Description of the rule 132 Description *string `pulumi:"description"` 133 // List of AWS account identifiers to exclude from the rule 134 ExcludedAccounts []string `pulumi:"excludedAccounts"` 135 // A string in JSON format that is passed to the AWS Config Rule Lambda Function 136 InputParameters *string `pulumi:"inputParameters"` 137 // The maximum frequency with which AWS Config runs evaluations for a rule, if the rule is triggered at a periodic frequency. Defaults to `TwentyFour_Hours` for periodic frequency triggered rules. Valid values: `One_Hour`, `Three_Hours`, `Six_Hours`, `Twelve_Hours`, or `TwentyFour_Hours`. 138 MaximumExecutionFrequency *string `pulumi:"maximumExecutionFrequency"` 139 // The name of the rule 140 Name *string `pulumi:"name"` 141 // Identifier of the AWS resource to evaluate 142 ResourceIdScope *string `pulumi:"resourceIdScope"` 143 // List of types of AWS resources to evaluate 144 ResourceTypesScopes []string `pulumi:"resourceTypesScopes"` 145 // Identifier of an available AWS Config Managed Rule to call. For available values, see the [List of AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html) documentation 146 RuleIdentifier *string `pulumi:"ruleIdentifier"` 147 // Tag key of AWS resources to evaluate 148 TagKeyScope *string `pulumi:"tagKeyScope"` 149 // Tag value of AWS resources to evaluate 150 TagValueScope *string `pulumi:"tagValueScope"` 151 } 152 153 type OrganizationManagedRuleState struct { 154 // Amazon Resource Name (ARN) of the rule 155 Arn pulumi.StringPtrInput 156 // Description of the rule 157 Description pulumi.StringPtrInput 158 // List of AWS account identifiers to exclude from the rule 159 ExcludedAccounts pulumi.StringArrayInput 160 // A string in JSON format that is passed to the AWS Config Rule Lambda Function 161 InputParameters pulumi.StringPtrInput 162 // The maximum frequency with which AWS Config runs evaluations for a rule, if the rule is triggered at a periodic frequency. Defaults to `TwentyFour_Hours` for periodic frequency triggered rules. Valid values: `One_Hour`, `Three_Hours`, `Six_Hours`, `Twelve_Hours`, or `TwentyFour_Hours`. 163 MaximumExecutionFrequency pulumi.StringPtrInput 164 // The name of the rule 165 Name pulumi.StringPtrInput 166 // Identifier of the AWS resource to evaluate 167 ResourceIdScope pulumi.StringPtrInput 168 // List of types of AWS resources to evaluate 169 ResourceTypesScopes pulumi.StringArrayInput 170 // Identifier of an available AWS Config Managed Rule to call. For available values, see the [List of AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html) documentation 171 RuleIdentifier pulumi.StringPtrInput 172 // Tag key of AWS resources to evaluate 173 TagKeyScope pulumi.StringPtrInput 174 // Tag value of AWS resources to evaluate 175 TagValueScope pulumi.StringPtrInput 176 } 177 178 func (OrganizationManagedRuleState) ElementType() reflect.Type { 179 return reflect.TypeOf((*organizationManagedRuleState)(nil)).Elem() 180 } 181 182 type organizationManagedRuleArgs struct { 183 // Description of the rule 184 Description *string `pulumi:"description"` 185 // List of AWS account identifiers to exclude from the rule 186 ExcludedAccounts []string `pulumi:"excludedAccounts"` 187 // A string in JSON format that is passed to the AWS Config Rule Lambda Function 188 InputParameters *string `pulumi:"inputParameters"` 189 // The maximum frequency with which AWS Config runs evaluations for a rule, if the rule is triggered at a periodic frequency. Defaults to `TwentyFour_Hours` for periodic frequency triggered rules. Valid values: `One_Hour`, `Three_Hours`, `Six_Hours`, `Twelve_Hours`, or `TwentyFour_Hours`. 190 MaximumExecutionFrequency *string `pulumi:"maximumExecutionFrequency"` 191 // The name of the rule 192 Name *string `pulumi:"name"` 193 // Identifier of the AWS resource to evaluate 194 ResourceIdScope *string `pulumi:"resourceIdScope"` 195 // List of types of AWS resources to evaluate 196 ResourceTypesScopes []string `pulumi:"resourceTypesScopes"` 197 // Identifier of an available AWS Config Managed Rule to call. For available values, see the [List of AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html) documentation 198 RuleIdentifier string `pulumi:"ruleIdentifier"` 199 // Tag key of AWS resources to evaluate 200 TagKeyScope *string `pulumi:"tagKeyScope"` 201 // Tag value of AWS resources to evaluate 202 TagValueScope *string `pulumi:"tagValueScope"` 203 } 204 205 // The set of arguments for constructing a OrganizationManagedRule resource. 206 type OrganizationManagedRuleArgs struct { 207 // Description of the rule 208 Description pulumi.StringPtrInput 209 // List of AWS account identifiers to exclude from the rule 210 ExcludedAccounts pulumi.StringArrayInput 211 // A string in JSON format that is passed to the AWS Config Rule Lambda Function 212 InputParameters pulumi.StringPtrInput 213 // The maximum frequency with which AWS Config runs evaluations for a rule, if the rule is triggered at a periodic frequency. Defaults to `TwentyFour_Hours` for periodic frequency triggered rules. Valid values: `One_Hour`, `Three_Hours`, `Six_Hours`, `Twelve_Hours`, or `TwentyFour_Hours`. 214 MaximumExecutionFrequency pulumi.StringPtrInput 215 // The name of the rule 216 Name pulumi.StringPtrInput 217 // Identifier of the AWS resource to evaluate 218 ResourceIdScope pulumi.StringPtrInput 219 // List of types of AWS resources to evaluate 220 ResourceTypesScopes pulumi.StringArrayInput 221 // Identifier of an available AWS Config Managed Rule to call. For available values, see the [List of AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html) documentation 222 RuleIdentifier pulumi.StringInput 223 // Tag key of AWS resources to evaluate 224 TagKeyScope pulumi.StringPtrInput 225 // Tag value of AWS resources to evaluate 226 TagValueScope pulumi.StringPtrInput 227 } 228 229 func (OrganizationManagedRuleArgs) ElementType() reflect.Type { 230 return reflect.TypeOf((*organizationManagedRuleArgs)(nil)).Elem() 231 } 232 233 type OrganizationManagedRuleInput interface { 234 pulumi.Input 235 236 ToOrganizationManagedRuleOutput() OrganizationManagedRuleOutput 237 ToOrganizationManagedRuleOutputWithContext(ctx context.Context) OrganizationManagedRuleOutput 238 } 239 240 func (*OrganizationManagedRule) ElementType() reflect.Type { 241 return reflect.TypeOf((**OrganizationManagedRule)(nil)).Elem() 242 } 243 244 func (i *OrganizationManagedRule) ToOrganizationManagedRuleOutput() OrganizationManagedRuleOutput { 245 return i.ToOrganizationManagedRuleOutputWithContext(context.Background()) 246 } 247 248 func (i *OrganizationManagedRule) ToOrganizationManagedRuleOutputWithContext(ctx context.Context) OrganizationManagedRuleOutput { 249 return pulumi.ToOutputWithContext(ctx, i).(OrganizationManagedRuleOutput) 250 } 251 252 // OrganizationManagedRuleArrayInput is an input type that accepts OrganizationManagedRuleArray and OrganizationManagedRuleArrayOutput values. 253 // You can construct a concrete instance of `OrganizationManagedRuleArrayInput` via: 254 // 255 // OrganizationManagedRuleArray{ OrganizationManagedRuleArgs{...} } 256 type OrganizationManagedRuleArrayInput interface { 257 pulumi.Input 258 259 ToOrganizationManagedRuleArrayOutput() OrganizationManagedRuleArrayOutput 260 ToOrganizationManagedRuleArrayOutputWithContext(context.Context) OrganizationManagedRuleArrayOutput 261 } 262 263 type OrganizationManagedRuleArray []OrganizationManagedRuleInput 264 265 func (OrganizationManagedRuleArray) ElementType() reflect.Type { 266 return reflect.TypeOf((*[]*OrganizationManagedRule)(nil)).Elem() 267 } 268 269 func (i OrganizationManagedRuleArray) ToOrganizationManagedRuleArrayOutput() OrganizationManagedRuleArrayOutput { 270 return i.ToOrganizationManagedRuleArrayOutputWithContext(context.Background()) 271 } 272 273 func (i OrganizationManagedRuleArray) ToOrganizationManagedRuleArrayOutputWithContext(ctx context.Context) OrganizationManagedRuleArrayOutput { 274 return pulumi.ToOutputWithContext(ctx, i).(OrganizationManagedRuleArrayOutput) 275 } 276 277 // OrganizationManagedRuleMapInput is an input type that accepts OrganizationManagedRuleMap and OrganizationManagedRuleMapOutput values. 278 // You can construct a concrete instance of `OrganizationManagedRuleMapInput` via: 279 // 280 // OrganizationManagedRuleMap{ "key": OrganizationManagedRuleArgs{...} } 281 type OrganizationManagedRuleMapInput interface { 282 pulumi.Input 283 284 ToOrganizationManagedRuleMapOutput() OrganizationManagedRuleMapOutput 285 ToOrganizationManagedRuleMapOutputWithContext(context.Context) OrganizationManagedRuleMapOutput 286 } 287 288 type OrganizationManagedRuleMap map[string]OrganizationManagedRuleInput 289 290 func (OrganizationManagedRuleMap) ElementType() reflect.Type { 291 return reflect.TypeOf((*map[string]*OrganizationManagedRule)(nil)).Elem() 292 } 293 294 func (i OrganizationManagedRuleMap) ToOrganizationManagedRuleMapOutput() OrganizationManagedRuleMapOutput { 295 return i.ToOrganizationManagedRuleMapOutputWithContext(context.Background()) 296 } 297 298 func (i OrganizationManagedRuleMap) ToOrganizationManagedRuleMapOutputWithContext(ctx context.Context) OrganizationManagedRuleMapOutput { 299 return pulumi.ToOutputWithContext(ctx, i).(OrganizationManagedRuleMapOutput) 300 } 301 302 type OrganizationManagedRuleOutput struct{ *pulumi.OutputState } 303 304 func (OrganizationManagedRuleOutput) ElementType() reflect.Type { 305 return reflect.TypeOf((**OrganizationManagedRule)(nil)).Elem() 306 } 307 308 func (o OrganizationManagedRuleOutput) ToOrganizationManagedRuleOutput() OrganizationManagedRuleOutput { 309 return o 310 } 311 312 func (o OrganizationManagedRuleOutput) ToOrganizationManagedRuleOutputWithContext(ctx context.Context) OrganizationManagedRuleOutput { 313 return o 314 } 315 316 // Amazon Resource Name (ARN) of the rule 317 func (o OrganizationManagedRuleOutput) Arn() pulumi.StringOutput { 318 return o.ApplyT(func(v *OrganizationManagedRule) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 319 } 320 321 // Description of the rule 322 func (o OrganizationManagedRuleOutput) Description() pulumi.StringPtrOutput { 323 return o.ApplyT(func(v *OrganizationManagedRule) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput) 324 } 325 326 // List of AWS account identifiers to exclude from the rule 327 func (o OrganizationManagedRuleOutput) ExcludedAccounts() pulumi.StringArrayOutput { 328 return o.ApplyT(func(v *OrganizationManagedRule) pulumi.StringArrayOutput { return v.ExcludedAccounts }).(pulumi.StringArrayOutput) 329 } 330 331 // A string in JSON format that is passed to the AWS Config Rule Lambda Function 332 func (o OrganizationManagedRuleOutput) InputParameters() pulumi.StringPtrOutput { 333 return o.ApplyT(func(v *OrganizationManagedRule) pulumi.StringPtrOutput { return v.InputParameters }).(pulumi.StringPtrOutput) 334 } 335 336 // The maximum frequency with which AWS Config runs evaluations for a rule, if the rule is triggered at a periodic frequency. Defaults to `TwentyFour_Hours` for periodic frequency triggered rules. Valid values: `One_Hour`, `Three_Hours`, `Six_Hours`, `Twelve_Hours`, or `TwentyFour_Hours`. 337 func (o OrganizationManagedRuleOutput) MaximumExecutionFrequency() pulumi.StringPtrOutput { 338 return o.ApplyT(func(v *OrganizationManagedRule) pulumi.StringPtrOutput { return v.MaximumExecutionFrequency }).(pulumi.StringPtrOutput) 339 } 340 341 // The name of the rule 342 func (o OrganizationManagedRuleOutput) Name() pulumi.StringOutput { 343 return o.ApplyT(func(v *OrganizationManagedRule) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 344 } 345 346 // Identifier of the AWS resource to evaluate 347 func (o OrganizationManagedRuleOutput) ResourceIdScope() pulumi.StringPtrOutput { 348 return o.ApplyT(func(v *OrganizationManagedRule) pulumi.StringPtrOutput { return v.ResourceIdScope }).(pulumi.StringPtrOutput) 349 } 350 351 // List of types of AWS resources to evaluate 352 func (o OrganizationManagedRuleOutput) ResourceTypesScopes() pulumi.StringArrayOutput { 353 return o.ApplyT(func(v *OrganizationManagedRule) pulumi.StringArrayOutput { return v.ResourceTypesScopes }).(pulumi.StringArrayOutput) 354 } 355 356 // Identifier of an available AWS Config Managed Rule to call. For available values, see the [List of AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html) documentation 357 func (o OrganizationManagedRuleOutput) RuleIdentifier() pulumi.StringOutput { 358 return o.ApplyT(func(v *OrganizationManagedRule) pulumi.StringOutput { return v.RuleIdentifier }).(pulumi.StringOutput) 359 } 360 361 // Tag key of AWS resources to evaluate 362 func (o OrganizationManagedRuleOutput) TagKeyScope() pulumi.StringPtrOutput { 363 return o.ApplyT(func(v *OrganizationManagedRule) pulumi.StringPtrOutput { return v.TagKeyScope }).(pulumi.StringPtrOutput) 364 } 365 366 // Tag value of AWS resources to evaluate 367 func (o OrganizationManagedRuleOutput) TagValueScope() pulumi.StringPtrOutput { 368 return o.ApplyT(func(v *OrganizationManagedRule) pulumi.StringPtrOutput { return v.TagValueScope }).(pulumi.StringPtrOutput) 369 } 370 371 type OrganizationManagedRuleArrayOutput struct{ *pulumi.OutputState } 372 373 func (OrganizationManagedRuleArrayOutput) ElementType() reflect.Type { 374 return reflect.TypeOf((*[]*OrganizationManagedRule)(nil)).Elem() 375 } 376 377 func (o OrganizationManagedRuleArrayOutput) ToOrganizationManagedRuleArrayOutput() OrganizationManagedRuleArrayOutput { 378 return o 379 } 380 381 func (o OrganizationManagedRuleArrayOutput) ToOrganizationManagedRuleArrayOutputWithContext(ctx context.Context) OrganizationManagedRuleArrayOutput { 382 return o 383 } 384 385 func (o OrganizationManagedRuleArrayOutput) Index(i pulumi.IntInput) OrganizationManagedRuleOutput { 386 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *OrganizationManagedRule { 387 return vs[0].([]*OrganizationManagedRule)[vs[1].(int)] 388 }).(OrganizationManagedRuleOutput) 389 } 390 391 type OrganizationManagedRuleMapOutput struct{ *pulumi.OutputState } 392 393 func (OrganizationManagedRuleMapOutput) ElementType() reflect.Type { 394 return reflect.TypeOf((*map[string]*OrganizationManagedRule)(nil)).Elem() 395 } 396 397 func (o OrganizationManagedRuleMapOutput) ToOrganizationManagedRuleMapOutput() OrganizationManagedRuleMapOutput { 398 return o 399 } 400 401 func (o OrganizationManagedRuleMapOutput) ToOrganizationManagedRuleMapOutputWithContext(ctx context.Context) OrganizationManagedRuleMapOutput { 402 return o 403 } 404 405 func (o OrganizationManagedRuleMapOutput) MapIndex(k pulumi.StringInput) OrganizationManagedRuleOutput { 406 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *OrganizationManagedRule { 407 return vs[0].(map[string]*OrganizationManagedRule)[vs[1].(string)] 408 }).(OrganizationManagedRuleOutput) 409 } 410 411 func init() { 412 pulumi.RegisterInputType(reflect.TypeOf((*OrganizationManagedRuleInput)(nil)).Elem(), &OrganizationManagedRule{}) 413 pulumi.RegisterInputType(reflect.TypeOf((*OrganizationManagedRuleArrayInput)(nil)).Elem(), OrganizationManagedRuleArray{}) 414 pulumi.RegisterInputType(reflect.TypeOf((*OrganizationManagedRuleMapInput)(nil)).Elem(), OrganizationManagedRuleMap{}) 415 pulumi.RegisterOutputType(OrganizationManagedRuleOutput{}) 416 pulumi.RegisterOutputType(OrganizationManagedRuleArrayOutput{}) 417 pulumi.RegisterOutputType(OrganizationManagedRuleMapOutput{}) 418 }