From 3f3d1d6f313333cd3b626b4b8b3f38c4827b541d Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 4 Aug 2023 14:34:42 +0200 Subject: s3_state -> aws/state --- aws/state/main.tf | 44 ++++++++++++++++++++++++++++++++++++++++++++ aws/state/variables.tf | 6 ++++++ s3_state/main.tf | 44 -------------------------------------------- s3_state/variables.tf | 6 ------ 4 files changed, 50 insertions(+), 50 deletions(-) create mode 100644 aws/state/main.tf create mode 100644 aws/state/variables.tf delete mode 100644 s3_state/main.tf delete mode 100644 s3_state/variables.tf diff --git a/aws/state/main.tf b/aws/state/main.tf new file mode 100644 index 0000000..1190892 --- /dev/null +++ b/aws/state/main.tf @@ -0,0 +1,44 @@ +resource "aws_s3_bucket" "state" { + bucket = var.bucket_name + + lifecycle { + prevent_destroy = true + } +} + +resource "aws_s3_bucket_versioning" "default" { + bucket = aws_s3_bucket.state.id + + versioning_configuration { + status = "Enabled" + } +} + +resource "aws_s3_bucket_server_side_encryption_configuration" "default" { + bucket = aws_s3_bucket.state.id + + rule { + apply_server_side_encryption_by_default { + sse_algorithm = "AES256" + } + } +} + +resource "aws_s3_bucket_public_access_block" "default" { + bucket = aws_s3_bucket.state.id + block_public_acls = true + block_public_policy = true + ignore_public_acls = true + restrict_public_buckets = true +} + +resource "aws_dynamodb_table" "locks" { + name = var.dynamodb_table_name + billing_mode = "PAY_PER_REQUEST" + hash_key = "LockID" + + attribute { + name = "LockID" + type = "S" + } +} diff --git a/aws/state/variables.tf b/aws/state/variables.tf new file mode 100644 index 0000000..861b754 --- /dev/null +++ b/aws/state/variables.tf @@ -0,0 +1,6 @@ +variable "bucket_name" { + type = string +} +variable "dynamodb_table_name" { + type = string +} diff --git a/s3_state/main.tf b/s3_state/main.tf deleted file mode 100644 index 1190892..0000000 --- a/s3_state/main.tf +++ /dev/null @@ -1,44 +0,0 @@ -resource "aws_s3_bucket" "state" { - bucket = var.bucket_name - - lifecycle { - prevent_destroy = true - } -} - -resource "aws_s3_bucket_versioning" "default" { - bucket = aws_s3_bucket.state.id - - versioning_configuration { - status = "Enabled" - } -} - -resource "aws_s3_bucket_server_side_encryption_configuration" "default" { - bucket = aws_s3_bucket.state.id - - rule { - apply_server_side_encryption_by_default { - sse_algorithm = "AES256" - } - } -} - -resource "aws_s3_bucket_public_access_block" "default" { - bucket = aws_s3_bucket.state.id - block_public_acls = true - block_public_policy = true - ignore_public_acls = true - restrict_public_buckets = true -} - -resource "aws_dynamodb_table" "locks" { - name = var.dynamodb_table_name - billing_mode = "PAY_PER_REQUEST" - hash_key = "LockID" - - attribute { - name = "LockID" - type = "S" - } -} diff --git a/s3_state/variables.tf b/s3_state/variables.tf deleted file mode 100644 index 861b754..0000000 --- a/s3_state/variables.tf +++ /dev/null @@ -1,6 +0,0 @@ -variable "bucket_name" { - type = string -} -variable "dynamodb_table_name" { - type = string -} -- cgit v1.2.3