minamijoyo / tfupdate

Update version constraints in your Terraform configurations
MIT License
539 stars 23 forks source link

Terragrunt support #82

Open userbradley opened 1 year ago

userbradley commented 1 year ago

I know this is a long shot, but I was wondering if you had any plans to support a similar method you use for terraform - but for terragrunt.

Let me explain the issue here.

In terragrunt, we have the concept of Generators and we use it for Creating provider blocks

The issue here is that sure, we can run terragrunt init and then tfupdate terraform -r . but this updates the generated files, not the original.

An example file is below:

generate "provider" {
  if_exists = "overwrite"
  path = "provider.tf"
  contents =<<EOF
terraform {
  required_version = "1.3.7"
  required_providers {
    google = {
      source  = "hashicorp/google"
      version = ">= 4.50.0"
    }
  }
}
EOF
}

Which after running terragrunt init we get something like the below

# Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa
terraform {
  required_version = "1.3.7"
  required_providers {
    google = {
      source  = "hashicorp/google"
      version = ">= 4.50.0"
    }
  }
}

I think you can start to see where the problem comes from. In the terragrunt.hcl file, the terraform is passed in as data, opposed to something structured.

Let me know if this is not in the roadmap, or if this is something you need more of an explanation of!