From 72eaef89cbd43c17a6e99d71d25d8dfac9be286d Mon Sep 17 00:00:00 2001 From: Adam Kunicki Date: Fri, 1 Aug 2025 15:35:35 -0700 Subject: [PATCH] Add bucket versioning status as an output When creating replicated buckets, expose a versioning status output in order to be able to create a dependency on replica buckets being ready (versioning enabled). Otherwise applying replication rules targeting a bucket which isn't fully set up may fail. Signed-off-by: Adam Kunicki --- README.md | 1 + outputs.tf | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index c3ce5d47..79661b9e 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,7 @@ No modules. | Name | Description | |------|-------------| +| [aws\_s3\_bucket\_versioning\_status](#output\_aws\_s3\_bucket\_versioning\_status) | The versioning status of the bucket. Will be 'Enabled', 'Suspended', or 'Disabled'. | | [s3\_bucket\_arn](#output\_s3\_bucket\_arn) | The ARN of the bucket. Will be of format arn:aws:s3:::bucketname. | | [s3\_bucket\_bucket\_domain\_name](#output\_s3\_bucket\_bucket\_domain\_name) | The bucket domain name. Will be of format bucketname.s3.amazonaws.com. | | [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. | diff --git a/outputs.tf b/outputs.tf index d67d0c44..444c4142 100644 --- a/outputs.tf +++ b/outputs.tf @@ -57,3 +57,8 @@ output "s3_directory_bucket_arn" { description = "ARN of the directory bucket." value = try(aws_s3_directory_bucket.this[0].arn, null) } + +output "aws_s3_bucket_versioning_status" { + description = "The versioning status of the bucket. Will be 'Enabled', 'Suspended', or 'Disabled'." + value = try(aws_s3_bucket_versioning.this[0].versioning_configuration[0].status, null) +}