Flagsmith / Flagsmith/terraform-provider-flagsmith
segment_priority assigned incorrectly when creating flagsmith_feature_state alongside existing overrides
- Dominant language
- Go
- Stars
- 6
- Forks
- 3
- Avg merge
- 18h 13m
- Merged PRs (30d)
- 8
Description
flagsmith/flagsmith provider version 0.9.1
## Description
When creating a `flagsmith_feature_state` segment override with `segment_priority=0`,
the API ignores the requested value and auto-assigns a priority based on existing
overrides in the environment. If another override already holds priority `0`,
the new one gets priority `1` regardless of what was requested.
This causes Terraform to fail with:
> Provider produced inconsistent result after apply
> .segment_priority: was cty.NumberIntVal(0), but now cty.NumberIntVal(1).
## Steps to Reproduce
1. Have a feature with two segment overrides (`override_0` priority 0, `override_1` priority 1)
2. Trigger a destroy+create on `override_0` (e.g. via `replace_triggered_by`)
3. `override_1` remains in the API with priority 0 during the recreate
4. Terraform creates `override_0` with `segment_priority=0` - API returns `1`
5. Terraform errors: provider produced inconsistent result
## Expected Behavior
The API should honor the `segment_priority` value provided on creation, or the provider
should handle priority conflicts gracefully (e.g. by reordering after creation).
## Actual Behavior
The API auto-assigns `segment_priority` based on insertion order, ignoring the
requested value. The provider does not reconcile this mismatch.
## Provider Version
`flagsmith/flagsmith` v0.9.1
## Workaround
Pre-delete all segment overrides for the affected feature before applying, so
Terraform recreates them on a clean slate in the correct order.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.