Terraform在vCloud Director 3.3.1版本中iniscript功能无法使用,寻求替代选项名称
Fixing the Deprecated
iniscript Option in vCloud Director Terraform Provider 3.3.1 Hey there, I’ve dealt with this exact deprecation issue when working with the vCloud Director Terraform provider v3.3.1, so I can help you out!
The Short Answer
The iniscript option was fully removed in v3.3.1, and its direct replacement is the script property inside the guest_customization block within your vcd_vm resource.
Example: Before vs. After
Here’s how your old configuration using iniscript would look:
resource "vcd_vm" "my_vm" { name = "test-vm" vdc = "my-vdc" catalog_name = "my-catalog" template_name = "ubuntu-22.04" memory = 4096 cpu_count = 2 # Old deprecated iniscript iniscript = <<EOF #!/bin/bash apt update && apt install -y nginx systemctl start nginx EOF }
And here’s the updated, supported configuration using the replacement option:
resource "vcd_vm" "my_vm" { name = "test-vm" vdc = "my-vdc" catalog_name = "my-catalog" template_name = "ubuntu-22.04" memory = 4096 cpu_count = 2 # New guest_customization block with script guest_customization { enabled = true # This is required for the script to run script = <<EOF #!/bin/bash apt update && apt install -y nginx systemctl start nginx EOF } }
Key Notes
- Make sure to set
enabled = truein theguest_customizationblock—without this, your script won’t execute at all. - This works for both Linux (bash scripts) and Windows (PowerShell/Batch scripts) VMs; just adjust the script content to match the guest OS.
- The deprecation of
iniscriptstarted in earlier provider versions (around v3.0.0), but it was fully removed in v3.3.1, so you’ll see errors if you keep using the old parameter.
内容的提问来源于stack exchange,提问作者gbiliza zaoro
相关产品推荐
相关产品推荐

