We will be sunsetting Advisor during Jan, 2026 and will instead be providing information in Snyk Security DB.

You can begin to take advantage of Snyk Security DB today for a unified, package-centric experience.

How to use @pulumi/random - 10 common examples

To help you get started, we’ve selected a few @pulumi/random 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 / integration / istio / step1 / config.ts View on Github external
export const gcpZone = "a";

// nodeCount is the number of cluster nodes to provision. Defaults to 3 if unspecified.
export const nodeCount = config.getNumber("nodeCount") || 5;

// nodeMachineType is the machine type to use for cluster nodes. Defaults to n1-standard-1 if unspecified.
// See https://cloud.google.com/compute/docs/machine-types for more details on available machine types.
export const nodeMachineType = config.get("nodeMachineType") || "n1-standard-2";

// masterUsername is the admin username for the cluster.
export const masterUsername = config.get("masterUsername") || "admin";

// masterPassword is the password for the admin user in the cluster.
export const masterPassword =
    config.get("password") ||
    new random.RandomString("password", {
        length: 16,
        special: true
    }).result;

// username is the admin username for the cluster.
export const gcpUsername =
    config.get("gcpUsername") || "test-ci@pulumi-development.iam.gserviceaccount.com";

export const kubeconfigPath = config.get("kubeconfigPath") || path.join(os.homedir(), ".kube", "config");
github pulumi / pulumi-kubernetes / tests / integration / retry / step1 / index.ts View on Github external
//
// 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";
import * as random from "@pulumi/random"

//
// To allow parallel test runs, generate a namespace name with a random suffix.
//

let randomSuffix = new random.RandomString("random-suffix", {
    length: 6,
    special: false,
    upper: false
});
let nsName = pulumi.concat(`test-namespace-`, randomSuffix.result);

//
// Tests that if we force a `Pod` to be created before the `Namespace` it is supposed to exist in,
// it will retry until created.
//

