github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/website/source/docs/providers/vsphere/r/file.html.markdown (about) 1 --- 2 layout: "vsphere" 3 page_title: "VMware vSphere: vsphere_file" 4 sidebar_current: "docs-vsphere-resource-file" 5 description: |- 6 Provides a VMware vSphere virtual machine file resource. This can be used to upload files (e.g. vmdk disks) from the Terraform host machine to a remote vSphere or copy fields within vSphere. 7 --- 8 9 # vsphere\_file 10 11 Provides a VMware vSphere virtual machine file resource. This can be used to upload files (e.g. vmdk disks) from the Terraform host machine to a remote vSphere. The file resource can also be used to copy files within vSphere. Files can be copied between Datacenters and/or Datastores. 12 13 Updates to file resources will handle moving a file to a new destination (datacenter and/or datastore and/or destination_file). If any source parameter (e.g. `source_datastore`, `source_datacenter` or `source_file`) are changed, this results in a new resource (new file uploaded or copied and old one being deleted). 14 15 ## Example Usages 16 17 **Upload file to vSphere:** 18 19 ``` 20 resource "vsphere_file" "ubuntu_disk_upload" { 21 datacenter = "my_datacenter" 22 datastore = "local" 23 source_file = "/home/ubuntu/my_disks/custom_ubuntu.vmdk" 24 destination_file = "/my_path/disks/custom_ubuntu.vmdk" 25 } 26 ``` 27 28 **Copy file within vSphere:** 29 30 ``` 31 resource "vsphere_file" "ubuntu_disk_copy" { 32 source_datacenter = "my_datacenter" 33 datacenter = "my_datacenter" 34 source_datastore = "local" 35 datastore = "local" 36 source_file = "/my_path/disks/custom_ubuntu.vmdk" 37 destination_file = "/my_path/custom_ubuntu_id.vmdk" 38 } 39 ``` 40 41 ## Argument Reference 42 43 If `source_datacenter` and `source_datastore` are not provided, the file resource will upload the file from Terraform host. If either `source_datacenter` or `source_datastore` are provided, the file resource will copy from within specified locations in vSphere. 44 45 The following arguments are supported: 46 47 * `source_file` - (Required) The path to the file being uploaded from the Terraform host to vSphere or copied within vSphere. 48 * `destination_file` - (Required) The path to where the file should be uploaded or copied to on vSphere. 49 * `source_datacenter` - (Optional) The name of a Datacenter in which the file will be copied from. 50 * `datacenter` - (Optional) The name of a Datacenter in which the file will be uploaded to. 51 * `source_datastore` - (Optional) The name of the Datastore in which file will be copied from. 52 * `datastore` - (Required) The name of the Datastore in which to upload the file to. 53 * `create_directories` - (Optional) Create directories in `destination_file` path parameter if any missing for copy operation. *Note: Directories are not deleted on destroy operation.