Giter Site home page Giter Site logo

gcp-terragrunt-demo's Introduction

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. After installation, run terraform --version to ensure it works.

  • Install Terragrunt. After installation, run terragrunt --version to ensure it works.

  • Go to [ROOT_DIR]/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

gcp-terragrunt-demo's People

Contributors

choonchernlim avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.