-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
xenorchestra_bonded_network
resource (#253)
* First attempt on bonded support. Implemented within the existing xenorchestra_network resource * Change implementation approach to use a separate resource * Remove stale comments and commented code * Add documentation for xenorchestra_bonded_network * Minor comment edits * Add example for using PIFs on a VLAN and remove unnecessary print statement
- Loading branch information
Showing
9 changed files
with
597 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "xenorchestra_bonded_network Resource - terraform-provider-xenorchestra" | ||
subcategory: "" | ||
description: |- | ||
A resource for managing Bonded Xen Orchestra networks. See the XCP-ng networking docs https://xcp-ng.org/docs/networking.html for more details. | ||
--- | ||
|
||
# xenorchestra_bonded_network (Resource) | ||
|
||
A resource for managing Bonded Xen Orchestra networks. See the XCP-ng [networking docs](https://xcp-ng.org/docs/networking.html) for more details. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "xenorchestra_host" "host1" { | ||
name_label = "Your host" | ||
} | ||
data "xenorchestra_pif" "eth1" { | ||
device = "eth1" | ||
vlan = -1 | ||
host_id = data.xenorchestra_host.host1.id | ||
} | ||
data "xenorchestra_pif" "eth2" { | ||
device = "eth2" | ||
vlan = -1 | ||
host_id = data.xenorchestra_host.host1.id | ||
} | ||
# Create a bonded network from normal PIFs | ||
resource "xenorchestra_bonded_network" "network" { | ||
name_label = "new network name" | ||
bond_mode = "active-backup" | ||
pool_id = data.xenorchestra_host.host1.pool_id | ||
pif_ids = [ | ||
data.xenorchestra_pif.eth1.id, | ||
data.xenorchestra_pif.eth2.id, | ||
] | ||
} | ||
# Create a bonded network from PIFs on VLANs | ||
data "xenorchestra_pif" "eth1_vlan" { | ||
device = "eth1" | ||
vlan = 15 | ||
host_id = data.xenorchestra_host.host1.id | ||
} | ||
data "xenorchestra_pif" "eth2_vlan" { | ||
device = "eth2" | ||
vlan = 15 | ||
host_id = data.xenorchestra_host.host1.id | ||
} | ||
# Create a bonded network from normal PIFs | ||
resource "xenorchestra_bonded_network" "network_vlan" { | ||
name_label = "new network name" | ||
bond_mode = "active-backup" | ||
pool_id = data.xenorchestra_host.host1.pool_id | ||
pif_ids = [ | ||
data.xenorchestra_pif.eth1_vlan.id, | ||
data.xenorchestra_pif.eth2_vlan.id, | ||
] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `name_label` (String) The name label of the network. | ||
- `pool_id` (String) The pool id that this network should belong to. | ||
|
||
### Optional | ||
|
||
- `automatic` (Boolean) | ||
- `bond_mode` (String) The bond mode that should be used for this network. | ||
- `default_is_locked` (Boolean) This argument controls whether the network should enforce VIF locking. This defaults to `false` which means that no filtering rules are applied. | ||
- `mtu` (Number) The MTU of the network. Defaults to `1500` if unspecified. | ||
- `name_description` (String) | ||
- `pif_ids` (List of String) The pifs (uuid) that should be used for this network. | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. |
50 changes: 50 additions & 0 deletions
50
examples/resources/xenorchestra_bonded_network/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
data "xenorchestra_host" "host1" { | ||
name_label = "Your host" | ||
} | ||
|
||
data "xenorchestra_pif" "eth1" { | ||
device = "eth1" | ||
vlan = -1 | ||
host_id = data.xenorchestra_host.host1.id | ||
} | ||
|
||
data "xenorchestra_pif" "eth2" { | ||
device = "eth2" | ||
vlan = -1 | ||
host_id = data.xenorchestra_host.host1.id | ||
} | ||
|
||
# Create a bonded network from normal PIFs | ||
resource "xenorchestra_bonded_network" "network" { | ||
name_label = "new network name" | ||
bond_mode = "active-backup" | ||
pool_id = data.xenorchestra_host.host1.pool_id | ||
pif_ids = [ | ||
data.xenorchestra_pif.eth1.id, | ||
data.xenorchestra_pif.eth2.id, | ||
] | ||
} | ||
|
||
# Create a bonded network from PIFs on VLANs | ||
data "xenorchestra_pif" "eth1_vlan" { | ||
device = "eth1" | ||
vlan = 15 | ||
host_id = data.xenorchestra_host.host1.id | ||
} | ||
|
||
data "xenorchestra_pif" "eth2_vlan" { | ||
device = "eth2" | ||
vlan = 15 | ||
host_id = data.xenorchestra_host.host1.id | ||
} | ||
|
||
# Create a bonded network from normal PIFs | ||
resource "xenorchestra_bonded_network" "network_vlan" { | ||
name_label = "new network name" | ||
bond_mode = "active-backup" | ||
pool_id = data.xenorchestra_host.host1.pool_id | ||
pif_ids = [ | ||
data.xenorchestra_pif.eth1_vlan.id, | ||
data.xenorchestra_pif.eth2_vlan.id, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.