You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(cloudtrail): Trail fails during resource creation due to invalid template properties when management events are 'None' (#23569)
#### Overview
Currently CDK produces invalid CloudFormation that fails validation by the CloudTrail API upon deployment when setting the `managementEvents` parameter to `ReadWriteType.NONE`.
Although this is a contribution to a stable module, I consider this change to not have breaking changes as the original implementation generates CloudFormation that would result in stack deployment failure so is currently broken.
#### Behaviour changes
*Setting `managementEvents` to `ReadWriteType.NONE`*
**Old behaviour:** Successfully synthesises but produces CloudFormation that fails to deploy.
**New behaviour:** Fails synthesis with a validation error if no additional event selectors are added to the trail, as the default behaviour of CloudTrail is to enable management events if no event selectors are provided. Sets `includeManagementEvents` to `false` by default when new event selectors are added unless overridden explicitly by the user.
#### Other options considered
The previous PR had a suggestion to just always set `includeManagementEvents` to `false` when adding additional event selectors rather than only setting it to `false` when the Trail was created with `ReadWriteType.NONE`. However, this would break backwards compatibility for some scenarios (such as where users don't set `managementEvents` when creating the trail and later add an event selector, as well as a bunch of other esoteric edge cases).
#### Related
Previous PR that was closed for staleness (#16387).
Closes#15488
----
### All Submissions:
* [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)
### Adding new Construct Runtime Dependencies:
* [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies)
### New Features
* [X] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
* [X] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
0 commit comments