-
Notifications
You must be signed in to change notification settings - Fork 0
/
07-vcva-template.tf
41 lines (38 loc) · 1.1 KB
/
07-vcva-template.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
resource "random_string" "vcenter_password" {
length = 16
min_upper = 2
min_lower = 2
min_numeric = 2
min_special = 2
override_special = "$!?@*"
}
resource "random_string" "sso_password" {
length = 16
min_upper = 2
min_lower = 2
min_numeric = 2
min_special = 2
override_special = "$!?@*"
}
data "template_file" "vcva_template" {
template = file("templates/vcva_template.json")
vars = {
vcenter_password = random_string.vcenter_password.result
sso_password = random_string.sso_password.result
first_esx_pass = packet_device.esxi_hosts.0.root_password
domain_name = var.domain_name
vcenter_network = var.vcenter_portgroup_name
}
}
resource "null_resource" "copy_vcva_template" {
connection {
type = "ssh"
user = "root"
private_key = file("~/.ssh/${local.ssh_key_name}")
host = packet_device.router.access_public_ipv4
}
provisioner "file" {
content = data.template_file.vcva_template.rendered
destination = "/root/vcva_template.json"
}
}