78 lines
2.5 KiB
Terraform
78 lines
2.5 KiB
Terraform
# Create the vApp after the VDC, Edge, organization IP allocation, and SNAT are ready.
|
|
resource "nubes_vapp" "vapp" {
|
|
# Name shown for this vApp service in the personal account.
|
|
resource_name = var.vapp_resource_name
|
|
|
|
# vApp name; must be unique in the organization and match the platform naming pattern.
|
|
vapp_name = var.vapp_name
|
|
|
|
# UUID of the VDC where the vApp will reside.
|
|
vdc_uid = nubes_vc_vdc.vdc.id
|
|
|
|
# UUID of the Edge whose routed network will be used by the vApp.
|
|
nsxt_uid = nubes_vc_nsxt.edge.id
|
|
|
|
# Suspend the vApp rather than fully deleting it on terraform destroy.
|
|
suspend_on_destroy = true
|
|
|
|
# Adopt an existing same-name vApp rather than failing during Create.
|
|
adopt_existing_on_create = true
|
|
|
|
# The tested PROD vApp deployment requires the IP/SNAT configuration to be ready.
|
|
depends_on = [nubes_vc_nsxt_snat.snat]
|
|
}
|
|
|
|
# Create one VM inside the vApp.
|
|
resource "nubes_vc_vm_v3" "vm" {
|
|
# Name shown for this VM service in the personal account.
|
|
resource_name = var.vm_resource_name
|
|
|
|
# VM hostname/IP-set name; it must match the platform naming pattern.
|
|
vm_name = var.vm_name
|
|
|
|
# UUID of the vApp created above.
|
|
vapp_uid = nubes_vapp.vapp.id
|
|
|
|
# Operating-system image; its base disk is separate from vm_disk.
|
|
image_vm = var.vm_image
|
|
|
|
# Number of vCPUs allocated to the VM.
|
|
vm_cpu = var.vm_cpu
|
|
|
|
# VM memory in GB.
|
|
vm_ram = var.vm_ram
|
|
|
|
# Additional disk size in GB, excluding the image's base disk.
|
|
vm_disk = var.vm_disk
|
|
|
|
# Linux account created for SSH access.
|
|
user_login = var.vm_user_login
|
|
|
|
# Public key installed for that account; never use a private key here.
|
|
user_public_key = var.vm_user_public_key
|
|
|
|
# Organization IP space used by this VM.
|
|
ip_space_name = var.ip_space_name
|
|
|
|
# true gives this VM its own external IP during deployment.
|
|
same_snat = var.vm_same_snat
|
|
|
|
# JSON-encoded inbound port/protocol allow-list.
|
|
access_port_list = jsonencode(var.vm_access_port_list)
|
|
|
|
# JSON-encoded source IP/CIDR allow-list; keep it as narrow as practical.
|
|
access_ip_list = jsonencode(var.vm_access_ip_list)
|
|
|
|
# Optional marker: changing it requests redeploy on Update.
|
|
git_revision = var.git_revision
|
|
|
|
# Optional marker: changing it requests reconcile on Update, not on Create.
|
|
reconcile_trigger = var.reconcile_trigger
|
|
|
|
# Suspend the VM rather than fully deleting it on terraform destroy.
|
|
suspend_on_destroy = true
|
|
|
|
# Adopt an existing same-name VM rather than failing during Create.
|
|
adopt_existing_on_create = true
|
|
}
|