RandomPet

class RandomPet : KotlinCustomResource

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());
}
}

Properties

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

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>

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

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

A string to prefix the name with.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val separator: Output<String>

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

Link copied to clipboard
val urn: Output<String>