vSphere
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 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 category = Output.Create(VSphere.GetTagCategory.InvokeAsync(new VSphere.GetTagCategoryArgs
{
Name = "test-category",
}));
var tag = category.Apply(category => Output.Create(VSphere.GetTag.InvokeAsync(new VSphere.GetTagArgs
{
CategoryId = category.Id,
Name = "test-tag",
})));
}
}
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: "test-category",
}, nil)
if err != nil {
return err
}
_, err = vsphere.LookupTag(ctx, &GetTagArgs{
CategoryId: category.Id,
Name: "test-tag",
}, nil)
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_vsphere as vsphere
category = vsphere.get_tag_category(name="test-category")
tag = vsphere.get_tag(category_id=category.id,
name="test-tag")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const category = pulumi.output(vsphere.getTagCategory({
name: "test-category",
}));
const tag = category.apply(category => vsphere.getTag({
categoryId: category.id,
name: "test-tag",
}));
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:
- Category
Id string The ID of the tag category the tag is located in.
- Name string
The name of the tag.
- Category
Id string The ID of the tag category the tag is located in.
- Name string
The name of the tag.
- category
Id String The ID of the tag category the tag is located in.
- name String
The name of the tag.
- category
Id string The ID of the tag category the tag is located in.
- name string
The name of the tag.
- category_
id str The ID of the tag category the tag is located in.
- name str
The name of the tag.
- category
Id String The ID of the tag category the tag is located in.
- name String
The name of the tag.
getTag Result
The following output properties are available:
- Category
Id string - Description string
- Id string
The provider-assigned unique ID for this managed resource.
- Name string
- Category
Id string - Description string
- Id string
The provider-assigned unique ID for this managed resource.
- Name string
- category
Id String - description String
- id String
The provider-assigned unique ID for this managed resource.
- name String
- category
Id 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
- category
Id 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.