diff --git a/terraform/backend.tf b/terraform/backend.tf index dad5147..939885e 100644 --- a/terraform/backend.tf +++ b/terraform/backend.tf @@ -1,8 +1,6 @@ terraform { backend "s3" { - bucket = "nvhi-atsila-tf-state" - key = "ecs/terraform.tfstate" - region = "us-east-2" - dynamodb_table = "nvhi-atsila-locks" + # Backend configuration values provided via command line during terraform init + # This allows for environment-specific backends while keeping code DRY } -} +} \ No newline at end of file diff --git a/terraform/main.tf b/terraform/main.tf index dd38e9f..40a83ea 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -1,18 +1,5 @@ -# Application Infrastructure - Uses remote state backend -# This contains your ECS cluster, VPC, and application resources - -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - version = "~> 5.0" - } - } -} - -provider "aws" { - region = var.aws_region -} +# Application Infrastructure +# Provider configuration is in versions.tf data "aws_availability_zones" "azs" {} @@ -105,7 +92,7 @@ resource "aws_security_group" "ecs_sg" { } } -# Key Pair - Using hardcoded public key from your original config +# Key Pair resource "aws_key_pair" "deployer" { key_name = var.key_pair_name public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDDFBAOogBj/GHKXQs6FLROGQfXkZe2uKbRron0We7ZOLgt6e1bI7U8IMe+DIH250CHSi4R5DBYFQF5Bk1TkS5cgMtPIAb87vRUGI3sLs29DQA/kllYiZlQi9ejxcEz2+TRWn10Q/Kltlb6ESNLnnnTsIUUxKUeY3MKFFd+V13FleSVLGYondwPWYwD/XJ6a3VwSTJ1wFKO+lpKknSjDl2ZOgYpWFALPH+EwMlRGVMrUXAB604zqR1XOzYXAAWnhmmC9IGgCzU/5JnEgFyhfZbR3kpEH8SmSXahvdFZERp+3j9d3ROjchqnf0Z0zZ7vzX+G+jvzT/jGOkzH9tx0/OqIO9f47OFF8iUfZgUtJU1QGbepdsmQqognhxfJQfMZbVtKUw7zt+mzJz3A0XcRp7IwVHaqJ2QW2dpXi4UbWtejtZqROg6byWq2FpvFGNIT3eiKTf+EpCoOec6YGSrRQlj73Ob0+FhmsyQ6e8KKncaRYx38PqtnWsI3UnLtdKmEJmDBPI0ipxJzmKJKtb0vtJPVYvFEpgiXSwnDX883rAUQrXR/EhOMmbMwk7JSes6/GXH9rWN10JHh1/i1LLpl+rg6VyktFgVBHzVw++y29QSfFixeTvFkkTS5kl//CpKd1GDQb9ZBH6SPgkgOjmASPUo+p5e/NiN/SIBSpYpMjOKs7Q== jacques@Xochiquetzal" @@ -217,7 +204,7 @@ resource "aws_instance" "ecs_instance" { } } -# ECS Service (placeholder - you may want to manage this separately) +# ECS Service resource "aws_ecs_service" "main" { name = "${var.cluster_name}-service" cluster = aws_ecs_cluster.main.id diff --git a/terraform/variables.tf b/terraform/variables.tf index f113b36..d9e6bc9 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -1,10 +1,11 @@ variable "aws_region" { - type = string - default = "us-east-2" + description = "AWS region for resources" + type = string + default = "us-east-2" } variable "jenkins_ip_cidr" { - description = "CIDR block for SSH access from Jenkins (injected by pipeline)" + description = "CIDR block for SSH access from Jenkins" type = string } @@ -31,4 +32,4 @@ variable "instance_type" { variable "key_pair_name" { description = "EC2 Key Pair name" type = string -} +} \ No newline at end of file