Skip to content

Using Cloud-Init to set an static IP in the virtual machine. #667

@donkerm

Description

@donkerm

Could somebody tell me the correct way to use cloud-init with this vcd provider?
I tried a lot of possibilities, but I can't get it working.
I can't find this option described in the documentation and maybe it's not possible.
Looking at #510 it should work.?
Please advise?

Terraform Version

Terraform v0.12.18

  • provider.template v2.2.0
  • provider.vcd v3.2.0
    vCloud 10.1

Affected Resource(s)

Static network configuration.

Terraform Configuration Files

In vm.tf
guest_properties = {
"user-data" = base64encode(file("test.yaml"))
}
network {
adapter_type = "VMXNET3"
type = "org"
name = vcd_vapp_org_network.direct-net.org_network_name
ip_allocation_mode = "MANUAL"
ip = "192.168.178.3"
mac = "de:ad:c0:de:ca:fe"
is_primary = true
connected = true
}

In test.yaml

  • content: |
    network:
    version: 2
    renderer: networkd
    ethernets:
    ens192:
    addresses: [192.168.178.3/24]
    gateway4: 192.168.178.1
    dhcp4: false
    nameservers:
    addresses: [8.8.8.8]
    path: /etc/netplan/50-cloud-init.yaml

No error and virtual machine template has Cloud-Init installed together with VMWare tools (latest).

Expected Behavior

Configuring an IP on the interface ens192.

Actual Behavior

No error's but also no configuration has been done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions