Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ No modules.
| <a name="input_logging_log_retention_days"></a> [logging\_log\_retention\_days](#input\_logging\_log\_retention\_days) | Number of days to retain S3 logging data before expiration. | `number` | `30` | no |
| <a name="input_logging_s3_prefix"></a> [logging\_s3\_prefix](#input\_logging\_s3\_prefix) | Prefix for S3 logging objects. | `string` | `"s3/"` | no |
| <a name="input_object_ownership"></a> [object\_ownership](#input\_object\_ownership) | Defines who owns newly uploaded objects in the bucket. | `string` | `"BucketOwnerPreferred"` | no |
| <a name="input_region"></a> [region](#input\_region) | AWS region for the provider. Defaults to ap-southeast-2 if not specified. | `string` | `"ap-southeast-2"` | no |
| <a name="input_restrict_public_buckets"></a> [restrict\_public\_buckets](#input\_restrict\_public\_buckets) | Whether to restrict public access to the bucket. | `bool` | `true` | no |
| <a name="input_sse_algorithm"></a> [sse\_algorithm](#input\_sse\_algorithm) | The encryption algorithm for S3 bucket | `string` | `"AES256"` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Tags for the S3 bucket | `map(string)` | `{}` | no |
Expand Down
2 changes: 2 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ resource "random_string" "suffix" {
module "s3_bucket" {
source = "../.."

region = "ap-southeast-2"

# General Configuration
bucket_name = "test-bucket"
bucket_suffix = random_string.suffix.result
Expand Down
2 changes: 2 additions & 0 deletions examples/minimal/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ resource "random_string" "suffix" {
module "s3_bucket" {
source = "../.."

region = "ap-southeast-2"

# General Configuration
bucket_name = "test-bucket"
bucket_suffix = random_string.suffix.result
Expand Down
2 changes: 2 additions & 0 deletions examples/standard/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ resource "random_string" "suffix" {
module "s3_bucket" {
source = "../.."

region = "ap-southeast-2"

# General Configuration
bucket_name = "test-bucket"
bucket_suffix = random_string.suffix.result
Expand Down
2 changes: 2 additions & 0 deletions tests/s3_bucket.tftest.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ run "setup" {

run "test_s3_bucket" {
variables {
region = run.setup.region

bucket_name = "test-s3-bucket"
bucket_suffix = run.setup.suffix
force_destroy = true
Expand Down
4 changes: 4 additions & 0 deletions tests/setup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ output "suffix" {
output "account_id" {
value = data.aws_caller_identity.current.account_id
}

output "region" {
value = "ap-southeast-2"
}
15 changes: 15 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
############################################
# GENERAL CONFIGURATION
############################################

variable "region" {
description = "AWS region for the provider. Defaults to ap-southeast-2 if not specified."
type = string
default = "ap-southeast-2"

validation {
condition = can(regex("^([a-z]{2}-[a-z]+-\\d{1})$", var.region))
error_message = "Invalid AWS region format. Example: 'us-east-1', 'ap-southeast-2'."
}
}

############################################
# GENERAL BUCKET CONFIGURATION VARIABLES
############################################
Expand Down
6 changes: 3 additions & 3 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ terraform {
}
}

# provider "aws" {
# region = var.region
# }
provider "aws" {
region = var.region
}