vsphere/resource_vsphere_virtual_disk.go
func resourceVSphereVirtualDisk() *schema.Resource {
	return &schema.Resource{
		Create: resourceVSphereVirtualDiskCreate,
		Read:   resourceVSphereVirtualDiskRead,
		Delete: resourceVSphereVirtualDiskDelete,

		Schema: map[string]*schema.Schema{
			// Size in GB
			"size": {
				Type:     schema.TypeInt,
				Required: true,
				ForceNew: true, //TODO Can this be optional (resize)?
			},

			// TODO:
			//
			// * Add extra lifecycles (move, rename, etc). May not be possible
			// without breaking other resources though.
			// * Add validation (make sure it ends in .vmdk)
			"vmdk_path": {
				Type:     schema.TypeString,
				Required: true,
				ForceNew: true,
			},

			"datastore": {
				Type:     schema.TypeString,
				Required: true,
				ForceNew: true,
			},

			"type": {
				Type:     schema.TypeString,
				Optional: true,
				ForceNew: true,
				Default:  "eagerZeroedThick",
				ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
					value := v.(string)
					if value != "thin" && value != "eagerZeroedThick" && value != "lazy" {
						errors = append(errors, fmt.Errorf(
							"only 'thin', 'eagerZeroedThick', and 'lazy' are supported values for 'type'"))
					}
					return
				},
			},

			"adapter_type": {
				Type:     schema.TypeString,
				Optional: true,
				ForceNew: true,
				Default:  "lsiLogic",
				// TODO: Move this to removed after we remove the support to specify this in later versions
				Deprecated: "this attribute has no effect on controller types - please use scsi_type in vsphere_virtual_machine instead",
				ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
					value := v.(string)
					if value != "ide" && value != "busLogic" && value != "lsiLogic" {
						errors = append(errors, fmt.Errorf(
							"only 'ide', 'busLogic', and 'lsiLogic' are supported values for 'adapter_type'"))
					}
					return
				},
			},

			"datacenter": {
				Type:     schema.TypeString,
				Optional: true,
				ForceNew: true,
			},

			"create_directories": {
				Type:     schema.TypeBool,
				Optional: true,
				ForceNew: true,
			},
		},
	}
}
func resourceVSphereVirtualDisk() *schema.Resource {
	return &schema.Resource{
		Create: resourceVSphereVirtualDiskCreate,
		Read:   resourceVSphereVirtualDiskRead,
		Delete: resourceVSphereVirtualDiskDelete,

		Schema: map[string]*schema.Schema{
			// Size in GB
			"size": {
				Type:     schema.TypeInt,
				Required: true,
				ForceNew: true, //TODO Can this be optional (resize)?
			},

			// TODO:
			//
			// * Add extra lifecycles (move, rename, etc). May not be possible
			// without breaking other resources though.
			// * Add validation (make sure it ends in .vmdk)
			"vmdk_path": {
				Type:     schema.TypeString,
				Required: true,
				ForceNew: true,
			},

			"datastore": {
				Type:     schema.TypeString,
				Required: true,
				ForceNew: true,
			},

			"type": {
				Type:     schema.TypeString,
				Optional: true,
				ForceNew: true,
				Default:  "eagerZeroedThick",
				ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
					value := v.(string)
					if value != "thin" && value != "eagerZeroedThick" && value != "lazy" {
						errors = append(errors, fmt.Errorf(
							"only 'thin', 'eagerZeroedThick', and 'lazy' are supported values for 'type'"))
					}
					return
				},
			},

			"adapter_type": {
				Type:     schema.TypeString,
				Optional: true,
				ForceNew: true,
				Default:  "lsiLogic",
				// TODO: Move this to removed after we remove the support to specify this in later versions
				Deprecated: "this attribute has no effect on controller types - please use scsi_type in vsphere_virtual_machine instead",
				ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
					value := v.(string)
					if value != "ide" && value != "busLogic" && value != "lsiLogic" {
						errors = append(errors, fmt.Errorf(
							"only 'ide', 'busLogic', and 'lsiLogic' are supported values for 'adapter_type'"))
					}
					return
				},
			},

			"datacenter": {
				Type:     schema.TypeString,
				Optional: true,
				ForceNew: true,
			},

			"create_directories": {
				Type:     schema.TypeBool,
				Optional: true,
				ForceNew: true,
			},
		},
	}
}
// Define VirtualDisk args