Skip to content

Conversation

@milldr
Copy link
Contributor

@milldr milldr commented Aug 19, 2025

what

  • Add reviewers and deployment branch policy to environments

why

  • Missing from the local var passed to the module

references

.

Summary by CodeRabbit

  • New Features
    • Added support to define reviewers per environment, enabling approval workflows before deployments proceed.
    • Introduced per-environment deployment branch policies to restrict deployments to designated branches.
    • These options enhance governance and provide finer control over who can approve changes and where they can be deployed.

@milldr milldr added the patch A minor, backward compatible change label Aug 19, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 19, 2025

Walkthrough

Extended the environments configuration in src/main.tf by adding reviewers and deployment_branch_policy fields within the locals block. No changes to public interfaces or exported declarations.

Changes

Cohort / File(s) Summary
Terraform environment config updates
src/main.tf
Added reviewers and deployment_branch_policy fields to locals.environments to support specifying reviewers and branch policy per environment. No exported/public declarations changed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitch my nose at branches neat,
New reviewers hop to greet.
Policies guard the garden gate,
Deployments wait for the perfect state.
Thump-thump—configs now aligned,
Carrots approved, release assigned! 🥕✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch environment-protection-inputs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

goruha
goruha previously approved these changes Aug 19, 2025
@mergify mergify bot requested review from a team August 19, 2025 17:14
@goruha goruha added this pull request to the merge queue Aug 19, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/main.tf (2)

91-95: Make fields resilient when not provided (optional)

If existing callers omit reviewers or deployment_branch_policy, direct attribute access may error. Consider defaulting with try(..., null) so these remain optional.

-      reviewers                = v.reviewers
-      deployment_branch_policy = v.deployment_branch_policy
+      reviewers                = try(v.reviewers, null)
+      deployment_branch_policy = try(v.deployment_branch_policy, null)

91-95: Environments schema is correct; documentation needs updates

I confirmed that in src/variables.tf, the environments variable’s type = map(object({…})) block already defines both

  • reviewers = object({ teams = list(string), users = list(string) })
  • deployment_branch_policy = object({ protected_branches = bool, custom_branches = optional(list(string)) })

and includes validation for each field, so no schema changes are required.

However, I didn’t find any mention of environments in README.md or an examples/ directory. Please:

  • Update README.md (under “Variables” or “Inputs”) to document the environments block and all nested attributes:
    wait_timer, can_admins_bypass, prevent_self_review
    reviewers.teams, reviewers.users
    deployment_branch_policy.protected_branches, deployment_branch_policy.custom_branches
    • any other nested maps (variables, secrets, etc.)
  • Add or update example usage (e.g. in an examples/ folder or code snippet in the README) showing how to configure these new attributes.

This will ensure users don’t hit plan-time errors and have accurate documentation.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5ccd54f and 87eb572.

📒 Files selected for processing (1)
  • src/main.tf (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Summary
🔇 Additional comments (1)
src/main.tf (1)

91-95: LGTM: Passing through reviewers and deployment_branch_policy to environments

This fills the gap in the locals map so the module receives the full environment config. Good catch.

@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 19, 2025
@milldr milldr added this pull request to the merge queue Aug 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 19, 2025
@milldr
Copy link
Contributor Author

milldr commented Aug 19, 2025

/terratest

@milldr milldr added this pull request to the merge queue Aug 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 19, 2025
@milldr
Copy link
Contributor Author

milldr commented Aug 19, 2025

/terratest

@mergify mergify bot added the needs-test Needs testing label Aug 19, 2025
@milldr milldr enabled auto-merge August 20, 2025 18:28
@goruha goruha disabled auto-merge August 20, 2025 19:51
@goruha goruha added this pull request to the merge queue Aug 20, 2025
Merged via the queue into main with commit 88205d8 Aug 20, 2025
18 checks passed
@goruha goruha deleted the environment-protection-inputs branch August 20, 2025 20:05
@github-actions
Copy link

These changes were released in v0.2.2.

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

Labels

needs-test Needs testing patch A minor, backward compatible change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants