Skip to content

fix(sso): handle unknown team_ids in group mapping CustomizeDiff#728

Merged
tembleking merged 2 commits intomasterfrom
fix/sso-group-mapping-unknown-team-ids
Apr 22, 2026
Merged

fix(sso): handle unknown team_ids in group mapping CustomizeDiff#728
tembleking merged 2 commits intomasterfrom
fix/sso-group-mapping-unknown-team-ids

Conversation

@tembleking
Copy link
Copy Markdown
Member

CustomizeDiff in sysdig_sso_group_mapping reads team_ids via diff.Get, which surfaces unknown (known-after-apply) values as empty lists. This causes a false "team_ids must be set when is_for_all_teams is false" error during plan when team_ids references resources not yet created (e.g. sysdig_secure_team.*.id).

Switches to diff.GetRawPlan().AsValueMap() with cty .IsKnown() checks to skip validation when values are not yet resolved, deferring to apply-time. Matches existing pattern in resource_sysdig_secure_team. Adds regression test with is_for_all_teams=false + team ID from a forward resource reference.

CustomizeDiff validation read team_ids via diff.Get which surfaces
unknown (known-after-apply) values as empty lists, causing a false
"team_ids must be set when is_for_all_teams is false" error during
plan when team_ids references resources not yet created.

Switch to diff.GetRawPlan().AsValueMap() with cty .IsKnown() checks
to skip validation when values are not yet resolved, deferring to
apply-time. Matches existing pattern in resource_sysdig_secure_team.
Copilot AI review requested due to automatic review settings April 22, 2026 10:42
@tembleking tembleking requested a review from a team as a code owner April 22, 2026 10:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the sysdig_sso_group_mapping resource diff validation so that team_ids values that are unknown at plan time (e.g., forward references like sysdig_secure_team.*.id) don’t incorrectly appear as empty lists and trigger a false validation error.

Changes:

  • Switch CustomizeDiff validation from diff.Get(...) to diff.GetRawPlan() with cty.IsKnown() checks to defer validation when values are unknown during plan.
  • Add an acceptance regression test covering is_for_all_teams = false with team_ids coming from a newly created sysdig_secure_team.
  • Add a new HCL config helper for the regression scenario.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sysdig/resource_sysdig_sso_group_mapping.go Uses raw plan + known checks to avoid false “missing team_ids” errors during plan for forward references.
sysdig/resource_sysdig_sso_group_mapping_test.go Adds acceptance coverage for team IDs sourced from another resource.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sysdig/resource_sysdig_sso_group_mapping_test.go
Zone tests used hardcoded names (acc-legacy, acc-expr, acc-migrate,
acc-v2rules) causing 409 Conflict when orphaned zones from failed
CI runs persisted in the tenant. Adds random suffix to all zone
test names to prevent collisions across concurrent/repeated runs.
@tembleking tembleking merged commit c2473a7 into master Apr 22, 2026
179 checks passed
@tembleking tembleking deleted the fix/sso-group-mapping-unknown-team-ids branch April 22, 2026 12:50
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.

3 participants