Skip to content

The vSphere tags Terraform module either creates or imports a tag category as well as a list of tags in your VMware Cloud on AWS or VMware vSphere on-premises environment, and then outputs the configuration of each for use in other Terraform projects.

License

aws-ia/terraform-vsphere-tags

Repository files navigation

vSphere Tags Terraform Module

This Terraform module either creates or imports a list of tags grouped in a tag category in your VMware Cloud on AWS or VMware vSphere on‑premises environment. You use these tags to label your inventory objects with metadata to make it easier to sort and search for these objects.

Tags and categories can span multiple vCenter Server instances. When you use Hybrid Linked Mode, tags and tag categories are maintained across your linked domain. So in this mode, the on‑premises and VMware Cloud on AWS software‑defined data centers (SDDCs) share tags and tag attributes. If multiple on‑premises vCenter Server instances are configured to use Enhanced Linked Mode, tags and categories are replicated across the vCenter Server instances.

Usage

Create new tags in a new tag category

module "vsphere_tags" {
  source  = "aws-ia/tags/vsphere"
  version = ">= 0.0.1"

  tag_category_name        = "example-category"
  tag_category_description = "Example tag category."
  tag_category_cardinality = "MULTIPLE"
  create_tag_category      = true
  create_tags              = true

  tags = {
    terraform = "Managed by Terraform"
    project   = "terraform-vsphere-tags"
  }
}

Create new tags in an existing tag category

module "vsphere_tags" {
  source  = "aws-ia/tags/vsphere"
  version = ">= 0.0.1"

  tag_category_name   = "example-category"
  create_tag_category = false
  create_tags         = true

  tags = {
    terraform = "Managed by Terraform"
    project   = "terraform-vsphere-tags"
  }
}

Import existing tags in an existing tag category

module "vsphere_tags" {
  source  = "aws-ia/tags/vsphere"
  version = ">= 0.0.1"

  tag_category_name   = "example-category"
  create_tag_category = false
  create_tags         = false

  tags = {
    terraform = "Managed by Terraform"
    project   = "terraform-vsphere-tags"
  }
}

Requirements

Name Version
terraform >= 1.1.0
vsphere >= 2.1.0

Providers

Name Version
vsphere >= 2.1.0

Modules

No modules.

Resources

Name Type
vsphere_tag.tags resource
vsphere_tag_category.category resource
vsphere_tag.tags data source
vsphere_tag_category.category data source

Inputs

Name Description Type Default Required
tag_category_name The name of the vSphere tag category. string n/a yes
tags Map of strings defining vSphere tag names and descriptions. map(string) n/a yes
create_tag_category If true, a new vSphere tag category will be created. bool true no
create_tags If true, new vSphere tags will be created for each entry. bool true no
tag_category_associable_types A list object types that this category to which this category can be assigned (https://registry.terraform.io/providers/hashicorp/vsphere/latest/docs/resources/tag_category#associable-object-types). list(string)
[
"Folder",
"ClusterComputeResource",
"Datacenter",
"Datastore",
"StoragePod",
"DistributedVirtualPortgroup",
"DistributedVirtualSwitch",
"VmwareDistributedVirtualSwitch",
"HostSystem",
"com.vmware.content.Library",
"com.vmware.content.library.Item",
"HostNetwork",
"Network",
"OpaqueNetwork",
"ResourcePool",
"VirtualApp",
"VirtualMachine"
]
no
tag_category_cardinality The number of tags that can be assigned from this category to a single object at once. string "MULTIPLE" no
tag_category_description The description of the vSphere tag category. string null no

Outputs

Name Description
tag_category The vSphere tag category.
tags The list of vSphere tags.

About

The vSphere tags Terraform module either creates or imports a tag category as well as a list of tags in your VMware Cloud on AWS or VMware vSphere on-premises environment, and then outputs the configuration of each for use in other Terraform projects.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •