Skip to content

Commit

Permalink
Update tags future state implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
tlindsay42 committed Mar 28, 2022
1 parent 4bf007b commit e8952de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 31 deletions.
14 changes: 4 additions & 10 deletions examples/basic/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,10 @@ variable "create_content_library_items" {
# variable "tags" {
# type = list(map(string))
# description = "List of one or more maps of strings defining vSphere tags. Each map must only have 'name' & 'description' keys, and the value for 'name' cannot be empty."
# default = [
# {
# name = "terraform"
# description = "Managed by Terraform"
# },
# {
# name = "project"
# description = "terraform-vsphere-tags"
# },
# ]
# default = {
# terraform = "Managed by Terraform"
# project = "terraform-vsphere-tags"
# }
# }

# variable "create_tags" {
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Reference: https://github.com/hashicorp/terraform-provider-vsphere/issues/1498

# module "vsphere_tags" {
# count = (length(var.tags) > 0) ? 1 : 0
# count = (length(keys(var.tags)) > 0) ? 1 : 0

# source = "github.com/aws-ia/terraform-vsphere-tags"
# # version = "0.0.1"
Expand Down
29 changes: 9 additions & 20 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -238,32 +238,21 @@ variable "subscription_on_demand" {
# }

# variable "tags" {
# type = list(map(string))
# description = "List of one or more maps of strings defining vSphere tags. Each map must only have 'name' & 'description' keys, and the value for 'name' cannot be empty."
# default = []
# type = map(string)
# description = "Map of strings defining vSphere tag names and descriptions."
# default = {}
# nullable = false

# /*
# example = [
# {
# name = "terraform"
# description = "Managed by Terraform"
# },
# {
# name = "project"
# description = "terraform-vsphere-tags"
# },
# ]
# */

# validation {
# condition = alltrue([for t in var.tags : length(keys(t)) == 2])
# error_message = "Must be a list of one or more maps of strings with exactly 2 keys."
# example = {
# terraform = "Managed by Terraform"
# project = "terraform-vsphere-tags"
# }
# */

# validation {
# condition = alltrue([for t in var.tags : alltrue([for k, v in t : (k == "name" && length(v) > 0) || k == "description"])])
# error_message = "Must be a list of maps of strings with only 'name' & 'description' keys, and the value for 'name' cannot be empty."
# condition = length(keys(var.tags)) > 0
# error_message = "Must be a maps of strings with one or more key/value pairs."
# }
# }

Expand Down

0 comments on commit e8952de

Please sign in to comment.