Class RandomInteger
The resource random..RandomInteger generates random values from a given range, described by the min and max attributes of a given resource.
This resource can be used in conjunction with resources that have
the create_before_destroy lifecycle flag set, to avoid conflicts with
unique names during the brief period where both the old and new resources
exist concurrently.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
using Random = Pulumi.Random;
class MyStack : Stack
{
public MyStack()
{
var priority = new Random.RandomInteger("priority", new Random.RandomIntegerArgs
{
Keepers =
{
{ "listener_arn", @var.Listener_arn },
},
Max = 50000,
Min = 1,
});
var main = new Aws.Alb.ListenerRule("main", new Aws.Alb.ListenerRuleArgs
{
Actions =
{
new Aws.Alb.Inputs.ListenerRuleActionArgs
{
TargetGroupArn = @var.Target_group_arn,
Type = "forward",
},
},
ListenerArn = @var.Listener_arn,
Priority = priority.Result,
});
}
}
Inherited Members
Namespace: Pulumi.Random
Assembly: Pulumi.Random.dll
Syntax
public class RandomInteger : CustomResource
Constructors
View SourceRandomInteger(String, RandomIntegerArgs, CustomResourceOptions)
Create a RandomInteger resource with the given unique name, arguments, and options.
Declaration
public RandomInteger(string name, RandomIntegerArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| RandomIntegerArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceKeepers
Arbitrary map of values that, when changed, will trigger a new id to be generated. See the main provider documentation for more information.
Declaration
public Output<ImmutableDictionary<string, object>> Keepers { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>> |
Max
The maximum inclusive value of the range.
Declaration
public Output<int> Max { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
Min
The minimum inclusive value of the range.
Declaration
public Output<int> Min { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
Result
(int) The random Integer result.
Declaration
public Output<int> Result { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
Seed
A custom seed to always produce the same value.
Declaration
public Output<string> Seed { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, RandomIntegerState, CustomResourceOptions)
Get an existing RandomInteger resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static RandomInteger Get(string name, Input<string> id, RandomIntegerState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| RandomIntegerState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| RandomInteger |