new k8s.core.v1.Pod("nginx", {
    metadata: {
        namespace: nsName,
        name: "nginx"
    },
github pulumi / pulumi-google-native / examples / webserver-ts / index.ts View on Github external
// Copyright 2016-2021, Pulumi Corporation.  All rights reserved.

import * as pulumi from "@pulumi/pulumi";
import * as google from "@pulumi/google-native";
import * as random from "@pulumi/random"

const randomString = new random.RandomString("name", {
    upper: false,
    number: false,
    special: false,
    length: 8,
});

const config = new pulumi.Config("google-native");
const project = config.require("project");
const zone = config.require("zone");

const computeNetwork = new google.compute.v1.Network("network", {
    autoCreateSubnetworks: true,
    project: project,
    name: pulumi.interpolate`${randomString.result}-net`,
});
github pulumi / pulumi-google-native / examples / pubsub-ts / index.ts View on Github external
// Copyright 2016-2021, Pulumi Corporation.

import * as pulumi from "@pulumi/pulumi";
import * as google from "@pulumi/google-native";
import * as random from "@pulumi/random"

const config = new pulumi.Config("google-native");
const project = config.require("project");
const region = config.require("region");

const randomString = new random.RandomString("name", {
    upper: false,
    number: false,
    special: false,
    length: 8,
});

const topic = new google.pubsub.v1.Topic("topic", {
    project,
    topicId: randomString.result,
});

const sub = new google.pubsub.v1.Subscription("sub", {
    project,
    topic: topic.name,
    subscriptionId: randomString.result,
});
github pulumi / examples / aws-ts-appsync / index.ts View on Github external
schema {
        query: Query
        mutation: Mutation
    }`;

// Create API accessible with a key
const api = new aws.appsync.GraphQLApi("api", {
    authenticationType: "API_KEY",
    schema,
});
const apiKey = new aws.appsync.ApiKey("key", {
    apiId: api.id,
});

const randomString = new random.RandomString("random-datasource-name", {
    length: 15,
    special: false,
    number: false,
});

// Link a data source to the Dynamo DB Table
const dataSource = new aws.appsync.DataSource("tenants-ds", {
    name: randomString.result,
    apiId: api.id,
    type: "AMAZON_DYNAMODB",
    dynamodbConfig: {
        tableName: table.name,
    },
    serviceRoleArn: role.arn,
});
github pulumi / kubernetes-guides / orig / azure / identity / config.ts View on Github external
// limitations under the License.

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

const config = new pulumi.Config();

//
// AKS-specific config.
//

export const name = config.get("name") || "aks";
export const location = config.get("location") || "West US 2";
export const password =
    config.get("password") ||
    new random.RandomString("password", {
        length: 16,
        special: true,
    }).result;
github pulumi / pulumi-google-native / examples / functions-ts / index.ts View on Github external
// Copyright 2016-2021, Pulumi Corporation.

import * as pulumi from "@pulumi/pulumi";
import * as google from "@pulumi/google-native";
import * as random from "@pulumi/random"

const config = new pulumi.Config("google-native");
const project = config.require("project");
const region = config.require("region");

const randomString = new random.RandomString("name", {
    upper: false,
    number: false,
    special: false,
    length: 8,
});

const bucket = new google.storage.v1.Bucket("bucket", {
    project,
    name: pulumi.interpolate`bucket-${randomString.result}`,
});

const bucketObject = new google.storage.v1.BucketObject("bucketObject", {
    name: "zip",
    bucket: bucket.name,
    source: new pulumi.asset.AssetArchive({
        ".": new pulumi.asset.FileArchive("./pythonfunc"),
github pulumi / examples / kubernetes-ts-multicloud / gke.ts View on Github external
constructor(name: string,
                opts: pulumi.ComponentResourceOptions = {}) {
        super("examples:kubernetes-ts-multicloud:GkeCluster", name, {}, opts);

        // Find the latest engine version.
        const engineVersion = gcp.container.getEngineVersions({}, { async: true }).then(v => v.latestMasterVersion);

        // Generate a strong password for the Kubernetes cluster.
        const password = new random.RandomPassword("password", {
            length: 20,
            special: true,
        }, {parent: this}).result;

        // Create the GKE cluster.
        const k8sCluster = new gcp.container.Cluster("cluster", {
            initialNodeCount: 2,
            nodeVersion: engineVersion,
            minMasterVersion: engineVersion,
            masterAuth: {username: "example-user", password: password},
            nodeConfig: {
                machineType: "n1-standard-1",
                oauthScopes: [
                    "https://www.googleapis.com/auth/compute",
                    "https://www.googleapis.com/auth/devstorage.read_only",
                    "https://www.googleapis.com/auth/logging.write",
github pulumi / kubernetes-guides / apps / wordpress / index.ts View on Github external
import * as k8s from "@pulumi/kubernetes";
import * as random from "@pulumi/random";
import { config } from "./config";

// Create a k8s Provider.
const provider = new k8s.Provider("provider", {
    kubeconfig: config.kubeconfig,
    namespace: config.appsNamespaceName,
});

// Create the DB secret for MariaDB, the backing storage for WordPress.
const mariadbSecret = new k8s.core.v1.Secret("mariadb", {
    stringData: {
        "mariadb-root-password": new random.RandomPassword("mariadb-root-pw", {
            length: 12}).result,
        "mariadb-password": new random.RandomPassword("mariadb-pw", {
            length: 12}).result
    }
}, { provider: provider });

// Create the DB Secret for the WordPress admin.
const wordpressSecret = new k8s.core.v1.Secret("wordpress", {
    stringData: {
        "wordpress-password": new random.RandomPassword("wordpress-pw", {
            length: 12}).result,
    }
}, { provider: provider });

// Create a ConfigMap of the MariaDB settings.
const mariadbCM = new k8s.core.v1.ConfigMap("mariadb", {
    data: {
        "my.cnf": `
github pulumi / examples / azure-ts-vm-scaleset / index.ts View on Github external
// Copyright 2016-2019, Pulumi Corporation.  All rights reserved.

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

const config = new pulumi.Config();
const adminUser = config.get("adminUser") || "azureuser";
const adminPassword = config.getSecret("adminPassword") || new random.RandomPassword("pwd", {
    length: 20,
    special: true,
}).result;
const domain = config.get("domain") || new random.RandomString("domain", {
    length: 10,
    number: false,
    special: false,
    upper: false,
}).result;
const applicationPort = config.getNumber("applicationPort") || 80;

const resourceGroup = new azure.core.ResourceGroup("vmss-rg");

const publicIp = new azure.network.PublicIp("public-ip", {
    resourceGroupName: resourceGroup.name,
    allocationMethod: "Static",

@pulumi/random

A Pulumi package to safely use randomness in Pulumi programs.

Apache-2.0
Latest version published 2 months ago

Package Health Score

89 / 100
Full package analysis