From d25ee52a1af1cb977c09c0f637167b4d9ab67b44 Mon Sep 17 00:00:00 2001 From: Tigran Muradyan Date: Mon, 26 Aug 2024 15:16:11 +0400 Subject: [PATCH] fix(DMVP-5087): have index object acl set based on bucket acl and have additional outputs for module --- README.md | 8 +++++--- main.tf | 7 ++++--- outputs.tf | 10 ++++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 88d6769..943c2d5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Creates AWS S3 bucket and if there is need IAM user with appropriated accesses t module "my_bucket" { source = "dasmeta/s3/aws" - version = "2.0.0" + version = "1.2.1" name = "my-files-bucket" } @@ -31,7 +31,7 @@ output "iam_user_arn" { ```terraform module "my_bucket" { source = "dasmeta/s3/aws" - version = "2.0.0" + version = "1.2.1" name = "my-files-bucket" @@ -53,7 +53,7 @@ module "my_bucket" { ```terraform module "my_bucket" { source = "dasmeta/s3/aws" - version = "2.0.0" + version = "1.2.1" name = "my-website" @@ -125,10 +125,12 @@ module "my_bucket" { | Name | Description | |------|-------------| +| [bucket\_regional\_domain\_name](#output\_bucket\_regional\_domain\_name) | The bucket regional domain name | | [iam\_access\_key\_id](#output\_iam\_access\_key\_id) | The access key ID | | [iam\_access\_key\_secret](#output\_iam\_access\_key\_secret) | The access key secret | | [iam\_user\_arn](#output\_iam\_user\_arn) | The ARN assigned by AWS for this user | | [iam\_user\_name](#output\_iam\_user\_name) | The user's name | +| [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | The bucket arn | | [s3\_bucket\_id](#output\_s3\_bucket\_id) | The bucket name | | [s3\_bucket\_website\_endpoint](#output\_s3\_bucket\_website\_endpoint) | The website endpoint associated to created s3 bucket | diff --git a/main.tf b/main.tf index 10b9cf8..7c36023 100644 --- a/main.tf +++ b/main.tf @@ -33,12 +33,13 @@ resource "aws_s3_object" "index" { bucket = module.bucket.s3_bucket_id key = "index.html" content = "OK, ${module.bucket.s3_bucket_id}" - acl = "public-read" + acl = var.acl content_type = "text/html" lifecycle { ignore_changes = [ - content + content, + acl ] } } @@ -51,6 +52,6 @@ module "bucket_files" { bucket = module.bucket.s3_bucket_id path = var.bucket_files.path - acl = try(var.bucket_files.acl, "public-read") + acl = try(var.bucket_files.acl, var.acl) pattern = try(var.bucket_files.pattern, "**") } diff --git a/outputs.tf b/outputs.tf index 96e25d6..49ce57d 100644 --- a/outputs.tf +++ b/outputs.tf @@ -3,11 +3,21 @@ output "s3_bucket_id" { value = module.bucket.s3_bucket_id } +output "s3_bucket_arn" { + description = "The bucket arn" + value = module.bucket.s3_bucket_arn +} + output "s3_bucket_website_endpoint" { description = "The website endpoint associated to created s3 bucket" value = module.bucket.s3_bucket_website_endpoint } +output "bucket_regional_domain_name" { + description = "The bucket regional domain name" + value = module.bucket.s3_bucket_bucket_regional_domain_name +} + output "iam_user_name" { description = "The user's name" value = module.iam_user.iam_user_name