---
title: "Terragrunt: Infrastructure as Code Management"
description: "Test your knowledge of Terragrunt fundamentals with a quiz covering DRY principles, remote state management, module dependencies, configuration inheritance, run-all commands, hooks, and best practices for managing Terraform at scale."
author: "Mohammad Abu Mattar"
canonical: https://mkabumattar.com/quizzes/post/terragrunt-iac-management-quiz
---

# Terragrunt: Infrastructure as Code Management

Welcome to the Terragrunt Basics Quiz! This quiz covers fundamental Terragrunt concepts, including DRY configuration management, remote state handling, module dependencies, and best practices for managing Terraform at scale. Each question is multiple-choice, and you'll find hints to help you along the way. Good luck!

## Questions

### 1. What is the primary purpose of Terragrunt?

- To serve as a complete replacement for the Terraform binary
- To maintain DRY configurations and automate remote state logic
- To provide a graphical user interface for resource visualization
- To enable the use of Python as the primary configuration language

**Hint:** It is a thin wrapper for Terraform.

### 2. Which file name is the standard configuration entry point for Terragrunt?

- `main.tf`
- `terragrunt.hcl`
- `config.yaml`
- `terraform.tfvars`

**Hint:** It ends in .hcl.

### 3. What does the "include" block do in a terragrunt.hcl file?

- It imports a third-party Docker image into the workspace
- It enables a configuration to inherit settings from a parent
- It renders a static CSS file for infrastructure documentation
- It executes a cleanup script to delete unused state files

**Hint:** Think about inheritance.

### 4. What is the "dependency" block used for?

- To automate the installation of packages on remote instances
- To pass output variables between independent infrastructure modules
- To download and manage the specific version of the Terraform binary
- To enforce strict version locking for specific cloud providers

**Hint:** Passing data between modules.

### 5. How do you run "terraform apply" across multiple directories using Terragrunt?

- `terragrunt run-all apply`
- `terragrunt apply --recursive`
- `terraform apply -all-folders`
- `terragrunt deploy --bulk`

**Hint:** Think "All".

### 6. What is the purpose of the "remote_state" block?

- To synchronize the local HCL source code with a Git repository
- To automate backend configuration and the creation of state buckets
- To trigger the execution of Terraform on a remote build server
- To encrypt the local working directory using OS-level security

**Hint:** Automating the S3/GCS bucket creation.

### 7. What does the "source" attribute in a Terragrunt block define?

- The specific API endpoint for the target cloud service provider
- The location of the Terraform module code to be deployed
- The primary maintainer and contact email for the infrastructure
- The version of the execution engine required to run the code

**Hint:** Where the Terraform code lives.

### 8. What is the role of "Before" and "After" hooks?

- To schedule recurring backups of the cloud provider account
- To execute custom commands during the Terraform lifecycle
- To monitor the total time elapsed during a resource deployment
- To perform syntax linting on the HCL configuration files

**Hint:** Custom scripts during the lifecycle.

### 9. What is the "find_in_parent_folders()" function used for?

- To recover deleted configuration files from the system trash
- To locate a parent configuration file for easier inheritance
- To scan the parent directories for unencrypted secret files
- To list all authorized users within the parent cloud organization

**Hint:** Locating the root configuration.

### 10. How does Terragrunt handle "Inputs"?

- It writes them to a plain-text file named secrets.txt
- It maps the HCL inputs block to Terraform variables
- It rejects any input variables that are not of the string type
- It prompts the user to manually enter values during execution

**Hint:** Passing variables to Terraform.

### 11. What is the "Locals" block in Terragrunt?

- A collection of resources limited to a single cloud region
- A block for defining reusable variables within a configuration
- A set of variables that only execute on a developer workstation
- A specialized security vault for storing sensitive credentials

**Hint:** Internal variables.

### 12. What command would you use to see what Terragrunt plans to do without making changes?

- `terragrunt view-changes`
- `terragrunt plan`
- `terragrunt dry-run`
- `terragrunt check-diff`

**Hint:** The same as Terraform.

### 13. What is the purpose of "generate" blocks?

- To generate complex passwords for cloud resource attributes
- To inject HCL code directly into the Terraform directory
- To generate a PDF summary of the current infrastructure state
- To generate a new set of SSH keys for server authentication

**Hint:** Creating files on the fly.

### 14. What happens when you use "terragrunt run-all destroy"?

