Skip to content

ci(infrastructure): add terraform fmt and validate reusable CI workflow#293

Merged
WilliamBerryiii merged 3 commits into
mainfrom
feat/288-tf-ci-validation
Mar 17, 2026
Merged

ci(infrastructure): add terraform fmt and validate reusable CI workflow#293
WilliamBerryiii merged 3 commits into
mainfrom
feat/288-tf-ci-validation

Conversation

@katriendg
Copy link
Copy Markdown
Collaborator

Description

Adds automated terraform fmt and terraform validate enforcement to the CI pipeline, closing the last gap in Terraform quality checks. TFLint was added in #229 but formatting and validation remained manual-only. This PR adds a reusable workflow that runs both checks on every PR and main branch push.

Closes #288

Implementation

A new PowerShell script (Invoke-TerraformValidation.ps1) runs terraform fmt -check -recursive across all Terraform files and terraform init -backend=false && terraform validate in each of the four deployment directories (., vpn/, dns/, automation/). The changed-files-only workflow input scopes PR validation to directories with modified .tf or .tfvars files, skipping unaffected directories.

Both pr-validation.yml and main.yml wire in the workflow with soft-fail: true, matching the pattern used by terraform-lint.yml. The lint:tf:validate npm script exposes the same check locally.

Files changed

File Change
.github/workflows/terraform-validation.yml New reusable workflow
shared/ci/linting/Invoke-TerraformValidation.ps1 New validation script (249 lines)
shared/ci/tests/Invoke-TerraformValidation.Tests.ps1 Pester test suite (363 lines)
.github/workflows/pr-validation.yml Wired in terraform-validation job
.github/workflows/main.yml Wired in terraform-validation job
package.json Added lint:tf:validate script
.gitignore Excluded dependency-pinning-artifacts/
docs/contributing/ (3 files) Updated validation commands to use npm run lint:tf:validate
.github/copilot-instructions.md Updated validation reference table

Type of Change

  • 🐛 Bug fix (non-breaking change fixing an issue)
  • ✨ New feature (non-breaking change adding functionality)
  • 💥 Breaking change (fix or feature causing existing functionality to change)
  • 📚 Documentation update
  • 🏗️ Infrastructure change (Terraform/IaC)
  • ♻️ Refactoring (no functional changes)

Component(s) Affected

  • infrastructure/terraform/prerequisites/ - Azure subscription setup
  • infrastructure/terraform/ - Terraform infrastructure
  • infrastructure/setup/ - OSMO control plane / Helm
  • workflows/ - Training and evaluation workflows
  • training/ - Training pipelines and scripts
  • docs/ - Documentation

Testing Performed

  • Terraform plan reviewed (no unexpected changes)
  • Terraform apply tested in dev environment
  • Training scripts tested locally with Isaac Sim
  • OSMO workflow submitted successfully
  • Smoke tests passed (smoke_test_azure.py)

Pester tests (npm run test:ps) passed. No Azure credentials required — terraform init -backend=false skips all remote backend calls. Terraform plan is not applicable to CI workflow and script changes.

Documentation Impact

  • Documentation updated in this PR

Checklist

Note

Also updated .gitignore to not track files in the ephemeral folder ./dependency-pinning-artifacts/

- create Invoke-TerraformValidation.ps1 with format check and per-directory validation
- create terraform-validation.yml reusable workflow with soft-fail and changed-files-only
- wire into pr-validation.yml and main.yml orchestrators with soft-fail rollout
- add terraform-validation to release-please needs gate

🔧 - Generated by Copilot
…ferences

- add Invoke-TerraformValidation npm script entry and Pester tests
- fix single-item array handling in Invoke-TerraformValidation.ps1 with @() wrapping
- update docs and copilot-instructions to use npm run lint:tf:validate
- update boolean prefix convention to should_ in infrastructure-style.md
- gitignore dependency-pinning-artifacts/ and remove tracked artifact

