random.RandomString
Explore with Pulumi AI
The resource random.RandomString
generates a random permutation of alphanumeric characters and optionally special characters.
This resource does use a cryptographic random number generator.
Historically this resource’s intended usage has been ambiguous as the original example used it in a password. For backwards compatibility it will continue to exist. For unique ids please use random_id, for sensitive random values please use random_password.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as random from "@pulumi/random";
const random = new random.RandomString("random", {
length: 16,
special: true,
overrideSpecial: "/@£$",
});
import pulumi
import pulumi_random as random
random = random.RandomString("random",
length=16,
special=True,
override_special="/@£$")
package main
import (
"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 {
_, err := random.NewRandomString(ctx, "random", &random.RandomStringArgs{
Length: pulumi.Int(16),
Special: pulumi.Bool(true),
OverrideSpecial: pulumi.String("/@£$"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var random = new Random.RandomString("random", new()
{
Length = 16,
Special = true,
OverrideSpecial = "/@£$",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomString;
import com.pulumi.random.RandomStringArgs;
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 random = new RandomString("random", RandomStringArgs.builder()
.length(16)
.special(true)
.overrideSpecial("/@£$")
.build());
}
}
resources:
random:
type: random:RandomString
properties:
length: 16
special: true
overrideSpecial: /@£$
Create RandomString Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RandomString(name: string, args: RandomStringArgs, opts?: CustomResourceOptions);
@overload
def RandomString(resource_name: str,
args: RandomStringArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RandomString(resource_name: str,
opts: Optional[ResourceOptions] = None,
length: Optional[int] = None,
keepers: Optional[Mapping[str, str]] = None,
lower: Optional[bool] = None,
min_lower: Optional[int] = None,
min_numeric: Optional[int] = None,
min_special: Optional[int] = None,
min_upper: Optional[int] = None,
number: Optional[bool] = None,
numeric: Optional[bool] = None,
override_special: Optional[str] = None,
special: Optional[bool] = None,
upper: Optional[bool] = None)
func NewRandomString(ctx *Context, name string, args RandomStringArgs, opts ...ResourceOption) (*RandomString, error)
public RandomString(string name, RandomStringArgs args, CustomResourceOptions? opts = null)
public RandomString(String name, RandomStringArgs args)
public RandomString(String name, RandomStringArgs args, CustomResourceOptions options)
type: random:RandomString
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RandomStringArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RandomStringArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RandomStringArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RandomStringArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RandomStringArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var randomStringResource = new Random.RandomString("randomStringResource", new()
{
Length = 0,
Keepers =
{
{ "string", "string" },
},
Lower = false,
MinLower = 0,
MinNumeric = 0,
MinSpecial = 0,
MinUpper = 0,
Numeric = false,
OverrideSpecial = "string",
Special = false,
Upper = false,
});
example, err := random.NewRandomString(ctx, "randomStringResource", &random.RandomStringArgs{
Length: pulumi.Int(0),
Keepers: pulumi.StringMap{
"string": pulumi.String("string"),
},
Lower: pulumi.Bool(false),
MinLower: pulumi.Int(0),
MinNumeric: pulumi.Int(0),
MinSpecial: pulumi.Int(0),
MinUpper: pulumi.Int(0),
Numeric: pulumi.Bool(false),
OverrideSpecial: pulumi.String("string"),
Special: pulumi.Bool(false),
Upper: pulumi.Bool(false),
})
var randomStringResource = new RandomString("randomStringResource", RandomStringArgs.builder()
.length(0)
.keepers(Map.of("string", "string"))
.lower(false)
.minLower(0)
.minNumeric(0)
.minSpecial(0)
.minUpper(0)
.numeric(false)
.overrideSpecial("string")
.special(false)
.upper(false)
.build());
random_string_resource = random.RandomString("randomStringResource",
length=0,
keepers={
"string": "string",
},
lower=False,
min_lower=0,
min_numeric=0,
min_special=0,
min_upper=0,
numeric=False,
override_special="string",
special=False,
upper=False)
const randomStringResource = new random.RandomString("randomStringResource", {
length: 0,
keepers: {
string: "string",
},
lower: false,
minLower: 0,
minNumeric: 0,
minSpecial: 0,
minUpper: 0,
numeric: false,
overrideSpecial: "string",
special: false,
upper: false,
});
type: random:RandomString
properties:
keepers:
string: string
length: 0
lower: false
minLower: 0
minNumeric: 0
minSpecial: 0
minUpper: 0
numeric: false
overrideSpecial: string
special: false
upper: false
RandomString Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The RandomString resource accepts the following input properties:
- Length int
- The length of the string desired. The minimum value for length is 1 and, length must also be >= (
min_upper
+min_lower
+min_numeric
+min_special
). - Keepers Dictionary<string, string>
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
- Lower bool
- Include lowercase alphabet characters in the result. Default value is
true
. - Min
Lower int - Minimum number of lowercase alphabet characters in the result. Default value is
0
. - Min
Numeric int - Minimum number of numeric characters in the result. Default value is
0
. - Min
Special int - Minimum number of special characters in the result. Default value is
0
. - Min
Upper int - Minimum number of uppercase alphabet characters in the result. Default value is
0
. - Number bool
- Include numeric characters in the result. Default value is
true
. Ifnumber
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. NOTE: This is deprecated, usenumeric
instead. - Numeric bool
- Include numeric characters in the result. Default value is
true
. Ifnumeric
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. - Override
Special string - 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. - Special bool
- Include special characters in the result. These are
!@#$%&*()-_=+[]{}<>:?
. Default value istrue
. - Upper bool
- Include uppercase alphabet characters in the result. Default value is
true
.
- Length int
- The length of the string desired. The minimum value for length is 1 and, length must also be >= (
min_upper
+min_lower
+min_numeric
+min_special
). - Keepers map[string]string
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
- Lower bool
- Include lowercase alphabet characters in the result. Default value is
true
. - Min
Lower int - Minimum number of lowercase alphabet characters in the result. Default value is
0
. - Min
Numeric int - Minimum number of numeric characters in the result. Default value is
0
. - Min
Special int - Minimum number of special characters in the result. Default value is
0
. - Min
Upper int - Minimum number of uppercase alphabet characters in the result. Default value is
0
. - Number bool
- Include numeric characters in the result. Default value is
true
. Ifnumber
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. NOTE: This is deprecated, usenumeric
instead. - Numeric bool
- Include numeric characters in the result. Default value is
true
. Ifnumeric
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. - Override
Special string - 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. - Special bool
- Include special characters in the result. These are
!@#$%&*()-_=+[]{}<>:?
. Default value istrue
. - Upper bool
- Include uppercase alphabet characters in the result. Default value is
true
.
- length Integer
- The length of the string desired. The minimum value for length is 1 and, length must also be >= (
min_upper
+min_lower
+min_numeric
+min_special
). - keepers Map<String,String>
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
- lower Boolean
- Include lowercase alphabet characters in the result. Default value is
true
. - min
Lower Integer - Minimum number of lowercase alphabet characters in the result. Default value is
0
. - min
Numeric Integer - Minimum number of numeric characters in the result. Default value is
0
. - min
Special Integer - Minimum number of special characters in the result. Default value is
0
. - min
Upper Integer - Minimum number of uppercase alphabet characters in the result. Default value is
0
. - number Boolean
- Include numeric characters in the result. Default value is
true
. Ifnumber
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. NOTE: This is deprecated, usenumeric
instead. - numeric Boolean
- Include numeric characters in the result. Default value is
true
. Ifnumeric
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. - override
Special String - 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. - special Boolean
- Include special characters in the result. These are
!@#$%&*()-_=+[]{}<>:?
. Default value istrue
. - upper Boolean
- Include uppercase alphabet characters in the result. Default value is
true
.
- length number
- The length of the string desired. The minimum value for length is 1 and, length must also be >= (
min_upper
+min_lower
+min_numeric
+min_special
). - keepers {[key: string]: string}
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
- lower boolean
- Include lowercase alphabet characters in the result. Default value is
true
. - min
Lower number - Minimum number of lowercase alphabet characters in the result. Default value is
0
. - min
Numeric number - Minimum number of numeric characters in the result. Default value is
0
. - min
Special number - Minimum number of special characters in the result. Default value is
0
. - min
Upper number - Minimum number of uppercase alphabet characters in the result. Default value is
0
. - number boolean
- Include numeric characters in the result. Default value is
true
. Ifnumber
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. NOTE: This is deprecated, usenumeric
instead. - numeric boolean
- Include numeric characters in the result. Default value is
true
. Ifnumeric
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. - override
Special string - 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. - special boolean
- Include special characters in the result. These are
!@#$%&*()-_=+[]{}<>:?
. Default value istrue
. - upper boolean
- Include uppercase alphabet characters in the result. Default value is
true
.
- length int
- The length of the string desired. The minimum value for length is 1 and, length must also be >= (
min_upper
+min_lower
+min_numeric
+min_special
). - keepers Mapping[str, str]
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
- lower bool
- Include lowercase alphabet characters in the result. Default value is
true
. - min_
lower int - Minimum number of lowercase alphabet characters in the result. Default value is
0
. - min_
numeric int - Minimum number of numeric characters in the result. Default value is
0
. - min_
special int - Minimum number of special characters in the result. Default value is
0
. - min_
upper int - Minimum number of uppercase alphabet characters in the result. Default value is
0
. - number bool
- Include numeric characters in the result. Default value is
true
. Ifnumber
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. NOTE: This is deprecated, usenumeric
instead. - numeric bool
- Include numeric characters in the result. Default value is
true
. Ifnumeric
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. - override_
special str - 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. - special bool
- Include special characters in the result. These are
!@#$%&*()-_=+[]{}<>:?
. Default value istrue
. - upper bool
- Include uppercase alphabet characters in the result. Default value is
true
.
- length Number
- The length of the string desired. The minimum value for length is 1 and, length must also be >= (
min_upper
+min_lower
+min_numeric
+min_special
). - keepers Map<String>
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
- lower Boolean
- Include lowercase alphabet characters in the result. Default value is
true
. - min
Lower Number - Minimum number of lowercase alphabet characters in the result. Default value is
0
. - min
Numeric Number - Minimum number of numeric characters in the result. Default value is
0
. - min
Special Number - Minimum number of special characters in the result. Default value is
0
. - min
Upper Number - Minimum number of uppercase alphabet characters in the result. Default value is
0
. - number Boolean
- Include numeric characters in the result. Default value is
true
. Ifnumber
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. NOTE: This is deprecated, usenumeric
instead. - numeric Boolean
- Include numeric characters in the result. Default value is
true
. Ifnumeric
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. - override
Special String - 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. - special Boolean
- Include special characters in the result. These are
!@#$%&*()-_=+[]{}<>:?
. Default value istrue
. - upper Boolean
- Include uppercase alphabet characters in the result. Default value is
true
.
Outputs
All input properties are implicitly available as output properties. Additionally, the RandomString resource produces the following output properties:
Look up Existing RandomString Resource
Get an existing RandomString resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RandomStringState, opts?: CustomResourceOptions): RandomString
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
keepers: Optional[Mapping[str, str]] = None,
length: Optional[int] = None,
lower: Optional[bool] = None,
min_lower: Optional[int] = None,
min_numeric: Optional[int] = None,
min_special: Optional[int] = None,
min_upper: Optional[int] = None,
number: Optional[bool] = None,
numeric: Optional[bool] = None,
override_special: Optional[str] = None,
result: Optional[str] = None,
special: Optional[bool] = None,
upper: Optional[bool] = None) -> RandomString
func GetRandomString(ctx *Context, name string, id IDInput, state *RandomStringState, opts ...ResourceOption) (*RandomString, error)
public static RandomString Get(string name, Input<string> id, RandomStringState? state, CustomResourceOptions? opts = null)
public static RandomString get(String name, Output<String> id, RandomStringState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Keepers Dictionary<string, string>
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
- Length int
- The length of the string desired. The minimum value for length is 1 and, length must also be >= (
min_upper
+min_lower
+min_numeric
+min_special
). - Lower bool
- Include lowercase alphabet characters in the result. Default value is
true
. - Min
Lower int - Minimum number of lowercase alphabet characters in the result. Default value is
0
. - Min
Numeric int - Minimum number of numeric characters in the result. Default value is
0
. - Min
Special int - Minimum number of special characters in the result. Default value is
0
. - Min
Upper int - Minimum number of uppercase alphabet characters in the result. Default value is
0
. - Number bool
- Include numeric characters in the result. Default value is
true
. Ifnumber
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. NOTE: This is deprecated, usenumeric
instead. - Numeric bool
- Include numeric characters in the result. Default value is
true
. Ifnumeric
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. - Override
Special string - 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. - Result string
- The generated random string.
- Special bool
- Include special characters in the result. These are
!@#$%&*()-_=+[]{}<>:?
. Default value istrue
. - Upper bool
- Include uppercase alphabet characters in the result. Default value is
true
.
- Keepers map[string]string
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
- Length int
- The length of the string desired. The minimum value for length is 1 and, length must also be >= (
min_upper
+min_lower
+min_numeric
+min_special
). - Lower bool
- Include lowercase alphabet characters in the result. Default value is
true
. - Min
Lower int - Minimum number of lowercase alphabet characters in the result. Default value is
0
. - Min
Numeric int - Minimum number of numeric characters in the result. Default value is
0
. - Min
Special int - Minimum number of special characters in the result. Default value is
0
. - Min
Upper int - Minimum number of uppercase alphabet characters in the result. Default value is
0
. - Number bool
- Include numeric characters in the result. Default value is
true
. Ifnumber
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. NOTE: This is deprecated, usenumeric
instead. - Numeric bool
- Include numeric characters in the result. Default value is
true
. Ifnumeric
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. - Override
Special string - 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. - Result string
- The generated random string.
- Special bool
- Include special characters in the result. These are
!@#$%&*()-_=+[]{}<>:?
. Default value istrue
. - Upper bool
- Include uppercase alphabet characters in the result. Default value is
true
.
- keepers Map<String,String>
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
- length Integer
- The length of the string desired. The minimum value for length is 1 and, length must also be >= (
min_upper
+min_lower
+min_numeric
+min_special
). - lower Boolean
- Include lowercase alphabet characters in the result. Default value is
true
. - min
Lower Integer - Minimum number of lowercase alphabet characters in the result. Default value is
0
. - min
Numeric Integer - Minimum number of numeric characters in the result. Default value is
0
. - min
Special Integer - Minimum number of special characters in the result. Default value is
0
. - min
Upper Integer - Minimum number of uppercase alphabet characters in the result. Default value is
0
. - number Boolean
- Include numeric characters in the result. Default value is
true
. Ifnumber
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. NOTE: This is deprecated, usenumeric
instead. - numeric Boolean
- Include numeric characters in the result. Default value is
true
. Ifnumeric
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. - override
Special String - 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. - result String
- The generated random string.
- special Boolean
- Include special characters in the result. These are
!@#$%&*()-_=+[]{}<>:?
. Default value istrue
. - upper Boolean
- Include uppercase alphabet characters in the result. Default value is
true
.
- keepers {[key: string]: string}
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
- length number
- The length of the string desired. The minimum value for length is 1 and, length must also be >= (
min_upper
+min_lower
+min_numeric
+min_special
). - lower boolean
- Include lowercase alphabet characters in the result. Default value is
true
. - min
Lower number - Minimum number of lowercase alphabet characters in the result. Default value is
0
. - min
Numeric number - Minimum number of numeric characters in the result. Default value is
0
. - min
Special number - Minimum number of special characters in the result. Default value is
0
. - min
Upper number - Minimum number of uppercase alphabet characters in the result. Default value is
0
. - number boolean
- Include numeric characters in the result. Default value is
true
. Ifnumber
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. NOTE: This is deprecated, usenumeric
instead. - numeric boolean
- Include numeric characters in the result. Default value is
true
. Ifnumeric
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. - override
Special string - 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. - result string
- The generated random string.
- special boolean
- Include special characters in the result. These are
!@#$%&*()-_=+[]{}<>:?
. Default value istrue
. - upper boolean
- Include uppercase alphabet characters in the result. Default value is
true
.
- keepers Mapping[str, str]
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
- length int
- The length of the string desired. The minimum value for length is 1 and, length must also be >= (
min_upper
+min_lower
+min_numeric
+min_special
). - lower bool
- Include lowercase alphabet characters in the result. Default value is
true
. - min_
lower int - Minimum number of lowercase alphabet characters in the result. Default value is
0
. - min_
numeric int - Minimum number of numeric characters in the result. Default value is
0
. - min_
special int - Minimum number of special characters in the result. Default value is
0
. - min_
upper int - Minimum number of uppercase alphabet characters in the result. Default value is
0
. - number bool
- Include numeric characters in the result. Default value is
true
. Ifnumber
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. NOTE: This is deprecated, usenumeric
instead. - numeric bool
- Include numeric characters in the result. Default value is
true
. Ifnumeric
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. - override_
special str - 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. - result str
- The generated random string.
- special bool
- Include special characters in the result. These are
!@#$%&*()-_=+[]{}<>:?
. Default value istrue
. - upper bool
- Include uppercase alphabet characters in the result. Default value is
true
.
- keepers Map<String>
- Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.
- length Number
- The length of the string desired. The minimum value for length is 1 and, length must also be >= (
min_upper
+min_lower
+min_numeric
+min_special
). - lower Boolean
- Include lowercase alphabet characters in the result. Default value is
true
. - min
Lower Number - Minimum number of lowercase alphabet characters in the result. Default value is
0
. - min
Numeric Number - Minimum number of numeric characters in the result. Default value is
0
. - min
Special Number - Minimum number of special characters in the result. Default value is
0
. - min
Upper Number - Minimum number of uppercase alphabet characters in the result. Default value is
0
. - number Boolean
- Include numeric characters in the result. Default value is
true
. Ifnumber
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. NOTE: This is deprecated, usenumeric
instead. - numeric Boolean
- Include numeric characters in the result. Default value is
true
. Ifnumeric
,upper
,lower
, andspecial
are all configured, at least one of them must be set totrue
. - override
Special String - 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. - result String
- The generated random string.
- special Boolean
- Include special characters in the result. These are
!@#$%&*()-_=+[]{}<>:?
. Default value istrue
. - upper Boolean
- Include uppercase alphabet characters in the result. Default value is
true
.
Import
You can import external strings into your Pulumi programs as RandomString resources as follows:
$ import random:index/randomString:RandomString newString myspecialdata
<break>```
This command will encode the `myspecialdata` token in Pulumi state and generate a code suggestion to
include a new RandomString resource in your Pulumi program. Include the suggested code and do a
`pulumi up`. Your data is now stored in Pulumi, and you can reference it in your Pulumi program as
`newString.result`.
If the data needs to be stored securily as a secret, consider using the RandomPassword resource
instead.
To learn more about importing existing cloud resources, see [Importing resources](/docs/using-pulumi/adopting-pulumi/import/).
<h2 id="package-details">Package Details</h2>
<dl class="package-details">
<dt>Repository</dt>
<dd><a href="https://github.com/pulumi/pulumi-random">random pulumi/pulumi-random</a></dd>
<dt>License</dt>
<dd>Apache-2.0</dd>
<dt>Notes</dt>
<dd>This Pulumi package is based on the <a href="https://github.com/terraform-providers/terraform-provider-random"><code>random</code> Terraform Provider</a>.</dd>
</dl>