Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOperationalSpaceFromState ¶ added in v0.12.2
func GetOperationalSpaceFromState(ctx context.Context, state tfsdk.State) (string, diag.Diagnostics)
GetOperationalSpaceFromState extracts the operational space ID from Terraform state. This helper reads space_ids from state (not plan) to determine which space to use for API operations, preventing errors when space_ids changes (e.g., prepending a new space).
**Why read from STATE not PLAN:** When updating space_ids = ["space-a"] → ["space-b", "space-a"], we need to query the policy in a space where it currently EXISTS (space-a from STATE), not where it WILL exist (space-b from PLAN). Otherwise, the API call fails with 404.
Selection Strategy:
- Extract space_ids from state
- If empty/null → return "" (uses default space without /s/{spaceId} prefix)
- Otherwise → return first space from state (where resource currently exists)
Note: With Sets, there's no inherent ordering, but we can rely on deterministic iteration to get a consistent space for API operations.
func SpaceIDsToSet ¶ added in v0.12.2
SpaceIDsToSet converts a Go string slice to a Terraform Set of strings.
Types ¶
This section is empty.