Terragrunt Plan Mock Output Subnet Dependency

I’m good with using Mock Outputs, but the problem I’m running into are values that Terraform wants to lookup during a plan.

I put in dummy values for a subnet ID, but Terraform is going to check to see if that exists and then will barf saying the Subnet ID doesn’t exist because it’s dependency on another networking stack that hasn’t been deployed. My goal is to do a “deploy all” type situation, hence the dependencies.

Anyone have suggestions around this? Like an ignore doesn’t exist or something like that?

Hi Mark,

Unfortunately, this isn’t something that is currently supported with terragrunt or terraform automatically. If you want to have some kind of plan, the only workarounds right now are to:

  • Add logic to shut off data sources in your terraform module based on a variable input, and then set this variable to shut off when using mock outputs. You can also use a magic string for the lookup variable and shut off the data source when the magic string is provided.

  • Create place holder resources in your AWS accounts that you use during the mocks. That is, you can create a VPC in your AWS account whose ID is what you pass in as the mock. This way, you are using a real AWS resource that exists.

Unfortunately, we don’t currently have plans to resolve this (creating a valid plan when using mocks in xxx-all). At the moment, it is impossible to manipulate terraform to give us a valid plan when values are absent because there is currently no way to “taint” the plan at the top level with “(known after apply)” like terraform does internally when it can see the full graph.

Yori