github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cfg/recorder.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 // Provides an AWS Config Configuration Recorder. Please note that this resource **does not start** the created recorder automatically. 16 // 17 // > **Note:** _Starting_ the Configuration Recorder requires a delivery channel (while delivery channel creation requires Configuration Recorder). This is why `cfg.RecorderStatus` is a separate resource. 18 // 19 // ## Example Usage 20 // 21 // ### Basic 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/iam" 31 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 32 // 33 // ) 34 // 35 // func main() { 36 // pulumi.Run(func(ctx *pulumi.Context) error { 37 // assumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{ 38 // Statements: []iam.GetPolicyDocumentStatement{ 39 // { 40 // Effect: pulumi.StringRef("Allow"), 41 // Principals: []iam.GetPolicyDocumentStatementPrincipal{ 42 // { 43 // Type: "Service", 44 // Identifiers: []string{ 45 // "config.amazonaws.com", 46 // }, 47 // }, 48 // }, 49 // Actions: []string{ 50 // "sts:AssumeRole", 51 // }, 52 // }, 53 // }, 54 // }, nil) 55 // if err != nil { 56 // return err 57 // } 58 // r, err := iam.NewRole(ctx, "r", &iam.RoleArgs{ 59 // Name: pulumi.String("awsconfig-example"), 60 // AssumeRolePolicy: pulumi.String(assumeRole.Json), 61 // }) 62 // if err != nil { 63 // return err 64 // } 65 // _, err = cfg.NewRecorder(ctx, "foo", &cfg.RecorderArgs{ 66 // Name: pulumi.String("example"), 67 // RoleArn: r.Arn, 68 // }) 69 // if err != nil { 70 // return err 71 // } 72 // return nil 73 // }) 74 // } 75 // 76 // ``` 77 // <!--End PulumiCodeChooser --> 78 // 79 // ### Exclude Resources Types Usage 80 // 81 // <!--Start PulumiCodeChooser --> 82 // ```go 83 // package main 84 // 85 // import ( 86 // 87 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cfg" 88 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 89 // 90 // ) 91 // 92 // func main() { 93 // pulumi.Run(func(ctx *pulumi.Context) error { 94 // _, err := cfg.NewRecorder(ctx, "foo", &cfg.RecorderArgs{ 95 // Name: pulumi.String("example"), 96 // RoleArn: pulumi.Any(r.Arn), 97 // RecordingGroup: &cfg.RecorderRecordingGroupArgs{ 98 // AllSupported: pulumi.Bool(false), 99 // ExclusionByResourceTypes: cfg.RecorderRecordingGroupExclusionByResourceTypeArray{ 100 // &cfg.RecorderRecordingGroupExclusionByResourceTypeArgs{ 101 // ResourceTypes: pulumi.StringArray{ 102 // pulumi.String("AWS::EC2::Instance"), 103 // }, 104 // }, 105 // }, 106 // RecordingStrategies: cfg.RecorderRecordingGroupRecordingStrategyArray{ 107 // &cfg.RecorderRecordingGroupRecordingStrategyArgs{ 108 // UseOnly: pulumi.String("EXCLUSION_BY_RESOURCE_TYPES"), 109 // }, 110 // }, 111 // }, 112 // }) 113 // if err != nil { 114 // return err 115 // } 116 // return nil 117 // }) 118 // } 119 // 120 // ``` 121 // <!--End PulumiCodeChooser --> 122 // 123 // ### Periodic Recording 124 // 125 // <!--Start PulumiCodeChooser --> 126 // ```go 127 // package main 128 // 129 // import ( 130 // 131 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cfg" 132 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 133 // 134 // ) 135 // 136 // func main() { 137 // pulumi.Run(func(ctx *pulumi.Context) error { 138 // _, err := cfg.NewRecorder(ctx, "foo", &cfg.RecorderArgs{ 139 // Name: pulumi.String("example"), 140 // RoleArn: pulumi.Any(r.Arn), 141 // RecordingGroup: &cfg.RecorderRecordingGroupArgs{ 142 // AllSupported: pulumi.Bool(false), 143 // IncludeGlobalResourceTypes: pulumi.Bool(false), 144 // ResourceTypes: pulumi.StringArray{ 145 // pulumi.String("AWS::EC2::Instance"), 146 // pulumi.String("AWS::EC2::NetworkInterface"), 147 // }, 148 // }, 149 // RecordingMode: &cfg.RecorderRecordingModeArgs{ 150 // RecordingFrequency: pulumi.String("CONTINUOUS"), 151 // RecordingModeOverride: &cfg.RecorderRecordingModeRecordingModeOverrideArgs{ 152 // Description: pulumi.String("Only record EC2 network interfaces daily"), 153 // ResourceTypes: pulumi.StringArray{ 154 // pulumi.String("AWS::EC2::NetworkInterface"), 155 // }, 156 // RecordingFrequency: pulumi.String("DAILY"), 157 // }, 158 // }, 159 // }) 160 // if err != nil { 161 // return err 162 // } 163 // return nil 164 // }) 165 // } 166 // 167 // ``` 168 // <!--End PulumiCodeChooser --> 169 // 170 // ## Import 171 // 172 // Using `pulumi import`, import Configuration Recorder using the name. For example: 173 // 174 // ```sh 175 // $ pulumi import aws:cfg/recorder:Recorder foo example 176 // ``` 177 type Recorder struct { 178 pulumi.CustomResourceState 179 180 // The name of the recorder. Defaults to `default`. Changing it recreates the resource. 181 Name pulumi.StringOutput `pulumi:"name"` 182 // Recording group - see below. 183 RecordingGroup RecorderRecordingGroupOutput `pulumi:"recordingGroup"` 184 // Recording mode - see below. 185 RecordingMode RecorderRecordingModeOutput `pulumi:"recordingMode"` 186 // Amazon Resource Name (ARN) of the IAM role. Used to make read or write requests to the delivery channel and to describe the AWS resources associated with the account. See [AWS Docs](http://docs.aws.amazon.com/config/latest/developerguide/iamrole-permissions.html) for more details. 187 RoleArn pulumi.StringOutput `pulumi:"roleArn"` 188 } 189 190 // NewRecorder registers a new resource with the given unique name, arguments, and options. 191 func NewRecorder(ctx *pulumi.Context, 192 name string, args *RecorderArgs, opts ...pulumi.ResourceOption) (*Recorder, error) { 193 if args == nil { 194 return nil, errors.New("missing one or more required arguments") 195 } 196 197 if args.RoleArn == nil { 198 return nil, errors.New("invalid value for required argument 'RoleArn'") 199 } 200 opts = internal.PkgResourceDefaultOpts(opts) 201 var resource Recorder 202 err := ctx.RegisterResource("aws:cfg/recorder:Recorder", name, args, &resource, opts...) 203 if err != nil { 204 return nil, err 205 } 206 return &resource, nil 207 } 208 209 // GetRecorder gets an existing Recorder resource's state with the given name, ID, and optional 210 // state properties that are used to uniquely qualify the lookup (nil if not required). 211 func GetRecorder(ctx *pulumi.Context, 212 name string, id pulumi.IDInput, state *RecorderState, opts ...pulumi.ResourceOption) (*Recorder, error) { 213 var resource Recorder 214 err := ctx.ReadResource("aws:cfg/recorder:Recorder", name, id, state, &resource, opts...) 215 if err != nil { 216 return nil, err 217 } 218 return &resource, nil 219 } 220 221 // Input properties used for looking up and filtering Recorder resources. 222 type recorderState struct { 223 // The name of the recorder. Defaults to `default`. Changing it recreates the resource. 224 Name *string `pulumi:"name"` 225 // Recording group - see below. 226 RecordingGroup *RecorderRecordingGroup `pulumi:"recordingGroup"` 227 // Recording mode - see below. 228 RecordingMode *RecorderRecordingMode `pulumi:"recordingMode"` 229 // Amazon Resource Name (ARN) of the IAM role. Used to make read or write requests to the delivery channel and to describe the AWS resources associated with the account. See [AWS Docs](http://docs.aws.amazon.com/config/latest/developerguide/iamrole-permissions.html) for more details. 230 RoleArn *string `pulumi:"roleArn"` 231 } 232 233 type RecorderState struct { 234 // The name of the recorder. Defaults to `default`. Changing it recreates the resource. 235 Name pulumi.StringPtrInput 236 // Recording group - see below. 237 RecordingGroup RecorderRecordingGroupPtrInput 238 // Recording mode - see below. 239 RecordingMode RecorderRecordingModePtrInput 240 // Amazon Resource Name (ARN) of the IAM role. Used to make read or write requests to the delivery channel and to describe the AWS resources associated with the account. See [AWS Docs](http://docs.aws.amazon.com/config/latest/developerguide/iamrole-permissions.html) for more details. 241 RoleArn pulumi.StringPtrInput 242 } 243 244 func (RecorderState) ElementType() reflect.Type { 245 return reflect.TypeOf((*recorderState)(nil)).Elem() 246 } 247 248 type recorderArgs struct { 249 // The name of the recorder. Defaults to `default`. Changing it recreates the resource. 250 Name *string `pulumi:"name"` 251 // Recording group - see below. 252 RecordingGroup *RecorderRecordingGroup `pulumi:"recordingGroup"` 253 // Recording mode - see below. 254 RecordingMode *RecorderRecordingMode `pulumi:"recordingMode"` 255 // Amazon Resource Name (ARN) of the IAM role. Used to make read or write requests to the delivery channel and to describe the AWS resources associated with the account. See [AWS Docs](http://docs.aws.amazon.com/config/latest/developerguide/iamrole-permissions.html) for more details. 256 RoleArn string `pulumi:"roleArn"` 257 } 258 259 // The set of arguments for constructing a Recorder resource. 260 type RecorderArgs struct { 261 // The name of the recorder. Defaults to `default`. Changing it recreates the resource. 262 Name pulumi.StringPtrInput 263 // Recording group - see below. 264 RecordingGroup RecorderRecordingGroupPtrInput 265 // Recording mode - see below. 266 RecordingMode RecorderRecordingModePtrInput 267 // Amazon Resource Name (ARN) of the IAM role. Used to make read or write requests to the delivery channel and to describe the AWS resources associated with the account. See [AWS Docs](http://docs.aws.amazon.com/config/latest/developerguide/iamrole-permissions.html) for more details. 268 RoleArn pulumi.StringInput 269 } 270 271 func (RecorderArgs) ElementType() reflect.Type { 272 return reflect.TypeOf((*recorderArgs)(nil)).Elem() 273 } 274 275 type RecorderInput interface { 276 pulumi.Input 277 278 ToRecorderOutput() RecorderOutput 279 ToRecorderOutputWithContext(ctx context.Context) RecorderOutput 280 } 281 282 func (*Recorder) ElementType() reflect.Type { 283 return reflect.TypeOf((**Recorder)(nil)).Elem() 284 } 285 286 func (i *Recorder) ToRecorderOutput() RecorderOutput { 287 return i.ToRecorderOutputWithContext(context.Background()) 288 } 289 290 func (i *Recorder) ToRecorderOutputWithContext(ctx context.Context) RecorderOutput { 291 return pulumi.ToOutputWithContext(ctx, i).(RecorderOutput) 292 } 293 294 // RecorderArrayInput is an input type that accepts RecorderArray and RecorderArrayOutput values. 295 // You can construct a concrete instance of `RecorderArrayInput` via: 296 // 297 // RecorderArray{ RecorderArgs{...} } 298 type RecorderArrayInput interface { 299 pulumi.Input 300 301 ToRecorderArrayOutput() RecorderArrayOutput 302 ToRecorderArrayOutputWithContext(context.Context) RecorderArrayOutput 303 } 304 305 type RecorderArray []RecorderInput 306 307 func (RecorderArray) ElementType() reflect.Type { 308 return reflect.TypeOf((*[]*Recorder)(nil)).Elem() 309 } 310 311 func (i RecorderArray) ToRecorderArrayOutput() RecorderArrayOutput { 312 return i.ToRecorderArrayOutputWithContext(context.Background()) 313 } 314 315 func (i RecorderArray) ToRecorderArrayOutputWithContext(ctx context.Context) RecorderArrayOutput { 316 return pulumi.ToOutputWithContext(ctx, i).(RecorderArrayOutput) 317 } 318 319 // RecorderMapInput is an input type that accepts RecorderMap and RecorderMapOutput values. 320 // You can construct a concrete instance of `RecorderMapInput` via: 321 // 322 // RecorderMap{ "key": RecorderArgs{...} } 323 type RecorderMapInput interface { 324 pulumi.Input 325 326 ToRecorderMapOutput() RecorderMapOutput 327 ToRecorderMapOutputWithContext(context.Context) RecorderMapOutput 328 } 329 330 type RecorderMap map[string]RecorderInput 331 332 func (RecorderMap) ElementType() reflect.Type { 333 return reflect.TypeOf((*map[string]*Recorder)(nil)).Elem() 334 } 335 336 func (i RecorderMap) ToRecorderMapOutput() RecorderMapOutput { 337 return i.ToRecorderMapOutputWithContext(context.Background()) 338 } 339 340 func (i RecorderMap) ToRecorderMapOutputWithContext(ctx context.Context) RecorderMapOutput { 341 return pulumi.ToOutputWithContext(ctx, i).(RecorderMapOutput) 342 } 343 344 type RecorderOutput struct{ *pulumi.OutputState } 345 346 func (RecorderOutput) ElementType() reflect.Type { 347 return reflect.TypeOf((**Recorder)(nil)).Elem() 348 } 349 350 func (o RecorderOutput) ToRecorderOutput() RecorderOutput { 351 return o 352 } 353 354 func (o RecorderOutput) ToRecorderOutputWithContext(ctx context.Context) RecorderOutput { 355 return o 356 } 357 358 // The name of the recorder. Defaults to `default`. Changing it recreates the resource. 359 func (o RecorderOutput) Name() pulumi.StringOutput { 360 return o.ApplyT(func(v *Recorder) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 361 } 362 363 // Recording group - see below. 364 func (o RecorderOutput) RecordingGroup() RecorderRecordingGroupOutput { 365 return o.ApplyT(func(v *Recorder) RecorderRecordingGroupOutput { return v.RecordingGroup }).(RecorderRecordingGroupOutput) 366 } 367 368 // Recording mode - see below. 369 func (o RecorderOutput) RecordingMode() RecorderRecordingModeOutput { 370 return o.ApplyT(func(v *Recorder) RecorderRecordingModeOutput { return v.RecordingMode }).(RecorderRecordingModeOutput) 371 } 372 373 // Amazon Resource Name (ARN) of the IAM role. Used to make read or write requests to the delivery channel and to describe the AWS resources associated with the account. See [AWS Docs](http://docs.aws.amazon.com/config/latest/developerguide/iamrole-permissions.html) for more details. 374 func (o RecorderOutput) RoleArn() pulumi.StringOutput { 375 return o.ApplyT(func(v *Recorder) pulumi.StringOutput { return v.RoleArn }).(pulumi.StringOutput) 376 } 377 378 type RecorderArrayOutput struct{ *pulumi.OutputState } 379 380 func (RecorderArrayOutput) ElementType() reflect.Type { 381 return reflect.TypeOf((*[]*Recorder)(nil)).Elem() 382 } 383 384 func (o RecorderArrayOutput) ToRecorderArrayOutput() RecorderArrayOutput { 385 return o 386 } 387 388 func (o RecorderArrayOutput) ToRecorderArrayOutputWithContext(ctx context.Context) RecorderArrayOutput { 389 return o 390 } 391 392 func (o RecorderArrayOutput) Index(i pulumi.IntInput) RecorderOutput { 393 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Recorder { 394 return vs[0].([]*Recorder)[vs[1].(int)] 395 }).(RecorderOutput) 396 } 397 398 type RecorderMapOutput struct{ *pulumi.OutputState } 399 400 func (RecorderMapOutput) ElementType() reflect.Type { 401 return reflect.TypeOf((*map[string]*Recorder)(nil)).Elem() 402 } 403 404 func (o RecorderMapOutput) ToRecorderMapOutput() RecorderMapOutput { 405 return o 406 } 407 408 func (o RecorderMapOutput) ToRecorderMapOutputWithContext(ctx context.Context) RecorderMapOutput { 409 return o 410 } 411 412 func (o RecorderMapOutput) MapIndex(k pulumi.StringInput) RecorderOutput { 413 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Recorder { 414 return vs[0].(map[string]*Recorder)[vs[1].(string)] 415 }).(RecorderOutput) 416 } 417 418 func init() { 419 pulumi.RegisterInputType(reflect.TypeOf((*RecorderInput)(nil)).Elem(), &Recorder{}) 420 pulumi.RegisterInputType(reflect.TypeOf((*RecorderArrayInput)(nil)).Elem(), RecorderArray{}) 421 pulumi.RegisterInputType(reflect.TypeOf((*RecorderMapInput)(nil)).Elem(), RecorderMap{}) 422 pulumi.RegisterOutputType(RecorderOutput{}) 423 pulumi.RegisterOutputType(RecorderArrayOutput{}) 424 pulumi.RegisterOutputType(RecorderMapOutput{}) 425 }