Skip to content

Commit

Permalink
doc: update version and example in index.md + added example for multi…
Browse files Browse the repository at this point in the history
…ple NICs on an IP Failover (#242)
  • Loading branch information
iblindu authored Mar 18, 2022
1 parent 5d8a159 commit 9972a15
Show file tree
Hide file tree
Showing 6 changed files with 249 additions and 35 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
### Documentation
- improved all the examples to be ready to use
- added units where missing
- added example for adding a secondary NIC to an IP Failover
- updated provider version to the latest release in main registry page

### Enhancement
- add `allow_replace` to node pool resource, which allows the update of immutable node_pool fields will first
Expand Down
75 changes: 40 additions & 35 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ terraform {
required_providers {
ionoscloud = {
source = "ionos-cloud/ionoscloud"
version = "= 6.0.0-alpha.3"
version = "= 6.2.1"
}
}
}
Expand Down Expand Up @@ -201,41 +201,46 @@ An example of overwriting the `create`, `update`, and `delete` timeouts:

```hcl
resource "ionoscloud_server" "example" {
name = "server"
datacenter_id = "${ionoscloud_datacenter.example.id}"
cores = 1
ram = 1024
availability_zone = "ZONE_1"
cpu_family = "AMD_OPTERON"
volume {
name = "new"
image_name = "${var.ubuntu}"
size = 5
disk_type = "SSD"
ssh_key_path = "${var.private_key_path}"
image_password = "test1234"
}
nic {
lan = "${ionoscloud_lan.example.id}"
dhcp = true
ip = "${ionoscloud_ipblock.example.ips[0]}"
firewall_active = true
firewall {
protocol = "TCP"
name = "SSH"
port_range_start = 22
port_range_end = 22
name = "Server Example"
datacenter_id = ionoscloud_datacenter.example.id
cores = 1
ram = 1024
availability_zone = "ZONE_1"
cpu_family = "AMD_OPTERON"
image_name = data.ionoscloud_image.example.id
image_password = "K3tTj8G14a3EgKyNeeiY"
type = "ENTERPRISE"
volume {
name = "system"
size = 5
disk_type = "SSD Standard"
user_data = "foo"
bus = "VIRTIO"
availability_zone = "ZONE_1"
}
nic {
lan = ionoscloud_lan.example.id
name = "system"
dhcp = true
firewall_active = true
firewall_type = "BIDIRECTIONAL"
ips = [ ionoscloud_ipblock.example.ips[0], ionoscloud_ipblock.example.ips[1] ]
firewall {
protocol = "TCP"
name = "SSH"
port_range_start = 22
port_range_end = 22
source_mac = "00:0a:95:9d:68:17"
source_ip = ionoscloud_ipblock.example.ips[2]
target_ip = ionoscloud_ipblock.example.ips[3]
type = "EGRESS"
}
}
timeouts {
create = "30m"
update = "300s"
delete = "2h"
}
}
timeouts {
create = "30m"
update = "300s"
delete = "2h"
}
}
```
Expand Down
12 changes: 12 additions & 0 deletions docs/resources/ipfailover.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,15 @@ Resource IpFailover can be imported using the `resource id`, e.g.
```shell
terraform import ionoscloud_ipfailover.myipfailover {datacenter uuid}/{lan uuid}
```


## A note on multiple NICs on an IP Failover
If you want to add a secondary NIC to an IP Failover, follow these steps:
1) Creating NIC A with failover IP on LAN 1
2) Create NIC B unde the same LAN but with a different IP
3) Create the IP Failover on LAN 1 with NIC A and failover IP of NIC A (A becomes now "master", no slaves)
4) Update NIC B IP to be the failover IP ( B becomes now a slave, A remains master)

After this you can create a new NIC C, NIC D and so on, in LAN 1, directly with the failover IP.

Please check [examples](../../examples/ip_failover) for a full example with the above steps.
11 changes: 11 additions & 0 deletions examples/ip_failover/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Multiple NICs under the same IP Failover

This example aims to exemplify the way in which a secondary NIC can be added to an IP Failover, following these steps:
1) Creating NIC A with failover IP on LAN 1
2) Create NIC B unde the same LAN but with a different IP
3) Create the IP Failover on LAN 1 with NIC A and failover IP of NIC A (A becomes now "master", no slaves)
4) Update NIC B IP to be the failover IP ( B becomes now a slave, A remains master)

To test this please run firstly [the main.tf from inital_structure folder](initial_infrastructure/main.tf), followed by [the one in update_nic folder](update_nic/main.tf).

After this you can create a new NIC C, NIC D and so on, in LAN 1, directly with the failover IP.
92 changes: 92 additions & 0 deletions examples/ip_failover/initial_infrastructure/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
terraform {
required_version = "> 0.12.0"
required_providers {
ionoscloud = {
source = "ionos-cloud/ionoscloud"
version = "6.2.0"
}
}
}

