Skip to content

Commit b5dc19c

Browse files
authored
adjust vpc flow log creation logic (#1112)
1 parent 055c6a8 commit b5dc19c

File tree

1 file changed

+4
-3
lines changed
  • src/deployments/cdk/src/deployments/vpc

1 file changed

+4
-3
lines changed

src/deployments/cdk/src/deployments/vpc/step-2.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,14 @@ function createVpcFlowLog(props: {
156156
customFields,
157157
} = props;
158158
for (const [index, logDestination] of logDestinations.entries()) {
159-
const flowLogs = new ec2.CfnFlowLog(scope, `FlowLog${vpcName}${logDestinationTypes[index]}`, {
160-
deliverLogsPermissionArn: roleArn,
159+
const logDestinationType = logDestinationTypes[index];
160+
const flowLogs = new ec2.CfnFlowLog(scope, `FlowLog${vpcName}${logDestinationType}`, {
161+
deliverLogsPermissionArn: logDestinationType == ec2.FlowLogDestinationType.CLOUD_WATCH_LOGS ? roleArn : undefined,
161162
resourceId: vpcId,
162163
resourceType: 'VPC',
163164
trafficType,
164165
logDestination,
165-
logDestinationType: logDestinationTypes[index],
166+
logDestinationType: logDestinationType,
166167
});
167168
flowLogs.addPropertyOverride('MaxAggregationInterval', aggregationInterval);
168169
if (customFields) {

0 commit comments

Comments
 (0)