Hey,
I am trying to use the restapi provider for some Infoblox objects, since the official provider does not support all of them. Unfortunately I am facing some problems and I don't know if the issue is my configuration or if it is simply not supported.
My current terraform configuration looks like this:
terraform {
required_providers {
restapi = {
source = "Mastercard/restapi"
version = "3.0.0-rc1"
}
}
}
provider "restapi" {
uri = "https://infoblox-endpoint.com"
debug = true
write_returns_object = true
username = "infobloxuser"
password = "secret"
insecure = true
headers = {
"Content-Type" = "application/json"
}
}
resource "restapi_object" "terraform_test_monitor_icmp" {
path = "/wapi/v2.12.3/dtc:monitor:icmp"
create_path = "/wapi/v2.12.3/dtc:monitor:icmp?_return_fields=name"
read_path = "/wapi/v2.12.3/{id}"
update_path = "/wapi/v2.12.3/{id}?_return_fields=name"
data = jsonencode({
name = "terraform_test_monitor_icmp1"
})
id_attribute = "_ref"
}
When creating an object, the Infoblox API either responds just with a string containing the object's ID or with the key "_ref" (only when "?_return_fields" is used).
When reading an object there is always the "_ref" key added to the response, no matter which "?_return_fields" are used.
Because of this, a terraform plan will always do a change, since it compares the current config containing only the name, with the target's config, always returning the name and the "_ref" ID.
It works, if I add an ignore_changes_to = ["_ref"] to the config.
But when I update an object, the Infoblox API will give you a new ID (_ref). Since "_ref" is ignored, this won't update and fail.
I've also tried ignore_server_additions = true, which unfortunately didn't help either.
And when using "read_search" and remove the "_ref" key there it also doesn't work, sice the update will not get an ID (I thought it was limited to read actions).
Is there any way to get this to work or is it just not compatible with the way the Infoblox API handles responses?
Hey,
I am trying to use the restapi provider for some Infoblox objects, since the official provider does not support all of them. Unfortunately I am facing some problems and I don't know if the issue is my configuration or if it is simply not supported.
My current terraform configuration looks like this:
When creating an object, the Infoblox API either responds just with a string containing the object's ID or with the key "_ref" (only when "?_return_fields" is used).
When reading an object there is always the "_ref" key added to the response, no matter which "?_return_fields" are used.
Because of this, a terraform plan will always do a change, since it compares the current config containing only the name, with the target's config, always returning the name and the "_ref" ID.
It works, if I add an
ignore_changes_to = ["_ref"]to the config.But when I update an object, the Infoblox API will give you a new ID (_ref). Since "_ref" is ignored, this won't update and fail.
I've also tried
ignore_server_additions = true, which unfortunately didn't help either.And when using "read_search" and remove the "_ref" key there it also doesn't work, sice the update will not get an ID (I thought it was limited to read actions).
Is there any way to get this to work or is it just not compatible with the way the Infoblox API handles responses?