Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

getPolicy

The vsphere.getPolicy data source can be used to discover the UUID of a vSphere storage policy. This can then be used with resources or data sources that require a storage policy.

NOTE: Storage policy support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.

Example Usage

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var policy = Output.Create(VSphere.GetPolicy.InvokeAsync(new VSphere.GetPolicyArgs
        {
            Name = "policy1",
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-vsphere/sdk/v2/go/vsphere"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := vsphere.GetPolicy(ctx, &vsphere.GetPolicyArgs{
            Name: "policy1",
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_vsphere as vsphere

policy = vsphere.get_policy(name="policy1")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const policy = pulumi.output(vsphere.getPolicy({
    name: "policy1",
}, { async: true }));

Using getPolicy

function getPolicy(args: GetPolicyArgs, opts?: InvokeOptions): Promise<GetPolicyResult>
def get_policy(name: Optional[str] = None, opts: Optional[InvokeOptions] = None) -> GetPolicyResult
func GetPolicy(ctx *Context, args *GetPolicyArgs, opts ...InvokeOption) (*GetPolicyResult, error)

Note: This function is named GetPolicy in the Go SDK.

public static class GetPolicy {
    public static Task<GetPolicyResult> InvokeAsync(GetPolicyArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Name string

The name of the storage policy.

Name string

The name of the storage policy.

name string

The name of the storage policy.

name str

The name of the storage policy.

getPolicy Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Name string
Id string

The provider-assigned unique ID for this managed resource.

Name string
id string

The provider-assigned unique ID for this managed resource.

name string
id str

The provider-assigned unique ID for this managed resource.

name str

Package Details

Repository
https://github.com/pulumi/pulumi-vsphere
License
Apache-2.0
Notes
This Pulumi package is based on the vsphere Terraform Provider.