Skip to content

Extract IaC (terraform, terragrunt, teststructure) into /v2 modules - #1868

Merged
james00012 merged 3 commits into
mainfrom
james/terratest-v2-iac
Jul 16, 2026
Merged

Extract IaC (terraform, terragrunt, teststructure) into /v2 modules#1868
james00012 merged 3 commits into
mainfrom
james/terratest-v2-iac

Conversation

@james00012

@james00012 james00012 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

Final modularization tier. Carves the three IaC packages into their own /v2 submodules, completing the 16-module split.

  • terraform requires core, httphelper, opa, ssh
  • terragrunt requires core, terraform
  • teststructure requires aws, core, k8s, opa, packer, ssh, terraform
  • external deps seeded from root versions, no drift
  • go.work and root replaces updated; terragrunt has no root require (only its own package tests consume it), so no root replace, matching dnshelper

After this merges, all 16 submodules exist and the split is done. Releasing is the tagging workflow, not a review PR.

Validation

  • All 16 submodules build and test-compile with the full build-tag set
  • Root and consumers (test/, examples/) compile
  • Gates green: acyclic, single source, SIV placement
  • Release-mode (GOWORK=off external consumer build) OK with 16 modules

Summary by CodeRabbit

  • New Features

    • Added version 2 support for Terraform, Terragrunt, and test-structure utilities.
    • Enables continued use of infrastructure testing workflows with the updated module versions.
  • Documentation

    • Updated Terragrunt usage examples to reflect the version 2 interface.
  • Tests

    • Updated infrastructure, cloud-provider, and integration test coverage to validate the version 2 modules.

Final modularization tier. Carves the three IaC packages into their own
/v2 submodules, completing the 16-module split.

- terraform requires core, httphelper, opa, ssh
- terragrunt requires core, terraform
- teststructure requires aws, core, k8s, opa, packer, ssh, terraform
- external deps seeded from root versions (no drift)
- go.work + root replaces updated; terragrunt has no root require (only
  its own package tests consume it), so no root replace, matching dnshelper
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 20a57b48-ff93-498b-85b1-49af3f34fc00

📥 Commits

Reviewing files that changed from the base of the PR and between e67d90a and d4b02e4.

⛔ Files ignored due to path filters (4)
  • go.work is excluded by !**/*.work
  • modules/terraform/go.sum is excluded by !**/*.sum
  • modules/terragrunt/go.sum is excluded by !**/*.sum
  • modules/teststructure/go.sum is excluded by !**/*.sum
