Skip to content

Latest commit

 

History

History
112 lines (87 loc) · 2.08 KB

File metadata and controls

112 lines (87 loc) · 2.08 KB

vsphere_vm_storage_policy

back

Index

Terraform

terraform {
  required_providers {
    vsphere = ">= 1.25.0"
  }
}

top

Example Usage

module "vsphere_vm_storage_policy" {
  source = "./modules/vsphere/r/vsphere_vm_storage_policy"

  # description - (optional) is a type of string
  description = null
  # name - (required) is a type of string
  name = null

  tag_rules = [{
    include_datastores_with_tags = null
    tag_category                 = null
    tags                         = []
  }]
}

top

Variables

variable "description" {
  description = "(optional) - Description of the storage policy."
  type        = string
  default     = null
}

variable "name" {
  description = "(required) - Name of the storage policy."
  type        = string
}

variable "tag_rules" {
  description = "nested block: NestingList, min items: 1, max items: 0"
  type = set(object(
    {
      include_datastores_with_tags = bool
      tag_category                 = string
      tags                         = list(string)
    }
  ))
}

top

Resource

resource "vsphere_vm_storage_policy" "this" {
  # description - (optional) is a type of string
  description = var.description
  # name - (required) is a type of string
  name = var.name

  dynamic "tag_rules" {
    for_each = var.tag_rules
    content {
      # include_datastores_with_tags - (optional) is a type of bool
      include_datastores_with_tags = tag_rules.value["include_datastores_with_tags"]
      # tag_category - (required) is a type of string
      tag_category = tag_rules.value["tag_category"]
      # tags - (required) is a type of list of string
      tags = tag_rules.value["tags"]
    }
  }

}

top

Outputs

output "id" {
  description = "returns a string"
  value       = vsphere_vm_storage_policy.this.id
}

output "this" {
  value = vsphere_vm_storage_policy.this
}

top