random logo
random v4.12.0, Mar 10 23

random.RandomUuid

The resource random.RandomUuid generates random uuid string that is intended to be used as unique identifiers for other resources.

This resource uses hashicorp/go-uuid to generate a UUID-formatted string for use with services needed a unique string identifier.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Azure = Pulumi.Azure;
using Random = Pulumi.Random;

return await Deployment.RunAsync(() => 
{
    var testRandomUuid = new Random.RandomUuid("testRandomUuid");

    var testResourceGroup = new Azure.Core.ResourceGroup("testResourceGroup", new()
    {
        Location = "Central US",
    });

});
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"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.NewRandomUuid(ctx, "testRandomUuid", nil)
		if err != nil {
			return err
		}
		_, err = core.NewResourceGroup(ctx, "testResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("Central US"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.random.RandomUuid;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
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 testRandomUuid = new RandomUuid("testRandomUuid");

        var testResourceGroup = new ResourceGroup("testResourceGroup", ResourceGroupArgs.builder()        
            .location("Central US")
            .build());

    }
}
import pulumi
import pulumi_azure as azure
import pulumi_random as random

test_random_uuid = random.RandomUuid("testRandomUuid")
test_resource_group = azure.core.ResourceGroup("testResourceGroup", location="Central US")
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
import * as random from "@pulumi/random";

const testRandomUuid = new random.RandomUuid("testRandomUuid", {});
const testResourceGroup = new azure.core.ResourceGroup("testResourceGroup", {location: "Central US"});
resources:
  testRandomUuid:
    type: random:RandomUuid
  testResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: Central US

Create RandomUuid Resource

new RandomUuid(name: string, args?: RandomUuidArgs, opts?: CustomResourceOptions);
@overload
def RandomUuid(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               keepers: Optional[Mapping[str, str]] = None)
@overload
def RandomUuid(resource_name: str,
               args: Optional[RandomUuidArgs] = None,
               opts: Optional[ResourceOptions] = None)
func NewRandomUuid(ctx *Context, name string, args *RandomUuidArgs, opts ...ResourceOption) (*RandomUuid, error)
public RandomUuid(string name, RandomUuidArgs? args = null, CustomResourceOptions? opts = null)
public RandomUuid(String name, RandomUuidArgs args)
public RandomUuid(String name, RandomUuidArgs args, CustomResourceOptions options)
type: random:RandomUuid
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args RandomUuidArgs
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 RandomUuidArgs
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 RandomUuidArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RandomUuidArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args RandomUuidArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

RandomUuid Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The RandomUuid resource accepts the following input properties:

Keepers Dictionary<string, string>

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

Keepers map[string]string

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

keepers Map<String,String>

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

keepers {[key: string]: string}

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

keepers Mapping[str, str]

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

keepers Map<String>

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

Outputs

All input properties are implicitly available as output properties. Additionally, the RandomUuid resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Result string

The generated uuid presented in string format.

Id string

The provider-assigned unique ID for this managed resource.

Result string

The generated uuid presented in string format.

id String

The provider-assigned unique ID for this managed resource.

result String

The generated uuid presented in string format.

id string

The provider-assigned unique ID for this managed resource.

result string

The generated uuid presented in string format.

id str

The provider-assigned unique ID for this managed resource.

result str

The generated uuid presented in string format.

id String

The provider-assigned unique ID for this managed resource.

result String

The generated uuid presented in string format.

Look up Existing RandomUuid Resource

Get an existing RandomUuid 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?: RandomUuidState, opts?: CustomResourceOptions): RandomUuid
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        keepers: Optional[Mapping[str, str]] = None,
        result: Optional[str] = None) -> RandomUuid
func GetRandomUuid(ctx *Context, name string, id IDInput, state *RandomUuidState, opts ...ResourceOption) (*RandomUuid, error)
public static RandomUuid Get(string name, Input<string> id, RandomUuidState? state, CustomResourceOptions? opts = null)
public static RandomUuid get(String name, Output<String> id, RandomUuidState 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.
The following state arguments are supported:
Keepers Dictionary<string, string>

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

Result string

The generated uuid presented in string format.

Keepers map[string]string

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

Result string

The generated uuid presented in string format.

keepers Map<String,String>

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

result String

The generated uuid presented in string format.

keepers {[key: string]: string}

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

result string

The generated uuid presented in string format.

keepers Mapping[str, str]

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

result str

The generated uuid presented in string format.

keepers Map<String>

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

result String

The generated uuid presented in string format.

Import

Random UUID’s can be imported. This can be used to replace a config value with a value interpolated from the random provider without experiencing diffs.

 $ pulumi import random:index/randomUuid:RandomUuid main aabbccdd-eeff-0011-2233-445566778899

Package Details

Repository
random pulumi/pulumi-random
License
Apache-2.0
Notes

This Pulumi package is based on the random Terraform Provider.