Hi all,
in our config we have a lambda we deploy which needs the IDs of other resources (vpc etc.) which is another repo.
dependencies {
paths = [
"../../remote-state-rds", "../../remote-state-vpc"
]
}
dependency "remote-state-rds" {
config_path = "../../remote-state-rds"
}
We used dependency blocks to get the terraform_remote_state of these objects and output it. Works well, but it seems when we call destroy-all, it is trying to also destroy the dependency state. Can this be prevented?
Would one of these options help?
Also from what I can tell, running xxx-all commands affects the entire dependency-tree. Can you make do with just destroy rather than destroy-all?
I have the same issue, I'm deploying different api gateway stages which depends on an api gateway module. When I delete an stage I don't want to delete the api gateway because it is use by the rest of stages. Using destroy without all is not an option because I have dependencies in each api gateway stage module that indeed I want to delete (vpclink and nlb).
You can either:
-all command.terragrunt.hcl config to protect that module.I solved it. I wanted to delete the modules inside uat (apigw-vpc-link, nlb, stage-uat, target-attach) without deleting the apigw one.
โโโ apigw
โ โโโ swagger.yaml
โ โโโ terraform.tfstate
โ โโโ terragrunt.hcl
โโโ cw-role
โ โโโ terragrunt.hcl
โโโ prod
โ โโโ apigw-vpc-link
โ โ โโโ terragrunt.hcl
โ โโโ nlb
โ โ โโโ terragrunt.hcl
โ โโโ stage_proddev
โ โ โโโ terragrunt.hcl
โ โโโ stage_prodprm
โ โ โโโ terragrunt.hcl
โ โโโ stage_prodstd
โ โ โโโ terragrunt.hcl
โ โโโ target-attach
โ โโโ terragrunt.hcl
โโโ uat
โโโ apigw-vpc-link
โ โโโ terragrunt.hcl
โโโ nlb
โ โโโ terragrunt.hcl
โโโ stage-uat
โ โโโ terragrunt.hcl
โโโ target-attach
โโโ terragrunt.hcl
So this is the command that I employed:
cd uat
terragrunt destroy-all --terragrunt-ignore-external-dependencies
In this way I avoided to delete the apigw module which is an external dependency of my stage-uat module. It would be good to have a clear example in the documentaion for the --terragrunt-ignore-external-dependencies flag, it is quite confusing how to use it
Most helpful comment
You can either:
-allcommand.terragrunt.hclconfig to protect that module.