This terraform module creates an S3 Bucket with the options of adding other s3 bucket configurations.
Examples available here
NOTE: These examples use the latest version of this module
locals {
name = "minimum-example-bucket"
}
module "minimum" {
source = "../../"
bucket = local.name
tags = {
Name = local.name
Environment = "Dev"
}
}
}
Terraform provider documentation
Name | Version |
---|---|
terraform | >= 0.14.11 |
aws | >= 4.15.1 |
Name | Version |
---|---|
aws | 4.22.0 |
No modules.
Name | Type |
---|---|
aws_s3_bucket.main | resource |
aws_s3_bucket_acl.main | resource |
aws_s3_bucket_cors_configuration.main | resource |
aws_s3_bucket_logging.main | resource |
aws_s3_bucket_policy.main | resource |
aws_s3_bucket_public_access_block.main | resource |
aws_s3_bucket_server_side_encryption_configuration.main | resource |
aws_s3_bucket_versioning.main | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
block_public_acls | (Optional) Whether Amazon S3 should block public ACLs for this bucket. | bool |
true |
no |
block_public_policy | (Optional) Whether Amazon S3 should block public bucket policies for this bucket. | bool |
true |
no |
bucket | (Optional, Forces new resource) The name of the bucket. If omitted, Terraform will assign a random, unique name. Must be lowercase and less than or equal to 63 characters in length. | string |
null |
no |
bucket_acl | The canned ACL to apply. | any |
{} |
no |
bucket_policy | Attaches a policy to an S3 bucket resource. | string |
null |
no |
bucket_prefix | Optional, Forces new resource) Creates a unique bucket name beginning with the specified prefix. Conflicts with bucket. Must be lowercase and less than or equal to 37 characters in length. | string |
null |
no |
cors_rule | A rule of Cross-Origin Resource Sharing. | any |
[] |
no |
expected_bucket_owner | (Optional, Forces new resource) The account ID of the expected bucket owner. | string |
null |
no |
force_destroy | (Optional, Default:false) A boolean that indicates all objects (including any locked objects) should be deleted from the bucket so that the bucket can be destroyed without error. These objects are not recoverable. | bool |
false |
no |
ignore_public_acls | (Optional) Whether Amazon S3 should ignore public ACLs for this bucket. | bool |
true |
no |
restrict_public_buckets | (Optional) Whether Amazon S3 should restrict public bucket policies for this bucket. | bool |
true |
no |
s3_logging | A map of configurations where to store logs | map(any) |
{} |
no |
sse_bucket_key_enabled | (Optional) Whether or not to use Amazon S3 Bucket Keys for SSE-KMS. | bool |
null |
no |
sse_kms_master_key_arn | (Optional) The AWS KMS master key ARN used for the SSE-KMS encryption. This can only be used when you set the value of sse_algorithm as aws:kms . The default aws/s3 AWS KMS master key is used if this element is absent while the sse_algorithm is aws:kms . |
string |
null |
no |
sse_sse_algorithm | (Required) The server-side encryption algorithm to use. Valid values are AES256 and aws:kms |
string |
"aws:kms" |
no |
tags | (Optional) A map of tags to assign to the bucket. | map(string) |
{} |
no |
versioning_mfa | The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device. | string |
null |
no |
versioning_mfa_delete | (Optional) Specifies whether MFA delete is enabled in the bucket versioning configuration. Valid values: Enabled or Disabled . |
string |
null |
no |
versioning_status | (Required) The versioning state of the bucket. Valid values: Enabled , Suspended , or Disabled . Disabled should only be used when creating or importing resources that correspond to unversioned S3 buckets. |
string |
"Enabled" |
no |
Name | Description |
---|---|
arn | The ARN of the bucket. Will be of format arn:aws:s3:::bucketname |
bucket | The name of the bucket. |
bucket_domain_name | The bucket domain name. Will be of format bucketname.s3.amazonaws.com . |
bucket_regional_domain_name | The bucket region-specific domain name. The bucket domain name including the region name |
hosted_zone_id | The Route 53 Hosted Zone ID for this bucket's region. |
id | The name of the bucket. |
region | The AWS region this bucket resides in. |
tags_all | A map of tags assigned to the resource, including those inherited from the provider default_tags |
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. |
website_endpoint | The website endpoint, if the bucket is configured with a website. If not, this will be an empty string |
This repository uses third party software:
- pre-commit - Used to help ensure code and documentation consistency
- Install with
brew install pre-commit
- Manually use with
pre-commit run
- Install with
- terraform 0.14.11 For backwards compatibility we are using version 0.14.11 for testing making this the min version tested and without issues with terraform-docs.
- terraform-docs - Used to generate the Inputs and Outputs sections
- Install with
brew install terraform-docs
- Manually use via pre-commit
- Install with
- tflint - Used to lint the Terraform code
- Install with
brew install tflint
- Manually use via pre-commit
- Install with
The makefile contain in this repo is optimised for linux paths and the main purpose is to execute testing for now.
- Create all tests:
$ make tests
- Clean all tests:
$ make clean