Skip to content

Commit b1b65d9

Browse files
authored
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.
1 parent 10bbbec commit b1b65d9

File tree

1 file changed

+5
-37
lines changed

1 file changed

+5
-37
lines changed

prod/main.tf

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ terraform {
77
}
88
backend "s3" {
99
bucket = "amzn-digger-demo-s3" # Change if a different S3 bucket name was used for the backend
10-
/* Un-comment to use DynamoDB state locking
11-
dynamodb_table = "digger-locktable-quickstart-aws" # Change if a different DynamoDB table name was used for backend
12-
*/
1310
key = "terraform/state"
1411
region = "us-east-1"
1512
}
@@ -19,41 +16,12 @@ provider "aws" {
1916
region = "us-east-1" # Replace with your desired AWS region
2017
}
2118

22-
resource "aws_vpc" "vpc_network" {
23-
cidr_block = "10.0.0.0/16"
24-
tags = {
25-
Name = "terraform-network"
26-
}
27-
}
28-
29-
resource "aws_subnet" "vpc_subnet" {
30-
vpc_id = aws_vpc.vpc_network.id
31-
cidr_block = "10.0.1.0/24"
32-
availability_zone = "us-east-1a"
33-
map_public_ip_on_launch = true
34-
35-
tags = {
36-
Name = "terraform-subnet"
37-
}
38-
}
39-
40-
resource "aws_security_group" "security_group" {
41-
vpc_id = aws_vpc.vpc_network.id
42-
name_prefix = "terraform-"
43-
ingress {
44-
from_port = 80
45-
to_port = 80
46-
protocol = "tcp"
47-
cidr_blocks = ["0.0.0.0/0"]
48-
}
49-
}
19+
resource "aws_s3_bucket" "example_bucket" {
20+
bucket = "unique-sample-bucket-terraform-111125"
21+
acl = "private"
5022

51-
resource "aws_instance" "vm_instance" {
52-
ami = "ami-05c13eab67c5d8861" # us-east-1 Amazon Linux 2023 AMI 2023.2.20231030.1 x86_64 HVM kernel-6.1
53-
instance_type = "t2.micro"
54-
subnet_id = aws_subnet.vpc_subnet.id
55-
security_groups = [aws_security_group.security_group.id]
5623
tags = {
57-
Name = "terraform-instance"
24+
Name = "ExampleBucket"
25+
Environment = "Dev"
5826
}
5927
}

0 commit comments

Comments
 (0)