- It removes all cloud resources in a random, unordered sequence
- It destroys all modules in the reverse order of dependencies
- It deletes the local Terragrunt configuration and HCL files
- It uninstalls the Terragrunt binary from the local system

**Hint:** Order matters.

### 15. What is the ".terragrunt-cache" folder?

- A storage directory for long-term execution and system logs
- The directory where Terragrunt runs Terraform commands
- A folder used for storing historical backups of the state file
- A system-level partition used for increasing build speeds

**Hint:** The temporary workspace.

### 16. Which function converts a string into an HCL object?

- `read_terragrunt_config()`
- `parse_hcl_string()`
- `import_hcl_file()`
- `json_decode_config()`

**Hint:** It "parses" the HCL.

### 17. What is the "iam_role" attribute used for in Terragrunt?

- To assign a friendly alias to a specific cloud user
- To assume a specific IAM role before executing Terraform
- To create a new IAM user within the cloud organization
- To encrypt sensitive data using an IAM-managed key

**Hint:** Assuming an AWS identity.

### 18. What is a "Mock Output"?

- A way to provide humorous feedback in the terminal
- A placeholder value used when a dependency is not yet deployed
- A fake error message used to test the failure logic
- A tool for testing the responsiveness of the web UI

**Hint:** Simulating data when a dependency isn't built yet.

### 19. How do you tell Terragrunt to use a specific version of Terraform?

- `tf_binary_version = "1.0.0"`
- `terraform_version_constraint = ">= 1.0.0"`
- `engine_version: 1.0.0`
- `require_terraform { version = "1.0.0" }`

**Hint:** terraform_version_constraint.

### 20. What does the "--terragrunt-non-interactive" flag do?

- It suppresses all terminal output and logs
- It assumes a "yes" response to all interactive prompts
- It reduces the execution speed of the deployment
- It disables all network connections to the cloud

**Hint:** Good for CI/CD.

### 21. What is the "get_env()" function used for?

- To query the current weather in the server region
- To retrieve environment variables from the host system
- To create a new environment tier in the cloud
- To permanently delete a file from the host machine

**Hint:** Accessing system variables.

### 22. What is "Prevent Destroy"?

- A hardware-level safeguard against fire damage
- A flag that prevents the accidental deletion of a module
- A command that destroys everything except databases
- A security firewall rule that blocks all traffic

**Hint:** Safety for critical resources.

### 23. Which command clears the Terragrunt cache?

- `terragrunt clean-workspace`
- `rm -rf .terragrunt-cache`
- `terragrunt reset-cache`
- `terraform refresh-all`

**Hint:** rm -rf .terragrunt-cache

### 24. What is the "path_relative_to_include()" function?

- The physical distance to the cloud data center
- The relative path from the root to the child config
- A method for renaming a directory in the project
- A list of all files currently active in the project

**Hint:** Finding the distance between files.

### 25. What is "Sops" integration in Terragrunt?

- A way to perform deep-cleaning on the build server
- A method for decrypting Mozilla SOPS files at runtime
- A specialized database for high-performance storage
- A technique for writing code significantly faster

**Hint:** Handling encrypted files.

### 26. How do you pass extra arguments to Terraform via Terragrunt?

- `terraform_flags = ["-lock=false"]`
- `extra_arguments "custom" { arguments = ["-lock=false"] }`
- `args_list: ["-lock=false"]`
- `run_terraform --with-flags="-lock=false"`

**Hint:** extra_arguments block.

### 27. What is the purpose of "skip = true" in a Terragrunt configuration?

- To bypass the automated testing phase of a build
- To ignore a directory during "run-all" executions
- To optimize the code for faster execution speeds
- To bypass the billing cycle of the cloud provider

**Hint:** Ignoring a directory.

### 28. What is a "Terragrunt Stack"?

- A detailed list of system errors and logs
- A set of modules deployed together via "run-all"
- A specialized type of computer hardware memory
- A physical arrangement of servers in a data rack

**Hint:** A collection of modules.

### 29. What does "get_terragrunt_dir()" return?

- The absolute path to the user's home directory
- The absolute path to the current HCL file directory
- The remote URL of the current GitHub repository
- A list of all subdirectories within the project

**Hint:** The current directory.

### 30. Why would you use Terragrunt over plain Terraform?

- Because Terraform is no longer an active project
- To reduce code duplication in large deployments
- To convert the HCL syntax into JavaScript code
- To eliminate the cost of cloud provider services

**Hint:** Managing complexity.
