Closed olivermeyer closed 1 month ago
Hey @olivermeyer ,
It supports it today! Terragrunt will respect any .tf
files placed next to a terragrunt.hcl
file, so if you want to use the same syntax to import resources, you can just place the HCL import
block you referenced above in an imports.tf
file right next to your terragrunt.hcl
.
Hey @olivermeyer ,
It supports it today! Terragrunt will respect any
.tf
files placed next to aterragrunt.hcl
file, so if you want to use the same syntax to import resources, you can just place the HCLimport
block you referenced above in animports.tf
file right next to yourterragrunt.hcl
.
Hi @yhakbar, thanks for the quick reply and apologies from my side - for some reason I couldn't get it to work and since I couldn't find it mentioned in the documentation, I assumed it wasn't supported. I'll take another shot at it :-)
No problem!
If you can think of a way to improve the documentation so that it's clearer for the next person, please submit a pull request. There isn't anything special in how Terragrunt handles imports. This feature is just a side-effect of the design of Terragrunt automatically ensuring that .tf
files next to a terragrunt.hcl
file are used for terragrunt
commands.
Describe the enhancement
Terraform supports
import
blocks as a way of importing existing resources into the state without running commands manually. For example, the following block will import the EC2 instance with idi-abcd1234
toaws_instance.example
in the state:For further details, see the Terraform docs.
It would be great if Terragrunt supported these blocks, since running import commands manually is inherently risky.
Note that this is different from the Terragrunt
import
blocks described here.Additional context
Alternatives: run the import commands manually