📒 Files selected for processing (101)
  • go.mod
  • modules/terraform/apply_test.go
  • modules/terraform/cmd_test.go
  • modules/terraform/count_test.go
  • modules/terraform/format_test.go
  • modules/terraform/go.mod
  • modules/terraform/init_test.go
  • modules/terraform/options_test.go
  • modules/terraform/output_test.go
  • modules/terraform/plan_struct_test.go
  • modules/terraform/plan_test.go
  • modules/terraform/show_test.go
  • modules/terraform/validate_test.go
  • modules/terraform/var-file_test.go
  • modules/terraform/workspace_test.go
  • modules/terragrunt/README.md
  • modules/terragrunt/apply_test.go
  • modules/terragrunt/cmd_args_test.go
  • modules/terragrunt/destroy_test.go
  • modules/terragrunt/format_test.go
  • modules/terragrunt/go.mod
  • modules/terragrunt/graph_test.go
  • modules/terragrunt/hcl_validate_test.go
  • modules/terragrunt/init_test.go
  • modules/terragrunt/json_helpers_test.go
  • modules/terragrunt/output_test.go
  • modules/terragrunt/plan_test.go
  • modules/terragrunt/render_test.go
  • modules/terragrunt/run_all_test.go
  • modules/terragrunt/run_test.go
  • modules/terragrunt/stack_clean_test.go
  • modules/terragrunt/stack_generate_test.go
  • modules/terragrunt/stack_output_test.go
  • modules/terragrunt/stack_run_test.go
  • modules/terragrunt/terragrunt_e2e_test.go
  • modules/terragrunt/terragrunt_example_test.go
  • modules/terragrunt/validate_test.go
  • modules/teststructure/go.mod
  • modules/teststructure/save_test_data.go
  • modules/teststructure/save_test_data_test.go
  • modules/teststructure/teststructure.go
  • modules/teststructure/teststructure_test.go
  • test/azure/terraform_azure_aci_example_test.go
  • test/azure/terraform_azure_acr_example_test.go
  • test/azure/terraform_azure_actiongroup_example_test.go
  • test/azure/terraform_azure_aks_example_test.go
  • test/azure/terraform_azure_availabilityset_example_test.go
  • test/azure/terraform_azure_container_apps_example_test.go
  • test/azure/terraform_azure_cosmosdb_example_test.go
  • test/azure/terraform_azure_datafactory_example_test.go
  • test/azure/terraform_azure_disk_example_test.go
  • test/azure/terraform_azure_example_test.go
  • test/azure/terraform_azure_frontdoor_example_test.go
  • test/azure/terraform_azure_functionapp_example_test.go
  • test/azure/terraform_azure_keyvault_example_test.go
  • test/azure/terraform_azure_loadbalancer_example_test.go
  • test/azure/terraform_azure_loganalytics_example_test.go
  • test/azure/terraform_azure_monitor_example_test.go
  • test/azure/terraform_azure_mysqldb_example_test.go
  • test/azure/terraform_azure_network_example_test.go
  • test/azure/terraform_azure_nsg_example_test.go
  • test/azure/terraform_azure_postgresql_example_test.go
  • test/azure/terraform_azure_recoveryservices_example_test.go
  • test/azure/terraform_azure_resourcegroup_example_test.go
  • test/azure/terraform_azure_servicebus_example_test.go
  • test/azure/terraform_azure_sqldb_example_test.go
  • test/azure/terraform_azure_sqlmanagedinstance_example_test.go
  • test/azure/terraform_azure_storage_example_test.go
  • test/azure/terraform_azure_synapse_example_test.go
  • test/azure/terraform_azure_vm_example_test.go
  • test/gcp/terraform_gcp_example_test.go
  • test/gcp/terraform_gcp_hello_world_example_test.go
  • test/gcp/terraform_gcp_ig_example_test.go
  • test/gcp/terraform_gcp_pubsub_example_test.go
  • test/terraform_aws_dynamodb_example_test.go
  • test/terraform_aws_ec2_windows_test.go
  • test/terraform_aws_ecs_example_test.go
  • test/terraform_aws_example_plan_test.go
  • test/terraform_aws_example_test.go
  • test/terraform_aws_hello_world_example_test.go
  • test/terraform_aws_lambda_example_test.go
  • test/terraform_aws_network_example_test.go
  • test/terraform_aws_rds_example_test.go
  • test/terraform_aws_s3_example_test.go
  • test/terraform_aws_ssm_example_test.go
  • test/terraform_backend_example_test.go
  • test/terraform_basic_example_regression_test.go
  • test/terraform_basic_example_test.go
  • test/terraform_database_example_test.go
  • test/terraform_hello_world_example_test.go
  • test/terraform_http_example_test.go
  • test/terraform_opa_example_extra_args_test.go
  • test/terraform_opa_example_test.go
  • test/terraform_packer_example_test.go
  • test/terraform_redeploy_example_test.go
  • test/terraform_remote_exec_example_test.go
  • test/terraform_scp_example_test.go
  • test/terraform_ssh_certificate_example_test.go
  • test/terraform_ssh_example_test.go
  • test/terraform_ssh_password_example_test.go
  • test/terraform_unit_null_test.go

Walkthrough

Terratest’s Terraform, Terragrunt, and teststructure modules now use /v2 import paths. New module manifests and root go.mod entries define local replacements, while existing tests and examples retain their logic.

Changes

Terratest v2 module migration

Layer / File(s) Summary
Add v2 module manifests
go.mod, modules/terraform/go.mod, modules/terragrunt/go.mod, modules/teststructure/go.mod
Adds v2 module declarations, dependency requirements, indirect annotations, and local replacements.
Switch Terraform consumers
modules/terraform/*, test/azure/*, test/gcp/*, test/terraform_*
Replaces unversioned Terraform imports with terraform/v2 while preserving test behavior.
Switch Terragrunt consumers
modules/terragrunt/*
Updates Terragrunt tests and README examples to import terragrunt/v2.
Switch teststructure consumers
modules/teststructure/*, test/gcp/*, test/terraform_*
Updates teststructure and related Terraform imports to their /v2 paths.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: denis256, yhakbar

Poem

Old paths drift, new paths align,
/v2 modules fall in line.
Tests keep their familiar tune,
Manifests bloom beneath the moon.
A tidy module migration—zoom!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the main change and validation, but it omits the template's TODOs, release notes, and migration guide sections. Add the missing template sections: TODOs, release notes draft, and a migration guide or note that none is needed.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: moving IaC packages into versioned /v2 modules.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch james/terratest-v2-iac

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.

@james00012
james00012 marked this pull request as ready for review July 15, 2026 16:54
@james00012
james00012 merged commit 993bbbb into main Jul 16, 2026
21 checks passed
@james00012
james00012 deleted the james/terratest-v2-iac branch July 16, 2026 01:28
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.

2 participants