0

I have my existing code in terraform and my infra is up and running in aws .Now I would liek to move to terragrunt , but can I move my terraform code into terragrunt ? similar to terraform mv command do we have anything in terragrunt ?

LKK
  • 13
  • 8

2 Answers2

2

Terragrunt is a thin-wrapper to Terraform. You shouldn't have to change any Terraform code to use Terragrunt. It's main focus is on the bootstrapping and execution of the Terraform runs. In a nut-shell: Terraform dictates syntax, Terragrunt handles backend, workspace, and module dependencies.

Use terragrunt.hcl files to setup your run environments (e.g. backend, workspace) like they were previously, and everything should be good to go.

1efty
  • 825
  • 7
  • 10
  • Thanks !1efty for the reply .My existing infra is running in terraform, and i would like to import the same to the new terragrunt s3 bucket , is it possible? like terraform move command , can I do the same in terragrunt ? – LKK Nov 01 '20 at 02:05
  • Terragrunt will pass commands to terraform, you could run `terragrunt mv ...`. So in theory, yes. However, you can setup terragrunt to reuse your existing backend. – 1efty Nov 01 '20 at 03:50
  • Thanks @1efty.Marking your answer as correct :) .Cheers – LKK Nov 23 '20 at 05:50
0

The answer is not so easy. In theory you need nothing to changes. But if you want to use subfolders and modularise your project, then it is very likely that you will need to change some parts of code e.g. variables and ouputs handling, dependencies, but not the complete definition of resources.

My personal experience was not so good and learning how to work with terragrunt is a bit pain, because there are not enough detailed examples how to work with it, but the project is looking now much nicer than without terragrunt.

Sharbag
  • 245
  • 6
  • 15