Skip to content

Commit

Permalink
fix(tf): Clean up pagerduty.
Browse files Browse the repository at this point in the history
  • Loading branch information
cass-moz committed Jun 18, 2024
1 parent e47321c commit b19e0e7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 35 deletions.
2 changes: 0 additions & 2 deletions .aws/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Construct } from 'constructs';
import { App, S3Backend, TerraformStack } from 'cdktf';
import { AwsProvider } from '@cdktf/provider-aws';
import { config } from './config';
import { PagerdutyProvider } from '@cdktf/provider-pagerduty';
import {
createApplicationCodePipeline,
createPocketAlbApplication,
Expand All @@ -19,7 +18,6 @@ class CurationAdminTools extends TerraformStack {
defaultTags: { tags: config.tags },
});

new PagerdutyProvider(this, 'pagerduty_provider', { token: undefined });
new LocalProvider(this, 'local_provider');
new NullProvider(this, 'null_provider');

Expand Down
34 changes: 1 addition & 33 deletions .aws/src/pocketAlbApplication.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,16 @@
import {
PocketALBApplication,
PocketECSCodePipeline,
PocketPagerDuty,
} from '@pocket-tools/terraform-modules';
import { config, isDev } from './config';

Check failure on line 5 in .aws/src/pocketAlbApplication.ts

View workflow job for this annotation

GitHub Actions / Lint Code Base

'isDev' is defined but never used
import { Construct } from 'constructs';
import { DataTerraformRemoteState } from 'cdktf';
import {
DataAwsCallerIdentity,
DataAwsRegion,
} from '@cdktf/provider-aws/lib/datasources';
import { DataAwsSnsTopic } from '@cdktf/provider-aws/lib/sns';
import { DataAwsKmsAlias } from '@cdktf/provider-aws/lib/kms';

/**
* @param scope
*/
function createPagerDuty(scope: Construct) {
const incidentManagement = new DataTerraformRemoteState(
scope,
'incident_management',
{
organization: 'Pocket',
workspaces: {
name: 'incident-management',
},
},
);

return new PocketPagerDuty(scope, 'pagerduty_policies', {
prefix: config.prefix,
service: {
criticalEscalationPolicyId: incidentManagement
.get('policy_default_critical_id')
.toString(),
nonCriticalEscalationPolicyId: incidentManagement
.get('policy_default_non_critical_id')
.toString(),
},
});
}

/**
* Create CodePipeline to build and deploy terraform and ecs
* @param app
Expand All @@ -66,8 +36,6 @@ export function createApplicationCodePipeline(
export function createPocketAlbApplication(
scope: Construct,
): PocketALBApplication {
const pagerDuty = createPagerDuty(scope);

const region = new DataAwsRegion(scope, 'region');
const caller = new DataAwsCallerIdentity(scope, 'caller');
const secretsManager = new DataAwsKmsAlias(scope, 'kms_alias', {
Expand Down Expand Up @@ -217,7 +185,7 @@ export function createPocketAlbApplication(
threshold: 25, // 25%
evaluationPeriods: 4,
period: 300, // 5 minutes
actions: isDev ? [] : [pagerDuty.snsCriticalAlarmTopic.arn],
actions: [],
},
},
});
Expand Down

0 comments on commit b19e0e7

Please sign in to comment.