Terraform Module: Bootstrap¶
This module creates and configures a S3 bucket backend and DynamoDB lock table for terraform state files.
Getting Started¶
Requirements¶
Name | Version |
---|---|
terraform | >= 1.4, < 2.0.0 |
aws | >= 4.0, < 6.0.0 |
Providers¶
Name | Version |
---|---|
aws | 5.58.0 |
Modules¶
No modules.
Resources¶
Name | Type |
---|---|
aws_dynamodb_table.terraform_state_lock | resource |
aws_s3_bucket.private | resource |
aws_s3_bucket_acl.this | resource |
aws_s3_bucket_analytics_configuration.private_analytics_config | resource |
aws_s3_bucket_cors_configuration.this | resource |
aws_s3_bucket_inventory.inventory | resource |
aws_s3_bucket_lifecycle_configuration.this | resource |
aws_s3_bucket_logging.this | resource |
aws_s3_bucket_ownership_controls.this | resource |
aws_s3_bucket_public_access_block.public_access_block | resource |
aws_s3_bucket_server_side_encryption_configuration.example | resource |
aws_s3_bucket_versioning.this | resource |
aws_caller_identity.current | data source |
aws_iam_policy_document.policy | data source |
aws_partition.current | data source |
Inputs¶
Name | Description | Type | Default | Required |
---|---|---|---|---|
abort_incomplete_multipart_upload_days | Specifies the number of days after initiating a multipart upload when the multipart upload must be completed. | number |
14 |
no |
bucket_key_enabled | Whether or not to use Amazon S3 Bucket Keys for SSE-KMS. | bool |
false |
no |
bucket_name | The name of the bucket. | string |
n/a | yes |
cors_rules | List of maps containing rules for Cross-Origin Resource Sharing. | list(any) |
[] |
no |
dynamo_kms_master_key_id | The Default ID of an AWS-managed customer master key (CMK) for Amazon Dynamo | string |
null |
no |
dynamodb_hash_key | The attribute to use as the hash (partition) key. | string |
"LockID" |
no |
dynamodb_name | The name of the table, this needs to be unique within a region. | string |
n/a | yes |
enable_analytics | Enables storage class analytics on the bucket. | bool |
true |
no |
enable_bucket_force_destroy | 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. | bool |
false |
no |
enable_bucket_inventory | If set to true, Bucket Inventory will be enabled. | bool |
false |
no |
enable_bucket_logging | Enable bucket activity logging. | bool |
false |
no |
enable_dynamodb_point_in_time_recovery | Whether to enable point-in-time recovery - note that it can take up to 10 minutes to enable for new tables. | bool |
true |
no |
enable_s3_public_access_block | Bool for toggling whether the s3 public access block resource should be enabled. | bool |
true |
no |
enable_versioning | Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state. | bool |
true |
no |
expiration | Specifies a period in the object's expire. | list(any) |
[ |
no |
inventory_bucket_format | The format for the inventory file. Default is ORC. Options are ORC or CSV. | string |
"ORC" |
no |
kms_master_key_id | The AWS KMS master key ID used for the SSE-KMS encryption. | string |
"" |
no |
logging_bucket_name | The S3 bucket to send S3 access logs. | string |
"" |
no |
logging_bucket_target_prefix | To specify a key prefix for log objects. | string |
"" |
no |
mfa_delete | mfa_delete is disabled | bool |
false |
no |
noncurrent_version_expiration | Number of days until non-current version of object expires | number |
365 |
no |
noncurrent_version_transitions | Non-current version transition blocks | list(any) |
[ |
no |
schedule_frequency | The S3 bucket inventory frequency. Defaults to Weekly. Options are 'Weekly' or 'Daily'. | string |
"Weekly" |
no |
sse_algorithm | The server-side encryption algorithm to use. Valid values are AES256 and aws:kms | string |
"AES256" |
no |
tags | A mapping of tags to assign to the bucket. | map(string) |
{ |
no |
transitions | Current version transition blocks | list(any) |
[] |
no |
Outputs¶
Name | Description |
---|---|
bucket_arn | Bucket's ARN |
bucket_id | Bucket's ID |
bucket_name | Bucket's Name |
dynamodb_arn | DynamoDB's ARN |
dynamodb_id | DynamoDB's ID |
dynamodb_name | DynamoDB's Name |
Bootstrapping¶
Initial Setup¶
On initial run, this project will create a local terraform state file. DO NOT delete this file. Once our backend and lock table are created, we will migrate the state to the new backend.
Migrating local state to backend¶
This can only be done once without affecting all workspaces.
After the initial apply of terraform, you can uncomment this section and save the state to the backend.
Then run terraform init
to initialize the new backend:
Our local state has now been migrated to the new backend. It is now safe to remove the local terraform.tfstate
.
Development¶
Versioning¶
While Contributing or doing git commit please specify the breaking change in your commit message whether its major,minor or patch
For Example
Prerequisites¶
Configurations¶
- Configure pre-commit hooks
- Configure golang deps for tests
- Execute pre-commit
Authors¶
This project is authored by below people
This project was generated by generator-tf-module