This repository was archived by the owner on Apr 15, 2026. It is now read-only.
fix(enterprise-teams): move input validation to schema ValidateDiagFunc#42
Merged
fix(enterprise-teams): move input validation to schema ValidateDiagFunc#42
Conversation
Fixes #22 - website/docs/d/enterprise.html.markdown - website/docs/r/enterprise_organization.html.markdown
…riseTeamOrganizations callers Closes #29 - Read: handle 404 by clearing state (d.SetId("")) instead of returning error, so resources deleted out-of-band are cleanly removed from state. - Create: handle 404 from pre-existence check as empty assignments and proceed, since a new team may not have any assignments yet. - Delete: already handled correctly — no change needed. The errors.As check now branches differently in each caller, making the type assertion effective as the reviewer requested.
) Fixes #22 - website/docs/d/enterprise.html.markdown - website/docs/r/enterprise_organization.html.markdown
…riseTeamOrganizations callers (#40) Closes #29 - Read: handle 404 by clearing state (d.SetId("")) instead of returning error, so resources deleted out-of-band are cleanly removed from state. - Create: handle 404 from pre-existence check as empty assignments and proceed, since a new team may not have any assignments yet. - Delete: already handled correctly — no change needed. The errors.As check now branches differently in each caller, making the type assertion effective as the reviewer requested.
Remove redundant runtime checks from dataSourceGithubEnterpriseTeamRead: - Drop 'if teamID != 0' guard — ValidateDiagFunc(IntAtLeast(1)) already rejects zero/negative values at plan time. - Drop 'if teamSlug == ""' fallback — ExactlyOneOf already enforces that exactly one of slug or team_id is provided. Closes #31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
if teamID != 0guard indataSourceGithubEnterpriseTeamRead— the schema already hasValidateDiagFunc: validation.ToDiagFunc(validation.IntAtLeast(1))which rejects zero/negative values at plan time.if teamSlug == "" { return diag.Errorf(...) }fallback —ExactlyOneOf: []string{"slug", "team_id"}already enforces that exactly one of the two fields is provided at plan time.Errors now surface at plan time instead of apply time, as suggested by reviewer feedback on upstream PR #3008.
Closes #31