diff --git a/Terraform-AWS-Services-Creation/terraform-state-s3-bucket/main.tf b/Terraform-AWS-Services-Creation/terraform-state-s3-bucket/main.tf index cba9f7a..7f55add 100644 --- a/Terraform-AWS-Services-Creation/terraform-state-s3-bucket/main.tf +++ b/Terraform-AWS-Services-Creation/terraform-state-s3-bucket/main.tf @@ -2,17 +2,24 @@ provider "aws" { region = "us-east-1" } -resource "aws_s3_bucket" "terraform_state" { - bucket = "terraform-state-devopsthehardway" - versioning { - enabled = true +resource "aws_s3_bucket" "terraform_state_bucket" { + bucket = "terraform-state-devopsthehardway-dcnproject" +} + +resource "aws_s3_bucket_versioning" "versioning_terraform_state" { + bucket = aws_s3_bucket.terraform_state_bucket.id + versioning_configuration { + status = "Enabled" } - server_side_encryption_configuration { - rule { +} + +resource "aws_s3_bucket_server_side_encryption_configuration" "encryption_terraform_state" { + bucket = aws_s3_bucket.terraform_state_bucket.id + + rule { apply_server_side_encryption_by_default { sse_algorithm = "AES256" } } - } } \ No newline at end of file