Skip to content

Conversation

@vmvarela
Copy link
Owner

  • Add data.github_user resource to fetch numeric IDs for referenced users
  • Extract user logins from repository permissions and environment reviewers
  • Build github_user_ids map from individual user data sources
  • Update README to document central ID resolution strategy
  • Update repository module to require all IDs from parent (no data sources)
  • Update all examples with ID resolution (simple and complete)
  • Document breaking changes in repository module README

Resolves user ID calculation for governance module examples.
Previous approach using github_organization data source returned GraphQL
string IDs instead of numeric IDs. New approach uses individual github_user
lookups which provide correct numeric IDs with acceptable API call trade-off.

- Add data.github_user resource to fetch numeric IDs for referenced users
- Extract user logins from repository permissions and environment reviewers
- Build github_user_ids map from individual user data sources
- Update README to document central ID resolution strategy
- Update repository module to require all IDs from parent (no data sources)
- Update all examples with ID resolution (simple and complete)
- Document breaking changes in repository module README

Resolves user ID calculation for governance module examples.
Previous approach using github_organization data source returned GraphQL
string IDs instead of numeric IDs. New approach uses individual github_user
lookups which provide correct numeric IDs with acceptable API call trade-off.
@vmvarela vmvarela requested a review from Copilot November 17, 2025 07:48
@vmvarela vmvarela added the bug Something isn't working label Nov 17, 2025
@vmvarela vmvarela self-assigned this Nov 17, 2025
Copy link
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

This PR implements automatic user ID resolution in the governance module to fix an issue where the previous approach returned GraphQL string IDs instead of numeric IDs. The new implementation extracts user logins from repository configurations and uses individual data.github_user lookups to obtain correct numeric IDs.

Key Changes:

  • Added automatic extraction of user logins from repository permissions and environment reviewers in the governance module
  • Removed data source lookups from the repository module, making it dependent on parent module for all IDs
  • Updated examples to demonstrate standalone ID resolution pattern
  • Documented breaking changes and new ID resolution strategy

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
data.tf Added user login extraction logic and data.github_user lookups to build central user ID map
modules/repository/main.tf Removed all data sources; added precondition validations requiring IDs from parent module
modules/repository/variables.tf Updated variable descriptions to indicate IDs must be provided by parent module
modules/repository/examples/simple/main.tf Added example ID resolution pattern using data sources
modules/repository/examples/complete/main.tf Added example ID resolution pattern for standalone usage
modules/repository/README.md Added breaking changes documentation and updated performance optimization section
README.md Updated high-level documentation about central ID resolution strategy
examples/complete/tfplan Binary terraform plan file (auto-generated)

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

data.tf Outdated

# Fetch user data for referenced users (only if not provided)
data "github_user" "referenced_users" {
for_each = length(var.github_user_ids) == 0 ? toset(local.all_user_logins) : []
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

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

The for_each argument expects a set or map, but the false branch returns [] (a list/tuple). While Terraform may coerce an empty list in practice, it's better to be explicit and use toset([]) instead of [] for type consistency and clarity.

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Copy link
Contributor

Copilot AI commented Nov 17, 2025

@vmvarela I've opened a new pull request, #3, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits November 17, 2025 07:57
Fix type consistency in for_each empty set handling
@vmvarela vmvarela merged commit 2f26c87 into master Nov 17, 2025
1 check passed
@vmvarela vmvarela deleted the vmvarela/do-not-get-ids-on-repository branch November 17, 2025 08:02
@github-actions
Copy link
Contributor

🎉 This PR is included in version 0.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants