Skip to content

Update terraform module#590

Open
Thanhphan1147 wants to merge 8 commits into
mainfrom
update_terraform_module
Open

Update terraform module#590
Thanhphan1147 wants to merge 8 commits into
mainfrom
update_terraform_module

Conversation

@Thanhphan1147

Copy link
Copy Markdown
Collaborator

What this PR does

Adds non-breaking outputs/inputs to the Terraform modules to align with CC008 (Charm Terraform Standards). No existing interface changes:

  • Charm modules (haproxy, haproxy_spoe_auth, haproxy_ddos_protection_configurator): add the application output exposing the deployed juju_application object.
  • Product module: add the models output (model UUID + deployed components) and the metadata output (version), plus a new metadata_version input.
  • Tests: assert the new product outputs in terraform/tests/main.tftest.hcl.

All changes are additive — existing app_name, provides, and requires outputs are unchanged.

Why we need it

CC008 mandates an application output for charm modules and models/metadata outputs for product modules. These additions improve module consumability (cross-module wiring, deployment metadata) while remaining backward compatible.

Test plan

  • terraform fmt -check -recursive — passes
  • terraform validate on all four modules (charm/haproxy, charm/haproxy_spoe_auth, charm/haproxy_ddos_protection_configurator, product) — Success!
  • tflint — runs in CI (test_terraform_files.yaml)
  • New terraform test assertions for models/metadata run in CI (test_terraform_module.yaml, needs a Juju controller)

Review focus

  • terraform/product/outputs.tfmodels.components references the new charm application outputs and merges the for_each spoe-auth/oauth applications.
  • metadata is intentionally version-only (no timestamps) to avoid plan/apply churn.

Potential breaking changes

None — all changes are additive. Deferred to a future major-bump PR: converting provides/requires to map(object) with kind/name/endpoint (and cross-controller controller field).

Checklist

  • I followed the contributing guide
  • I added or updated tests as needed (unit and integration)
  • If this PR involves Terraform: terraform fmt passes and tflint reports no errors
  • I used AI to assist with preparing this PR
  • I added or updated the documentation (if applicable) — module READMEs are auto-generated by the terraform-docs workflow
  • I updated docs/changelog.md with user-relevant changes
  • I added a change artifact / tagged no-release-note

@Thanhphan1147 Thanhphan1147 requested a review from a team as a code owner June 30, 2026 21:01
@Thanhphan1147 Thanhphan1147 changed the title Add CC008-aligned Terraform outputs (application, models, metadata) Update terraform module Jul 1, 2026
@Thanhphan1147 Thanhphan1147 added the no-release-note This PR does not require a change artifact label Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Libraries: Out of sync no-release-note This PR does not require a change artifact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant