Skip to content

Commit a1d0d0e

Browse files
committed
feat: add bin file
1 parent d7170fa commit a1d0d0e

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

shared/dns/aws/bin/shared-dns.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2025-Present Datadog, Inc.
5+
*/
6+
7+
import * as cdk from "aws-cdk-lib";
8+
import { execSync } from "child_process";
9+
import { StickerlandiaSharedDnsStack } from "../lib/shared-dns-stack";
10+
11+
// Get AWS account from STS if CDK_DEFAULT_ACCOUNT is not set (e.g., with SSO credentials)
12+
function getAwsAccount(): string | undefined {
13+
if (process.env.CDK_DEFAULT_ACCOUNT) {
14+
return process.env.CDK_DEFAULT_ACCOUNT;
15+
}
16+
try {
17+
return execSync("aws sts get-caller-identity --query Account --output text", {
18+
encoding: "utf-8",
19+
stdio: ["pipe", "pipe", "pipe"],
20+
}).trim();
21+
} catch {
22+
return undefined;
23+
}
24+
}
25+
26+
const app = new cdk.App();
27+
new StickerlandiaSharedDnsStack(
28+
app,
29+
`StickerlandiaSharedDns`,
30+
{
31+
env: {
32+
account: getAwsAccount(),
33+
region: process.env.CDK_DEFAULT_REGION,
34+
},
35+
}
36+
);
37+
38+
cdk.Tags.of(app).add("project", "stickerlandia");
39+
cdk.Tags.of(app).add("service", "shared-dns");
40+
cdk.Tags.of(app).add("team", "advocacy");

0 commit comments

Comments
 (0)