How to use the @pulumi/pulumi/automation.LocalWorkspace.createOrSelectStack function in @pulumi/pulumi

To help you get started, we’ve selected a few @pulumi/pulumi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pulumi / automation-api-examples / nodejs / crossLanguage-tsnode / automation / index.ts View on Github external
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);
    }
github pulumi / automation-api-examples / nodejs / localProgram-tsnode / automation / index.ts View on Github external
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);
    }
github pulumi / automation-api-examples / nodejs / databaseMigration-ts / index.ts View on Github external
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");
github pulumi / automation-api-examples / nodejs / inlineSecretsProvider-ts / index.ts View on Github external
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");
github pulumi / automation-api-examples / nodejs / inlineProgram-ts / index.ts View on Github external
});

        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");
github pulumi / automation-api-examples / nodejs / localProgram-tsnode-mochatests / automation.ts View on Github external
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;
}
github pulumi / automation-api-examples / nodejs / localProgram-tsnode-mochatests / automation.ts View on Github external
export async function destroy() {
  console.log("Selecting stack...");
  const stack = await LocalWorkspace.createOrSelectStack(args);

  console.log("Destroying stack");
  await stack.destroy({onOutput: console.log});
}
github pulumi / automation-api-examples / nodejs / localProgram-tsnode-mochatests / automation.ts View on Github external
export async function getOuputs(): Promise {
  const stack = await LocalWorkspace.createOrSelectStack(args);

  var outputs = stack.outputs();

  return outputs;
}