RandomPetArgs

data class RandomPetArgs(val keepers: Output<Map<String, String>>? = null, val length: Output<Int>? = null, val prefix: Output<String>? = null, val separator: Output<String>? = null) : ConvertibleToJava<RandomPetArgs>

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

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomPet;
import com.pulumi.random.RandomPetArgs;
import com.pulumi.aws.ec2.Instance;
import com.pulumi.aws.ec2.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 serverRandomPet = new RandomPet("serverRandomPet", RandomPetArgs.builder()
.keepers(Map.of("ami_id", var_.ami_id()))
.build());
var serverInstance = new Instance("serverInstance", InstanceArgs.builder()
.tags(Map.of("Name", serverRandomPet.id().applyValue(id -> String.format("web-server-%s", id))))
.ami(serverRandomPet.keepers().applyValue(keepers -> keepers.amiId()))
.build());
}
}

Constructors

Link copied to clipboard
fun RandomPetArgs(keepers: Output<Map<String, String>>? = null, length: Output<Int>? = null, prefix: Output<String>? = null, separator: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): RandomPetArgs

Properties

Link copied to clipboard
val keepers: Output<Map<String, String>>? = null

Arbitrary map of values that, when changed, will trigger recreation of resource. See the main provider documentation for more information.

Link copied to clipboard
val length: Output<Int>? = null

The length (in words) of the pet name. Defaults to 2

Link copied to clipboard
val prefix: Output<String>? = null

A string to prefix the name with.

Link copied to clipboard
val separator: Output<String>? = null

The character to separate words in the pet name. Defaults to "-"