55 lines
1.4 KiB
HCL
55 lines
1.4 KiB
HCL
variable "vra_url" {
|
|
type = string
|
|
}
|
|
variable "vra_refresh_token" {
|
|
type = string
|
|
sensitive = true
|
|
}
|
|
variable "vra_username" {
|
|
type = string
|
|
}
|
|
|
|
data "local_file" "ssh-pub-key" {
|
|
filename = "/home/pcaseiro/.ssh/id_rsa.pub"
|
|
}
|
|
|
|
module "deployment" {
|
|
source = "./modules/pycloud"
|
|
|
|
vra_url = var.vra_url
|
|
vra_refresh_token = var.vra_refresh_token
|
|
vra_insecure_ssl = true
|
|
|
|
deployments = local.deployments
|
|
}
|
|
|
|
/*
|
|
output "flatten_vms" {
|
|
value = flatten([
|
|
for k1, deploy in module.deployment.deployments : [
|
|
for k2, resource in deploy.resources : {
|
|
deployment_name = k1
|
|
vm_name = jsondecode(resource.properties_json).name
|
|
vm_hostname = jsondecode(resource.properties_json).hostName
|
|
address = jsondecode(resource.properties_json).address
|
|
networks = jsondecode(resource.properties_json).networks
|
|
} if resource.type == "Cloud.vSphere.Machine"
|
|
]
|
|
])
|
|
}
|
|
*/
|
|
|
|
output "vms" {
|
|
value = flatten([
|
|
for k1, deploy in module.deployment.deployments : {
|
|
for k2, resource in deploy.resources : jsondecode(resource.properties_json).name => {
|
|
deployment_name = k1
|
|
vm_name = jsondecode(resource.properties_json).name
|
|
vm_hostname = jsondecode(resource.properties_json).hostName
|
|
address = jsondecode(resource.properties_json).address
|
|
networks = jsondecode(resource.properties_json).networks
|
|
} if resource.type == "Cloud.vSphere.Machine"
|
|
}
|
|
])
|
|
}
|