Skip to content

Commit 24b88e8

Browse files
authored
feat: Added outputs for s3 bucket lifecycle rules and policy (#234)
1 parent 96226df commit 24b88e8

File tree

8 files changed

+24
-5
lines changed

8 files changed

+24
-5
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ No modules.
236236
| <a name="output_s3_bucket_bucket_regional_domain_name"></a> [s3\_bucket\_bucket\_regional\_domain\_name](#output\_s3\_bucket\_bucket\_regional\_domain\_name) | The bucket region-specific domain name. The bucket domain name including the region name, please refer here for format. Note: The AWS CloudFront allows specifying S3 region-specific endpoint when creating S3 origin, it will prevent redirect issues from CloudFront to S3 Origin URL. |
237237
| <a name="output_s3_bucket_hosted_zone_id"></a> [s3\_bucket\_hosted\_zone\_id](#output\_s3\_bucket\_hosted\_zone\_id) | The Route 53 Hosted Zone ID for this bucket's region. |
238238
| <a name="output_s3_bucket_id"></a> [s3\_bucket\_id](#output\_s3\_bucket\_id) | The name of the bucket. |
239+
| <a name="output_s3_bucket_lifecycle_configuration_rules"></a> [s3\_bucket\_lifecycle\_configuration\_rules](#output\_s3\_bucket\_lifecycle\_configuration\_rules) | The lifecycle rules of the bucket, if the bucket is configured with lifecycle rules. If not, this will be an empty string. |
240+
| <a name="output_s3_bucket_policy"></a> [s3\_bucket\_policy](#output\_s3\_bucket\_policy) | The policy of the bucket, if the bucket is configured with a policy. If not, this will be an empty string. |
239241
| <a name="output_s3_bucket_region"></a> [s3\_bucket\_region](#output\_s3\_bucket\_region) | The AWS region this bucket resides in. |
240242
| <a name="output_s3_bucket_website_domain"></a> [s3\_bucket\_website\_domain](#output\_s3\_bucket\_website\_domain) | The domain of the website endpoint, if the bucket is configured with a website. If not, this will be an empty string. This is used to create Route 53 alias records. |
241243
| <a name="output_s3_bucket_website_endpoint"></a> [s3\_bucket\_website\_endpoint](#output\_s3\_bucket\_website\_endpoint) | The website endpoint, if the bucket is configured with a website. If not, this will be an empty string. |

examples/complete/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ No inputs.
7373
| <a name="output_s3_bucket_bucket_regional_domain_name"></a> [s3\_bucket\_bucket\_regional\_domain\_name](#output\_s3\_bucket\_bucket\_regional\_domain\_name) | The bucket region-specific domain name. The bucket domain name including the region name, please refer here for format. Note: The AWS CloudFront allows specifying S3 region-specific endpoint when creating S3 origin, it will prevent redirect issues from CloudFront to S3 Origin URL. |
7474
| <a name="output_s3_bucket_hosted_zone_id"></a> [s3\_bucket\_hosted\_zone\_id](#output\_s3\_bucket\_hosted\_zone\_id) | The Route 53 Hosted Zone ID for this bucket's region. |
7575
| <a name="output_s3_bucket_id"></a> [s3\_bucket\_id](#output\_s3\_bucket\_id) | The name of the bucket. |
76+
| <a name="output_s3_bucket_lifecycle_configuration_rules"></a> [s3\_bucket\_lifecycle\_configuration\_rules](#output\_s3\_bucket\_lifecycle\_configuration\_rules) | The lifecycle rules of the bucket, if the bucket is configured with lifecycle rules. If not, this will be an empty string. |
77+
| <a name="output_s3_bucket_policy"></a> [s3\_bucket\_policy](#output\_s3\_bucket\_policy) | The policy of the bucket, if the bucket is configured with a policy. If not, this will be an empty string. |
7678
| <a name="output_s3_bucket_region"></a> [s3\_bucket\_region](#output\_s3\_bucket\_region) | The AWS region this bucket resides in. |
7779
| <a name="output_s3_bucket_website_domain"></a> [s3\_bucket\_website\_domain](#output\_s3\_bucket\_website\_domain) | The domain of the website endpoint, if the bucket is configured with a website. If not, this will be an empty string. This is used to create Route 53 alias records. |
7880
| <a name="output_s3_bucket_website_endpoint"></a> [s3\_bucket\_website\_endpoint](#output\_s3\_bucket\_website\_endpoint) | The website endpoint, if the bucket is configured with a website. If not, this will be an empty string. |

examples/complete/outputs.tf

+10
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ output "s3_bucket_hosted_zone_id" {
2323
value = module.s3_bucket.s3_bucket_hosted_zone_id
2424
}
2525

26+
output "s3_bucket_lifecycle_configuration_rules" {
27+
description = "The lifecycle rules of the bucket, if the bucket is configured with lifecycle rules. If not, this will be an empty string."
28+
value = module.s3_bucket.s3_bucket_lifecycle_configuration_rules
29+
}
30+
31+
output "s3_bucket_policy" {
32+
description = "The policy of the bucket, if the bucket is configured with a policy. If not, this will be an empty string."
33+
value = module.s3_bucket.s3_bucket_policy
34+
}
35+
2636
output "s3_bucket_region" {
2737
description = "The AWS region this bucket resides in."
2838
value = module.s3_bucket.s3_bucket_region

examples/notification/main.tf

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ provider "aws" {
22
region = local.region
33

44
# Make it faster by skipping something
5-
skip_get_ec2_platforms = true
65
skip_metadata_api_check = true
76
skip_region_validation = true
87
skip_credentials_validation = true

examples/object/main.tf

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ provider "aws" {
22
region = local.region
33

44
# Make it faster by skipping something
5-
skip_get_ec2_platforms = true
65
skip_metadata_api_check = true
76
skip_region_validation = true
87
skip_credentials_validation = true

examples/s3-inventory/main.tf

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ provider "aws" {
77
region = local.region
88

99
# Make it faster by skipping something
10-
skip_get_ec2_platforms = true
1110
skip_metadata_api_check = true
1211
skip_region_validation = true
1312
skip_credentials_validation = true

examples/s3-replication/main.tf

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ provider "aws" {
22
region = local.origin_region
33

44
# Make it faster by skipping something
5-
skip_get_ec2_platforms = true
65
skip_metadata_api_check = true
76
skip_region_validation = true
87
skip_credentials_validation = true
@@ -15,7 +14,6 @@ provider "aws" {
1514
alias = "replica"
1615

1716
# Make it faster by skipping something
18-
skip_get_ec2_platforms = true
1917
skip_metadata_api_check = true
2018
skip_region_validation = true
2119
skip_credentials_validation = true

outputs.tf

+10
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ output "s3_bucket_hosted_zone_id" {
2323
value = try(aws_s3_bucket.this[0].hosted_zone_id, "")
2424
}
2525

26+
output "s3_bucket_lifecycle_configuration_rules" {
27+
description = "The lifecycle rules of the bucket, if the bucket is configured with lifecycle rules. If not, this will be an empty string."
28+
value = try(aws_s3_bucket_lifecycle_configuration.this[0].rule, "")
29+
}
30+
31+
output "s3_bucket_policy" {
32+
description = "The policy of the bucket, if the bucket is configured with a policy. If not, this will be an empty string."
33+
value = try(aws_s3_bucket_policy.this[0].policy, "")
34+
}
35+
2636
output "s3_bucket_region" {
2737
description = "The AWS region this bucket resides in."
2838
value = try(aws_s3_bucket.this[0].region, "")

0 commit comments

Comments
 (0)