-
Notifications
You must be signed in to change notification settings - Fork 3
feat: allow BitBucket Cloud integration as VCS #97
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
Walkthrough
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (4)
variables.tf (1)
39-46: Doc hint: clarify “namespace” meaning for Bitbucket CloudConsider noting in the variable description/README that “namespace” refers to the Bitbucket Cloud workspace (to prevent confusion vs. org/project wording used by other VCS). (docs.spacelift.io)
README.md (1)
363-363: README row added correctly; consider a tiny usage exampleThe Inputs table entry is accurate. Add a short HCL snippet under “Usage” showing bitbucket_cloud to reduce guesswork.
bitbucket_cloud = { namespace = "your-workspace" # id = "integration-id" # optional } repository = "your-repo"main.tf (2)
488-518: Guard against multiple VCS blocks being set simultaneouslyAt module level, users can set github_enterprise, bitbucket_cloud, azure_devops, and raw_git together, which would render multiple nested VCS blocks and cause a provider error. Add a single precondition to enforce “exactly one VCS input” to improve UX.
HCL snippet to add (outside the changed lines):
locals { _vcs_selected_count = length(compact([ var.github_enterprise != null ? "x" : null, var.bitbucket_cloud != null ? "x" : null, var.azure_devops != null ? "x" : null, var.raw_git != null ? "x" : null, ])) } resource "spacelift_stack" "default" { # ...existing attrs... lifecycle { precondition { condition = local._vcs_selected_count == 1 error_message = "Exactly one of github_enterprise, bitbucket_cloud, azure_devops, or raw_git must be set." } } }
496-502: (Optional) Consistency: use attribute access over map indexingWe already use indexing (value["namespace"]). Using attribute access (value.namespace) is a tad cleaner and keeps parity with many HCL examples. Non-blocking.
- namespace = bitbucket_cloud.value["namespace"] - id = try(bitbucket_cloud.value["id"], null) + namespace = bitbucket_cloud.value.namespace + id = try(bitbucket_cloud.value.id, null)
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
README.md(1 hunks)main.tf(1 hunks)variables.tf(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.tf
⚙️ CodeRabbit configuration file
**/*.tf: You're a Terraform expert who has thoroughly studied all the documentation from Hashicorp https://developer.hashicorp.com/terraform/docs and OpenTofu https://opentofu.org/docs/.
You have a strong grasp of Terraform syntax and prioritize providing accurate and insightful code suggestions.
As a fan of the Cloud Posse / SweetOps ecosystem, you incorporate many of their best practices https://docs.cloudposse.com/best-practices/terraform/ while balancing them with general Terraform guidelines.
Files:
main.tfvariables.tf
🧠 Learnings (1)
📚 Learning: 2024-10-30T17:01:23.897Z
Learnt from: Gowiem
PR: masterpointio/terraform-spacelift-automation#3
File: main.tf:231-257
Timestamp: 2024-10-30T17:01:23.897Z
Learning: In `main.tf`, grouping related attributes in the `spacelift_stack` resource using locals may overcomplicate things and remove important logic elsewhere; prefer to keep attributes as is.
Applied to files:
main.tf
🔇 Additional comments (3)
variables.tf (1)
39-46: Bitbucket Cloud input looks correct and consistent with other VCS inputsType, shape, and defaults mirror existing patterns. Nice, minimal addition.
main.tf (2)
496-502: Dynamic block is spot‑on and matches existing patternsConditional for_each, namespace, and try(...) for id are consistent with github_enterprise/azure_devops. Looks good.
496-502: Please verify the provider version that introduced thebitbucket_cloudnested block onspacelift_stackby inspecting the Spacelift Terraform provider’s CHANGELOG or GitHub releases (https://github.com/spacelift-io/terraform-provider-spacelift/releases) for the PR addingbitbucket_cloud; confirm which version it landed in and ensure yourrequired_providersconstraint is at least that version.
Gowiem
left a comment
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.
![]()
westonplatter
left a comment
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.
sweet 🚢 it.
|
I'll close my PR in favor of Weston's PR as it covers this and more: #97 |
Support BitBucket Cloud as an integration for VCS for Spacelift stacks.
Terraform Spacelift Registry documentation: https://registry.terraform.io/providers/spacelift-io/spacelift/latest/docs/resources/stack#bitbucket_cloud-1
This is identical to the GitHub integration we already have in place:

Summary by CodeRabbit