diff --git a/cdk/lib/iam/delegation-role.ts b/cdk/lib/iam/delegation-role.ts index 084e225..973c18e 100644 --- a/cdk/lib/iam/delegation-role.ts +++ b/cdk/lib/iam/delegation-role.ts @@ -8,7 +8,7 @@ import { } from 'aws-cdk-lib/aws-iam'; import { ProjectEnvironment } from '../pipeline'; -export interface HostedZoneDelegationProps { +export interface HostedZoneDelegateProps { /** * The parent hosted zone arn. */ @@ -24,7 +24,7 @@ export interface HostedZoneDelegationProps { /** * Wrapper that builds a role to allow delegation of subdomain records to another account. */ -export class HostedZoneDelegationRole extends Construct { +export class HostedZoneDelegate extends Construct { readonly defaultAccount: string = '211125587522'; readonly defaultDomain: string = 'mealplanner.projects.chittyinsights.com'; @@ -36,9 +36,9 @@ export class HostedZoneDelegationRole extends Construct { * * @param{Construct} scope the parent scope * @param{string} id logical id - * @param{HostedZoneDelegationProps} props properties for this role + * @param{HostedZoneDelegateProps} props properties for this role */ - constructor(scope: Construct, id: string, props: HostedZoneDelegationProps) { + constructor(scope: Construct, id: string, props: HostedZoneDelegateProps) { super(scope, id); this.normalizedDomain = this.normalizeRecordName(props.projectEnvironment.subdomain); this.delegationRole = new Role(this, 'CrossAccountRole', { diff --git a/cdk/lib/pipeline.ts b/cdk/lib/pipeline.ts index c20ce1f..3fac07d 100644 --- a/cdk/lib/pipeline.ts +++ b/cdk/lib/pipeline.ts @@ -9,7 +9,7 @@ import { } from 'aws-cdk-lib/pipelines'; import path = require('path'); import { HostedZone } from 'aws-cdk-lib/aws-route53'; -import { HostedZoneDelegationRole } from './iam/delegation-role'; +import { HostedZoneDelegate } from './iam/delegation-role'; export interface ProjectEnvironment extends Environment { /** @@ -54,12 +54,6 @@ export default class PipelineStack extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { super(scope, id, props); - const projectsHostedZone = HostedZone.fromHostedZoneId( - this, - 'ProjectsHostedZone', - 'Z09758583PVMFV16WNRXR', - ); - const synth = new ShellStep('Synth', { /* eslint-disable max-len */ input: CodePipelineSource.connection('NChitty/meal-planner', 'main', { @@ -80,25 +74,6 @@ export default class PipelineStack extends Stack { crossAccountKeys: true, }); - const stagingRoleWrapper = new HostedZoneDelegationRole( - this, - `${stagingEnvironment.name}HostedZoneDelegationRole`, - { - hostedZoneArn: projectsHostedZone.hostedZoneArn, - projectEnvironment: stagingEnvironment, - }); - - projectsHostedZone.grantDelegation(stagingRoleWrapper.delegationRole); - - const prodRoleWrapper = new HostedZoneDelegationRole( - this, - `${prodEnvironment.name}HostedZoneDelegationRole`, - { - hostedZoneArn: projectsHostedZone.hostedZoneArn, - projectEnvironment: stagingEnvironment, - }); - projectsHostedZone.grantDelegation(prodRoleWrapper.delegationRole); - const stagingStage = new MealPlannerStage(this, 'MealPlannerAppStaging', { env: stagingEnvironment, }); diff --git a/cdk/lib/shared.ts b/cdk/lib/shared.ts index d9ab8b3..bab817b 100644 --- a/cdk/lib/shared.ts +++ b/cdk/lib/shared.ts @@ -1,7 +1,7 @@ import { Stack, StackProps } from 'aws-cdk-lib'; import { HostedZone } from 'aws-cdk-lib/aws-route53'; import { Construct } from 'constructs'; -import { HostedZoneDelegationRole } from './iam/delegation-role'; +import { HostedZoneDelegate } from './iam/delegation-role'; import { ProjectEnvironment } from './pipeline'; export interface SharedStackProps extends StackProps { @@ -15,7 +15,7 @@ export interface SharedStackProps extends StackProps { */ export class SharedStack extends Stack { public readonly hostedZoneId: string; - public readonly roleWrapper: HostedZoneDelegationRole; + public readonly roleWrapper: HostedZoneDelegate; /** * Build the stack resources. * @param{Construct} scope parent @@ -32,9 +32,9 @@ export class SharedStack extends Stack { ); this.hostedZoneId = projectsHostedZone.hostedZoneId; - this.roleWrapper = new HostedZoneDelegationRole( + this.roleWrapper = new HostedZoneDelegate( this, - `${props.environment.name}HostedZoneDelegation`, + `${props.environment.name}HostedZoneDelegate`, { hostedZoneArn: projectsHostedZone.hostedZoneArn, projectEnvironment: props.environment,