Skip to content

Commit

Permalink
[feat] create s3 module
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyBoWu committed May 10, 2024
1 parent fdc010b commit 15963eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 2 additions & 0 deletions infra/s3/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module "s3-bucket" {
source = "terraform-aws-modules/s3-bucket/aws"
version = "4.1.2"

bucket = var.bucket_name
}
11 changes: 2 additions & 9 deletions statestore/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@ locals {
dynamodb_table_name = "${var.project}-${var.env}-tflock-${var.region}"
}

resource "random_string" "bucket_suffix" {
length = 8
special = false
upper = false
numeric = true
}

resource "aws_s3_bucket" "bucket" {
bucket = format("%s-%s", local.bucket_name, random_string.bucket_suffix.result)
bucket = local.bucket_name

lifecycle {
prevent_destroy = true
Expand All @@ -26,7 +19,7 @@ resource "aws_s3_bucket_versioning" "versioning" {
}

resource "aws_dynamodb_table" "table" {
name = format("%s-%s", local.dynamodb_table_name, random_string.bucket_suffix.result)
name = local.dynamodb_table_name
hash_key = "LockID"
read_capacity = 20
write_capacity = 20
Expand Down

0 comments on commit 15963eb

Please sign in to comment.