Skip to content

Conversation

meraj-kashi
Copy link

@meraj-kashi meraj-kashi commented Jul 28, 2025

Refactor Terraform Configuration for Module Reusability

This PR refactors the Terraform configuration to improve its usability as a module within other projects.

Currently, the Terraform module includes a hardcoded backend configuration and AWS provider definitions, which makes it difficult to integrate the module into other Terraform-based infrastructures.

The final goal is to consume the module in the below way:

module "cloud-intelligence-dashboard" {
  source = "github.com/aws-solutions-library-samples/cloud-intelligence-dashboards-framework//terraform/cicd-deployment?ref=<release-tag>"

}

Challenges Addressed

  1. The Terraform backend configuration should not be included in the module itself. It must be defined by the consumer project to maintain flexibility.
  2. An IAM role for the destination account was hardcoded, preventing deployments where the destination account is the primary executor (i.e., when not using cross-account roles). This setup assumes a cross-account deployment model from the payer (master) account only.

Summary of Changes

  1. Removed the backend configuration from the module.
  2. Removed AWS provider definitions from provider.tf.
  3. Added configuration_aliases to the terraform block to support both payer and destination account deployments.
  4. Updated the README.md with new instructions for using the module, including deployment details and the rationale for these changes.
  5. Modified deploy.sh to generate a versions.tf file containing the AWS provider configuration.
    Previously, the script generated a _overrides.tf file, which conflicted with the current provider setup.
    By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@iakov-aws iakov-aws requested a review from vtaws July 28, 2025 10:10
@iakov-aws
Copy link
Contributor

@vtaws
please can you check that?

@roynesholen
Copy link

@vtaws, @iakov-aws Can you please check and merge this improvement, thanks

@PhilippEngl
Copy link

Gamechanger 🚀 please merge

@vtaws
Copy link
Contributor

vtaws commented Aug 7, 2025

Hi @meraj-kashi @roynesholen @PhilippEngl,

I want to sincerely thank you all for your valuable suggestions and feedback. @meraj-kashi, I'm particularly grateful for the significant time and effort you've invested in converting our terraform code to a modular approach - this is exactly the kind of collaborative improvement that makes our community thrive.

I'm excited to share that we're actually in the final stages of a comprehensive modularization effort that extends beyond the current foundational dashboards. While our public terraform currently supports 3 dashboards, we've been working behind the scenes to modularize the entire suite of 25+ dashboards. Several additional dashboards have already been completed and are currently in testing.

Rather than creating potential merge conflicts between your PR and our in-progress work, I believe the most efficient path forward would be to complete our current modularization effort. I'll be keeping your PR as a valuable reference, as it contains insights that will certainly benefit our implementation.

We expect to release the modularized version with additional dashboards very soon, which should address the integration needs you've highlighted. Your contribution has reinforced that we're moving in the right direction, and I truly appreciate your initiative in helping improve this project.

Thank you again for your support and engagement. Contributions like yours are invaluable, and I look forward to your continued input on this and future developments.

FYI: progress will be documented here: #1286

@abportela
Copy link

+1 just to increase the pressure here :)

This is blocking our adoption of CID.

@abportela
Copy link

@vtaws got an ETA you could share with us?

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.

6 participants