Skip to content

Conversation

kin0992
Copy link
Contributor

@kin0992 kin0992 commented Sep 10, 2025

This pull request enhances the infrastructure scaffolding process in the monorepo generator by improving how Terraform files are organized and generated. The changes introduce a clearer separation of repository-level and environment-specific Terraform files, and add a new default provider configuration template for production environments.

Depends on #863 #884 #911
Closes CES-1260

Copy link

changeset-bot bot commented Sep 10, 2025

🦋 Changeset detected

Latest commit: 90fe018

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@pagopa/monorepo-generator Minor
@pagopa/dx-cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2025

Codecov Report

❌ Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.85%. Comparing base (8abeb56) to head (acab9b9).
⚠️ Report is 65 commits behind head on main.

Files with missing lines Patch % Lines
packages/monorepo-generator/src/index.ts 0.00% 23 Missing ⚠️

❌ Your project status has failed because the head coverage (47.85%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #864       +/-   ##
===========================================
- Coverage   67.85%   47.85%   -20.01%     
===========================================
  Files          31       39        +8     
  Lines         840     1469      +629     
  Branches      146      184       +38     
===========================================
+ Hits          570      703      +133     
- Misses        258      752      +494     
- Partials       12       14        +2     
Files with missing lines Coverage Δ
packages/monorepo-generator/src/index.ts 0.67% <0.00%> (ø)

... and 6 files with indirect coverage changes

🚀 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.

@kin0992 kin0992 marked this pull request as ready for review September 11, 2025 08:03
@kin0992 kin0992 requested a review from a team as a code owner September 11, 2025 08:03
@Copilot Copilot AI review requested due to automatic review settings September 11, 2025 08:03
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request enhances the infrastructure scaffolding process by introducing clearer separation between repository-level and environment-specific Terraform files. It adds support for scaffolding a default production environment with its own provider configuration template.

Key changes:

  • Adds a new Terraform provider template for the production environment
  • Refactors the Terraform file generation to separate repository and environment concerns
  • Introduces new functions to handle environment-specific file scaffolding

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/monorepo-generator/templates/monorepo/infra/resources/prod/providers.tf.hbs Adds new Terraform provider template for production environment
packages/monorepo-generator/src/index.ts Refactors Terraform file generation functions and adds environment-specific scaffolding
.changeset/weak-bears-crash.md Documents the addition of default prod environment to the template

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@kin0992 kin0992 force-pushed the features/scaffold-terraform-repository-configuration branch 5 times, most recently from b6c732c to b1d5765 Compare September 16, 2025 10:37
@kin0992 kin0992 marked this pull request as draft September 16, 2025 12:54
@kin0992 kin0992 force-pushed the features/scaffold-terraform-repository-configuration branch from 871c3a3 to 576a6b8 Compare September 17, 2025 07:53
@kin0992 kin0992 force-pushed the features/scaffold-empty-infra-prod-environment-directory branch from f111c61 to 7b03d33 Compare September 17, 2025 07:57
@kin0992 kin0992 force-pushed the features/scaffold-terraform-repository-configuration branch 2 times, most recently from f60f4dc to 74d2054 Compare September 18, 2025 13:37
Base automatically changed from features/scaffold-terraform-repository-configuration to main September 19, 2025 09:46
Copy link

dpulls bot commented Sep 19, 2025

🎉 All dependencies have been resolved !

@kin0992 kin0992 force-pushed the features/scaffold-empty-infra-prod-environment-directory branch from 7b03d33 to d0386d0 Compare September 22, 2025 06:57
� Conflicts:
�	packages/monorepo-generator/package.json
�	pnpm-lock.yaml
# Conflicts:
#	packages/monorepo-generator/src/adapters/octokit/index.ts
� Conflicts:
�	apps/cli/package.json
�	packages/monorepo-generator/package.json
�	pnpm-lock.yaml
�	pnpm-workspace.yaml
# Conflicts:
#	packages/monorepo-generator/src/adapters/octokit/index.ts

core_state = {
bucket = "{{ awsAccountId }}-terraform-state"
key = "{{ repoName }}.repository.tfstate"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: key contains repository. it should not here since we are in the bootstrapper

location = "{{ azureLocation }}"
location_short = "{{ locationShort }}"
domain = "{{ domain }}"
app_name = "{{ awsAppName }}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: do we really need the app_name? why the parameter is called awsAppName then? here we are in the azure template

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the underlying module variables, the app_name can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the location_short as well

@kin0992 kin0992 requested a review from Copilot October 2, 2025 10:59
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@kin0992 kin0992 requested a review from Copilot October 2, 2025 11:12
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment on lines +6 to +7
resource_group_name = "{{ tfStateResourceGroupName }}"
storage_account_name = "{{ tfStateStorageAccountName }}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: those parameters are not coded into this PR, but we are going to inherit them from #911 🚓

@kin0992 kin0992 requested a review from Copilot October 2, 2025 11:13
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@kin0992 kin0992 marked this pull request as ready for review October 2, 2025 12:53
@kin0992
Copy link
Contributor Author

kin0992 commented Oct 2, 2025

To verify the generated code:

  1. run pnpm build
  2. run ENABLE_INIT_COMMAND=true node apps/cli/bin/index.js init project from the repo root
  3. answer the questions

Please note that the resource_group_name and storage_account_name might be empty in this branch, because the questions are in a different PR

cc @pagopa/engineering-team-devex

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