Skip to content

Commit 0bb9dfc

Browse files
committed
Add API Gateway to the stack
1 parent c233ff0 commit 0bb9dfc

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

backend/src/iac/backend-stack.ts

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class BackendStack extends cdk.Stack {
4040
});
4141

4242
// CloudMap Namespace for service discovery
43-
const namespace = cluster.addDefaultCloudMapNamespace({
43+
cluster.addDefaultCloudMapNamespace({
4444
name: `${appName.toLowerCase()}.local`,
4545
});
4646

@@ -138,18 +138,24 @@ export class BackendStack extends cdk.Stack {
138138
reportsTable.grantReadWriteData(taskDefinition.taskRole);
139139

140140
// Create a secrets manager for the SSL certificate and key
141-
const certificateSecret = new cdk.aws_secretsmanager.Secret(this, `${appName}CertSecret-${props.environment}`, {
142-
secretName: `${appName}/ssl-cert-${props.environment}`,
143-
description: 'SSL certificate and private key for HTTPS',
144-
generateSecretString: {
145-
secretStringTemplate: JSON.stringify({
146-
// You'll need to populate these values after deployment
147-
certificate: '-----BEGIN CERTIFICATE-----\nYour certificate here\n-----END CERTIFICATE-----',
148-
privateKey: '-----BEGIN PRIVATE KEY-----\nYour private key here\n-----END PRIVATE KEY-----'
149-
}),
150-
generateStringKey: 'dummy' // This key won't be used but is required
141+
const certificateSecret = new cdk.aws_secretsmanager.Secret(
142+
this,
143+
`${appName}CertSecret-${props.environment}`,
144+
{
145+
secretName: `${appName}/ssl-cert-${props.environment}`,
146+
description: 'SSL certificate and private key for HTTPS',
147+
generateSecretString: {
148+
secretStringTemplate: JSON.stringify({
149+
// You'll need to populate these values after deployment
150+
certificate:
151+
'-----BEGIN CERTIFICATE-----\nYour certificate here\n-----END CERTIFICATE-----',
152+
privateKey:
153+
'-----BEGIN PRIVATE KEY-----\nYour private key here\n-----END PRIVATE KEY-----',
154+
}),
155+
generateStringKey: 'dummy', // This key won't be used but is required
156+
},
151157
},
152-
});
158+
);
153159

154160
// Container
155161
const container = taskDefinition.addContainer(`${appName}Container-${props.environment}`, {
@@ -328,8 +334,12 @@ export class BackendStack extends cdk.Stack {
328334
const executionRole = new iam.Role(this, `${appName}APIGatewayVPCRole-${props.environment}`, {
329335
assumedBy: new iam.ServicePrincipal('apigateway.amazonaws.com'),
330336
managedPolicies: [
331-
iam.ManagedPolicy.fromAwsManagedPolicyName('service-role/AmazonAPIGatewayPushToCloudWatchLogs'),
332-
iam.ManagedPolicy.fromAwsManagedPolicyName('AmazonVPCCrossAccountNetworkInterfaceOperations'),
337+
iam.ManagedPolicy.fromAwsManagedPolicyName(
338+
'service-role/AmazonAPIGatewayPushToCloudWatchLogs',
339+
),
340+
iam.ManagedPolicy.fromAwsManagedPolicyName(
341+
'AmazonVPCCrossAccountNetworkInterfaceOperations',
342+
),
333343
],
334344
});
335345

0 commit comments

Comments
 (0)