Fix vApp properties & interpolation
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Danny Bessems 2021-02-02 14:03:16 +01:00
parent c01153aa45
commit 60268b7f84
3 changed files with 22 additions and 27 deletions

View File

@ -36,11 +36,18 @@ steps:
image: bv11-cr01.bessems.eu/library/packer-extended image: bv11-cr01.bessems.eu/library/packer-extended
commands: commands:
- | - |
terraform apply \ terraform -chdir=terraform apply \
-chdir=terraform \ -var="vsphere_password=$${VSPHERE_PASSWORD}" -var="repo_username=$${REPO_USERNAME}" -var="repo_password=$${REPO_PASSWORD}" \
-var-file='vsphere.tfvars' \
-input=false \ -input=false \
-auto-approve \ -auto-approve \
terraform.plan terraform.plan
environment: environment:
TF_AUTOMATION: yes TF_AUTOMATION: yes
VSPHERE_PASSWORD:
from_secret: vsphere_password
REPO_USERNAME:
from_secret: repo_username
REPO_PASSWORD:
from_secret: repo_password
# TF_LOG: TRACE # TF_LOG: TRACE

View File

@ -8,21 +8,21 @@ resource "vsphere_content_library" "library" {
resource "vsphere_content_library_item" "Server2019" { resource "vsphere_content_library_item" "Server2019" {
name = "Windows-Server-2019-LTSC" name = "Windows-Server-2019-LTSC"
library_id = vsphere_content_library.library.id library_id = vsphere_content_library.library.id
file_url = "https://{{user `repo_username`}}:{{user `repo_password`}}@sn.itch.fyi/Repository/rel/Windows-Server-2019-LTSC.ova" file_url = "https://${var.repo_username}:${var.repo_password}@sn.itch.fyi/Repository/rel/Windows-Server-2019-LTSC.ova"
} }
resource "vsphere_content_library_item" "ADCS" { resource "vsphere_content_library_item" "ADCS" {
name = "ADCS-appliance" name = "ADCS-appliance"
library_id = vsphere_content_library.library.id library_id = vsphere_content_library.library.id
file_url = "https://{{user `repo_username`}}:{{user `repo_password`}}@sn.itch.fyi/Repository/rel/ADCS-appliance.ova" file_url = "https://${var.repo_username}:${var.repo_password}@sn.itch.fyi/Repository/rel/ADCS-appliance.ova"
} }
resource "vsphere_content_library_item" "ADDS" { resource "vsphere_content_library_item" "ADDS" {
name = "ADDS-appliance" name = "ADDS-appliance"
library_id = vsphere_content_library.library.id library_id = vsphere_content_library.library.id
file_url = "https://{{user `repo_username`}}:{{user `repo_password`}}@sn.itch.fyi/Repository/rel/ADDS-appliance.ova" file_url = "https://${var.repo_username}:${var.repo_password}@sn.itch.fyi/Repository/rel/ADDS-appliance.ova"
} }
resource "vsphere_content_library_item" "Win10" { resource "vsphere_content_library_item" "Win10" {
name = "Windows 10" name = "Windows 10"
library_id = vsphere_content_library.library.id library_id = vsphere_content_library.library.id
file_url = "https://{{user `repo_username`}}:{{user `repo_password`}}@sn.itch.fyi/Repository/rel/Windows10.ova" file_url = "https://${var.repo_username}:${var.repo_password}@sn.itch.fyi/Repository/rel/Windows10.ova"
} }

View File

@ -1,5 +1,5 @@
resource "vsphere_virtual_machine" "TF-Windows2019" { resource "vsphere_virtual_machine" "TF-SRV01" {
name = "TF-Windows2019" name = "TF-SRV01"
resource_pool_id = data.vsphere_resource_pool.pool.id resource_pool_id = data.vsphere_resource_pool.pool.id
datastore_id = data.vsphere_datastore.vmdatastore.id datastore_id = data.vsphere_datastore.vmdatastore.id
folder = var.vsphere_vmfolder folder = var.vsphere_vmfolder
@ -14,35 +14,23 @@ resource "vsphere_virtual_machine" "TF-Windows2019" {
disk { disk {
label = "disk0" label = "disk0"
unit_number = 0 unit_number = 0
size = 150 size = 40
thin_provisioned = true thin_provisioned = true
} }
disk { disk {
label = "disk1" label = "disk1"
unit_number = 1 unit_number = 1
size = 225 size = 25
thin_provisioned = true thin_provisioned = true
} }
vapp { vapp {
properties = { properties = {
"guestinfo.hostname" = "<<vm-hostname>>" "guestinfo.hostname" = "TF-SRV01"
"guestinfo.ipaddress" = "<<vm-ipaddress>>" "guestinfo.ipaddress" = "10.0.0.42"
"guestinfo.netmask" = "<<vm-netmask>>" "guestinfo.prefixlength" = "24"
"guestinfo.gateway" = "<<vm-gateway>>" "guestinfo.dnsserver" = "10.0.0.5"
"guestinfo.dns" = "<<vm-dns>>" "guestinfo.gateway" = "10.0.0.1"
"guestinfo.domain_name" = "<<vm-searchdomain>>"
"guestinfo.ntp" = "<<vm-ntp>>"
"guestinfo.enable_domain_join" = "<<ad-enable-domain-join>>"
"guestinfo.domain_short_name" = "<<ad-netbios>>"
"guestinfo.domain_join_user" = "<<ad-user>>"
"guestinfo.domain_join_password" = "<<ad-password>>"
"guestinfo.domain_controller" = "<<ad-domaincontroller>>"
"guestinfo.viadmin_password" = "<<pass-viadmin>>"
"guestinfo.viuser_password" = "<<pass-viuser>>"
"guestinfo.viservice_password" = "<<pass-viservice>>"
"guestinfo.project_name" = "<<proj-name>>"
"guestinfo.monitor_server" = "<<mon-address>>"
} }
} }