diff --git a/CHANGELOG.md b/CHANGELOG.md index 06852f347..79c4df158 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/index.md b/docs/index.md index 8a083e1a2..8c2798cff 100644 --- a/docs/index.md +++ b/docs/index.md @@ -150,7 +150,7 @@ terraform { required_providers { ionoscloud = { source = "ionos-cloud/ionoscloud" - version = "= 6.0.0-alpha.3" + version = "= 6.2.1" } } } @@ -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" - } } ``` diff --git a/docs/resources/ipfailover.md b/docs/resources/ipfailover.md index f1eb54eeb..1ac28efd2 100644 --- a/docs/resources/ipfailover.md +++ b/docs/resources/ipfailover.md @@ -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. \ No newline at end of file diff --git a/examples/ip_failover/README.md b/examples/ip_failover/README.md new file mode 100644 index 000000000..be9c65574 --- /dev/null +++ b/examples/ip_failover/README.md @@ -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. \ No newline at end of file diff --git a/examples/ip_failover/initial_infrastructure/main.tf b/examples/ip_failover/initial_infrastructure/main.tf new file mode 100644 index 000000000..cc2769a5c --- /dev/null +++ b/examples/ip_failover/initial_infrastructure/main.tf @@ -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 +} \ No newline at end of file diff --git a/examples/ip_failover/update_nic/main.tf b/examples/ip_failover/update_nic/main.tf new file mode 100644 index 000000000..1e255fcf6 --- /dev/null +++ b/examples/ip_failover/update_nic/main.tf @@ -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 +} \ No newline at end of file