ionos-cloud / terraform-provider-ionoscloud

The IonosCloud Terraform provider gives the ability to deploy and configure resources using the IonosCloud APIs.
Mozilla Public License 2.0
35 stars 24 forks source link

Nic should have multiple ips #47

Closed arteonprifti closed 3 years ago

arteonprifti commented 3 years ago

Description

for the nic resources the ip should be a list of string and not a string https://devops.ionos.com/api/cloud/v5/#network-interfaces

this would solve the issue of adding a slave to the failoverip

curl --include \
     --request PATCH \
     -n \
     --header "Content-Type: application/json" \
     --data-binary '    {
         "name": "Heartbeat NIC",
         "ips" : [ "85.215.229.77", "85.215.249.8" ]
       }
    }' \
     https://api.ionos.com/cloudapi/v5/datacenters/2ede419f-c4d9-4951-89c4-e7e74cd61523/servers/99dfd250-4e87-4ead-8c82-59d7a86f31b4/nics/0de6e510-cd66-4133-8872-35513e0c7b36

Expected behavior

add multiple ips to nic

Environment

Terraform version: 0.15.5 Provider version: 5.2.2 OS: Ubuntu 20.04

Configuration Files

How to Reproduce


resource "ionoscloud_server" "example2" {
  name              = "server2"
  datacenter_id     = "${ionoscloud_datacenter.example.id}"
  cores             = 1
  ram               = 1024
  availability_zone = "ZONE_1"
  image_password    = "test1234"
  ssh_key_path      = ["id_rsa.pub"]
  image_name        = "ubuntu:latest"

  volume {
    name           = "new"
    size           = 5
    disk_type      = "SSD"
  }

  nic {
    lan             = "${ionoscloud_lan.example.id}"
    dhcp            = true
//    ip              = "${ionoscloud_ipblock.example.ips[1]}"
    ip             = ["${ionoscloud_ipblock.example.ips[1]}","${ionoscloud_ipblock.example.ips[0]}"]
    firewall_active = false
  }
}

Error and Debug Output

Error: Incorrect attribute value type
│ 
│   on main.tf line 76, in resource "ionoscloud_server" "example2":
│   76:     ip             = ["${ionoscloud_ipblock.example.ips[1]}","${ionoscloud_ipblock.example.ips[0]}"]
│     ├────────────────
│     │ ionoscloud_ipblock.example.ips[0] will be known only after apply
│     │ ionoscloud_ipblock.example.ips[1] will be known only after apply
│ 
│ Inappropriate value for attribute "ip": string required.

Additional Notes

References

https://devops.ionos.com/api/cloud/v5/#network-interfaces

iblindu commented 3 years ago

@arteonprifti I am currently working on it and as soon at it's ready a new version will be available with this issue solved

iblindu commented 3 years ago

@arteonprifti please check v5.2.4