Skip to content

PF-190: Confirm support for Azure Government in pipelines - #51

Open
gruntwork-ci wants to merge 1 commit into
mainfrom
claude-pr/PF-190-28256470055
Open

PF-190: Confirm support for Azure Government in pipelines#51
gruntwork-ci wants to merge 1 commit into
mainfrom
claude-pr/PF-190-28256470055

Conversation

@gruntwork-ci

@gruntwork-ci gruntwork-ci commented Jun 26, 2026

Copy link
Copy Markdown

Implements plan for Linear issue PF-190.

Plan source: https://github.com/gruntwork-io-team/linear-claude-plans/blob/main/plans/PF-190.md


Claude's implementation summary
All good. Final summary by repo:

## Summary of changes

### `pipelines` (gruntwork-io/pipelines)

Plumbed `cloud_environment` through the Azure OIDC stack so Pipelines can target Azure sovereign clouds (US Government, China, Germany, Stack) instead of only the public Azure cloud.

- `internal/config/authentication/authentication.go` — Added `AzureOIDCHCL` (parse-phase struct with `cloud_environment,optional`) and `(*AzureOIDCHCL).Resolve()`. Resolve defaults the value to `"public"` and validates against the azurerm-accepted set (`public`, `usgovernment`, `china`, `german`, `stack`) via `hcl.Diagnostics`. The resolved `AzureOIDC` struct gains a `CloudEnvironment` field. `AuthenticationHCL.Resolve()` now calls into the new Azure resolver.
- `internal/config/oidc/azure/azure.go` — `AzureOIDCConfig` gains a `CloudEnvironment` field; `Hash()` and `LogrusFields()` include it (so credentials cached for `public` don't satisfy a request for `usgovernment`), and `GetOIDCConfig` propagates it from the authentication config.
- `internal/oidc/cloud/azure/azure.go` — `GetCreds` adds `ARM_ENVIRONMENT` to the env map when `CloudEnvironment` is non-empty.
- Tests:
  - `internal/config/authentication/authentication_test.go` — Updated existing Azure cases to expect the new default `"public"`, added cases for `usgovernment`, `china`, `german`, `stack`, and a new `TestAzureOIDCHCLResolve_InvalidCloudEnvironment` that asserts the error lists every valid value.
  - `internal/config/oidc/azure/azure_test.go` (new) — `Hash()` differs across cloud environments; `GetOIDCConfig` propagates `CloudEnvironment` for both plan and apply roles.
  - `internal/oidc/cloud/azure/azure_test.go` — Added stub `OIDCTokenProvider` and two tests covering `ARM_ENVIRONMENT` emission (set when populated, omitted when empty).
- `test-fixtures/pipelines-config/azure-government/` (new) — HCL config fixture exercising `cloud_environment = "usgovernment"`; `expected.json` generated via `go run ./test/plumbing/config/generate_fixtures/main.go`.

`go test ./internal/config/... ./internal/oidc/cloud/... ./test/plumbing/config/...` all pass. The wider `./internal/...` suite has unrelated failures from this sandbox lacking `terragrunt` / `mise` on PATH.

ARCHITECTURE.md was already accurate for this work — no updates required.

### `docs` (gruntwork-io/docs)

- `docs/2.0/reference/pipelines/configurations-as-code/api.mdx` — New `HclListItem name="cloud_environment"` (optional, default `public`) at the end of the `azure_oidc` block attributes, listing all five accepted values and linking to the new tutorial and the azurerm/azuread provider docs.
- `docs/2.0/docs/pipelines/concepts/cloud-auth/azure.md` — Inline comment in the worked example noting the new attribute. New top-level **"Azure sovereign cloud support"** section explaining the default, the accepted values, the `ARM_ENVIRONMENT` plumbing, the provider/backend implications, and links to the new tutorial.
- `docs/2.0/docs/pipelines/tutorials/deploying-to-azure-government.mdx` (new) — Full tutorial modeled on `deploying-to-aws-gov-cloud.mdx`: prerequisites, overview of the three configuration points, Entra ID setup walkthrough via `portal.azure.us` (GitHub/GitLab tabs), HCL update with `cloud_environment`, `root.hcl` provider block update, Boilerplate vending (GitHub/GitLab tabs with `CloudEnvironment: usgovernment`), local testing via `az cloud set --name AzureUSGovernment`, and a troubleshooting table covering common failure modes.
- `sidebars/docs.js` — New entry "Connecting to Azure Government" in the Pipelines → Tutorials category, directly after "Deploying to AWS GovCloud".
- `cspell.json` — Added `azurerm`, `usgovernment`, `usgovcloudapi` to the allowlist.

### `terragrunt-scale-catalog` (gruntwork-io/terragrunt-scale-catalog)

- `templates/boilerplate/.dependencies/azure/subscription/.gruntwork/environment-{{ .SubscriptionName }}.hcl` — `azure_oidc` block now sets `cloud_environment = "{{ .CloudEnvironment }}"` with an explanatory comment.
- `templates/boilerplate/.dependencies/azure/subscription/boilerplate.yml` — New `CloudEnvironment` variable (default `"public"`); existing `State*` variables renumbered to make room.
- `templates/boilerplate/.dependencies/azure/base/root.hcl` — Generated `azurerm` and `azuread` provider blocks now set `environment = "{{ .CloudEnvironment }}"` so local Terragrunt runs target the same cloud as Pipelines.
- `templates/boilerplate/.dependencies/azure/base/boilerplate.yml` — New `CloudEnvironment` variable.
- `templates/boilerplate/azure/{github,gitlab}/subscription/boilerplate.yml` — New `CloudEnvironment` variable so vending a subscription directly threads the value into the dependency template.
- `templates/boilerplate/azure/{github,gitlab}/infrastructure-live/boilerplate.yml` — New `CloudEnvironment` variable so the infrastructure-live render also threads the value through to `root.hcl` and the subscription environment HCL.
- `templates/boilerplate/azure/{github,gitlab}/subscription/README.md` — Documented `CloudEnvironment` in the variable table with a link to the new docs tutorial.

### Caveats for the PR description

- **No end-to-end verification against a real Azure Government tenant.** The CLI change is mechanical (set `ARM_ENVIRONMENT`), but the only true "confirm support" signal is a live plan/apply against `*.usgovcloudapi.net` endpoints, which this PR does not exercise.
- **Bootstrap stack does not yet accept an `environment` value.** The shared `stacks/azure/{github,gitlab}/pipelines-bootstrap` stack (referenced by the rendered `bootstrap/terragrunt.stack.hcl`) still emits an unscoped `provider "azurerm" { features {} }` from its own `root.hcl`. Bootstrapping a fresh Azure Government subscription via this PR will fail at the bootstrap step until that stack is updated to accept a `cloud_environment` input. Adding that input is out of scope for this PR but is the natural follow-up.
- **`german` (Azure Germany) was retired by Microsoft in 2021.** Included to match the azurerm provider's accepted set exactly.
- **No experiment flag.** Default `"public"` preserves the existing behavior bit-for-bit, so per RFC-169 this ships as a pure addition without a `PIPELINES_FEATURE_EXPERIMENT_*` gate.

Related PRs in this change set

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@gruntwork-ci, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 59 minutes and 57 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 310d5404-5639-4fe9-8c3a-b5d1685a6799

📥 Commits

Reviewing files that changed from the base of the PR and between 3de6f37 and d6d168c.

📒 Files selected for processing (10)
  • templates/boilerplate/.dependencies/azure/base/boilerplate.yml
  • templates/boilerplate/.dependencies/azure/base/root.hcl
  • templates/boilerplate/.dependencies/azure/subscription/.gruntwork/environment-{{ .SubscriptionName }}.hcl
  • templates/boilerplate/.dependencies/azure/subscription/boilerplate.yml
  • templates/boilerplate/azure/github/infrastructure-live/boilerplate.yml
  • templates/boilerplate/azure/github/subscription/README.md
  • templates/boilerplate/azure/github/subscription/boilerplate.yml
  • templates/boilerplate/azure/gitlab/infrastructure-live/boilerplate.yml
  • templates/boilerplate/azure/gitlab/subscription/README.md
  • templates/boilerplate/azure/gitlab/subscription/boilerplate.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude-pr/PF-190-28256470055

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

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant