Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cloudandthings/terraform-aws-s3-bucket


https://github.com/cloudandthings/terraform-aws-s3-bucket

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

# terraform-aws-s3-bucket

## Description

Terraform module for creating an S3 bucket.

Will be used for *HashiTalks: Africa 2023*.

Features:

- Creates an S3 bucket.

[AWS documentation](https://docs.aws.amazon.com...)

----
## Prerequisites

None.

----
## Usage

See `examples` dropdown on Terraform Cloud, or [browse here](/examples/).

----
## Testing

This module is tested during development using [`pytest`](https://docs.pytest.org/en/7.2.x/) and [`tftest`](https://pypi.org/project/tftest/). See the `tests` folder for further details, and in particular the [testing readme](./tests/README.md).

----
## Notes

*This repo was created from [terraform-aws-template](https://github.com/cloudandthings/terraform-aws-template)*

----
## Known issues

This project is currently unlicenced. Please contact the maintaining team to add a licence.

----
## Contributing

Direct contributions are welcome.

See [`CONTRIBUTING.md`](./.github/CONTRIBUTING.md) for further information.

----
## Documentation

----
### Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [bucket\_logging\_target\_bucket](#input\_bucket\_logging\_target\_bucket) | Target S3 bucket name for logging. | `string` | `""` | no |
| [bucket\_logging\_target\_prefix](#input\_bucket\_logging\_target\_prefix) | Target S3 bucket prefix for logging. | `string` | `""` | no |
| [create\_aws\_s3\_bucket\_lifecycle\_configuration](#input\_create\_aws\_s3\_bucket\_lifecycle\_configuration) | Whether to enable the default aws\_s3\_bucket\_lifecycle\_configuration on the bucket. | `bool` | `true` | no |
| [enable\_attach\_default\_bucket\_policy](#input\_enable\_attach\_default\_bucket\_policy) | Whether to attach the default bucket policy or not (default=true). You may wish to attach the bucket policy document separately, in which case it is an output from this module. | `bool` | `true` | no |
| [enable\_public\_access\_block](#input\_enable\_public\_access\_block) | Whether to enable public\_access\_block on the bucket. | `bool` | `true` | no |
| [enable\_versioning](#input\_enable\_versioning) | Whether to enable versioning on the bucket. | `bool` | `true` | no |
| [force\_destroy](#input\_force\_destroy) | **Caution** Whether to automatically delete all objects from the bucket when it is destroyed. These objects are NOT recoverable. | `bool` | `false` | no |
| [general\_read\_only\_aws\_principals](#input\_general\_read\_only\_aws\_principals) | List of AWS principals to give read access to all bucket objects via bucket policy resource. | `list(string)` | `[]` | no |
| [general\_read\_write\_aws\_principals](#input\_general\_read\_write\_aws\_principals) | List of AWS principals to give read and write access to all bucket objects via bucket policy resource. | `list(string)` | `[]` | no |
| [kms\_key\_id](#input\_kms\_key\_id) | KMS key ID to use for encrypting bucket objects. | `string` | `null` | no |
| [name](#input\_name) | Name for S3 bucket. Also see `naming_method` | `string` | `null` | no |
| [naming\_method](#input\_naming\_method) | Whether to use `bucket`, `bucket_prefix` or neither when creating the `aws_s3_bucket` resource. | `string` | `"BUCKET"` | no |
| [tags](#input\_tags) | Map of additional tags to assign to created resources. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. | `map(string)` | `{}` | no |

----
### Modules

No modules.

----
### Outputs

| Name | Description |
|------|-------------|
| [arn](#output\_arn) | The bucket ARN that is created. |
| [bucket](#output\_bucket) | The bucket that is created. |
| [default\_bucket\_policy\_document](#output\_default\_bucket\_policy\_document) | Default bucket policy document, attached to the bucket if `var.attach_default_bucket_policy=true`. |
| [id](#output\_id) | The bucket id that is created. |
| [kms\_key\_id](#output\_kms\_key\_id) | The KMS key ID used for encrypting bucket objects. |
| [region](#output\_region) | The bucket region. |

----
### Providers

| Name | Version |
|------|---------|
| [aws](#provider\_aws) | ~> 5.0 |

----
### Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | >= 0.13.1 |
| [aws](#requirement\_aws) | ~> 5.0 |
| [null](#requirement\_null) | ~> 3.1 |

----
### Resources

| Name | Type |
|------|------|
| [aws_s3_bucket.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
| [aws_s3_bucket_lifecycle_configuration.abort_incomplete_multipart_upload](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_lifecycle_configuration) | resource |
| [aws_s3_bucket_logging.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_logging) | resource |
| [aws_s3_bucket_ownership_controls.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_ownership_controls) | resource |
| [aws_s3_bucket_policy.default_bucket_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
| [aws_s3_bucket_public_access_block.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
| [aws_s3_bucket_server_side_encryption_configuration.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration) | resource |
| [aws_s3_bucket_versioning.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_versioning) | resource |
| [aws_iam_policy_document.default_bucket_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.deny_unencrypted_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.general_read_only_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.general_read_write_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |

----