vSphere

Pulumi Official
Package maintained by Pulumi
v4.3.0 published on Monday, Jun 27, 2022 by Pulumi

getTag

The vsphere.Tag data source can be used to reference tags that are not managed by this provider. Its attributes are exactly the same as the vsphere.Tag resource, and, like importing, the data source takes a name and category to search on. The id and other attributes are then populated with the data found by the search.

NOTE: Tagging is not supported on direct ESXi hosts connections and requires vCenter Server.

Example Usage

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var category = Output.Create(VSphere.GetTagCategory.InvokeAsync(new VSphere.GetTagCategoryArgs
        {
            Name = "example-category",
        }));
        var tag = category.Apply(category => Output.Create(VSphere.GetTag.InvokeAsync(new VSphere.GetTagArgs
        {
            Name = "example-tag",
            CategoryId = category.Id,
        })));
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		category, err := vsphere.LookupTagCategory(ctx, &GetTagCategoryArgs{
			Name: "example-category",
		}, nil)
		if err != nil {
			return err
		}
		_, err = vsphere.LookupTag(ctx, &GetTagArgs{
			Name:       "example-tag",
			CategoryId: category.Id,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_vsphere as vsphere

category = vsphere.get_tag_category(name="example-category")
tag = vsphere.get_tag(name="example-tag",
    category_id=category.id)
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const category = vsphere.getTagCategory({
    name: "example-category",
});
const tag = category.then(category => vsphere.getTag({
    name: "example-tag",
    categoryId: category.id,
}));

Coming soon!

Using getTag

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getTag(args: GetTagArgs, opts?: InvokeOptions): Promise<GetTagResult>
function getTagOutput(args: GetTagOutputArgs, opts?: InvokeOptions): Output<GetTagResult>
def get_tag(category_id: Optional[str] = None,
            name: Optional[str] = None,
            opts: Optional[InvokeOptions] = None) -> GetTagResult
def get_tag_output(category_id: Optional[pulumi.Input[str]] = None,
            name: Optional[pulumi.Input[str]] = None,
            opts: Optional[InvokeOptions] = None) -> Output[GetTagResult]
func LookupTag(ctx *Context, args *LookupTagArgs, opts ...InvokeOption) (*LookupTagResult, error)
func LookupTagOutput(ctx *Context, args *LookupTagOutputArgs, opts ...InvokeOption) LookupTagResultOutput

> Note: This function is named LookupTag in the Go SDK.

public static class GetTag 
{
    public static Task<GetTagResult> InvokeAsync(GetTagArgs args, InvokeOptions? opts = null)
    public static Output<GetTagResult> Invoke(GetTagInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetTagResult> getTag(GetTagArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: vsphere:index/getTag:getTag
  Arguments:
    # Arguments dictionary

The following arguments are supported:

CategoryId string

The ID of the tag category in which the tag is located.

Name string

The name of the tag.

CategoryId string

The ID of the tag category in which the tag is located.

Name string

The name of the tag.

categoryId String

The ID of the tag category in which the tag is located.

name String

The name of the tag.

categoryId string

The ID of the tag category in which the tag is located.

name string

The name of the tag.

category_id str

The ID of the tag category in which the tag is located.

name str

The name of the tag.

categoryId String

The ID of the tag category in which the tag is located.

name String

The name of the tag.

getTag Result

The following output properties are available:

CategoryId string
Description string
Id string

The provider-assigned unique ID for this managed resource.

Name string
CategoryId string
Description string
Id string

The provider-assigned unique ID for this managed resource.

Name string
categoryId String
description String
id String

The provider-assigned unique ID for this managed resource.

name String
categoryId string
description string
id string

The provider-assigned unique ID for this managed resource.

name string
category_id str
description str
id str

The provider-assigned unique ID for this managed resource.

name str
categoryId String
description String
id String

The provider-assigned unique ID for this managed resource.

name String

Package Details

Repository
https://github.com/pulumi/pulumi-vsphere
License
Apache-2.0
Notes

This Pulumi package is based on the vsphere Terraform Provider.