🔧 - Generated by Copilot
@katriendg katriendg requested a review from a team as a code owner March 17, 2026 12:58
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 17, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/checkout de0fac2e4500dabe0009e67214ff5f5447ce83dd 🟢 5.9
Details
CheckScoreReason
Maintained⚠️ 23 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Code-Review🟢 10all changesets reviewed
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Packaging⚠️ -1packaging workflow not detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Pinned-Dependencies🟢 3dependency not pinned by hash detected -- score normalized to 3
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection🟢 5branch protection is not maximal on development and all release branches
SAST🟢 8SAST tool detected but not run on all commits
actions/actions/upload-artifact bbbca2ddaa5d8feaa63e36b76fdaad77386f024f 🟢 5.6
Details
CheckScoreReason
Packaging⚠️ -1packaging workflow not detected
Code-Review🟢 10all changesets reviewed
Binary-Artifacts🟢 10no binaries found in the repo
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Maintained🟢 44 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 4
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies⚠️ 1dependency not pinned by hash detected -- score normalized to 1
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
SAST🟢 10SAST tool is run on all commits
actions/hashicorp/setup-terraform b9cd54a3c349d3f38e8881555d616ced269862dd 🟢 6.2
Details
CheckScoreReason
Code-Review🟢 4Found 2/5 approved changesets -- score normalized to 4
Binary-Artifacts🟢 10no binaries found in the repo
Maintained🟢 1012 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 10
Packaging⚠️ -1packaging workflow not detected
Pinned-Dependencies🟢 10all dependencies are pinned
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Fuzzing⚠️ 0project is not fuzzed
Security-Policy🟢 10security policy file detected
Branch-Protection🟢 6branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0

Scanned Files

  • .github/workflows/terraform-validation.yml

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 9.79%. Comparing base (01ea384) to head (406f0e6).

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #293   +/-   ##
=====================================
  Coverage   9.79%   9.79%           
=====================================
  Files         29      29           
  Lines       3881    3881           
  Branches     497     497           
=====================================
  Hits         380     380           
  Misses      3491    3491           
  Partials      10      10           
Flag Coverage Δ *Carryforward flag
pester 79.87% <ø> (ø)
pytest 6.89% <ø> (ø) Carriedforward from a3aff2f

*This pull request uses carry forward flags. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@WilliamBerryiii WilliamBerryiii merged commit 05f2220 into main Mar 17, 2026
25 checks passed
@WilliamBerryiii WilliamBerryiii deleted the feat/288-tf-ci-validation branch March 17, 2026 18:05
katriendg added a commit that referenced this pull request Mar 18, 2026
…#299)

Clarify issue assignment requirement before starting work. Two
contributors independently opened PRs for the same issue (#288#293
and #294) because the contribution workflow didn't require issue
assignment before starting work.

Add step 1 to PR Workflow in
`docs/contributing/contribution-workflow.md`: "Check the issue is open
and unassigned" — request assignment via comment before starting work.
Covers both "already assigned" and `needs-triage` edge cases. Renumbers
existing steps 2–9 and updates `ms.date`.

The new step reads:

```markdown
1. **Check the issue is open and unassigned.** Comment on the issue to request assignment before starting any work. Maintainers will assign you when confirmed.
   * If the issue is already assigned to someone, do not open a competing PR without first coordinating with the assignee or a maintainer.
   * Issues labelled `needs-triage` are not ready to be picked up. You are welcome to comment your interest in being assigned — maintainers will follow up once triage is complete.
```

## Type of Change

- [x] 📚 Documentation update

## Component(s) Affected

- [x] `docs/` - Documentation

## Testing Performed

- [x] `npm run lint:md` passes with 0 errors
- [x] `cspell` spell check passes with 0 issues

## Documentation Impact

- [x] Documentation updated in this PR

## Checklist

- [x] My code follows the [project conventions](copilot-instructions.md)
- [x] Commit messages follow [conventional commit
format](instructions/commit-message.instructions.md)
- [x] I have performed a self-review
- [x] Documentation impact assessed above
- [x] No new linting warnings introduced

Closes #295
---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: katriendg <838216+katriendg@users.noreply.github.com>
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.

ci(infrastructure): create terraform fmt and validate reusable CI workflow

3 participants