aliyun / terraform-provider-alicloud

Terraform AliCloud provider
https://www.terraform.io/docs/providers/alicloud/
Mozilla Public License 2.0
582 stars 548 forks source link

Query on the HAVIP support with Private IP and ENI attachment #6135

Open Rashmi0986 opened 1 year ago

Rashmi0986 commented 1 year ago

Hello ,

This is Rashmi BS from the PANW , we are looking for the terraform support for the HAVIP configuration with the ENI binding and Private Ip address configuration . I could see https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/havip_attachment

But it has mention that for an instance we can assign the vswitch but there is no mention of the IP address configuration .

In this link - https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/havip

it is mentioned that Ip_address should be specified else the Default will be assigned from HAVIP - which is unclear as there are two IP address exist . The IP address mentioned above i believe that private IP address but how to assign the EIP to the HAVIP is not mentioned . Please confirm if there are any enhancements planned for the same

Rashmi0986 commented 1 year ago

The requirement is to attach the havip Id to the Multiple ENI instances , do we have support for this please confirm .

I have tried to configure it in this way ,

configure Havip for two instances

resource "alicloud_havip" "havip-untrust" { vswitch_id = alicloud_vswitch.havip_untrust_vswitch_name.id ip_address = "10.51.5.100" }

resource "alicloud_havip_attachment" "havip-untrust" { havip_id = alicloud_havip.havip-untrust.id instance_id = alicloud_network_interface.auto-pavmqa-DATA[var.north_intf - 1].id instance_id = alicloud_network_interface.auto-pavmqa-DATA2[var.north_intf - 1].id instance_type = NetworkInterface }

But i could see the below error

The argument "instance_id" was already set at ali_terraform_HA.tf:346,5-16. Each argument may be set only once.

Ideally we will need to have the support for the HAVIP id attachment to Multiple ENI's which ali cloud supports today.

DctrG commented 1 year ago

Hey Rashmi. If you look at the API and Python SDK, you'll see this is not how the call is implemented and I don't think it's necessary, you just need to add a second attachment with the same HAVIP to the ENI of the other firewall:

resource "alicloud_havip_attachment" "havip-untrust-fw2" { havip_id = alicloud_havip.havip-untrust.id instance_id = alicloud_network_interface.auto-pavmqa-DATA2[var.north_intf - 1].id instance_type = NetworkInterface }

I hope it helps.

xiaozhu36 commented 4 months ago

HI @Rashmi0986 As the @DctrG mentioned, you can add a second attachment to meet your requirement. Please let me know it works or if you have more question. Thanks.