From b1b65d908b114a46ce0f972c6379fa3dde29529d Mon Sep 17 00:00:00 2001 From: Alfredo Alonso Date: Mon, 10 Nov 2025 22:57:54 -0500 Subject: [PATCH] Refactor Terraform configuration and add S3 bucket Removed commented-out DynamoDB state locking configuration and several AWS resources including VPC, subnet, security group, and EC2 instance. Added a new S3 bucket resource with specific configurations. --- prod/main.tf | 42 +++++------------------------------------- 1 file changed, 5 insertions(+), 37 deletions(-) diff --git a/prod/main.tf b/prod/main.tf index ed17668..35820cf 100644 --- a/prod/main.tf +++ b/prod/main.tf @@ -7,9 +7,6 @@ terraform { } backend "s3" { bucket = "amzn-digger-demo-s3" # Change if a different S3 bucket name was used for the backend - /* Un-comment to use DynamoDB state locking - dynamodb_table = "digger-locktable-quickstart-aws" # Change if a different DynamoDB table name was used for backend - */ key = "terraform/state" region = "us-east-1" } @@ -19,41 +16,12 @@ provider "aws" { region = "us-east-1" # Replace with your desired AWS region } -resource "aws_vpc" "vpc_network" { - cidr_block = "10.0.0.0/16" - tags = { - Name = "terraform-network" - } -} - -resource "aws_subnet" "vpc_subnet" { - vpc_id = aws_vpc.vpc_network.id - cidr_block = "10.0.1.0/24" - availability_zone = "us-east-1a" - map_public_ip_on_launch = true - - tags = { - Name = "terraform-subnet" - } -} - -resource "aws_security_group" "security_group" { - vpc_id = aws_vpc.vpc_network.id - name_prefix = "terraform-" - ingress { - from_port = 80 - to_port = 80 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } -} +resource "aws_s3_bucket" "example_bucket" { + bucket = "unique-sample-bucket-terraform-111125" + acl = "private" -resource "aws_instance" "vm_instance" { - ami = "ami-05c13eab67c5d8861" # us-east-1 Amazon Linux 2023 AMI 2023.2.20231030.1 x86_64 HVM kernel-6.1 - instance_type = "t2.micro" - subnet_id = aws_subnet.vpc_subnet.id - security_groups = [aws_security_group.security_group.id] tags = { - Name = "terraform-instance" + Name = "ExampleBucket" + Environment = "Dev" } }