provider "ionoscloud" {}

data "ionoscloud_image" "example" {
type = "HDD"
cloud_init = "V1"
location = "us/las"
}

resource "ionoscloud_datacenter" "example" {
name = "Datacenter Example"
location = "us/las"
description = "Datacenter Description"
sec_auth_protection = false
}

resource "ionoscloud_lan" "example" {
datacenter_id = ionoscloud_datacenter.example.id
public = true
name = "Lan Example"
}

resource "ionoscloud_ipblock" "example" {
location = ionoscloud_datacenter.example.location
size = 2
name = "IP Block Example"
}

resource "ionoscloud_server" "example_A" {
name = "Server A"
datacenter_id = ionoscloud_datacenter.example.id
cores = 1
ram = 1024
availability_zone = "ZONE_1"
cpu_family = "AMD_OPTERON"
image_name = data.ionoscloud_image.example.id
image_password = "K3tTj8G14a3EgKyNeeiY"
volume {
name = "system"
size = 14
disk_type = "SSD"
}
nic {
name = "NIC A"
lan = ionoscloud_lan.example.id
dhcp = true
firewall_active = true
ips = [ ionoscloud_ipblock.example.ips[0] ]
}
}


resource "ionoscloud_server" "example_B" {
name = "Server B"
datacenter_id = ionoscloud_datacenter.example.id
cores = 1
ram = 1024
availability_zone = "ZONE_1"
cpu_family = "AMD_OPTERON"
image_name = data.ionoscloud_image.example.id
image_password = "K3tTj8G14a3EgKyNeeiY"
volume {
name = "system"
size = 14
disk_type = "SSD"
}
nic {
name = "NIC B"
lan = ionoscloud_lan.example.id
dhcp = true
firewall_active = true
ips = [ ionoscloud_ipblock.example.ips[1] ]
}
}


resource "ionoscloud_ipfailover" "example" {
depends_on = [ ionoscloud_lan.example ]
datacenter_id = ionoscloud_datacenter.example.id
lan_id = ionoscloud_lan.example.id
ip = ionoscloud_ipblock.example.ips[0]
nicuuid = ionoscloud_server.example_A.primary_nic
}
92 changes: 92 additions & 0 deletions examples/ip_failover/update_nic/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
terraform {
required_version = "> 0.12.0"
required_providers {
ionoscloud = {
source = "ionos-cloud/ionoscloud"
version = "6.2.0"
}
}
}

provider "ionoscloud" {}

data "ionoscloud_image" "example" {
type = "HDD"
cloud_init = "V1"
location = "us/las"
}

resource "ionoscloud_datacenter" "example" {
name = "Datacenter Example"
location = "us/las"
description = "Datacenter Description"
sec_auth_protection = false
}

resource "ionoscloud_lan" "example" {
datacenter_id = ionoscloud_datacenter.example.id
public = true
name = "Lan Example"
}

resource "ionoscloud_ipblock" "example" {
location = ionoscloud_datacenter.example.location
size = 2
name = "IP Block Example"
}

resource "ionoscloud_server" "example_A" {
name = "Server A"
datacenter_id = ionoscloud_datacenter.example.id
cores = 1
ram = 1024
availability_zone = "ZONE_1"
cpu_family = "AMD_OPTERON"
image_name = data.ionoscloud_image.example.id
image_password = "K3tTj8G14a3EgKyNeeiY"
volume {
name = "system"
size = 14
disk_type = "SSD"
}
nic {
name = "NIC A"
lan = ionoscloud_lan.example.id
dhcp = true
firewall_active = true
ips = [ ionoscloud_ipblock.example.ips[0] ]
}
}


resource "ionoscloud_server" "example_B" {
name = "Server B"
datacenter_id = ionoscloud_datacenter.example.id
cores = 1
ram = 1024
availability_zone = "ZONE_1"
cpu_family = "AMD_OPTERON"
image_name = data.ionoscloud_image.example.id
image_password = "K3tTj8G14a3EgKyNeeiY"
volume {
name = "system"
size = 14
disk_type = "SSD"
}
nic {
name = "NIC B"
lan = ionoscloud_lan.example.id
dhcp = true
firewall_active = true
ips = [ ionoscloud_ipblock.example.ips[0] ]
}
}


resource "ionoscloud_ipfailover" "example" {
depends_on = [ ionoscloud_lan.example ]
datacenter_id = ionoscloud_datacenter.example.id
lan_id = ionoscloud_lan.example.id
ip = ionoscloud_ipblock.example.ips[0]
nicuuid = ionoscloud_server.example_A.primary_nic
}

0 comments on commit 9972a15

Please sign in to comment.