Closed bhati-pradeep closed 2 years ago
Thanks for opening the issue. I think you have the requirements stated fine.
Discussed with team and this operation can be done by terraform builtin resources itself. For foundation image upload resource, the file needs to be there in the local workstation. So in order to download file from remote server first we can use below code snippet. This will download file from remote server at a certain directory.
resource "null_resource" "download_image" {
triggers = {
temp_var = "${timestamp()}"
}
provisioner "local-exec" {
command = "wget <remote-server-file-link>"
working_dir = "/User/pradeep.bhati/Downloads/images/"
}
}
In code, triggers always make sure the resource is run everytime there is terraform apply. working_dir is used to run this command in the particulary directory.
Reference: https://www.terraform.io/language/resources/provisioners/local-exec
Is your feature request related to a problem? Please describe. Current nutanix_foundation_image resource uploads file from local setup to the foundation VM. New feature can be a way to upload image to foundation vm using remote server/ filer URL using same resource. This would reduce dependency on local setup for running terraform automation.