Skip to content

Commit

Permalink
Add a variable for data vsphere_tag depends_on
Browse files Browse the repository at this point in the history
  • Loading branch information
keachi committed Jul 20, 2020
1 parent 7ed6d70 commit 92bd720
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ data "vsphere_virtual_machine" "template" {
}

data "vsphere_tag_category" "category" {
count = var.tags != null ? length(var.tags) : 0
name = keys(var.tags)[count.index]
count = var.tags != null ? length(var.tags) : 0
name = keys(var.tags)[count.index]
depends_on = [var.tag_depends_on]
}

data "vsphere_tag" "tag" {
count = var.tags != null ? length(var.tags) : 0
name = var.tags[keys(var.tags)[count.index]]
category_id = "${data.vsphere_tag_category.category[count.index].id}"
depends_on = [var.tag_depends_on]
}

locals {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,9 @@ variable "vm_depends_on" {
type = any
default = null
}

variable "tag_depends_on" {
description = "Add any external depend on module here like tag_depends_on = [vsphere_tag.foo.id]"
type = any
default = null
}

0 comments on commit 92bd720

Please sign in to comment.