fortinetdev / terraform-provider-fortios

Terraform Fortios provider
https://www.terraform.io/docs/providers/fortios/
Mozilla Public License 2.0
69 stars 50 forks source link

import for `fortios_firewall_vip` does not import `real_servers` block #287

Closed maikelpoot closed 2 months ago

maikelpoot commented 1 year ago

When importing an existing virtual server into terraform the real_servers block isn't loaded into the state.

This causes 2 problems:

  1. Terraform doesn't update the state on a refresh, so changes made outside of terraform are not noticed and doesn't trigger an update to enforce terraform configuration.

  2. First plan/apply after the import triggers a in-place update to add the real server config. In my tests this doesn't cause an error or duplicate real_servers in fortigate but you can't see if this changes the live configuration.

Using:

Reproduce:

Import virtual server:

$ terraform import 'fortios_firewall_vip.vserver' LB-TEST
...
Import successful!
...

Check state, should return 2 lines, but returns 0

$ terraform state show 'fortios_firewall_vip.vserver' | grep real_server | wc -l
       0
MaxxLiu22 commented 1 year ago

Hi @maikelpoot ,

Thank you for raising this issue, I can reproduce it, this issue is similar with https://github.com/fortinetdev/terraform-provider-fortios/issues/267#issue-1660584313, I have reported them to the development team for further investigation.

Thanks, Maxx

MaxxLiu22 commented 2 months ago

Hi @maikelpoot

I try to reproduce this issue with Terraform FOS 1.21.0, but it did not recur after running exportFORTIOS_IMPORT_TABLE=true and importing the fortios_firewall_vip. Therefore, I will proceed to close this case. If you have any further questions or need additional assistance, please feel free to reopen this case or open a new one, and we will be happy to help.

Thank you, Maxx