Skip to content

Commit

Permalink
docs: network_interface update
Browse files Browse the repository at this point in the history
Updated network interface markdown file to try to better explain network interface order

Closes #2101

Signed-off-by: Jared Burns <jared.burns@broadcom.com>
  • Loading branch information
burnsjared0415 committed Sep 6, 2024
1 parent 5d7a516 commit b309bed
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ BUG FIX:
* `resource/vsphere_resource_pool`: Removes the default setting for `scale_descendants_shares` to
allows for inheritance from the parent resource pool.
([#2255]https://github.com/hashicorp/terraform-provider-vsphere/pull/2255)

DOCUMENTATION:
* updated `virtual_machine.html.markdown` to include clarification of network_interface assignment.
([#2256]https://github.com/hashicorp/terraform-provider-vsphere/pull/2256)

## 2.9.0 (September 3, 2024)

Expand Down
35 changes: 32 additions & 3 deletions website/docs/r/virtual_machine.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -963,20 +963,49 @@ Interfaces are assigned to devices in the order declared in the configuration an

**Example**:

data "vsphere_network" "routable" {
name = var.routable_network
datacenter_id = data.vsphere_datacenter.datacenter.id
}

data "vsphere_network" "not_routable" {
name = "var.non_routable_network"
datacenter_id = data.vsphere_datacenter.datacenter.id
}

```hcl
resource "vsphere_virtual_machine" "vm" {
# ... other configuration ...
network_interface {
network_id = data.vsphere_network.public.id
network_id = data.vsphere_network.routable.id
}
network_interface {
network_id = data.vsphere_network.private.id
network_id = data.vsphere_network.non_routable.id
}
# ... other configuration ...
}
clone {
template_uuid = data.vsphere_virtual_machine.template.id
customize {
linux_options {
host_name = "foo"
domain = "example.com
}
network_interface {
ipv4_address = "10.0.0.10"
ipv4_netmask = 24
}
network_interface {
ipv4_address = "172.16.0.10"
ipv4_netmask = 24
}
ipv4_gateway = "10.0.0.1"
}
}
```

In the above example, the first interface is assigned to the `public` network and will also appear first in the interface order. The second interface is assigned to the `private` network. On some Linux distributions, first interface may be presented as `eth0` and the second may be presented as `eth1`.
In the above example, the first interface is assigned to the `routable` based on order of sequential order which in this case the first network to be assigned a ip address would be the routable network i.e. `10.0.0.10`. The second interface is assigned to the `non_routeable` network i.e. `172.16.0.10`. On some Linux distributions, first interface may be presented as `eth0` and the second may be presented as `eth1`.

The options are:

Expand Down

0 comments on commit b309bed

Please # to comment.