vsphere_tag_category
The vsphere_tag_category
resource can be used to create and manage tag categories, which determine how tags are grouped together and applied to specific objects.
For more information about tags, click here. For more information about tag categories specifically, click here.
NOTE: Tagging support is unsupported on direct ESXi connections and requires vCenter 6.0 or higher.
Example Usage
This example creates a tag category named terraform-test-category
, with single cardinality (meaning that only one tag in this category can be assigned to an object at any given time). Tags in this category can only be assigned to VMs and datastores.
resource "vsphere_tag_category" "category" { name = "terraform-test-category" description = "Managed by Terraform" cardinality = "SINGLE" associable_types = [ "VirtualMachine", "Datastore", ] }
Argument Reference
The following arguments are supported:
-
name
- (Required) The name of the category. -
cardinality
- (Required) The number of tags that can be assigned from this category to a single object at once. Can be one ofSINGLE
(object can only be assigned one tag in this category), toMULTIPLE
(object can be assigned multiple tags in this category). Forces a new resource if changed. -
associable_types
- (Required) A list object types that this category is valid to be assigned to. For a full list, click here. -
description
- (Optional) A description for the category.
NOTE: You can add associable types to a category, but you cannot remove them. Attempting to do so will result in an error.
Associable Object Types
The following table will help you determine what values you need to enter for the associable type you want to associate with a tag category.
Note that if you want a tag to apply to all objects, the All
alias exists - just remember that you will not be able to revert this later, and this category will permanently allow all objects.
Type | Value |
---|---|
Folders | Folder |
Clusters | ClusterComputeResource |
Datacenters | Datacenter |
Datastores | Datastore |
Datastore Clusters | StoragePod |
DVS Portgroups | DistributedVirtualPortgroup |
Distributed vSwitches |
DistributedVirtualSwitch VmwareDistributedVirtualSwitch
|
Hosts | HostSystem |
Content Libraries | com.vmware.content.Library |
Content Library Items | com.vmware.content.library.Item |
Networks |
HostNetwork Network OpaqueNetwork
|
Resource Pools | ResourcePool |
vApps | VirtualApp |
Virtual Machines | VirtualMachine |
Attribute Reference
The only attribute that is exported for this resource is the id
, which is the uniform resource name (URN) of this tag category.
Importing
An existing tag category can be imported into this resource via its name, using the following command:
terraform import vsphere_tag_category.category terraform-test-category
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/vsphere/r/tag_category.html