The main purpose of this repository is to create a template for Terraform. This project will focus on the AWS provider.
- aws-vault
- terraform
- terragrunt
- terraform-docs this is required for
terraform_docs
hooks - pre-commit
- Have a AWS account account and associated credentials.
Due to the HashiCorp BSL license change, restricting Terraform to the latest open source version (1.5.7
).
Will create a new project template using OpenTofu. To learn more, see the official OpenTofu website
and project status.
- Navigate to the environment you would like to deploy,
- Initialize the configuration with:
aws-vault exec <profile> --no-session terragrunt init
- Plan your changes with:
aws-vault exec <profile> --no-session terragrunt plan
- If you're happy with the changes
aws-vault exec <profile> --no-session terragrunt apply
Note
Please note that terragrunt will create an S3 Bucket and DynamoDB table for storing the remote state. Ensure the account deploying the resources has the appropriate permissions to create or connect to these resources.
Git hook scripts are very helpful for identifying simple issues before pushing any changes. Hooks will run on every commit automatically pointing out issues in the code e.g. trailing whitespace.
To help with the maintenance of these hooks, pre-commit is used, along with pre-commit-hooks.
Please following these instructions to install pre-commit
locally and ensure that you have run pre-commit install
to install the hooks for this project.
Additionally, once installed, the hooks can be updated to the latest available version with pre-commit autoupdate
.
Code formatting and documentation for variables
and outputs
is generated using pre-commit-terraform hooks that in turn uses terraform-docs that will insert/update documentation. The following markers have been added to the README.md
:
<!-- {BEGINNING|END} OF PRE-COMMIT-TERRAFORM DOCS HOOK --->
Name | Version |
---|---|
terraform | >= 1.0.0, <= 1.5.7 |
aws | ~> 5.17.0 |
Name | Version |
---|---|
aws | 5.17.0 |
No modules.
Name | Type |
---|---|
aws_availability_zones.avaliabile_zones | data source |
aws_caller_identity.current_caller_identity | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
allowed_account_ids | List of allowed AWS account IDs to prevent you from mistakenly using an incorrect one. |
list(string) |
n/a | yes |
aws_region | The AWS region. | string |
n/a | yes |
Name | Description |
---|---|
availability_zones | List of the Availability Zone names available to the account. |
current_caller_identity | AWS Account ID number of the account that owns or contains the calling entity. |