vSphere

v4.3.0 published on Monday, Jun 27, 2022 by Pulumi

File

Example Usage

Uploading a File

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var ubuntuVmdkUpload = new VSphere.File("ubuntuVmdkUpload", new VSphere.FileArgs
        {
            CreateDirectories = true,
            Datacenter = "dc-01",
            Datastore = "datastore-01",
            DestinationFile = "/my/dst/path/custom_ubuntu.vmdk",
            SourceFile = "/my/src/path/custom_ubuntu.vmdk",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vsphere.NewFile(ctx, "ubuntuVmdkUpload", &vsphere.FileArgs{
			CreateDirectories: pulumi.Bool(true),
			Datacenter:        pulumi.String("dc-01"),
			Datastore:         pulumi.String("datastore-01"),
			DestinationFile:   pulumi.String("/my/dst/path/custom_ubuntu.vmdk"),
			SourceFile:        pulumi.String("/my/src/path/custom_ubuntu.vmdk"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_vsphere as vsphere

ubuntu_vmdk_upload = vsphere.File("ubuntuVmdkUpload",
    create_directories=True,
    datacenter="dc-01",
    datastore="datastore-01",
    destination_file="/my/dst/path/custom_ubuntu.vmdk",
    source_file="/my/src/path/custom_ubuntu.vmdk")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const ubuntuVmdkUpload = new vsphere.File("ubuntu_vmdk_upload", {
    createDirectories: true,
    datacenter: "dc-01",
    datastore: "datastore-01",
    destinationFile: "/my/dst/path/custom_ubuntu.vmdk",
    sourceFile: "/my/src/path/custom_ubuntu.vmdk",
});

Coming soon!

Copying a File

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var ubuntuCopy = new VSphere.File("ubuntuCopy", new VSphere.FileArgs
        {
            CreateDirectories = true,
            Datacenter = "dc-01",
            Datastore = "datastore-01",
            DestinationFile = "/my/dst/path/custom_ubuntu.vmdk",
            SourceDatacenter = "dc-01",
            SourceDatastore = "datastore-01",
            SourceFile = "/my/src/path/custom_ubuntu.vmdk",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vsphere.NewFile(ctx, "ubuntuCopy", &vsphere.FileArgs{
			CreateDirectories: pulumi.Bool(true),
			Datacenter:        pulumi.String("dc-01"),
			Datastore:         pulumi.String("datastore-01"),
			DestinationFile:   pulumi.String("/my/dst/path/custom_ubuntu.vmdk"),
			SourceDatacenter:  pulumi.String("dc-01"),
			SourceDatastore:   pulumi.String("datastore-01"),
			SourceFile:        pulumi.String("/my/src/path/custom_ubuntu.vmdk"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_vsphere as vsphere

ubuntu_copy = vsphere.File("ubuntuCopy",
    create_directories=True,
    datacenter="dc-01",
    datastore="datastore-01",
    destination_file="/my/dst/path/custom_ubuntu.vmdk",
    source_datacenter="dc-01",
    source_datastore="datastore-01",
    source_file="/my/src/path/custom_ubuntu.vmdk")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const ubuntuCopy = new vsphere.File("ubuntu_copy", {
    createDirectories: true,
    datacenter: "dc-01",
    datastore: "datastore-01",
    destinationFile: "/my/dst/path/custom_ubuntu.vmdk",
    sourceDatacenter: "dc-01",
    sourceDatastore: "datastore-01",
    sourceFile: "/my/src/path/custom_ubuntu.vmdk",
});

Coming soon!

Create a File Resource

new File(name: string, args: FileArgs, opts?: CustomResourceOptions);
@overload
def File(resource_name: str,
         opts: Optional[ResourceOptions] = None,
         create_directories: Optional[bool] = None,
         datacenter: Optional[str] = None,
         datastore: Optional[str] = None,
         destination_file: Optional[str] = None,
         source_datacenter: Optional[str] = None,
         source_datastore: Optional[str] = None,
         source_file: Optional[str] = None)
@overload
def File(resource_name: str,
         args: FileArgs,
         opts: Optional[ResourceOptions] = None)
func NewFile(ctx *Context, name string, args FileArgs, opts ...ResourceOption) (*File, error)
public File(string name, FileArgs args, CustomResourceOptions? opts = null)
public File(String name, FileArgs args)
public File(String name, FileArgs args, CustomResourceOptions options)
type: vsphere:File
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args FileArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args FileArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args FileArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args FileArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args FileArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

File Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The File resource accepts the following input properties:

Datastore string

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

DestinationFile string

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

SourceFile string
CreateDirectories bool

Create directories in destination_file path parameter on first apply if any are missing for copy operation.

Datacenter string

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

SourceDatacenter string

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

SourceDatastore string

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

Datastore string

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

DestinationFile string

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

SourceFile string
CreateDirectories bool

Create directories in destination_file path parameter on first apply if any are missing for copy operation.

Datacenter string

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

SourceDatacenter string

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

SourceDatastore string

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

datastore String

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

destinationFile String

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

sourceFile String
createDirectories Boolean

Create directories in destination_file path parameter on first apply if any are missing for copy operation.

datacenter String

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

sourceDatacenter String

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

sourceDatastore String

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

datastore string

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

destinationFile string

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

sourceFile string
createDirectories boolean

Create directories in destination_file path parameter on first apply if any are missing for copy operation.

datacenter string

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

sourceDatacenter string

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

sourceDatastore string

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

datastore str

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

destination_file str

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

source_file str
create_directories bool

Create directories in destination_file path parameter on first apply if any are missing for copy operation.

datacenter str

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

source_datacenter str

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

source_datastore str

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

datastore String

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

destinationFile String

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

sourceFile String
createDirectories Boolean

Create directories in destination_file path parameter on first apply if any are missing for copy operation.

datacenter String

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

sourceDatacenter String

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

sourceDatastore String

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

Outputs

All input properties are implicitly available as output properties. Additionally, the File resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing File Resource

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

public static get(name: string, id: Input<ID>, state?: FileState, opts?: CustomResourceOptions): File
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_directories: Optional[bool] = None,
        datacenter: Optional[str] = None,
        datastore: Optional[str] = None,
        destination_file: Optional[str] = None,
        source_datacenter: Optional[str] = None,
        source_datastore: Optional[str] = None,
        source_file: Optional[str] = None) -> File
func GetFile(ctx *Context, name string, id IDInput, state *FileState, opts ...ResourceOption) (*File, error)
public static File Get(string name, Input<string> id, FileState? state, CustomResourceOptions? opts = null)
public static File get(String name, Output<String> id, FileState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
CreateDirectories bool

Create directories in destination_file path parameter on first apply if any are missing for copy operation.

Datacenter string

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

Datastore string

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

DestinationFile string

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

SourceDatacenter string

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

SourceDatastore string

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

SourceFile string
CreateDirectories bool

Create directories in destination_file path parameter on first apply if any are missing for copy operation.

Datacenter string

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

Datastore string

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

DestinationFile string

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

SourceDatacenter string

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

SourceDatastore string

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

SourceFile string
createDirectories Boolean

Create directories in destination_file path parameter on first apply if any are missing for copy operation.

datacenter String

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

datastore String

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

destinationFile String

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

sourceDatacenter String

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

sourceDatastore String

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

sourceFile String
createDirectories boolean

Create directories in destination_file path parameter on first apply if any are missing for copy operation.

datacenter string

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

datastore string

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

destinationFile string

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

sourceDatacenter string

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

sourceDatastore string

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

sourceFile string
create_directories bool

Create directories in destination_file path parameter on first apply if any are missing for copy operation.

datacenter str

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

datastore str

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

destination_file str

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

source_datacenter str

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

source_datastore str

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

source_file str
createDirectories Boolean

Create directories in destination_file path parameter on first apply if any are missing for copy operation.

datacenter String

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

datastore String

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

destinationFile String

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

sourceDatacenter String

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

sourceDatastore String

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

sourceFile String

Package Details

Repository
https://github.com/pulumi/pulumi-vsphere
License
Apache-2.0
Notes

This Pulumi package is based on the vsphere Terraform Provider.