Skip to content

Commit 1d372a9

Browse files
author
Marco Franceschi
committed
fix: Generated ARN for flowLogs
1 parent 6d98383 commit 1d372a9

2 files changed

Lines changed: 39 additions & 19 deletions

File tree

src/services/flowLogs/format.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { AwsFlowLog } from '../../types/generated'
22
import { formatTagsFromMap } from '../../utils/format'
3+
import { flowLogsArn } from '../../utils/generateArns'
34
import { RawFlowLog } from './data'
45

56
/**
@@ -37,6 +38,11 @@ export default ({
3738

3839
const flowLog = {
3940
id,
41+
arn: flowLogsArn({
42+
region,
43+
account,
44+
flowLogId: id,
45+
}),
4046
region,
4147
accountId: account,
4248
deliverLogsErrorMessage,

src/utils/generateArns.ts

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export const apiGatewayMethodArn = ({ resourceArn, httpMethod }) =>
99
`${resourceArn}/methods/${httpMethod}`
1010
export const route53HostedZoneArn = ({ id }: { id: string }): string =>
1111
`arn:aws:route53:::hostedzone/${id}`
12+
1213
export const routeTableArn = ({
1314
region,
1415
account,
@@ -69,7 +70,7 @@ export const kmsArn = ({
6970
region: string
7071
account: string
7172
id: string
72-
}) : string => `arn:aws:kms:${region}:${account}:key/${id}`
73+
}): string => `arn:aws:kms:${region}:${account}:key/${id}`
7374

7475
export const ecsContainerArn = ({
7576
region,
@@ -105,7 +106,7 @@ export const ebsVolumeArn = ({
105106
region,
106107
account,
107108
id,
108-
} : {
109+
}: {
109110
region: string
110111
account: string
111112
id: string
@@ -115,7 +116,7 @@ export const ec2InstanceArn = ({
115116
region,
116117
account,
117118
id,
118-
} : {
119+
}: {
119120
region: string
120121
account: string
121122
id: string
@@ -125,7 +126,7 @@ export const eipAllocationArn = ({
125126
region,
126127
account,
127128
id,
128-
} : {
129+
}: {
129130
region: string
130131
account: string
131132
id: string
@@ -135,17 +136,18 @@ export const elbArn = ({
135136
region,
136137
account,
137138
name,
138-
} : {
139+
}: {
139140
region: string
140141
account: string
141142
name: string
142-
}): string => `arn:aws:elasticloadbalancing:${region}:${account}:loadbalancer/${name}`
143+
}): string =>
144+
`arn:aws:elasticloadbalancing:${region}:${account}:loadbalancer/${name}`
143145

144146
export const igwArn = ({
145147
region,
146148
account,
147149
id,
148-
} : {
150+
}: {
149151
region: string
150152
account: string
151153
id: string
@@ -155,7 +157,7 @@ export const networkInterfaceArn = ({
155157
region,
156158
account,
157159
id,
158-
} : {
160+
}: {
159161
region: string
160162
account: string
161163
id: string
@@ -165,7 +167,7 @@ export const securityGroupArn = ({
165167
region,
166168
account,
167169
id,
168-
} : {
170+
}: {
169171
region: string
170172
account: string
171173
id: string
@@ -175,7 +177,7 @@ export const vpcArn = ({
175177
region,
176178
account,
177179
id,
178-
} : {
180+
}: {
179181
region: string
180182
account: string
181183
id: string
@@ -185,7 +187,7 @@ export const clientVpnEndpointArn = ({
185187
region,
186188
account,
187189
id,
188-
} : {
190+
}: {
189191
region: string
190192
account: string
191193
id: string
@@ -195,7 +197,7 @@ export const vpnConnectionArn = ({
195197
region,
196198
account,
197199
id,
198-
} : {
200+
}: {
199201
region: string
200202
account: string
201203
id: string
@@ -205,11 +207,12 @@ export const transitGatewayAttachmentArn = ({
205207
region,
206208
account,
207209
id,
208-
} : {
210+
}: {
209211
region: string
210212
account: string
211213
id: string
212-
}): string => `arn:aws:ec2:${region}:${account}:transit-gateway-attachment/${id}`
214+
}): string =>
215+
`arn:aws:ec2:${region}:${account}:transit-gateway-attachment/${id}`
213216

214217
export const configurationRecorderArn = ({
215218
region,
@@ -224,7 +227,7 @@ export const configurationRecorderArn = ({
224227
export const athenaDataCatalogArn = ({
225228
region,
226229
account,
227-
name
230+
name,
228231
}: {
229232
region: string
230233
account: string
@@ -234,7 +237,7 @@ export const athenaDataCatalogArn = ({
234237
export const glueJobArn = ({
235238
region,
236239
account,
237-
name
240+
name,
238241
}: {
239242
region: string
240243
account: string
@@ -244,7 +247,7 @@ export const glueJobArn = ({
244247
export const ssmManagedInstanceArn = ({
245248
region,
246249
account,
247-
name
250+
name,
248251
}: {
249252
region: string
250253
account: string
@@ -254,7 +257,7 @@ export const ssmManagedInstanceArn = ({
254257
export const ssmDocumentArn = ({
255258
region,
256259
account,
257-
name
260+
name,
258261
}: {
259262
region: string
260263
account: string
@@ -269,4 +272,15 @@ export const cognitoIdentityPoolArn = ({
269272
region: string
270273
account: string
271274
identityPoolId: string
272-
}): string => `arn:aws:cognito-identity:${region}:${account}:identitypool/${identityPoolId}`
275+
}): string =>
276+
`arn:aws:cognito-identity:${region}:${account}:identitypool/${identityPoolId}`
277+
278+
export const flowLogsArn = ({
279+
region,
280+
account,
281+
flowLogId,
282+
}: {
283+
region: string
284+
account: string
285+
flowLogId: string
286+
}): string => `arn:aws:ec2:${region}:${account}:vpc-flow-log/${flowLogId}`

0 commit comments

Comments
 (0)