SYN-4498: Fix issues with default values #64
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before the change?
max_wait_time
andwait_for_nav_timeout
are defined and used for all types of stepsA) Value gets persisted in the database. That could cause validation issues - eg. in case the API introduces stricter validation.
B) Value is not persisted because the API drops it. Terraform always reports drift in the plan because the value from API differs from the configuration.
After the change?
max_wait_time
andwait_for_nav_timeout
in the providerI tried hard to remove this limitations but the support in terraform-plugin-sdk for working with TypeSet and ListSet is probably not sufficient. I tried all kind of approaches - Optional Computed attribute, DiffSuppressFunc, CustomizeDiff... but I was never able to cover all cases.
I haven't found a way how to ignore the value in configuration when it's set to the default value. It might be possible with the PlanModifiers when using the new terraform-plugin-framework but I was not able to modify the plan in CustomizeDiff - I was not even able to access the transactions in the new value, it was always nil.
Pull request checklist
make testacc
), and pasted in this PR (for bug fixes / features)Acceptance Test Output
Does this introduce a breaking change?
Upgrading from any version:
max_wait_time
orwait_for_nav_timeout
is used and set to a non default value, no changes are needed and there are no changes in state or in the plan.If users upgrade from older version than v2.0.9:
max_wait_time
is set to 10000 orwait_for_nav_timeout
to 50 or 2000 the validation fails and user has to remove it from the configuration.max_wait_time
orwait_for_nav_timeout
is not used in the configuration, no user action is required and there are no changes in state or in the plan.If upgraded from v2.0.9 or v2.0.10:
max_wait_time
is set to 10000 orwait_for_nav_timeout
to 50 or 2000 the validation will fail and user has to remove it from the configuration.max_wait_time
orwait_for_nav_timeout
is not used in the configuration, no user action is required but there there will be changes in the TF state (default -> 0) so the plan will not be empty.I don't think this is an ideal solution and I'm open to any suggestion how to handle this situation properly.
Other option I was thinking about was to keep the default values in the state but mirror the logic from the API to the provider and set the default only to specific test types (eg. max_wait_time for assert_* types). I didn't want to add additional logic to the provider but it might be a better solution after all.