Centralize Terraform plan storage - #1993
Conversation
Move Azure and AWS plan bundle handling into dx-tasks so the existing upload and download actions share one tested implementation without changing their contracts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR centralizes Terraform plan bundle storage logic into @pagopa/dx-tasks, and refactors the existing GitHub Actions (upload/download) to act as thin adapters that preserve current inputs/outputs while delegating implementation details to the shared module.
Changes:
- Added a shared plan bundle storage API (
readBackendConfig,computePlanPath,uploadPlanBundle,downloadPlanBundle,deleteRemotePlanBundle) supporting both Azure Blob Storage and S3. - Refactored
terraform-plan-storage-uploadandterraform-plan-storage-downloadactions to use the shared@pagopa/dx-tasks/terraform-plan-storageimplementation. - Added tests + updated lockfile and Nx version plans for the affected packages/actions.
Reviewed changes
Copilot reviewed 10 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Moves Azure/AWS SDK deps from actions to dx-tasks; lockfile refresh. |
| packages/dx-tasks/src/terraform/plan-storage.ts | Introduces shared Azure/S3 plan bundle storage implementation (upload/download/delete + backend parsing). |
| packages/dx-tasks/src/terraform/tests/plan-storage.test.ts | Adds unit tests for the new plan storage module (partial provider coverage). |
| packages/dx-tasks/package.json | Exports the new terraform-plan-storage entrypoint and adds required SDK dependencies. |
| actions/terraform-plan-storage-upload/src/main.ts | Refactors upload action to delegate to uploadPlanBundle and map outputs. |
| actions/terraform-plan-storage-upload/package.json | Replaces direct cloud SDK deps with @pagopa/dx-tasks; adjusts Nx build inputs. |
| actions/terraform-plan-storage-download/src/main.ts | Refactors download action to delegate to downloadPlanBundle and manage post-state. |
| actions/terraform-plan-storage-download/src/post.ts | Refactors post-step cleanup to delegate to deleteRemotePlanBundle. |
| actions/terraform-plan-storage-download/package.json | Replaces direct cloud SDK deps with @pagopa/dx-tasks; adjusts Nx build inputs. |
| .nx/version-plans/version-plan-1784226540183.md | Patch plan for upload/download actions. |
| .nx/version-plans/version-plan-1784226528365.md | Minor plan for @pagopa/dx-tasks to expose shared plan storage. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the added provider coverage compliant with the repository lint configuration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Code Review ReportTerraform Plan:
|
Why
Terraform plan storage was implemented independently in the upload and download actions, making fixes difficult to keep aligned.
What changed
@pagopa/dx-tasks.Validation
pnpm nx run-many -t test lint typecheck -p @pagopa/dx-tasks @pagopa-dx/terraform-plan-storage-upload @pagopa-dx/terraform-plan-storage-downloadpnpm nx run-many -t build -p @pagopa-dx/terraform-plan-storage-upload @pagopa-dx/terraform-plan-storage-downloadExtracted from #1926.