Last active
March 4, 2024 23:43
-
-
Save TreehouseFalcon/ba7362a125dbb3a24ded44f57b6e314f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import { AwsProvider } from "@cdktf/provider-aws/lib/provider"; | |
import { CloudBackend, NamedCloudWorkspace, TerraformStack } from "cdktf"; | |
import { Construct } from "constructs"; | |
import { Cert } from "./cert"; | |
import { Domain } from "./domain/index"; | |
import { Iam } from "./iam"; | |
import { Net } from "./net"; | |
import { S3 } from "./s3"; | |
import { TailscaleProvider } from "../../../.gen/providers/tailscale/provider"; | |
import { DeviceKey as TailscaleDeviceKey } from "../../../.gen/providers/tailscale/device-key"; | |
export class CoreStack extends TerraformStack { | |
public iam: Iam; | |
public net: Net; | |
public domain: Domain; | |
public cert: Cert; | |
public s3: S3; | |
constructor(scope: Construct) { | |
super(scope, "core"); | |
const awsAccessKey = process.env.AWS_ACCESS_KEY_ID; | |
const awsSecretKey = process.env.AWS_SECRET_ACCESS_KEY; | |
const tailscaleApiKey = process.env.TAILSCALE_API_KEY; | |
new CloudBackend(this, { | |
hostname: "app.terraform.io", | |
organization: "...", | |
workspaces: new NamedCloudWorkspace(`neuraone-backend-core`), | |
token: process.env.TERRAFORM_API_KEY === "" ? undefined : process.env.TERRAFORM_API_KEY, | |
}); | |
new AwsProvider(this, "AWS", { | |
accessKey: awsAccessKey, | |
secretKey: awsSecretKey, | |
region: "us-west-2", | |
}); | |
new TailscaleProvider(this, "tailscale", { | |
tailnet: "...", | |
apiKey: tailscaleApiKey, | |
}); | |
new TailscaleDeviceKey(this, "ts-device-key", { | |
deviceId: "testing-device", | |
}); | |
this.iam = new Iam(this, "iam"); | |
this.net = new Net(this, "net"); | |
this.domain = new Domain(this, "domain"); | |
this.s3 = new S3(this, "s3"); | |
this.cert = new Cert(this, "cert"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment