fortinetdev / terraform-provider-fortios

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

Importing resources with vdomparam #324

Open zippanto opened 2 months ago

zippanto commented 2 months ago

Hi,

I guess this is somewhat related to #320?

We are managing a firewall that has multiple VDOMs. We don't specify a vdom on the provider. We do specify the vdom / vdomparam attribute on the resources though. This allows us to manage resources in multiple VDOMs using a single provider. This has been working well.

However recently we noticed that imports are not working correctly. It seems like when we run import against a resource that has vdom / vdomparam set, terraform tries to import the resource from the root VDOM. Temporarily (for the duration of running the import command) adding vdom attribute to the provider and then running the same import command is successful and the results are as expected.

Example resources: fortios_system_sdwan fortios_router_static fortios_routerbgp_neighbor

Please could this be looked into. Please let us know if you require as to provide any snippets or logs.

Thanks.

MaxxLiu22 commented 1 month ago

Hi @zippanto,

Thank you for raising this issue. Currently, when using the import function, Terraform does not read any information from resources; it only reads the VDOM info from the provider. If VDOM is not set, it defaults to "root". For now, we can set VDOM in the provider temporarily and remove it after importing. I have reported this to the development team to check if that is possible to explore alternative methods for a more flexible import process.

Thanks, Maxx