https://github.com/choonchernlim/gcp-terragrunt-demo
A simple GCP Terragrunt tutorial
https://github.com/choonchernlim/gcp-terragrunt-demo
gcp terraform terragrunt
Last synced: 3 months ago
JSON representation
A simple GCP Terragrunt tutorial
- Host: GitHub
- URL: https://github.com/choonchernlim/gcp-terragrunt-demo
- Owner: choonchernlim
- Created: 2020-01-23T20:54:33.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-24T20:27:55.000Z (over 5 years ago)
- Last Synced: 2025-04-06T22:38:17.000Z (6 months ago)
- Topics: gcp, terraform, terragrunt
- Language: HCL
- Homepage:
- Size: 9.77 KB
- Stars: 2
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GCP Terragrunt Demo
This simple demo illustrates the following use cases:-
* Provisions all modules recursively.
* Passes common variables to all modules.
* Creates a module dependency by passing an output value from `parent` module to `child` module.
* Stores all module state files in a GCS bucket called `gcp-terragrunt-demo`. This GCS bucket has the following directory structure:-```
gs://gcp-terragrunt-demo
└── modules
├── child
│ └── terraform.tfstate
└── parent
└── terraform.tfstate
```## Getting Started
* [Install Terraform](https://learn.hashicorp.com/terraform/getting-started/install). After installation, run `terraform --version` to ensure it works.
* [Install Terragrunt](https://terragrunt.gruntwork.io/docs/getting-started/install/). After installation, run `terragrunt --version` to ensure it works.
* Go to [\[ROOT_DIR\]/terragrunt.hcl](terragrunt.hcl) and update the parameters in `locals { ... }` block.
* If you are running the code outside of GCP environment (ie: from your IDE instead of Cloud Shell), run the `gloud` commands below to get authenticated first:-
* `gcloud auth login`
* `gcloud auth application-default login`
* *Note: Failure to do so causes Terragrunt to throw "Missing required GCS remote state configuration project" error.** If the GCS bucket does not exist yet, run this once:-
* `terragrunt init`
* *Note: Once the GCS bucket is created, there is no need to run this command again.** To determine changes needed to be applied to the infrastructure:-
* `terragrunt plan-all`* To provision the entire infrastructure by running each module and resolving any module dependencies:-
* `terragrunt apply-all`* To deprovision the entire infrastructure:-
* `terragrunt destroy-all`