Skip to content

(fix): perpetual drift in fortios_system_dnsdatabase interface_select_method#402

Open
ianc769 wants to merge 1 commit intofortinetdev:mainfrom
ianc769:fix/dns-database-interface-select-method-drift
Open

(fix): perpetual drift in fortios_system_dnsdatabase interface_select_method#402
ianc769 wants to merge 1 commit intofortinetdev:mainfrom
ianc769:fix/dns-database-interface-select-method-drift

Conversation

@ianc769
Copy link
Copy Markdown

@ianc769 ianc769 commented Dec 17, 2025

When interface_select_method is set to its default value ("auto"), the FortiOS API omits this field from GET responses. This caused Terraform to continuously detect drift and attempt to add the field on every apply.

Fixes persistent plan changes showing:

  • interface_select_method = "auto"

…thod

When interface_select_method is set to its default value ("auto"), the
FortiOS API omits this field from GET responses. This caused Terraform
to continuously detect drift and attempt to add the field on every apply.

Root Cause:
- Field is defined as Optional + Computed in the schema
- When set to "auto" in config, value is sent to API during create/update
- API doesn't return the field in GET response when it's the default
- Previous code didn't explicitly preserve the config value in state
- Terraform detected drift: config has "auto", state has nothing

Fix:
- Check if API returned interface-select-method in response
- If yes: use the API value (existing behavior)
- If no: explicitly preserve the configured value in state
- This prevents drift when API omits default values

This pattern may need to be applied to other Optional+Computed fields
that exhibit similar behavior with FortiOS API default value handling.

Fixes persistent plan changes showing:
  + interface_select_method = "auto"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant