You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve default team handling for pipeline resource (#969)
fix: refresh errors when team permissions change from Full Access to Build and Read
- Replace StringUnknown() with StringNull() to prevent "Provider produced invalid object" errors during refresh operations
- Enforces Terraform configuration as source of truth if drift is detected
- Automatically re-add default teams to pipelines when they exist globally but are removed from the pipeline
- Add warning when default team permissions are reduced from Full Access
- Add warning when team is automatically added back to maintain Terraform configuration
- Fail explicitly when configured team doesn't exist in the organization
- Preserve backward compatibility for existing configurations with null values
The flow now enforces the Terraform configuration:
- If a team is configured but removed from the pipeline, it's automatically re-added with Full Access
- If a team has reduced permissions, it will warn but respect the configuration if changed via UI/CLI
- If a team doesn't exist globally, it will fail, requiring default team to be changed
- If no team is configured (null), it respect user choice and do nothing, preserving backwards-compatibility
Fixes#965: "Provider produced invalid object" error during refresh operations
resp.Diagnostics.AddError("Error encountered trying to read teams for pipeline", err.Error())
409
+
resp.Diagnostics.AddError("Error with default team configuration", err.Error())
410
+
return
411
+
}
412
+
413
+
// Add warning if team was added back to enforce Terraform configuration
414
+
ifteamResult!=nil&&teamResult.teamAddedBack {
415
+
resp.Diagnostics.AddWarning(
416
+
"Default team missing from pipeline",
417
+
fmt.Sprintf("The default team (ID: %s) is missing from the pipeline but exists in your organization. The team has been removed from state - run 'terraform apply' to add it back with Full Access.",
418
+
teamResult.originalTeamId),
419
+
)
420
+
}
421
+
422
+
// Add warning if team permissions were reduced
423
+
ifteamResult!=nil&&teamResult.reducedPermission {
424
+
resp.Diagnostics.AddWarning(
425
+
"Default team permission level reduced",
426
+
fmt.Sprintf("The default team (ID: %s) no longer has Full Access (current level: %s). This may cause issues with pipeline updates, team management, or build triggering. Consider updating the team's permissions in the Buildkite UI or using a different team with Full Access as the default.",
0 commit comments