terraform-provider-fortios
terraform-provider-fortios copied to clipboard
fosid requirement on fortios_systemdhcp_server
We are trying to understand why it is required to provide the fosid for fortios_systemdhcp_server.
We are creating interfaces and the associated dhcp servers using Terraform. Hence these objects are new we are setting fosid to 0 (similar how you would add a new entry on CLI using "edit 0"). However because of this the dhcp servers get destroyed and recreated every time we apply. Please see below the output of terraform apply (when ran for the second time, with no changes in-between).
Terraform will perform the following actions:
# fortios_systemdhcp_server.dhcp_server["DL.62"] must be replaced
-/+ resource "fortios_systemdhcp_server" "dhcp_server" {
~ auto_configuration = "enable" -> (known after apply)
~ auto_managed_status = "enable" -> (known after apply)
~ conflicted_ip_timeout = 1800 -> (known after apply)
~ ddns_auth = "disable" -> (known after apply)
+ ddns_key = (sensitive value)
+ ddns_keyname = (known after apply)
~ ddns_server_ip = "0.0.0.0" -> (known after apply)
~ ddns_ttl = 300 -> (known after apply)
~ ddns_update = "disable" -> (known after apply)
~ ddns_update_override = "disable" -> (known after apply)
+ ddns_zone = (known after apply)
~ dhcp_settings_from_fortiipam = "disable" -> (known after apply)
~ dns_server1 = "0.0.0.0" -> (known after apply)
~ dns_server2 = "0.0.0.0" -> (known after apply)
~ dns_server3 = "0.0.0.0" -> (known after apply)
~ dns_server4 = "0.0.0.0" -> (known after apply)
+ domain = (known after apply)
+ filename = (known after apply)
~ forticlient_on_net_status = "enable" -> (known after apply)
~ fosid = 8 -> 0 # forces replacement
Please can you advise why specifying fosid is required and if there's a way around this.
Hi @zippanto,
Thank you for raising this issue. fosid
is the id
of this resource. To separate it with Terraform internal id
, we name it fosid
. It is required because it is the primary key of the resource. But, yes, 0
is the default value for id
in REST API, and it is not required. By setting it to 0
, FortiOS will auto-generate an ID for it based on your existing items, rather than create a new entry with ID 0. Team are working on this issue, and we will get back to you once it's resolved.
Thanks, Xing
Hi @zippanto,
This issue has been fixed in the latest release of FortiOS Terraform provider v1.16.0. Please switch to the latest version of FortiOS Terraform provider and try it again.
Please let me know if you have any questions.
Thanks, Xing