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 the @pulumi/random.RandomString function in @pulumi/random

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 mapbox / asset-tracking / src / index.js View on Github external
policy: pulumi.interpolate`{
    "Version": "2012-10-17",
    "Statement": [
      {
          "Effect": "Allow",
          "Action": [
              "kinesis:*"
          ],
          "Resource": "${ingestStream.arn}"
      }
    ]
  }`,
  role: iotRole.id
});

const iotId = new random.RandomString("random", {
  length: 8,
  special: false
});

const iotRule = new aws.iot.TopicRule("iotAssetIngest", {
  name: pulumi.interpolate`assetIngest_${iotId.id}`,
  description: "Pass from IoT Core to Asset Tracking",
  enabled: true,
  kinesis: {
    partitionKey: "id",
    roleArn: iotRole.arn,
    streamName: ingestStream.name
  },
  //If you want to downselect from your stream, you can change this.
  sql: "SELECT * FROM 'assetingest'",
  sqlVersion: "2015-10-08"
github pulumi / examples / azure-ts-cosmosapp-component / vms.ts View on Github external
return ({ location }: RegionalContext) => {
        const domainName = new random.RandomString(`pipdns${location}`, { length: 10, special: false, upper: false, number: false }).result;

        const publicIp = new azure.network.PublicIp(`pip-${location}`, {
            resourceGroupName: resourceGroup.name,
            location,
            allocationMethod: "Static",
            domainNameLabel: domainName,
        }, opts);

        const loadBalancer = new azure.lb.LoadBalancer(`lb-${location}`, {
            resourceGroupName: resourceGroup.name,
            location,
            frontendIpConfigurations: [{
                name: "PublicIPAddress",
                publicIpAddressId: publicIp.id,
            }],
        }, opts);

@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