Tag
The vsphere..Tag resource can be used to create and manage tags, which allow
you to attach metadata to objects in the vSphere inventory to make these
objects more sortable and searchable.
For more information about tags, click here.
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 = new VSphere.TagCategory("category", new VSphere.TagCategoryArgs
{
AssociableTypes =
{
"VirtualMachine",
"Datastore",
},
Cardinality = "SINGLE",
Description = "Managed by Pulumi",
});
var tag = new VSphere.Tag("tag", new VSphere.TagArgs
{
CategoryId = category.Id,
Description = "Managed by Pulumi",
});
}
}
Coming soon!
import pulumi
import pulumi_vsphere as vsphere
category = vsphere.TagCategory("category",
associable_types=[
"VirtualMachine",
"Datastore",
],
cardinality="SINGLE",
description="Managed by Pulumi")
tag = vsphere.Tag("tag",
category_id=category.id,
description="Managed by Pulumi")import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const category = new vsphere.TagCategory("category", {
associableTypes: [
"VirtualMachine",
"Datastore",
],
cardinality: "SINGLE",
description: "Managed by Pulumi",
});
const tag = new vsphere.Tag("tag", {
categoryId: category.id,
description: "Managed by Pulumi",
});Using Tags in a Supported Resource
using Pulumi;
using VSphere = Pulumi.VSphere;
class MyStack : Stack
{
public MyStack()
{
var category = new VSphere.TagCategory("category", new VSphere.TagCategoryArgs
{
AssociableTypes =
{
"VirtualMachine",
"Datastore",
},
Cardinality = "SINGLE",
Description = "Managed by Pulumi",
});
var tag = new VSphere.Tag("tag", new VSphere.TagArgs
{
CategoryId = category.Id,
Description = "Managed by Pulumi",
});
var web = new VSphere.VirtualMachine("web", new VSphere.VirtualMachineArgs
{
Tags =
{
tag.Id,
},
});
}
}
Coming soon!
import pulumi
import pulumi_vsphere as vsphere
category = vsphere.TagCategory("category",
associable_types=[
"VirtualMachine",
"Datastore",
],
cardinality="SINGLE",
description="Managed by Pulumi")
tag = vsphere.Tag("tag",
category_id=category.id,
description="Managed by Pulumi")
web = vsphere.VirtualMachine("web", tags=[tag.id])import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const category = new vsphere.TagCategory("category", {
associableTypes: [
"VirtualMachine",
"Datastore",
],
cardinality: "SINGLE",
description: "Managed by Pulumi",
});
const tag = new vsphere.Tag("tag", {
categoryId: category.id,
description: "Managed by Pulumi",
});
const web = new vsphere.VirtualMachine("web", {
tags: [tag.id],
});Create a Tag Resource
new Tag(name: string, args: TagArgs, opts?: CustomResourceOptions);def Tag(resource_name, opts=None, category_id=None, description=None, name=None, __props__=None);public Tag(string name, TagArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args TagArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args TagArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TagArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Tag Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Tag resource accepts the following input properties:
- Category
Id string The unique identifier of the parent category in which this tag will be created. Forces a new resource if changed.
- Description string
A description for the tag.
- Name string
The display name of the tag. The name must be unique within its category.
- Category
Id string The unique identifier of the parent category in which this tag will be created. Forces a new resource if changed.
- Description string
A description for the tag.
- Name string
The display name of the tag. The name must be unique within its category.
- category
Id string The unique identifier of the parent category in which this tag will be created. Forces a new resource if changed.
- description string
A description for the tag.
- name string
The display name of the tag. The name must be unique within its category.
- category_
id str The unique identifier of the parent category in which this tag will be created. Forces a new resource if changed.
- description str
A description for the tag.
- name str
The display name of the tag. The name must be unique within its category.
Outputs
All input properties are implicitly available as output properties. Additionally, the Tag resource produces the following output properties:
Look up an Existing Tag Resource
Get an existing Tag 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?: TagState, opts?: CustomResourceOptions): Tagstatic get(resource_name, id, opts=None, category_id=None, description=None, name=None, __props__=None);public static Tag Get(string name, Input<string> id, TagState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
- Category
Id string The unique identifier of the parent category in which this tag will be created. Forces a new resource if changed.
- Description string
A description for the tag.
- Name string
The display name of the tag. The name must be unique within its category.
- Category
Id string The unique identifier of the parent category in which this tag will be created. Forces a new resource if changed.
- Description string
A description for the tag.
- Name string
The display name of the tag. The name must be unique within its category.
- category
Id string The unique identifier of the parent category in which this tag will be created. Forces a new resource if changed.
- description string
A description for the tag.
- name string
The display name of the tag. The name must be unique within its category.
- category_
id str The unique identifier of the parent category in which this tag will be created. Forces a new resource if changed.
- description str
A description for the tag.
- name str
The display name of the tag. The name must be unique within its category.
Package Details
- Repository
- https://github.com/pulumi/pulumi-vsphere
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vsphereTerraform Provider.