Skip to content

Commit

Permalink
stupid mistake, deleted chapt 2 code but it didn't work anyway
Browse files Browse the repository at this point in the history
  • Loading branch information
hazzardr committed Feb 11, 2024
1 parent 946abf8 commit 84845c7
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
37 changes: 37 additions & 0 deletions chapter-2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,41 @@ resource "aws_s3_bucket" "terraform_state" {
lifecycle {
prevent_destroy = true
}
}

resource "aws_s3_bucket_versioning" "enabled" {
bucket = aws_s3_bucket.terraform_state.id
versioning_configuration {
status = "Enabled"
}
}

resource "aws_s3_bucket_server_side_encryption_configuration" "default" {
bucket = aws_s3_bucket.terraform_state.id
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}

# Not technically necessary since buckets are private by default. But, this stops us
# from accidentally making it public later (will have pw etc in it)
resource "aws_s3_bucket_public_access_block" "public_access" {
bucket = aws_s3_bucket.terraform_state.id

block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}

resource "aws_dynamodb_table" "terraform_locks" {
name = "terraform-up-and-running-locks"
billing_mode = "PAY_PER_REQUEST"
hash_key = "LockID"
attribute {
name = "LockID"
type = "S"
}
}
24 changes: 24 additions & 0 deletions chapter-3/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions chapter-3/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
provider "aws" {
region = "us-east-2"
}

resource "aws_s3_bucket" "terraform_state" {
bucket = "hazzardr-terraform-up-and-running-state"

# so we don't accidentally delete remote state with a destroy command
lifecycle {
prevent_destroy = true
}
}

resource "aws_s3_bucket_versioning" "enabled" {
bucket = aws_s3_bucket.terraform_state.id
versioning_configuration {
status = "Enabled"
}
}

resource "aws_s3_bucket_server_side_encryption_configuration" "default" {
bucket = aws_s3_bucket.terraform_state.id
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}

# Not technically necessary since buckets are private by default. But, this stops us
# from accidentally making it public later (will have pw etc in it)
resource "aws_s3_bucket_public_access_block" "public_access" {
bucket = aws_s3_bucket.terraform_state.id

block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}

resource "aws_dynamodb_table" "terraform_locks" {
name = "terraform-up-and-running-locks"
billing_mode = "PAY_PER_REQUEST"
hash_key = "LockID"
attribute {
name = "LockID"
type = "S"
}
}

0 comments on commit 84845c7

Please sign in to comment.