terraform-provider-fortios
terraform-provider-fortios copied to clipboard
Unable to set `ldb_method` to something else than `static`.
Hi All,
I am using the v1.15.0 to set a fortios_firewall_vip
and I seem to be unable to change the ldb_method to something else than static
.
Given the following terraform:
resource "fortios_firewall_vip" "vip" {
name = "test_virtual_server"
type = "server-load-balance"
dynamic_sort_subtable = true
server_type = "tcp"
extintf = "any"
extip = "10.255.0.201"
extport = "1337"
ldb_method = "first-active"
dynamic "realservers" {
for_each = local.serverts
content {
type="ip"
ip=realservers.value
port="22"
status="active"
healthcheck="enable"
monitor = "\"test_health_check\""
}
}
monitor {
name="test_health_check"
}
}
When I try to apply, the terraform run completes succesfully and says:
# fortios_firewall_vip.vip will be updated in-place
~ resource "fortios_firewall_vip" "vip" {
id = "test_virtual_server"
~ ldb_method = "static" -> "first-alive"
name = "test_virtual_server"
# (57 unchanged attributes hidden)
# (4 unchanged blocks hidden)
}
But nothing changes in the fortigate itself.
Am I doing something wrong here?
Thanks!
Hi @jzandbergen,
Thank you for raising this issue. This issue will occur when setting argument server_type
to tcp
at the same time. Somehow, argument ldb_method
could not be set to value other than static
when argument server_type
also exist for the HTTP request. We have created an internal ticket to track this issue, and we will work with the related team to find a solution. We will get back to you once we have any update.
Thanks, Xing
any updates on this?
Still does not work. Cannot set ldb_method = "least-session"
resource "fortios_firewall_vip" "example" {
...
type = "server-load-balance"
server_type = "tcp"
ldb_method = "least-session"
extport = "443"
...
monitor {
name = "name_of_my_monitor"
}
}
Hello. I have just tested this with CURL, and it works. However I had to figure out correct JSON payload. The one I copied from Fortinet OS preview, I assumed payload should be:
{
"data": {
"ldb-method": "round-robin",
"extport": 443
}
}
Running this command shows no change, in fact resets load balancing method to static.
curl -k -XPUT -H "Authorization: Bearer xxxxxxx" --data @data.json https://1.2.3.4/api/v2/cmdb/firewall/vip/my-test-vip
{
"http_method":"PUT",
"revision":"xxxxxxxxxxxxxxxxxxxxxxxxxx",
"revision_changed":false,
"mkey":"my-test-vip",
"status":"success",
"http_status":200,
"vdom":"root",
"path":"firewall",
"name":"vip",
"serial":"FGXXXXXXXXXX",
"version":"v7.2.7",
"build":1577
}
However, when I changed payload to this, my curl command worked and I am able to change load balancer method. Working JSON:
{
"ldb-method": "round-robin",
"extport": 443
}
Could it be that terraform provider is sending payload in a wrong format?
@lix-fortinet maybe above comment is of any help?