---
title: "Discussion on \"Using Terragrunt to deploy to Azure\" | Hashnode"
description: "Discussion on \"Using Terragrunt to deploy to Azure\". This is the guide I wish I had"
url: "https://hashnode.com/posts/using-terragrunt-to-deploy-to-azure/6213f62495c64c6eda45537f"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Using Terragrunt to deploy to Azure](https://gaunacode.com/using-terragrunt-to-deploy-to-azure?utm_source=hashnode&utm_medium=feed)

This is the guide I wish I had

Feb 21, 2022 · 21 min read · gaunacode.com  
Updated Jan 8, 2024  
Read the article

-   [#azure](https://hashnode.com/tag/azure)
-   [#devops](https://hashnode.com/tag/devops)
-   [#terraform](https://hashnode.com/tag/terraform)
-   [#terragrunt](https://hashnode.com/tag/terragrunt)

## Written by

[Facundo Gauna](https://hashnode.com/@gaunacode)

@gaunacode · Orlando, FL

  
[View profile](https://hashnode.com/@gaunacode)

Building cloud-native apps on Azure. I can't stop self-improving.

I used to be a .NET developer. Nowaways, I am a DevOps solutions architect with a focus on Azure and Kubernetes. I also love productivity topics, especially when it comes to doing more with less of my time. I'm also a daddy, so time is a limited resource for me.

## Responses 2

Markdown supported · ⌘↵ to post

[Montgomery Burns](https://hashnode.com/@MrOnion)

[Oct 12, 2022](https://hashnode.com/posts/using-terragrunt-to-deploy-to-azure/6213f62495c64c6eda45537f/comment/6347188e81c6df26fb022743)

Great guide - thanks :)

The mock resouce group is not working for me though. Does it need an update?

```
terragrunt run-all plan

Module /home/xxxx/workspace/terragrunt-azure-example-main/vs-enterprise/staging/eastus/spoke-vnet depends on module /home/xxxx/workspace/terragrunt-azure-example-main/vs-enterprise/staging/global/resource_groups, which is an external dependency outside of the current working directory. Should Terragrunt run this external dependency? Warning, if you say 'yes', Terragrunt will make changes in /home/xxxx/workspace/terragrunt-azure-example-main/vs-enterprise/staging/global/resource_groups as well! (y/n) y

INFO[0001] The stack at /home/xxxx/workspace/terragrunt-azure-example-main/vs-enterprise/staging/eastus will be processed in the following order for command plan:
Group 1
- Module /home/xxxx/workspace/terragrunt-azure-example-main/vs-enterprise/staging/global/resource_groups

Group 2
- Module /home/xxxx/workspace/terragrunt-azure-example-main/vs-enterprise/staging/eastus/spoke-vnet

^[[21~
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_resource_group.vnet_resource_group will be created
  + resource "azurerm_resource_group" "vnet_resource_group" {
      + id       = (known after apply)
      + location = "eastus"
      + name     = "rg-example-vnet"
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Changes to Outputs:
  + vnet_resource_group_name = "rg-example-vnet"

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.
data.azurerm_resource_group.vnet: Reading...
╷
│ Error: Error: Resource Group "rg-terragrunt-mock-001" was not found
│ 
│   with data.azurerm_resource_group.vnet,
│   on main.tf line 2, in data "azurerm_resource_group" "vnet":
│    2: data "azurerm_resource_group" "vnet" {
│ 
╵
time=2022-10-12T20:38:29+01:00 level=error msg=Terraform invocation failed in /home/xxxx/workspace/terragrunt-azure-example-main/vs-enterprise/staging/eastus/spoke-vnet/.terragrunt-cache/elSLctBsMYdjj1v7pFng8kbSZu4/UD_UZz400laOPGIaJ_MvMsygCC0 prefix=[/home/xxxx/workspace/terragrunt-azure-example-main/vs-enterprise/staging/eastus/spoke-vnet] 
ERRO[0029] Module /home/xxxx/workspace/terragrunt-azure-example-main/vs-enterprise/staging/eastus/spoke-vnet has finished with an error: 1 error occurred:
    * exit status 1
  prefix=[/home/xxxx/workspace/terragrunt-azure-example-main/vs-enterprise/staging/eastus/spoke-vnet] 
INFO[0029] ╷
│ Error: Error: Resource Group "rg-terragrunt-mock-001" was not found
│ 
│   with data.azurerm_resource_group.vnet,
│   on main.tf line 2, in data "azurerm_resource_group" "vnet":
│    2: data "azurerm_resource_group" "vnet" {
│ 
╵
time=2022-10-12T20:38:29+01:00 level=error msg=Terraform invocation failed in /home/xxxx/workspace/terragrunt-azure-example-main/vs-enterprise/staging/eastus/spoke-vnet/.terragrunt-cache/elSLctBsMYdjj1v7pFng8kbSZu4/UD_UZz400laOPGIaJ_MvMsygCC0 prefix=[/home/xxxx/workspace/terragrunt-azure-example-main/vs-enterprise/staging/eastus/spoke-vnet]  
ERRO[0029] 1 error occurred:
    * exit status 1
```

[Facundo Gauna](https://hashnode.com/@gaunacode)

[Oct 31, 2022](https://hashnode.com/posts/using-terragrunt-to-deploy-to-azure/6213f62495c64c6eda45537f/comment/6347188e81c6df26fb022743#reply-635fa282c273e95cf5d97843)

[Montgomery Burns](https://hashnode.com/@MrOnion) - I'll take a look today!

[Facundo Gauna](https://hashnode.com/@gaunacode)

[Nov 2, 2022](https://hashnode.com/posts/using-terragrunt-to-deploy-to-azure/6213f62495c64c6eda45537f/comment/6347188e81c6df26fb022743#reply-636249661178d47ddd624574)

[Montgomery Burns](https://hashnode.com/@MrOnion) - Did you create the `rg-terragrunt-mock-001` resource group? It's called out in the `Wait ✋🏽, some prep work` section.

I did catch a mistake there, it did not mention that you also needed to create a storage container for the backend called `environment-states,` but you seem to have gone past that issue.

[Carl in 't Veld](https://hashnode.com/@carlintveld)

[Aug 31, 2022](https://hashnode.com/posts/using-terragrunt-to-deploy-to-azure/6213f62495c64c6eda45537f/comment/630fc36456df9e8e5025a315)

This seems all quite complicated! Are you sure terragrunt pays off?

[Facundo Gauna](https://hashnode.com/@gaunacode)

[Sep 1, 2022](https://hashnode.com/posts/using-terragrunt-to-deploy-to-azure/6213f62495c64c6eda45537f/comment/630fc36456df9e8e5025a315#reply-63109be156df9e8e5025c0af)

It is complicated. I think if you're using Terraform lightly and/or your team is new to it, you won't get much value out of this.

If you're starting out, maybe start with an environment folder and trunk based development strategy so that if you want to use terragrunt, you can switch.

If you are advanced Terraform user and don't feel the pain points that Terragrunt tries to address then it's probably not worth it.
