Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] create s3 module #10

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading