How kalenarndt/terraform-vsphere-vcsa-deploy works
Project type and purpose
• This is an open-source Terraform module whose sole purpose is to automate the deployment of a VMware vCenter Server Appliance (VCSA) on either an ESXi host or inside an existing vCenter.
• It leverages Terraform’s provider/plugin architecture to interact with the VMware vSphere APIs (through the “vsphere” provider), and uses the “local” and “null” providers to manipulate local files and execute the VCSA installer binary.
File structure
• Top-level HCL files: main.tf, variables.tf, providers.tf, output.tf → define the module’s inputs, providers, resources and outputs.
• JSON templates in vcsa-esxi.json.tmpl and vcsa-vc.json.tmpl → used to feed the installer with a JSON config.
• examples/ directory → contains sample YAML maps and Terraform root modules that demonstrate how to invoke this module for ESXi or vCenter.
• No nested sub-modules; it is a single self-contained module.
Key insights from the README
• Describes how to consume the module (passing in a YAML file that is decoded to a Terraform map).
• Explains the required inputs (binaries_path, network settings, credentials, etc.).
• Shows that two null_resource blocks run either the Linux or Windows VCSA deployment binary using the JSON template.
• Outlines outputs that surface the deployed appliance’s IP, FQDN, root user, and SSO user credentials.
Components
a. User / Operator
• Interacts with Terraform CLI (init, plan, apply).
• Supplies:
• YAML deployment map (examples/…yaml)
• VCSA installer binaries (binaries_path).
b. Terraform Core
• HCL engine that parses .tf files, variables.tf, providers.tf.
• Providers invoked:
• vsphere provider → communicates with ESXi or vCenter API
• local provider → writes JSON template file (local_file.vcsa_template_to_json)
• null provider → executes the deployment binary (null_resource.vcsa_linux_deploy or vcsa_windows_deploy).
c. JSON Template Generator
• Takes HCL variables + decoded YAML → produces JSON config file for the VCSA installer.
d. VCSA Installer Binary
• Two paths: Linux binary (appliance installer) or Windows binary.
• Consumes JSON template, contacts target (ESXi host or vCenter) over API to push and configure the appliance VM.
e. VMware Infrastructure
• ESXi host or vCenter Server cluster/Datacenter.
• Network and datastore objects where the appliance VM gets deployed.
f. Outputs back into Terraform state
• module outputs (IP, FQDN, passwords).
Relationships & interactions
• Operator → Terraform CLI → Terraform Core
• Terraform Core → reads YAML map; passes variables into module
• Terraform Core(local provider) → writes JSON template → disk
• Terraform Core(null provider) → invokes installer binary → network → ESXi or vCenter API
• vSphere provider → API calls to create VM from template, customize OS, set networking
• Results flow back → Terraform state → outputs reported to user
Architectural patterns & design principles
• Infrastructure as Code module pattern
• Clear separation of concerns:
• HCL for config and orchestration
• JSON templating for installer config
• Null/local providers for external program execution and file I/O
• Idempotent resource model: Terraform tracks state, only re-runs deployment when needed.
Technologies & frameworks
• Terraform (HCL)
• VMware vSphere provider (Terraform plugin)
• HashiCorp local and null providers
• JSON template files
• YAML maps for input data
• VMware VCSA appliance binaries
Final advice
• Be exhaustive: capture each Terraform resource, the flow from input YAML to final VM.
• Do not overthink grouping; show every module, provider, resource and external interface as its own node.
• This level of detail will give stakeholders a crystal-clear view of how the module wires together to deploy VCSA.