39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import {Construct} from "constructs";
|
||
import {App, TerraformStack} from "cdktf";
|
||
|
||
import {Org} from "./.gen/providers/zitadel/org";
|
||
import {parse} from "dotenv";
|
||
import { ZitadelProvider } from "./.gen/providers/zitadel/provider";
|
||
|
||
|
||
const config = parse("../.zitadel.env");
|
||
|
||
const configExpanded = {
|
||
zitadelKey: config.ZITADEL_MASTERKEY,
|
||
};
|
||
|
||
|
||
class MyStack extends TerraformStack {
|
||
constructor(scope: Construct, id: string) {
|
||
super(scope, id);
|
||
// 1️⃣ Provider configuration
|
||
new ZitadelProvider(this, "zitadel", {
|
||
domain: "http://localhost", // your instance URL
|
||
port: "8080",
|
||
insecure: true, // set true for dev/self-signed
|
||
token: configExpanded.zitadelKey
|
||
// or serviceAccountId / key depending on the auth method you prefer
|
||
});
|
||
|
||
// 2️⃣ Create an organisation
|
||
new Org(this, "demoOrg", {
|
||
name: "geoffs-makers-guild"
|
||
// optional: project_grant_role_assertion, default_language, etc.
|
||
});
|
||
}
|
||
}
|
||
|
||
const app = new App();
|
||
new MyStack(app, "zitadel-configurator");
|
||
app.synth();
|