Show / Hide Table of Contents

Class RandomPet

The resource random..RandomPet generates random pet names that are intended to be used as unique identifiers for other resources.

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 serverRandomPet = new Random.RandomPet("serverRandomPet", new Random.RandomPetArgs
    {
        Keepers = 
        {
            { "ami_id", @var.Ami_id },
        },
    });
    var serverInstance = new Aws.Ec2.Instance("serverInstance", new Aws.Ec2.InstanceArgs
    {
        Ami = serverRandomPet.Keepers.Apply(keepers => keepers.AmiId),
        Tags = 
        {
            { "Name", serverRandomPet.Id.Apply(id => $"web-server-{id}") },
        },
    });
}

}
Inheritance
System.Object
Resource
CustomResource
RandomPet
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Random
Assembly: Pulumi.Random.dll
Syntax
public class RandomPet : CustomResource

Constructors

View Source

RandomPet(String, RandomPetArgs, CustomResourceOptions)

Create a RandomPet resource with the given unique name, arguments, and options.

Declaration
public RandomPet(string name, RandomPetArgs args = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

RandomPetArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

Keepers

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>>
View Source

Length

The length (in words) of the pet name.

Declaration
public Output<int?> Length { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

Prefix

A string to prefix the name with.

Declaration
public Output<string> Prefix { get; }
Property Value
Type Description
Output<System.String>
View Source

Separator

The character to separate words in the pet name.

Declaration
public Output<string> Separator { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, RandomPetState, CustomResourceOptions)

Get an existing RandomPet resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static RandomPet Get(string name, Input<string> id, RandomPetState 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.

RandomPetState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
RandomPet
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.