How to use the @pulumi/pulumi.Config 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 / pulumi-kubernetes / tests / sdk / nodejs / secrets / step1 / index.ts View on Github external
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import * as pulumi from "@pulumi/pulumi";
import * as k8s from "@pulumi/kubernetes";

const config = new pulumi.Config();

const pw = config.requireSecret("message");
const rawPW = config.require("message");

const cmData = new k8s.core.v1.ConfigMap("cmdata", {
    data: {
        password: pw,
    }
});

const cmBinaryData = new k8s.core.v1.ConfigMap("cmbinarydata", {
    binaryData: {
        password: pw.apply(d => Buffer.from(d).toString("base64")),
    }
});
github pulumi / pulumi-cloud / examples / integration / aws.ts View on Github external
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import * as pulumi from "@pulumi/pulumi";

// AWS IAM credentials for making calls agaisnt AWS resources.
// See http://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html
let config = new pulumi.Config("aws");
let accessKeyID = config.require("access_key");
let secretAccessKey = config.require("secret_access_key");
let region = config.require("region");

export let sendEmail: (message: EmailMessage) => Promise = async (message) => {
    let AWS = require("aws-sdk");
    AWS.config = new AWS.Config({
        accessKeyId: accessKeyID,
        secretAccessKey: secretAccessKey,
        region: region,
    });
    let ses = new AWS.SES();
    console.log(`Sending email: ${JSON.stringify(message)}`);
    let params: any = {
        Destination: {
            ToAddresses: message.to,
github pulumi / pulumi-cloud / azure / config / index.ts View on Github external
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import * as azure from "@pulumi/azure";
import * as pulumi from "@pulumi/pulumi";
import { RunError } from "@pulumi/pulumi/errors";

const config = new pulumi.Config("cloud-azure");

const functionIncludePathsString = config.get("functionIncludePaths");
/**
 * Comma-seperated list of additional paths (relative to the project root) to include in Lambda zip uploads for
 * JavaScript callbacks.  E.g "./img.png,app/".
 */
export let functionIncludePaths: string[] | undefined = undefined;
if (functionIncludePathsString) {
    functionIncludePaths = functionIncludePathsString.split(",");
}

const functionIncludePackagesString = config.get("functionIncludePackages");
/**
 * Comma-seperated list of additional packages (relative to the project root) to include in Lambda zip uploads for
 * JavaScript callbacks.  E.g "body-parser,typescript".
 */
github pulumi / examples / aws-ts-voting-app / index.ts View on Github external
// Copyright 2016-2019, Pulumi Corporation.  All rights reserved.

import * as awsx from "@pulumi/awsx";
import * as pulumi from "@pulumi/pulumi";

// Get the password to use for Redis from config.
const config = new pulumi.Config();
const redisPassword = config.require("redisPassword");
const redisPort = 6379;

// The data layer for the application
// Use the 'image' property to point to a pre-built Docker image.
const redisListener = new awsx.elasticloadbalancingv2.NetworkListener("voting-app-cache", { port: redisPort });
const redisCache = new awsx.ecs.FargateService("voting-app-cache", {
    taskDefinitionArgs: {
        containers: {
            redis: {
                image: "redis:alpine",
                memory: 512,
                portMappings: [redisListener],
                command: ["redis-server", "--requirepass", redisPassword],
            },
        },
github pulumi / kubernetes-guides / apps / deployment-secret / config.ts View on Github external
import * as pulumi from "@pulumi/pulumi";

let pulumiConfig = new pulumi.Config();

// Existing Pulumi stack reference in the format:
// // e.g. "myUser/myProject/dev"
const infraStackRef = new pulumi.StackReference(pulumiConfig.require("infraStackRef"));
const clusterStackRef = new pulumi.StackReference(pulumiConfig.require("clusterStackRef"));

export const config = {
    // Infra
    privateSubnetIds: infraStackRef.getOutput("privateSubnetIds"),
    publicSubnetIds: infraStackRef.getOutput("publicSubnetIds"),

    // Cluster
    kubeconfig: clusterStackRef.getOutput("kubeconfig"),
    clusterName: clusterStackRef.getOutput("clusterName"),
    securityGroupIds: clusterStackRef.getOutput("securityGroupIds"),
    clusterSvcsNamespaceName: clusterStackRef.getOutput("clusterSvcsNamespaceName"),
github pulumi / pulumi-cloud / aws / config / index.ts View on Github external
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";
import { RunError } from "@pulumi/pulumi/errors";

const config = new pulumi.Config("cloud-aws");

// TODO[pulumi/pulumi-cloud#134]: We need to clean up the set of options available on `cloud-aws`
// and potentially reduce the dimentionality of the available configuration space.

/**
 * Optionally override the Lambda function memory size for all functions.
 */
export let functionMemorySize = config.getNumber("functionMemorySize") || 128;
if (functionMemorySize % 64 !== 0 || functionMemorySize < 128 || functionMemorySize > 1536) {
    throw new RunError("Lambda memory size in MiB must be a multiple of 64 between 128 and 1536.");
}

const functionIncludePathsString = config.get("functionIncludePaths");
/**
 * Comma-seperated list of additional paths (relative to the project root) to include in Lambda zip uploads for
 * JavaScript callbacks.  E.g "./img.png,app/".
github pulumi / examples / cloud-ts-url-shortener-cache / config.ts View on Github external
// Copyright 2016-2018, Pulumi Corporation.  All rights reserved.

import * as pulumi from "@pulumi/pulumi";

const config = new pulumi.Config();

// Get the Redis password from config
export const redisPassword = config.require("redisPassword");
github pulumi / examples / azure-ts-appservice-devops / infra / index.ts View on Github external
type: "block",

    content: new pulumi.asset.FileArchive("../src/bin/Debug/netcoreapp2.1/publish"),
});

const codeBlobUrl = azure.storage.signedBlobReadUrl(blob, storageAccount);

const appInsights = new azure.appinsights.Insights(`${prefix}-ai`, {
    ...resourceGroupArgs,

    applicationType: "Web",
});


// Get the password to use for SQL from config.
const config = new pulumi.Config();
const username = config.require("sqlUsername");
const pwd = config.require("sqlPassword");

const sqlServer = new azure.sql.SqlServer(`${prefix}-sql`, {
    ...resourceGroupArgs,

    administratorLogin: username,
    administratorLoginPassword: pwd,
    version: "12.0",
});

const database = new azure.sql.Database(`${prefix}-db`, {
    ...resourceGroupArgs,
    serverName: sqlServer.name,
    requestedServiceObjectiveName: "S0",
});
github pulumi / examples / kubernetes-ts-guestbook / simple / index.ts View on Github external
// Copyright 2016-2018, Pulumi Corporation.  All rights reserved.

import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";

// Minikube does not implement services of type `LoadBalancer`; require the user to specify if we're
// running on minikube, and if so, create only services of type ClusterIP.
const config = new pulumi.Config();
const isMinikube = config.getBoolean("isMinikube");

//
// REDIS MASTER.
//

const redisMasterLabels = { app: "redis-master" };
const redisMasterDeployment = new k8s.apps.v1.Deployment("redis-master", {
    spec: {
        selector: { matchLabels: redisMasterLabels },
        template: {
            metadata: { labels: redisMasterLabels },
            spec: {
                containers: [
                    {
                        name: "master",
github pulumi / pulumi-kubernetes / tests / sdk / nodejs / examples / mariadb / config.ts View on Github external
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";

const config = new pulumi.Config();

export interface AppConfig {
    namespace: pulumi.Input;
    appName: string;

    metricsEnabled: pulumi.Input;

    storageClassName?: pulumi.Input;

    mariaConfig: pulumi.Input<{
        rootPassword: pulumi.Input;
        user: pulumi.Input;
        db: pulumi.Input;
        password: pulumi.Input;
        cnf: pulumi.Input;
    }>;