aws / aws/aws-cdk

(aws_cloudtrail >> Trail): (Invalid request provided: Incorrect S3 bucket policy is detected for bucket)

Open
#31,400 3 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-cloudtrail bug effort/small p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

Unable to create Organization Trail in management account when using the i.e as per the [doc](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudtrail-readme.html#organization-trail) :
++++++++++++++++++++++++++++++++++++++++
new cloudtrail.Trail(this, 'OrganizationTrail', {
isOrganizationTrail: true,
orgId: "o-xxxxxxxxx",
});
++++++++++++++++++++++++++++++++++++++++
This fail with the "Invalid request provided: Incorrect S3 bucket policy is detected for bucket" every-time.

Only when we add the trailName property explicitly to some string name it is then we are somehow able to mitigate the "Invalid request provided: Incorrect S3 bucket policy is detected for bucket"
++++++++++++++++++++++++++++++++++++++++
new cloudtrail.Trail(this, 'OrganizationTrail', {
isOrganizationTrail: true,
orgId: "o-xxxxxxxxx",
trailName: "trailname123"
});
++++++++++++++++++++++++++++++++++++++++

### Regression Issue

- [ ] Select this option if this issue appears to be a regression.

### Last Known Working CDK Version

2.157.0

### Expected Behavior

To work without explicitly passing the trailName: property .

### Current Behavior

CreateTrial API fails with the "Invalid request provided: Incorrect S3 bucket policy is detected for bucket" when using the following code to create Organization Trail:
++++++++++++++++++++++++++++++++++++++++
new cloudtrail.Trail(this, 'OrganizationTrail', {
isOrganizationTrail: true,
orgId: "o-xxxxxxxxx",
});
++++++++++++++++++++++++++++++++++++++++

### Reproduction Steps

Use :
++++++++++++++++++++++++++++++++++++++++
new cloudtrail.Trail(this, 'OrganizationTrail', {
isOrganizationTrail: true,
orgId: "o-xxxxxxxxx",
});
++++++++++++++++++++++++++++++++++++++++

### Possible Solution

To add trailName property explicitly

### Additional Information/Context

NA

### CDK CLI Version

2.157.0

### Framework Version

_No response_

### Node.js Version

v16.14.2

### OS

MAC

### Language

TypeScript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the aws_cloudtrail Trail entry point and reproduce the Organization Trail case without trailName, then compare it with the explicit trailName case. The issue names no source file or test; done means the organization trail creates successfully without requiring trailName, with coverage for the failing configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.