Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const run = async () => {
// Create our stack using a local program
// in the ../fargate directory
const args: LocalProgramArgs = {
stackName: "dev",
workDir: upath.joinSafe(__dirname, "..", "fargate"),
};
// create (or select if one already exists) a stack that uses our local program
const stack = await LocalWorkspace.createOrSelectStack(args);
console.info("successfully initialized stack");
console.info("setting up config");
await stack.setConfig("aws:region", { value: "us-west-2" });
console.info("config set");
console.info("refreshing stack...");
await stack.refresh({ onOutput: console.info });
console.info("refresh complete");
if (destroy) {
console.info("destroying stack...");
await stack.destroy({onOutput: console.info});
console.info("stack destroy complete");
process.exit(0);
}
const run = async () => {
// Create our stack using a local program
// in the ../website directory
const args: LocalProgramArgs = {
stackName: "dev",
workDir: upath.joinSafe(__dirname, "..", "website"),
};
// create (or select if one already exists) a stack that uses our local program
const stack = await LocalWorkspace.createOrSelectStack(args);
console.info("successfully initialized stack");
console.info("setting up config");
await stack.setConfig("aws:region", { value: "us-west-2" });
console.info("config set");
console.info("refreshing stack...");
await stack.refresh({ onOutput: console.info });
console.info("refresh complete");
if (destroy) {
console.info("destroying stack...");
await stack.destroy({onOutput: console.info});
console.info("stack destroy complete");
process.exit(0);
}
host: pulumi.interpolate`${cluster.endpoint}`,
dbName,
dbUser,
dbPass
};
};
// Create our stack
const args: InlineProgramArgs = {
stackName: "dev",
projectName: "databaseMigration",
program: pulumiProgram
};
// create (or select if one already exists) a stack that uses our inline program
const stack = await LocalWorkspace.createOrSelectStack(args);
console.info("successfully initialized stack");
console.info("installing plugins...");
await stack.workspace.installPlugin("aws", "v4.0.0");
console.info("plugins installed");
console.info("setting up config");
await stack.setConfig("aws:region", { value: aws.Region.USWest2 });
console.info("config set");
console.info("refreshing stack...");
await stack.refresh({ onOutput: console.info });
console.info("refresh complete");
if (destroy) {
console.info("destroying stack...");
await stack.destroy({ onOutput: console.info });
console.info("stack destroy complete");
stackName: "dev",
projectName: "inlineNode",
program: pulumiProgram
};
// create (or select if one already exists) a stack that uses our inline program
let secretsProvider = "awskms://aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee?region=us-west-2";
if (process.env.KMS_KEY) {
secretsProvider = `awskms://${process.env.KMS_KEY}?region=${process.env.AWS_REGION}`;
}
if (secretsProvider === "awskms://aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee?region=us-west-2") {
throw new Error("Provide an actual KMS key for secretsProvider");
}
const stack = await LocalWorkspace.createOrSelectStack(args, {
projectSettings: {
name: args.projectName,
runtime: "nodejs",
backend: {
url: "file://~/.pulumi-local",
},
},
secretsProvider,
stackSettings: {
[args.stackName]: {
secretsProvider,
},
},
});
console.info("successfully initialized stack");
});
return {
websiteUrl: siteBucket.websiteEndpoint,
};
};
// Create our stack
const args: InlineProgramArgs = {
stackName: "dev",
projectName: "inlineNode",
program: pulumiProgram
};
// create (or select if one already exists) a stack that uses our inline program
const stack = await LocalWorkspace.createOrSelectStack(args);
console.info("successfully initialized stack");
console.info("installing plugins...");
await stack.workspace.installPlugin("aws", "v4.0.0");
console.info("plugins installed");
console.info("setting up config");
await stack.setConfig("aws:region", { value: "us-west-2" });
console.info("config set");
console.info("refreshing stack...");
await stack.refresh({ onOutput: console.info });
console.info("refresh complete");
if (destroy) {
console.info("destroying stack...");
await stack.destroy({ onOutput: console.info });
console.info("stack destroy complete");
export async function deploy(): Promise {
console.log("Initialising stack...");
const stack = await LocalWorkspace.createOrSelectStack(args);
console.log("Setting region...");
await stack.setConfig("aws:region", {value: "us-west-1"});
console.log("Run update...");
const up = await stack.up({ onOutput: console.log });
return up.outputs;
}
export async function destroy() {
console.log("Selecting stack...");
const stack = await LocalWorkspace.createOrSelectStack(args);
console.log("Destroying stack");
await stack.destroy({onOutput: console.log});
}
export async function getOuputs(): Promise {
const stack = await LocalWorkspace.createOrSelectStack(args);
var outputs = stack.outputs();
return outputs;
}