Random Password Args
data class RandomPasswordArgs(val keepers: Output<Map<String, String>>? = null, val length: Output<Int>? = null, val lower: Output<Boolean>? = null, val minLower: Output<Int>? = null, val minNumeric: Output<Int>? = null, val minSpecial: Output<Int>? = null, val minUpper: Output<Int>? = null, val number: Output<Boolean>? = null, val numeric: Output<Boolean>? = null, val overrideSpecial: Output<String>? = null, val special: Output<Boolean>? = null, val upper: Output<Boolean>? = null) : ConvertibleToJava<RandomPasswordArgs>
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as random from "@pulumi/random";
const password = new random.RandomPassword("password", {
length: 16,
special: true,
overrideSpecial: "!#$%&*()-_=+[]{}<>:?",
});
const example = new aws.rds.Instance("example", {
instanceClass: aws.rds.InstanceType.T3_Micro,
allocatedStorage: 64,
engine: "mysql",
username: "someone",
password: password.result,
});
Content copied to clipboard
import pulumi
import pulumi_aws as aws
import pulumi_random as random
password = random.RandomPassword("password",
length=16,
special=True,
override_special="!#$%&*()-_=+[]{}<>:?")
example = aws.rds.Instance("example",
instance_class=aws.rds.InstanceType.T3_MICRO,
allocated_storage=64,
engine="mysql",
username="someone",
password=password.result)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var password = new Random.RandomPassword("password", new()
{
Length = 16,
Special = true,
OverrideSpecial = "!#$%&*()-_=+[]{}<>:?",
});
var example = new Aws.Rds.Instance("example", new()
{
InstanceClass = Aws.Rds.InstanceType.T3_Micro,
AllocatedStorage = 64,
Engine = "mysql",
Username = "someone",
Password = password.Result,
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/rds"
"github.com/pulumi/pulumi-random/sdk/v4/go/random"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
password, err := random.NewRandomPassword(ctx, "password", &random.RandomPasswordArgs{
Length: pulumi.Int(16),
Special: pulumi.Bool(true),
OverrideSpecial: pulumi.String("!#$%&*()-_=+[]{}<>:?"),
})
if err != nil {
return err
}
_, err = rds.NewInstance(ctx, "example", &rds.InstanceArgs{
InstanceClass: pulumi.String(rds.InstanceType_T3_Micro),
AllocatedStorage: pulumi.Int(64),
Engine: pulumi.String("mysql"),
Username: pulumi.String("someone"),
Password: password.Result,
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomPassword;
import com.pulumi.random.RandomPasswordArgs;
import com.pulumi.aws.rds.Instance;
import com.pulumi.aws.rds.InstanceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var password = new RandomPassword("password", RandomPasswordArgs.builder()
.length(16)
.special(true)
.overrideSpecial("!#$%&*()-_=+[]{}<>:?")
.build());
var example = new Instance("example", InstanceArgs.builder()
.instanceClass("db.t3.micro")
.allocatedStorage(64)
.engine("mysql")
.username("someone")
.password(password.result())
.build());
}
}
Content copied to clipboard
resources:
password:
type: random:RandomPassword
properties:
length: 16
special: true
overrideSpecial: '!#$%&*()-_=+[]{}<>:?'
example:
type: aws:rds:Instance
properties:
instanceClass: db.t3.micro
allocatedStorage: 64
engine: mysql
username: someone
password: ${password.result}
Content copied to clipboard
Import
You can import external passwords into your Pulumi programs as follows:
$ import random:index/randomPassword:RandomPassword newPassword supersecret
<break>```
This command will encode the `supersecret` token in Pulumi state and generate a code suggestion to
include a new RandomPassword resource in your Pulumi program. Include the suggested code and do a
`pulumi up`. Your secret password is now securely stored in Pulumi, and you can reference it in your
Pulumi program as `newPassword.result`.
Content copied to clipboard
Constructors
Link copied to clipboard
constructor(keepers: Output<Map<String, String>>? = null, length: Output<Int>? = null, lower: Output<Boolean>? = null, minLower: Output<Int>? = null, minNumeric: Output<Int>? = null, minSpecial: Output<Int>? = null, minUpper: Output<Int>? = null, number: Output<Boolean>? = null, numeric: Output<Boolean>? = null, overrideSpecial: Output<String>? = null, special: Output<Boolean>? = null, upper: Output<Boolean>? = null)
Properties
Link copied to clipboard
Minimum number of numeric characters in the result. Default value is 0
.
Link copied to clipboard
Minimum number of special characters in the result. Default value is 0
.
Link copied to clipboard
Supply your own list of special characters to use for string generation. This overrides the default character list in the special argument. The special
argument must still be set to true for any overwritten characters to be used in generation.