Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/no shared stack #33

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 0 additions & 102 deletions cdk/cdk.context.json

This file was deleted.

4 changes: 2 additions & 2 deletions cdk/lib/application-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface ApplicationLayerStackProps extends StackProps {
*/
readonly domain: string;

readonly parentHostedZoneId: string;
readonly parentHostedZone: string;

/**
* Table where the partition key refers to the top-level element of recipes.
Expand Down Expand Up @@ -61,7 +61,7 @@ export default class ApplicationLayerStack extends Stack {

new CrossAccountZoneDelegationRecord(this, 'Delegate', {
delegatedZone: hostedZone,
parentHostedZoneName: props.parentHostedZoneId,
parentHostedZoneName: props.parentHostedZone,
delegationRole: props.delegationRole,
});

Expand Down
16 changes: 7 additions & 9 deletions cdk/lib/application-stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { Construct } from 'constructs';
import { Stage, StageProps } from 'aws-cdk-lib';
import PersistenceLayerStack from './persistence-layer';
import ApplicationLayerStack from './application-layer';
import { ProjectEnvironment, sharedEnvironment } from './pipeline';
import { SharedStack } from './shared';
import { ProjectEnvironment } from './pipeline';
import { HostedZoneDelegate } from './iam/delegation-role';

export interface MealPlannerStageProps extends StageProps {
readonly env: ProjectEnvironment;
readonly parentHostedZone: string;
readonly roleWrapper: HostedZoneDelegate;
}

/**
Expand All @@ -22,16 +24,12 @@ export default class MealPlannerStage extends Stage {
constructor(scope: Construct, id: string, props: MealPlannerStageProps) {
super(scope, id, props);

const sharedLayer = new SharedStack(this, 'SharedLayer', {
environment: props.env,
env: sharedEnvironment,
});
const persistanceLayer = new PersistenceLayerStack(this, 'PersistenceLayer');
new ApplicationLayerStack(this, 'ApplicationLayer', {
delegationRole: sharedLayer.roleWrapper.delegationRole,
delegationRole: props.roleWrapper.delegationRole,
recipeTable: persistanceLayer.recipeTable,
domain: sharedLayer.roleWrapper.normalizedDomain,
parentHostedZoneId: sharedLayer.hostedZoneId,
domain: props.roleWrapper.normalizedDomain,
parentHostedZone: props.parentHostedZone,
});
}
}
28 changes: 28 additions & 0 deletions cdk/lib/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,39 @@ export default class PipelineStack extends Stack {
crossAccountKeys: true,
});

const projectsHostedZone = HostedZone.fromHostedZoneId(
this,
'ProjectsHostedZone',
'Z09758583PVMFV16WNRXR',
);

const stagingHostedZoneDelegate = new HostedZoneDelegate(
this,
`${stagingEnvironment.name}HostedZoneDelegate`,
{
hostedZoneArn: projectsHostedZone.hostedZoneArn,
projectEnvironment: stagingEnvironment,
});
projectsHostedZone.grantDelegation(stagingHostedZoneDelegate.delegationRole);

const prodHostedZoneDelegate = new HostedZoneDelegate(
this,
`${prodEnvironment.name}HostedZoneDelegate`,
{
hostedZoneArn: projectsHostedZone.hostedZoneArn,
projectEnvironment: prodEnvironment,
});
projectsHostedZone.grantDelegation(prodHostedZoneDelegate.delegationRole);

const stagingStage = new MealPlannerStage(this, 'MealPlannerAppStaging', {
env: stagingEnvironment,
roleWrapper: stagingHostedZoneDelegate,
parentHostedZone: 'projects.chittyinsights.com',
});
const prodStage = new MealPlannerStage(this, 'MealPlannerAppProd', {
env: prodEnvironment,
roleWrapper: prodHostedZoneDelegate,
parentHostedZone: 'projects.chittyinsights.com',
});

pipeline.addStage(stagingStage);
Expand Down
44 changes: 0 additions & 44 deletions cdk/lib/shared.ts

This file was deleted.

Loading