Terragrunt for Beginners

Terragrunt Attributes

skip Attribute

In this lesson, we explore the skip attribute in Terragrunt: a powerful boolean flag that controls whether a specific module runs Terraform commands. By leveraging skip, you can conditionally bypass apply, destroy, and other operations—ideal for tailoring complex infrastructure workflows.

Why Use the skip Attribute?

  • Customize multi-module deployments without removing configuration
  • Temporarily disable modules under development or testing
  • Avoid unintentional changes in non-critical environments

The image shows a diagram with connected nodes and a flag, symbolizing a customized workflow. It includes the text "Customizes workflow" and a button labeled "Benefits."

Note

Use the skip flag to control module execution dynamically, ensuring only ready and tested modules are deployed.

Key Considerations

  • Skipping critical modules can lead to incomplete infrastructure
  • Ensure dependencies are met before disabling a module

The image features a diagram with three stacked rectangles connected by arrows, accompanied by the text "Use it judiciously" and a button labeled "Considerations."

Warning

Never set skip = true on production-critical modules. Always verify dependencies to prevent configuration drift.

skip Attribute Options

skip ValueDescription
trueBypasses Terraform actions on the module
falseExecutes Terraform actions normally

Example: Skipping a VPC Module

Imagine you have a VPC module under development. To prevent Terraform from applying it, add skip = true in your terragrunt.hcl:

terraform {
  source = "tfr://terraform-aws-modules/vpc/aws//?version=5.8.1"
}

include "root" {
  path   = find_in_parent_folders()
  expose = true
}

inputs = {
  name = "KodeKloud-VPC"
  cidr = "10.100.0.0/16"
}

download_dir     = "../.terragrunt-kodekloud"
prevent_destroy  = false
skip             = true

Running terragrunt apply:

~/workspace/vpc $ terragrunt apply
INFO[0000] Skipping terragrunt module /config/workspace/vpc/terragrunt.hcl due to skip = true.
~/workspace/vpc $

Terragrunt detects skip = true and leaves the VPC unchanged.

Enabling the Module

When you're ready to deploy, set skip to false or remove it:

terraform {
  source = "tfr://terraform-aws-modules/vpc/aws//?version=5.8.1"
}

include "root" {
  path   = find_in_parent_folders()
  expose = true
}

inputs = {
  name = "KodeKloud-VPC"
  cidr = "10.100.0.0/16"
}

download_dir     = "../.terragrunt-kodekloud"
prevent_destroy  = false
skip             = false

Then run:

~/workspace/vpc $ terragrunt apply
...
Are you sure you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes
...
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

With skip disabled, Terragrunt proceeds to create the VPC as expected.

Watch Video

Watch video content

Previous
prevent destroy Attribute