Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ec2): flow logs from TransitGateway and TransitGatewayAttachment (…
…#28605) I have enabled the configuration of flow logs for TransitGateway and TransitGatewayAttachment. Create flow logs from TransitGateway: ```ts declare const tgw: ec2.CfnTransitGateway; new ec2.FlowLog(this, 'TransitGatewayFlowLog', { resourceType: ec2.FlowLogResourceType.fromTransitGatewayId(tgw.ref) }) ``` Create flowlogs from TransitGatewayAttachment: ```ts declare const tgwAttachment: ec2.CfnTransitGatewayAttachment; new ec2.FlowLog(this, 'TransitGatewayAttachmentFlowLog', { resourceType: ec2.FlowLogResourceType.fromTransitGatewayAttachmentId(tgwAttachment.ref) }) ``` Since `trafficType` [cannot be set for flow logs related to TransitGateway resources](https://docs.aws.amazon.com/vpc/latest/tgw/working-with-flow-logs.html#flow-logs-api-cli), I have also added error handling for this. ```ts if (props.resourceType.resourceType === 'TransitGateway' || props.resourceType.resourceType === 'TransitGatewayAttachment') { if (props.trafficType) { throw new Error('trafficType is not supported for Transit Gateway and Transit Gateway Attachment'); } ... } ``` Closes #27222. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information