https://pulumi.com logo
#aws
Title
# aws
s

stocky-france-59380

01/27/2021, 7:56 PM
can you still do this https://www.pulumi.com/docs/reference/pkg/aws/cloudtrail/trail/#logging-all-s3-bucket-object-events?
Copy code
error TS2345: Argument of type '{ eventSelectors: { dataResources: { type: string; values: string[]; }[]; includeManagementEvents: true; readWr
iteType: string; }[]; }' is not assignable to parameter of type 'TrailArgs'.                                                                                     
  Property 's3BucketName' is missing in type '{ eventSelectors: { dataResources: { type: string; values: string[]; }[]; includeManagementEvents: true; readWriteT
ype: string; }[]; }' but required in type 'TrailArgs'.                                                                                                           
                                                                                                                                                                 
    at createTSError (/codefresh/volume/iac-s3/node_modules/@pulumi/pulumi/node_modules/ts-node/src/index.ts:293:12)                                             
    at reportTSError (/codefresh/volume/iac-s3/node_modules/@pulumi/pulumi/node_modules/ts-node/src/index.ts:297:19)                                             
    at getOutput (/codefresh/volume/iac-s3/node_modules/@pulumi/pulumi/node_modules/ts-node/src/index.ts:399:34)                                                 
    at Object.compile (/codefresh/volume/iac-s3/node_modules/@pulumi/pulumi/node_modules/ts-node/src/index.ts:457:32)                                            
    at Module.m._compile (/codefresh/volume/iac-s3/node_modules/@pulumi/pulumi/node_modules/ts-node/src/index.ts:536:43)                                         
    at Module._extensions..js (internal/modules/cjs/loader.js:1027:10)                                                                                           
    at Object.require.extensions.<computed> [as .ts] (/codefresh/volume/iac-s3/node_modules/@pulumi/pulumi/node_modules/ts-node/src/index.ts:539:12)             
    at Module.load (internal/modules/cjs/loader.js:863:32)                                                                                                       
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)                                                                                             
    at Module.require (internal/modules/cjs/loader.js:887:19)
l

little-cartoon-10569

01/27/2021, 8:07 PM
Yes. Have you removed the property s3BucketName? It is required. The exception is saying that you aren't passing it to the constructor of the Trail.
Can we see your code? You're passing properties eventSelectors and includeManagementEvents to the Trail constructor, but it doesn't take either of those properties...
Ah never mind, I had the wrong collapsible open on the doc page. No, that example is wrong, since you must provide the s3BucketName.
I see the problem.. the Terraform docs (from which the Pulumi docs are generated) look like this:
Copy code
resource "aws_cloudtrail" "example" {
  # ... other configuration ...

  event_selector {
    read_write_type           = "All"
    include_management_events = true

    data_resource {
      type   = "AWS::S3::Object"
      values = ["arn:aws:s3:::"]
    }
  }
}
The "... other configuration ..." bit includes s3BucketName.
That'll be a tricky one to fix.. I guess they'll have to update the generated code, which is always fraught...
I'll raise a ticket.
👍 1