-
Notifications
You must be signed in to change notification settings - Fork 1
feat: combine github_team_membership resource blocks into one
#61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @vedantthapa, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the Terraform configuration for managing GitHub team memberships. By consolidating the separate resource blocks for maintainers and members into a single, unified resource, the change aims to significantly improve the handling of role updates. This prevents the previous issue where changing a user's role from 'maintainer' to 'member' (or vice-versa) would result in a destructive 'destroy + create' operation, instead enabling more efficient 'update in-place' actions. The modification streamlines membership management and enhances the stability of the Terraform state. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the github_team_membership resources to use a single resource block, which is a great improvement. It correctly addresses the issue with Terraform's plan showing destroy+create instead of in-place updates when a member's role changes. The implementation is clean and uses a local variable to merge maintainers and members effectively. I have one suggestion to improve the robustness of the merge logic to prevent potential silent privilege demotion if a user is accidentally listed as both a member and a maintainer.
Combine separate
github_team_membershipresource blocks for maintainers and members into one. This simplifies making changes when reconciling drift in membership.Consider the following example, terraform plan suggests an update in-place -
However, following the suggestion from the previous plan and moving
yeybrfrom themaintainerstomemberslist, instead results in a destroy + create, like so -This is likely due to having separate resource definitions for each role. This PR combines the resource definitions into one via an intermediate local variable to transform the list of maintainers and members, into a single key-value pair of
username => role. As a result, any suggestions forupdate in-placecan be resolved by moving users to the right list.