Hello - I am new to Pulumi. Currently having issue...
# yaml
p
Hello - I am new to Pulumi. Currently having issues deploying to a local vCenter using vsphere provider. Just wondering if anyone here has any experience deploying to Vsphere?
b
hi there! yes I’ve had this working, here’s an example: https://github.com/jaxxstorm/pulumi-examples/blob/main/python/vmware/__main__.py
what errors are you getting/running into?
p
Thanks for replying. I'm getting the following errors:
Copy code
error: List<vsphere:index/VirtualMachineDisk:VirtualMachineDisk> is not assignable from {label: string, size: number, thinProvisioned: boolean}

      on Pulumi.yaml line 47:
      47:       disks:

    Cannot assign '{label: string, size: number, thinProvisioned: boolean}' to 'List<vsphere:index/VirtualMachineDisk:VirtualMachineDisk>'
    error: List<vsphere:index/VirtualMachineNetworkInterface:VirtualMachineNetworkInterface> is not assignable from {networkId: string}

      on Pulumi.yaml line 51:
      51:       networkInterfaces:

    Cannot assign '{networkId: string}' to 'List<vsphere:index/VirtualMachineNetworkInterface:VirtualMachineNetworkInterface>'
    error: vsphere:index/VirtualMachineClone:VirtualMachineClone is not assignable from {templateUuid: string, customize: {networkInterfaces: {dnsDomain: string}, linuxOptions: {domain: string, hostName: string}, ipv4Gateway: string}}

      on Pulumi.yaml line 53:
      53:       clone:

    Cannot assign '{templateUuid: string, customize: {networkInterfaces: {dnsDomain: string}, linuxOptions: {domain: string, hostName: string}, ipv4Gateway: string}}' to 'vsphere:index/VirtualMachineClone:VirtualMachineClone':
      customize: Cannot assign '{networkInterfaces: {dnsDomain: string}, linuxOptions: {domain: string, hostName: string}, ipv4Gateway: string}' to 'vsphere:index/VirtualMachineCloneCustomize:VirtualMachineCloneCustomize':
        networkInterfaces: Cannot assign '{dnsDomain: string}' to 'List<vsphere:index/VirtualMachineCloneCustomizeNetworkInterface:VirtualMachineCloneCustomizeNetworkInterface>'
Copy code
name: vsphere
description: VM deployment to vsphere
runtime: yaml
configuration: {}
variables:
  dcid:
    Fn::Invoke:
      Function: vsphere:index/getDatacenter:getDatacenter
      Arguments:
        name: "AVDE"
      Return: id
  clusterinfo:
    Fn::Invoke:
      Function: vsphere:index/getComputeCluster:getComputeCluster
      Arguments:
        name: "AVDE Cluster"
        datacenterId: "${dcid}"
  datastoreid:
    Fn::Invoke:
      Function: vsphere:index/getDatastore:getDatastore
      Arguments:
        name: "Pure-VVol"
        datacenterId: ${dcid}
      Return: id
  netid:
    Fn::Invoke:
      Function: vsphere:index/getNetwork:getNetwork
      Arguments:
        name: "225 - AVDE-Evaluation"
        datacenterId: ${dcid}
      Return: id
  template:
    Fn::Invoke:
      Function: vsphere:index/getVirtualMachine:getVirtualMachine
      Arguments: {}
resources:
  vsphere:
    type: vsphere:VirtualMachine
    properties:
      resourcePoolId: ${clusterinfo.resourcePoolId}
      datastoreId: ${datastoreid}
      name: "terraform-vm"
      memory: 2048
      cpuLimit: 2
      folder: "Evaluation"
      guestId: "rhel8_64Guest"
      disks:
        label: "disktf"
        size: 70
        thinProvisioned: true
      networkInterfaces:
        networkId: ${netid}
      clone:
        templateUuid: ${template.id}
        customize:
          networkInterfaces:
            dnsDomain: "<http://example.net|example.net>"
          linuxOptions:
            domain: "terraform-vm"
            hostName: "<http://example.net|example.net>"
          ipv4Gateway: "10.57.225.1"
I'm most likely missing something. I am not sure why my variables aren't working.
b
it looks like you’re not passing the right type disks is an array: https://www.pulumi.com/registry/packages/vsphere/api-docs/virtualmachine/#virtualmachinedisk as is network interfaces: https://www.pulumi.com/registry/packages/vsphere/api-docs/virtualmachine/#virtualmachinenetworkinterface So it’d be:
Copy code
disks:
      - label: "disktf"
        size: 70
        thinProvisioned: true
      networkInterfaces:
       -
1
p
Thank you so much!! that fixed the issue! Cheers!🎉