diff --git a/backend/main.tf b/backend/main.tf index f0fc96f..22181a0 100644 --- a/backend/main.tf +++ b/backend/main.tf @@ -2,40 +2,50 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = "5.23.1" + version = "5.24.0" } } } provider "aws" { - region = "us-east-1" # Replace with your desired AWS region + region = "us-east-1" } -resource "random_string" "bucket_prefix" { - length = 8 - special = false +resource "aws_s3_bucket" "example" { + bucket = "bucket-tfstate" } -resource "aws_s3_bucket" "default" { - bucket = "${random_string.bucket_prefix.result}-bucket-tfstate" -} - -resource "aws_s3_bucket_versioning" "versioning_example" { - bucket = aws_s3_bucket.default.id +resource "aws_s3_bucket_versioning" "example" { + bucket = aws_s3_bucket.example.id versioning_configuration { status = "Enabled" } } -resource "aws_s3_bucket_acl" "example" { - bucket = aws_s3_bucket.default.id - acl = "private" -} +resource "aws_s3_bucket_public_access_block" "example" { + bucket = aws_s3_bucket.example.id + block_public_acls = true + block_public_policy = true + ignore_public_acls = true + restrict_public_buckets = true +} resource "aws_dynamodb_table" "DiggerDynamoDBLockTable" { name = "DiggerDynamoDBLockTable" billing_mode = "PAY_PER_REQUEST" stream_enabled = true stream_view_type = "NEW_AND_OLD_IMAGES" + hash_key = "PK" + range_key = "SK" + + attribute { + name = "PK" + type = "S" + } + + attribute { + name = "SK" + type = "S" + } }