fleet

package
v0.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

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:

  1. Extract space_ids from state
  2. If empty/null → return "" (uses default space without /s/{spaceId} prefix)
  3. 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

func SpaceIDsToSet(ctx context.Context, spaceIDs []string) (types.Set, diag.Diagnostics)

SpaceIDsToSet converts a Go string slice to a Terraform Set of strings.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL