Terraform vSphere Provider: Disks Default to Thin Instead of Thick Lazy Zeroed
search cancel

Terraform vSphere Provider: Disks Default to Thin Instead of Thick Lazy Zeroed

book

Article ID: 447579

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

Virtual machine disks provisioned via HashiCorp Terraform automation default to Thin Provisioned, even when the vCenter Server global or cluster-level default is set to Thick Provision Lazy Zeroed.

Symptoms

  • Users observe that while the vSphere Client defaults to Thick Provisioning during manual creation, the same VM deployed via Terraform results in Thin Provisioned disks.
  • The thin_provisioned attribute in the Terraform state file is set to true by default.

Environment

  • VMware vSphere ESXi 7.x / 8.x
  • VMware vCenter Server 7.x / 8.x
  • HashiCorp Terraform vsphere provider

Cause

The HashiCorp Terraform vSphere provider resource schema explicitly sets the thin_provisioned attribute to true by default. This explicit API parameter overrides the vCenter Server's global or cluster-level defaults during the provisioning process.

Resolution

To enforce Thick Provision Lazy Zeroed allocation when using Terraform, use one of the following methods:

Method 1: Explicit Resource Declaration

  1. Locate the vsphere_virtual_machine resource block in the Terraform configuration.
  2. Include the thin_provisioned and eagerly_scrub flags within the disk block.
  3. Set thin_provisioned = false and eagerly_scrub = false as shown in the following example:
resource "vsphere_virtual_machine" "vm" {  # ... other configuration ...  disk {    label            = "disk0"    size             = 40    thin_provisioned = false    eagerly_scrub    = false  }}

Method 2: Storage Policy Based Management (SPBM)

  1. Create a vCenter storage policy that mandates thick provisioning.
  2. Obtain the id of the storage policy.
  3. Apply the storage_policy_id within the disk block of the Terraform configuration:
resource "vsphere_virtual_machine" "vm" {  # ... other configuration ...  disk {    label             = "disk0"    size              = 40    storage_policy_id = "your-storage-policy-uuid-here"  }}

Note: Ensure that Terraform parameters align with the requirements of the assigned storage policy to avoid API-level deployment conflicts.

Support Boundary Note: Terraform providers are community-supported open-source projects. For issues specifically regarding provider logic or internal bugs, reports should be directed to the .

Additional Information