Skip to content

Commit

Permalink
Create CNAME helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
rarous committed Feb 26, 2023
1 parent a26c8e8 commit 731c9da
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,32 @@ function createAliasRecords(
})
];
}
/**
* Creates CNAME record in Route 53
* @param name {string}
* @param domain {string}
* @param value {string}
* @param provider {aws.Provider}
*/
export function createCNAMERecord(
name: string,
domain: string,
value: string,
provider?: aws.Provider
) {
const hostedZone = getHostedZone(domain, provider);
return new aws.route53.Record(
`${domain}/txt-record-${name}`,
{
name: hostedZone.apply(x => x.name),
type: "CNAME",
zoneId: hostedZone.apply(x => x.zoneId),
records: [value],
ttl: 3600
},
{ provider }
);
}

/**
* Creates TXT record in Route 53
Expand Down

0 comments on commit 731c9da

Please sign in to comment.