gruntwork-io / terragrunt

Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/Terraform to scale.
https://terragrunt.gruntwork.io/
MIT License
8.04k stars 975 forks source link

Terragrunt Apply - Got 0 resources applied when Terraform fails #1606

Closed lmayorga1980 closed 3 years ago

lmayorga1980 commented 3 years ago

I got the following error when deploying through terragrunt

Error: timeout - last error: http response error: 401 - invalid content type

This is because my winrm configuration was incorrect. Now I would like to destroy whatever resources where created prior the compute instances(firewall rules, networking objects, etc)

Error: timeout - last error: http response error: 401 - invalid content type

Error: timeout - last error: http response error: 401 - invalid content type

ERRO[0618] Hit multiple errors:
Hit multiple errors:
exit status 1 
➜  us-east1 git:(dev) ✗ terragrunt destroy 
Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

Destroy complete! Resources: 0 destroyed.

When I was using Terraform binary i could just execute terraform destroy and it will destroy the objects that were created prior to the error.

brikis98 commented 3 years ago

The destroy command is based off what is in your state file. How are you managing the state file? Are you using some backend? Or is it local, on disk? Could you perhaps have accidentally deleted or moved the file?

lmayorga1980 commented 3 years ago

The state file is local on disk. But even when using Terraform itself without Terragrunt, I can destroy part of the resources that were created.

brikis98 commented 3 years ago

If the same thing is happening with Terraform, then I don't think it's related to Terragrunt?

yorinasub17 commented 3 years ago

Closing this as the original question has been answered. If there are any follow ups, please open a new ticket with updated context. Thanks!