Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ec2): flow logs from TransitGateway and TransitGatewayAttachment #28605

Merged
merged 30 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1dbb2b8
feat: add fromTransitGatewayId and fromTransitGatewayAttachmentId
badmintoncryer Jan 7, 2024
d028318
test
badmintoncryer Jan 7, 2024
a9e1720
docs: add docstring
badmintoncryer Jan 7, 2024
fe588a4
docs: add reference
badmintoncryer Jan 7, 2024
b779cb7
chore: remove unnecessary change
badmintoncryer Jan 7, 2024
12c8bcb
Merge branch 'main' into 27222-flowLog
badmintoncryer Jan 9, 2024
3aa77d9
Update packages/aws-cdk-lib/aws-ec2/lib/vpc-flow-logs.ts
badmintoncryer Jan 10, 2024
2b6159e
feat: maxAggregationInterval check
badmintoncryer Jan 10, 2024
d3e85e6
docs: maxAggregationInterval
badmintoncryer Jan 10, 2024
ab41d4e
refactor: docs
badmintoncryer Jan 10, 2024
56247f6
refactor: error message
badmintoncryer Jan 10, 2024
a83658f
Update packages/aws-cdk-lib/aws-ec2/test/vpc-flow-logs.test.ts
badmintoncryer Jan 11, 2024
45434a8
Update packages/aws-cdk-lib/aws-ec2/test/vpc-flow-logs.test.ts
badmintoncryer Jan 11, 2024
49a9f89
Update packages/aws-cdk-lib/aws-ec2/test/vpc-flow-logs.test.ts
badmintoncryer Jan 11, 2024
27f4c10
Update packages/aws-cdk-lib/aws-ec2/test/vpc-flow-logs.test.ts
badmintoncryer Jan 11, 2024
50d230c
Update packages/aws-cdk-lib/aws-ec2/lib/vpc-flow-logs.ts
badmintoncryer Jan 13, 2024
65f6d2b
Update packages/aws-cdk-lib/aws-ec2/lib/vpc-flow-logs.ts
badmintoncryer Jan 13, 2024
515a11a
Update packages/aws-cdk-lib/aws-ec2/lib/vpc-flow-logs.ts
badmintoncryer Jan 13, 2024
fd3e10c
Update packages/aws-cdk-lib/aws-ec2/test/vpc-flow-logs.test.ts
badmintoncryer Jan 13, 2024
4765687
Update packages/aws-cdk-lib/aws-ec2/test/vpc-flow-logs.test.ts
badmintoncryer Jan 13, 2024
1ec14a7
fix: unit test
badmintoncryer Jan 13, 2024
d9b1f4e
Merge branch 'main' into 27222-flowLog
badmintoncryer Jan 16, 2024
a30109b
Merge branch 'main' into 27222-flowLog
badmintoncryer Jan 17, 2024
4f53223
Merge branch 'main' into 27222-flowLog
paulhcsun Jan 19, 2024
38d1e89
Merge branch 'main' into 27222-flowLog
paulhcsun Jan 19, 2024
706b527
vpc-flow-logs.ts を更新
badmintoncryer Jan 20, 2024
9f9b1a2
vpc-flow-logs.test.ts を更新
badmintoncryer Jan 20, 2024
6147412
chore: update comment
badmintoncryer Jan 20, 2024
9584074
Merge branch 'main' into 27222-flowLog
badmintoncryer Jan 20, 2024
3a14a7e
Merge branch 'main' into 27222-flowLog
paulhcsun Jan 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/aws-cdk-lib/aws-ec2/lib/vpc-flow-logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ export abstract class FlowLogResourceType {
};
}

public static fromTransitGatewayId(id: string): FlowLogResourceType {
return {
resourceType: 'TransitGateway',
resourceId: id,
};
};

public static fromTransitGatewayAttachmentId(id: string): FlowLogResourceType {
return {
resourceType: 'TransitGatewayAttachment',
resourceId: id,
};
};

/**
* The type of resource to attach a flow log to.
*/
Expand Down
41 changes: 41 additions & 0 deletions packages/aws-cdk-lib/aws-ec2/test/vpc-flow-logs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,46 @@ describe('vpc flow logs', () => {
MaxAggregationInterval: 60,
});
});

test('create with transit gateway id()`', () => {
const stack = getTestStack();

new FlowLog(stack, 'FlowLogs', {
resourceType: FlowLogResourceType.fromTransitGatewayId('tgw-123456'),
});

Template.fromStack(stack).hasResourceProperties('AWS::EC2::FlowLog', {
ResourceType: 'TransitGateway',
TrafficType: 'ALL',
ResourceId: 'tgw-123456',
DeliverLogsPermissionArn: {
'Fn::GetAtt': ['FlowLogsIAMRoleF18F4209', 'Arn'],
},
LogGroupName: {
Ref: 'FlowLogsLogGroup9853A85F',
},
});
});

test('create with transit gateway attachment id', () => {
badmintoncryer marked this conversation as resolved.
Show resolved Hide resolved
const stack = getTestStack();

new FlowLog(stack, 'FlowLogs', {
resourceType: FlowLogResourceType.fromTransitGatewayAttachmentId('tgw-attach-123456'),
});

Template.fromStack(stack).hasResourceProperties('AWS::EC2::FlowLog', {
ResourceType: 'TransitGatewayAttachment',
TrafficType: 'ALL',
ResourceId: 'tgw-attach-123456',
DeliverLogsPermissionArn: {
'Fn::GetAtt': ['FlowLogsIAMRoleF18F4209', 'Arn'],
},
LogGroupName: {
Ref: 'FlowLogsLogGroup9853A85F',
},
});
});
});

test('add to vpc with maxAggregationInterval', () => {
Expand Down Expand Up @@ -721,3 +761,4 @@ test('with custom log format set custom, it not creates with cloudwatch log dest
},
});
});

Loading