-
Notifications
You must be signed in to change notification settings - Fork 0
/
05-download_vcenter_iso.tf
45 lines (40 loc) · 1.26 KB
/
05-download_vcenter_iso.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
42
43
44
45
data "template_file" "download_vcenter" {
template = file("templates/download_vcenter.sh")
vars = {
gcs_bucket_name = var.gcs_bucket_name
storage_reader_key_name = var.storage_reader_key_name
s3_boolean = var.s3_boolean
s3_url = var.s3_url
s3_access_key = var.s3_access_key
s3_secret_key = var.s3_secret_key
s3_bucket_name = var.s3_bucket_name
vcenter_iso_name = var.vcenter_iso_name
ssh_private_key = chomp(tls_private_key.ssh_key_pair.private_key_pem)
}
}
resource "null_resource" "download_vcenter_iso" {
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.download_vcenter.rendered
destination = "/root/download_vcenter.sh"
}
provisioner "remote-exec" {
inline = ["mkdir -p /root/anthos/gcp_keys"]
}
provisioner "file" {
source = "anthos/gcp_keys/"
destination = "/root/anthos/gcp_keys"
}
provisioner "remote-exec" {
inline = [
"cd /root",
"chmod +x /root/download_vcenter.sh",
"/root/download_vcenter.sh"
]
}
}