Skip to content

Commit 943b3b9

Browse files
committed
Fix provider version; backend config; AZ; VPC ID; AMI ID; EC2 security group
1 parent 855d323 commit 943b3b9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

prod/main.tf

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = "3.0.0" # Use an appropriate version
5+
version = "5.24.0"
66
}
77
}
88
backend "s3" {
9-
bucket = "8046b8f4c208f5bb-bucket-tfstate"
9+
bucket = "digger-s3backend-quickstart-aws" # 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+
*/
1013
key = "terraform/state"
1114
region = "us-east-1"
1215
}
13-
1416
}
1517

1618
provider "aws" {
@@ -27,7 +29,7 @@ resource "aws_vpc" "vpc_network" {
2729
resource "aws_subnet" "vpc_subnet" {
2830
vpc_id = aws_vpc.vpc_network.id
2931
cidr_block = "10.0.1.0/24"
30-
availability_zone = "us-east-2a"
32+
availability_zone = "us-east-1a"
3133
map_public_ip_on_launch = true
3234

3335
tags = {
@@ -36,6 +38,7 @@ resource "aws_subnet" "vpc_subnet" {
3638
}
3739

3840
resource "aws_security_group" "security_group" {
41+
vpc_id = aws_vpc.vpc_network.id
3942
name_prefix = "terraform-"
4043
ingress {
4144
from_port = 80
@@ -46,10 +49,10 @@ resource "aws_security_group" "security_group" {
4649
}
4750

4851
resource "aws_instance" "vm_instance" {
49-
ami = "ami-0b17ac7207aae009f" #Debian 11 (bullsey AMI provided by the Debian Project https://wiki.debian.org/Cloud/AmazonEC2Image/Bullseye)
52+
ami = "ami-05c13eab67c5d8861" # us-east-1 Amazon Linux 2023 AMI 2023.2.20231030.1 x86_64 HVM kernel-6.1
5053
instance_type = "t2.micro"
5154
subnet_id = aws_subnet.vpc_subnet.id
52-
security_groups = [aws_security_group.security_group.name]
55+
security_groups = [aws_security_group.security_group.id]
5356
tags = {
5457
Name = "terraform-instance"
5558
}

0 commit comments

Comments
 (0)