Skip to content

Commit

Permalink
fix(types): adding in client types for braze content proxy (#701)
Browse files Browse the repository at this point in the history
* fix(types): adding in client types for braze content proxy

* fix(build): making semantic release on build its own package

* fix(pager): removing pagerduty terraform state

* fix(xray): removing aws xray
  • Loading branch information
bassrock authored Aug 28, 2024
1 parent 9215280 commit 8dc3a73
Show file tree
Hide file tree
Showing 19 changed files with 4,034 additions and 292 deletions.
72 changes: 4 additions & 68 deletions infrastructure/braze-content-proxy/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import { Construct } from 'constructs';
import {
App,
Aspects,
DataTerraformRemoteState,
MigrateIds,
S3Backend,
TerraformStack,
} from 'cdktf';
import { App, S3Backend, TerraformStack } from 'cdktf';
import {
provider as awsProvider,
dataAwsCallerIdentity,
Expand All @@ -15,10 +8,7 @@ import {
dataAwsSnsTopic,
} from '@cdktf/provider-aws';
import { config } from './config';
import {
PocketALBApplication,
PocketPagerDuty,
} from '@pocket-tools/terraform-modules';
import { PocketALBApplication } from '@pocket-tools/terraform-modules';
import { provider as localProvider } from '@cdktf/provider-local';
import { provider as nullProvider } from '@cdktf/provider-null';
import { provider as pagerDutyProvider } from '@cdktf/provider-pagerduty';
Expand Down Expand Up @@ -52,16 +42,11 @@ class BrazeContentProxy extends TerraformStack {
);

this.createPocketAlbApplication({
pagerDuty: this.createPagerDuty(),
secretsManagerKmsAlias: this.getSecretsManagerKmsAlias(),
snsTopic: this.getCodeDeploySnsTopic(),
region,
caller,
});

// Pre cdktf 0.17 ids were generated differently so we need to apply a migration aspect
// https://developer.hashicorp.com/terraform/cdktf/concepts/aspects
Aspects.of(this).add(new MigrateIds());
}

/**
Expand All @@ -84,50 +69,13 @@ class BrazeContentProxy extends TerraformStack {
});
}

/**
* Create PagerDuty service for alerts
* @private
*/
private createPagerDuty() {
// don't create any pagerduty resources if in dev
if (config.isDev) {
return undefined;
}

const incidentManagement = new DataTerraformRemoteState(
this,
'incident_management',
{
organization: 'Pocket',
workspaces: {
name: 'incident-management',
},
},
);

return new PocketPagerDuty(this, 'pagerduty', {
prefix: config.prefix,
service: {
// This is a Tier 2 service and as such only raises non-critical alarms.
criticalEscalationPolicyId: incidentManagement
.get('policy_default_non_critical_id')
.toString(),
nonCriticalEscalationPolicyId: incidentManagement
.get('policy_default_non_critical_id')
.toString(),
},
});
}

private createPocketAlbApplication(dependencies: {
pagerDuty: PocketPagerDuty;
region: dataAwsRegion.DataAwsRegion;
caller: dataAwsCallerIdentity.DataAwsCallerIdentity;
secretsManagerKmsAlias: dataAwsKmsAlias.DataAwsKmsAlias;
snsTopic: dataAwsSnsTopic.DataAwsSnsTopic;
}): PocketALBApplication {
const { pagerDuty, region, caller, secretsManagerKmsAlias, snsTopic } =
dependencies;
const { region, caller, secretsManagerKmsAlias, snsTopic } = dependencies;

return new PocketALBApplication(this, 'application', {
internal: false,
Expand Down Expand Up @@ -166,18 +114,6 @@ class BrazeContentProxy extends TerraformStack {
},
],
},
{
name: 'xray-daemon',
containerImage: 'public.ecr.aws/xray/aws-xray-daemon:latest',
portMappings: [
{
hostPort: 2000,
containerPort: 2000,
protocol: 'udp',
},
],
command: ['--region', 'us-east-1', '--local-mode'],
},
],
codeDeploy: {
useCodeDeploy: true,
Expand Down Expand Up @@ -248,7 +184,7 @@ class BrazeContentProxy extends TerraformStack {
threshold: 25,
evaluationPeriods: 4,
period: 300,
actions: config.isDev ? [] : [pagerDuty.snsNonCriticalAlarmTopic.arn],
actions: config.isDev ? [] : [snsTopic.arn],
},
},
});
Expand Down
3 changes: 2 additions & 1 deletion packages/apollo-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"dev": "pnpm run build --watch",
"format": "eslint --fix",
"lint": "eslint --fix-dry-run",
"presemantic-release": "pnpm run build",
"semantic-release": "semantic-release",
"test": "jest",
"test:watch": "pnpm run test -- --watch"
Expand Down Expand Up @@ -113,4 +114,4 @@
"graphql": "16.8.1",
"graphql-tag": "2.12.6"
}
}
}
3 changes: 2 additions & 1 deletion packages/lambda-secrets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"dev": "pnpm run build --watch",
"format": "eslint --fix",
"lint": "eslint --fix-dry-run",
"presemantic-release": "pnpm run build",
"semantic-release": "semantic-release"
},
"release": {
Expand Down Expand Up @@ -86,4 +87,4 @@
"tsup": "8.2.4",
"typescript": "5.5.4"
}
}
}
3 changes: 2 additions & 1 deletion packages/terraform-modules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"example:synth": "cdktf synth",
"format": "eslint --fix",
"lint": "eslint --fix-dry-run",
"presemantic-release": "pnpm run build",
"semantic-release": "semantic-release",
"test": "jest --ci --maxWorkers=4 --logHeapUsage",
"test:watch": "npm test -- --watch --watch-extensions ts -R min --watch-files src"
Expand Down Expand Up @@ -94,4 +95,4 @@
"tsup": "8.2.4",
"typescript": "5.5.4"
}
}
}
3 changes: 2 additions & 1 deletion packages/tracing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"dev": "pnpm run build --watch",
"format": "eslint --fix",
"lint": "eslint --fix-dry-run",
"presemantic-release": "pnpm run build",
"semantic-release": "semantic-release"
},
"release": {
Expand Down Expand Up @@ -105,4 +106,4 @@
"tsup": "8.2.4",
"typescript": "5.5.4"
}
}
}
3 changes: 2 additions & 1 deletion packages/ts-logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"dev": "pnpm run build --watch",
"format": "eslint --fix",
"lint": "eslint --fix-dry-run",
"presemantic-release": "pnpm run build",
"semantic-release": "semantic-release",
"test": "jest",
"test:watch": "pnpm run test -- --watch"
Expand Down Expand Up @@ -86,4 +87,4 @@
"tsup": "8.2.4",
"typescript": "5.5.4"
}
}
}
Loading

0 comments on commit 8dc3a73

Please sign in to comment.