Skip to content

Add Terraform configuration files for stack migration and AWS resources#4

Open
sujaysamanta wants to merge 1 commit intomainfrom
stack-retry-test-v4
Open

Add Terraform configuration files for stack migration and AWS resources#4
sujaysamanta wants to merge 1 commit intomainfrom
stack-retry-test-v4

Conversation

@sujaysamanta
Copy link
Contributor

@sujaysamanta sujaysamanta commented Jan 8, 2026

This pull request introduces a new Terraform stacks-based infrastructure setup, including configuration for an EC2 instance component, deployment definitions, provider and variable management, and supporting infrastructure for managing Terraform stacks and migrations. The changes automate and standardize the provisioning and management of resources using Terraform stacks, and add supporting infrastructure for stack migration and management via Terraform Cloud/Enterprise.

The most important changes are:

Stacks-based EC2 Instance Component Setup:

  • Adds a new component definition for an EC2 instance using the terraform-aws-modules/ec2-instance/aws module, with inputs for AMI, instance type, monitoring, name, subnet, and tags (_stacks_generated/components.tfcomponent.hcl).
  • Defines outputs for the EC2 instance, including instance_id and instance_public_ip (_stacks_generated/outputs.tfcomponent.hcl).
  • Introduces variables for configuring the EC2 instance and AWS credentials, with appropriate types, defaults, and sensitivity/ephemerality where needed (_stacks_generated/variables.tfcomponent.hcl).
  • Configures the AWS provider for the component, specifying region and credentials, and sets required provider versions (_stacks_generated/providers.tfcomponent.hcl).

Deployment and Provider Locking:

  • Adds deployment definitions for dev-workspace and prod-workspace, wiring in variable sets for AWS credentials and specifying instance configuration for each workspace (_stacks_generated/deployment.tfdeploy.hcl).
  • Locks the AWS provider version and hashes in the Terraform lock file for reproducible builds (_stacks_generated/.terraform.lock.hcl).
  • Sets the Terraform version to 1.13.5 for the stacks-generated configuration (_stacks_generated/.terraform-version).

Stacks Migration Infrastructure:

  • Adds a new infrastructure module for managing Terraform stacks and migrations, including provider configuration for tfe (Terraform Cloud/Enterprise) and tfmigrate, and resources for projects, stacks, and stack migrations (stacks_migration_infra/main.tf).
  • Locks provider versions and hashes for tfe and tfmigrate to ensure consistent infrastructure management (stacks_migration_infra/.terraform.lock.hcl).
  • Defines variables for organization, project, stack names, configuration directories, and workspace-deployment mapping (stacks_migration_infra/variables.tf).
  • Adds outputs for project and stack URLs, and decodes stack deployment details from migration hash for easier inspection (stacks_migration_infra/output.tf).

Stacks Details

Project URL: https://app.terraform.io/app/sujay-test-01/projects/prj-YGNMV3GYrwPLyoPK
Stack URL: https://app.terraform.io/app/sujay-test-01/projects/prj-YGNMV3GYrwPLyoPK/stacks/st-jM9MGFHL32wNEwXP

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.

1 participant