-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2058 from vrk-kpa/AV-2058_add_new_domain_zone
AV-2058: Add new domain to route53
- Loading branch information
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import {StackProps} from "aws-cdk-lib"; | ||
|
||
export interface DomainStackProps extends StackProps{ | ||
crossAccountId?: string, | ||
zoneName: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as cdk from 'aws-cdk-lib'; | ||
import { Construct } from 'constructs'; | ||
import {aws_iam, aws_route53} from "aws-cdk-lib"; | ||
import {DomainStackProps} from "./domain-stack-props"; | ||
|
||
export class DomainStack extends cdk.Stack { | ||
readonly publicZone: aws_route53.PublicHostedZone; | ||
constructor(scope: Construct, id: string, props: DomainStackProps) { | ||
super(scope, id, props); | ||
|
||
this.publicZone = new aws_route53.PublicHostedZone(this, "HostedZone", { | ||
zoneName: props.zoneName, | ||
}) | ||
|
||
|
||
if (props.crossAccountId) { | ||
const role = new aws_iam.Role(this, 'Route53CrossDelegateRole', { | ||
assumedBy: new aws_iam.AccountPrincipal(props.crossAccountId), | ||
roleName: "Route53CrossDelegateRole" | ||
}) | ||
|
||
this.publicZone.grantDelegation(role) | ||
} | ||
} | ||
} |