Skip to content

Commit

Permalink
fix(DMVP-5087): have index object acl set based on bucket acl and hav…
Browse files Browse the repository at this point in the history
…e additional outputs for module
  • Loading branch information
mrdntgrn committed Aug 26, 2024
1 parent 56bea9c commit d25ee52
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -125,10 +125,12 @@ module "my_bucket" {

| Name | Description |
|------|-------------|
| <a name="output_bucket_regional_domain_name"></a> [bucket\_regional\_domain\_name](#output\_bucket\_regional\_domain\_name) | The bucket regional domain name |
| <a name="output_iam_access_key_id"></a> [iam\_access\_key\_id](#output\_iam\_access\_key\_id) | The access key ID |
| <a name="output_iam_access_key_secret"></a> [iam\_access\_key\_secret](#output\_iam\_access\_key\_secret) | The access key secret |
| <a name="output_iam_user_arn"></a> [iam\_user\_arn](#output\_iam\_user\_arn) | The ARN assigned by AWS for this user |
| <a name="output_iam_user_name"></a> [iam\_user\_name](#output\_iam\_user\_name) | The user's name |
| <a name="output_s3_bucket_arn"></a> [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | The bucket arn |
| <a name="output_s3_bucket_id"></a> [s3\_bucket\_id](#output\_s3\_bucket\_id) | The bucket name |
| <a name="output_s3_bucket_website_endpoint"></a> [s3\_bucket\_website\_endpoint](#output\_s3\_bucket\_website\_endpoint) | The website endpoint associated to created s3 bucket |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
7 changes: 4 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
}
}
Expand All @@ -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, "**")
}
10 changes: 10 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d25ee52

Please sign in to comment.