Show / Hide Table of Contents

Class File

The vsphere..File resource can be used to upload files (such as virtual disk files) from the host machine that this provider is running on to a target datastore. The resource can also be used to copy files between datastores, or from one location to another on the same datastore.

Updates to destination parameters such as datacenter, datastore, or destination_file will move the managed file a new destination based on the values of the new settings. If any source parameter is changed, such as source_datastore, source_datacenter or source_file), the resource will be re-created. Depending on if destination parameters are being changed as well, this may result in the destination file either being overwritten or deleted at the old location.

Example Usage

Uploading a file

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
public MyStack()
{
    var ubuntuDiskUpload = new VSphere.File("ubuntuDiskUpload", new VSphere.FileArgs
    {
        Datacenter = "my_datacenter",
        Datastore = "local",
        DestinationFile = "/my_path/disks/custom_ubuntu.vmdk",
        SourceFile = "/home/ubuntu/my_disks/custom_ubuntu.vmdk",
    });
}

}

Copying a file

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
public MyStack()
{
    var ubuntuDiskCopy = new VSphere.File("ubuntuDiskCopy", new VSphere.FileArgs
    {
        Datacenter = "my_datacenter",
        Datastore = "local",
        DestinationFile = "/my_path/custom_ubuntu_id.vmdk",
        SourceDatacenter = "my_datacenter",
        SourceDatastore = "local",
        SourceFile = "/my_path/disks/custom_ubuntu.vmdk",
    });
}

}
Inheritance
System.Object
Resource
CustomResource
File
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.VSphere
Assembly: Pulumi.VSphere.dll
Syntax
public class File : CustomResource

Constructors

View Source

File(String, FileArgs, CustomResourceOptions)

Create a File resource with the given unique name, arguments, and options.

Declaration
public File(string name, FileArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

FileArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

CreateDirectories

Create directories in destination_file path parameter if any missing for copy operation.

Declaration
public Output<bool?> CreateDirectories { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Datacenter

The name of a datacenter in which the file will be uploaded to.

Declaration
public Output<string> Datacenter { get; }
Property Value
Type Description
Output<System.String>
View Source

Datastore

The name of the datastore in which to upload the file to.

Declaration
public Output<string> Datastore { get; }
Property Value
Type Description
Output<System.String>
View Source

DestinationFile

The path to where the file should be uploaded or copied to on vSphere.

Declaration
public Output<string> DestinationFile { get; }
Property Value
Type Description
Output<System.String>
View Source

SourceDatacenter

The name of a datacenter in which the file will be copied from. Forces a new resource if changed.

Declaration
public Output<string> SourceDatacenter { get; }
Property Value
Type Description
Output<System.String>
View Source

SourceDatastore

The name of the datastore in which file will be copied from. Forces a new resource if changed.

Declaration
public Output<string> SourceDatastore { get; }
Property Value
Type Description
Output<System.String>
View Source

SourceFile

The path to the file being uploaded from the host to vSphere or copied within vSphere. Forces a new resource if changed.

Declaration
public Output<string> SourceFile { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, FileState, CustomResourceOptions)

Get an existing File resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static File Get(string name, Input<string> id, FileState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

FileState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
File
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.