The main purpose of this repository is to create a template for Terraform. This project will focus on the GCP provider.
- gcloud
- terraform
- terragrunt
- terraform-docs this is required for
terraform_docs
hooks - pre-commit
- Have a Google Cloud account account and associated credentials.
-
Navigate to the environment you would like to deploy,
-
Initialize the configuration with:
terragrunt init
-
Plan your changes with:
terragrunt plan
-
If you're happy with the changes
terragrunt apply
Note
Please note that terragrunt will create a bucket 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.5.7, <= 1.9.0 |
~> 6.6.0 |
Name | Version |
---|---|
6.6.0 |
No modules.
Name | Type |
---|---|
google_project.project | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
gcp_default_labels | The default region to manage resources in. | map(string) |
{} |
no |
gcp_project | The default project to manage resources in. | string |
n/a | yes |
gcp_region | The default region to manage resources in. | string |
n/a | yes |
gcp_zone | The default zone to manage resources in. Generally, this zone should be within the default region you specified. |
string |
n/a | yes |
Name | Description |
---|---|
gcp_project_number | The numeric identifier of the project. |