FlexibleEngineCloud / terraform-provider-flexibleengine

Terraform flexibleengine provider
https://www.terraform.io/docs/providers/flexibleengine/
Mozilla Public License 2.0
30 stars 53 forks source link

Assign multiple fixed ipaddress to a port #445

Closed kchenhal closed 3 years ago

kchenhal commented 3 years ago

I am trying to create neutron port with multiple fixed ipaddress, when I apply it, got the following error:

module.instances.flexibleengine_networking_port_v2.test[0]: Creating...

Error: Error creating FlexibleEngine Neutron network: Bad request with: [POST https://vpc.eu-west-0.prod-cloud-ocb.orange-business.com/v2.0/ports], error message: {"NeutronError":{"message":"One port can only set one ipaddress","type":"InvalidInput","detail":""}}

here is the TF code

resource "flexibleengine_networking_port_v2" "test" {
    count           = 1
    admin_state_up  = "true"
    network_id       = var.db_subnets[count.index].id
    fixed_ip {     
      subnet_id     = var.db_subnets[count.index].subnet_id
      ip_address    = cidrhost(var.db_subnets[count.index].cidr, 20)
    }
    fixed_ip {
      subnet_id     = var.db_subnets[count.index].subnet_id
      ip_address    = cidrhost(var.db_subnets[count.index].cidr, 21)
    }
    fixed_ip {
      subnet_id     = var.db_subnets[count.index].subnet_id
      ip_address    = cidrhost(var.db_subnets[count.index].cidr, 22)
    }
}

I intend to attach this port an instance via flexibleengine_compute_interface_attach_v2

./terraform version

Terraform v0.13.5
+ provider registry.terraform.io/flexibleenginecloud/flexibleengine v1.16.1

Your version of Terraform is out of date! The latest version
is 0.14.4. You can update by downloading from https://www.terraform.io/downloads.html

Thanks

osaluden commented 3 years ago

Hello @kchenhal , it is indeed not possible to associate multiple IP addresses to an ECS this way. I can see to options:

kchenhal commented 3 years ago

Thanks Olivier. I will try the VIP approach. what is the different between vip and private ip used in the neutron port? will the client be able to use vip to connect to the server?

osaluden commented 3 years ago

Actually a VIP is the way (in a sort) to associate an IP address to a MAC at Neutron level (the network manager). So the IP packets for this VIP will be routed to the Neutron port of the ECS you associated to. At ECS level, do not forget to declare the VIP as a secondary IP of the network interface (ex: eth0 for the primary, eth0:1 for the secondary, eth0:2 for the third and so on), the Virtual Network Interface method for Linux: https://linuxconfig.org/configuring-virtual-network-interfaces-in-linux

kchenhal commented 3 years ago

thanks! @osaluden