Skip to content

Commit

Permalink
- add outputs
Browse files Browse the repository at this point in the history
  - s3_requested_bucket_name
  - s3_module_settings
  • Loading branch information
badra001 committed Mar 1, 2022
1 parent 918df06 commit 5186969
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ Provides standard and t26 S3 bucket construction.
- ${s3_bucket_arn} in the template to get replaced with the created s3 bucket ARN
- ${s3_bucket_id} in the template to get replaced with the created s3 bucket ID
- ${kms_key_arn} in the template to get replaced with the provided or created KMS Key ARN

* 2.4.4 -- 2022-03-01
- add outputs
- s3_requested_bucket_name
- s3_module_settings
21 changes: 21 additions & 0 deletions common/outputs.s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,24 @@ output "s3_bucket_id" {
description = "Created S3 Bucket ID"
value = aws_s3_bucket.this.id
}

output "s3_requested_bucket_name" {
description = "Requested S3 Bucket Name before prefix and other settings"
value = var.bucket_name
}

output "s3_module_settings" {
description = "S3 module settings and values"
value = {
bucket_name = var.bucket_name
resulting_bucket_name = local.bucket_name
resulting_bucket_arn = aws_s3_bucket.this.arn
name_include_region = var.name_include_region
name_include_account = var.name_include_account
name_include_region_compact = var.name_include_region_compact
name_enforce_region_compact = var.name_enforce_region_compact
account_id = local.account_id
region = local.region
region_short = local.region_short
}
}
2 changes: 1 addition & 1 deletion common/version.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
locals {
_module_version = "2.4.3"
_module_version = "2.4.4"
}
24 changes: 24 additions & 0 deletions standard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,28 @@ this shorter region value.
## Options :: name\_enforce\_region\_compact
This flag always compacts the region, no mater whehter the name is longer than 63 characters or not.

# Outputs
One output of note is the `s3_module_settings`. With this, you can get the settings used when calling the
module, the original bucket name before prefix and suffixes, and other things. It is a map.

```hcl
output "s3_module_settings" {
description = "S3 module settings and values"
value = {
bucket_name = var.bucket_name
resulting_bucket_name = local.bucket_name
resulting_bucket_arn = aws_s3_bucket.this.arn
name_include_region = var.name_include_region
name_include_account = var.name_include_account
name_include_region_compact = var.name_include_region_compact
name_enforce_region_compact = var.name_enforce_region_compact
account_id = local.account_id
region = local.region
region_short = local.region_short
}
}
```

## Requirements

No requirements.
Expand Down Expand Up @@ -193,3 +215,5 @@ No modules.
| <a name="output_kms_key_id"></a> [kms\_key\_id](#output\_kms\_key\_id) | KMS Key ID. This is the created key id or the key id of kms\_key\_arn |
| <a name="output_s3_bucket_arn"></a> [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | Created S3 Bucket ARN |
| <a name="output_s3_bucket_id"></a> [s3\_bucket\_id](#output\_s3\_bucket\_id) | Created S3 Bucket ID |
| <a name="output_s3_module_settings"></a> [s3\_module\_settings](#output\_s3\_module\_settings) | S3 module settings and values |
| <a name="output_s3_requested_bucket_name"></a> [s3\_requested\_bucket\_name](#output\_s3\_requested\_bucket\_name) | Requested S3 Bucket Name before prefix and other settings |
22 changes: 22 additions & 0 deletions standard/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,28 @@
* ## Options :: name_enforce_region_compact
* This flag always compacts the region, no mater whehter the name is longer than 63 characters or not.
*
*
* # Outputs
* One output of note is the `s3_module_settings`. With this, you can get the settings used when calling the
* module, the original bucket name before prefix and suffixes, and other things. It is a map.
*
* ```hcl
* output "s3_module_settings" {
* description = "S3 module settings and values"
* value = {
* bucket_name = var.bucket_name
* resulting_bucket_name = local.bucket_name
* resulting_bucket_arn = aws_s3_bucket.this.arn
* name_include_region = var.name_include_region
* name_include_account = var.name_include_account
* name_include_region_compact = var.name_include_region_compact
* name_enforce_region_compact = var.name_enforce_region_compact
* account_id = local.account_id
* region = local.region
* region_short = local.region_short
* }
* }
* ```
*/

locals {
Expand Down
24 changes: 24 additions & 0 deletions title26/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,28 @@ this shorter region value.
## Options :: name\_enforce\_region\_compact
This flag always compacts the region, no mater whehter the name is longer than 63 characters or not.

# Outputs
One output of note is the `s3_module_settings`. With this, you can get the settings used when calling the
module, the original bucket name before prefix and suffixes, and other things. It is a map.

```hcl
output "s3_module_settings" {
description = "S3 module settings and values"
value = {
bucket_name = var.bucket_name
resulting_bucket_name = local.bucket_name
resulting_bucket_arn = aws_s3_bucket.this.arn
name_include_region = var.name_include_region
name_include_account = var.name_include_account
name_include_region_compact = var.name_include_region_compact
name_enforce_region_compact = var.name_enforce_region_compact
account_id = local.account_id
region = local.region
region_short = local.region_short
}
}
```

## Requirements

No requirements.
Expand Down Expand Up @@ -190,3 +212,5 @@ No modules.
| <a name="output_kms_key_id"></a> [kms\_key\_id](#output\_kms\_key\_id) | KMS Key ID. This is the created key id or the key id of kms\_key\_arn |
| <a name="output_s3_bucket_arn"></a> [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | Created S3 Bucket ARN |
| <a name="output_s3_bucket_id"></a> [s3\_bucket\_id](#output\_s3\_bucket\_id) | Created S3 Bucket ID |
| <a name="output_s3_module_settings"></a> [s3\_module\_settings](#output\_s3\_module\_settings) | S3 module settings and values |
| <a name="output_s3_requested_bucket_name"></a> [s3\_requested\_bucket\_name](#output\_s3\_requested\_bucket\_name) | Requested S3 Bucket Name before prefix and other settings |
22 changes: 22 additions & 0 deletions title26/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,28 @@
*
* ## Options :: name_enforce_region_compact
* This flag always compacts the region, no mater whehter the name is longer than 63 characters or not.
*
* # Outputs
* One output of note is the `s3_module_settings`. With this, you can get the settings used when calling the
* module, the original bucket name before prefix and suffixes, and other things. It is a map.
*
* ```hcl
* output "s3_module_settings" {
* description = "S3 module settings and values"
* value = {
* bucket_name = var.bucket_name
* resulting_bucket_name = local.bucket_name
* resulting_bucket_arn = aws_s3_bucket.this.arn
* name_include_region = var.name_include_region
* name_include_account = var.name_include_account
* name_include_region_compact = var.name_include_region_compact
* name_enforce_region_compact = var.name_enforce_region_compact
* account_id = local.account_id
* region = local.region
* region_short = local.region_short
* }
* }
* ```
*/

locals {
Expand Down

0 comments on commit 5186969

Please sign in to comment.