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
8k stars 972 forks source link

Terraform 0.13 registry module syntax appears to be unsupported #1380

Open mike-morr opened 4 years ago

mike-morr commented 4 years ago
# Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
# working directory, into a temporary folder, and execute your Terraform commands in that folder.
terraform {
  source  = "terraform-aws-modules/atlantis/aws"
  version = "2.24.0"
}

I am trying to use the new module syntax shown above in TF 0.13 on TG 0.25.2 and getting the following error:

project/us-west-2/dev/atlantis_fargate/terragrunt.hcl:22,3-10: Unsupported argument; An argument named "version" is not expected here.

I am assuming this is just not supported yet. If so, this is a feature request. Otherwise, it is a support request. :-)

Thank you for the amazing project! 🥇

mike-morr commented 4 years ago

FYI. I tried adding the version to the inputs as a workaround, but it resulted in:

[terragrunt] 2020/10/06 22:07:18 WARNING: no double-slash (//) found in source URL p/us-west-2/dev/atlantis_fargate/terraform-aws-modules/atlantis/aws. Relative paths in downloaded Terraform code may not work.

This might trip people up, since the TF registry has already been updated to show only the new syntax in the top right of the documentation

tf screenshot of provider instructions
brikis98 commented 4 years ago

This is not something currently supported. Right now, Terragrunt solely supports the source param. PRs to support an optional, separate version param are welcome.

kitos9112 commented 3 years ago

Hmm - Trying to understand what's the actual limitation here. Could you not just use locals to perform an in-place interpolation following the standard git module source of Terraform?

# project/us-west-2/dev/atlantis_fargate/terragrunt.hcl
locals {
  module_url = "git::https://github.com/hashicorp/terraform-aws-consul.git" # << This could come from anywhere else in your TG project
  module_version = "v0.0.8" << This could come from anywhere else in your TG project
}

terraform {
  source = "${local.module_url}?ref=${local.module_version}"
}
yhakbar commented 3 years ago

@kitos9112 that doesn't work if you are utilizing terraform.io or another registry provider to download the modules instead of git.

See https://www.terraform.io/docs/registry/modules/use.html#using-modules

kitos9112 commented 3 years ago

Fair point - not consuming much Terraform content directly from the registry. You're right, this could be an enhancement to Terragrunt :)

yhakbar commented 3 years ago

@kitos9112 is there a formal way I can make this feature request? I would try to provide a PR to address this issue, but I don't think I'm familiar enough with this project or competent enough with Golang to do so.

yorinasub17 commented 3 years ago

is there a formal way I can make this feature request?

This is the ticket for the feature request (the enhancement tag). We're buried right now though with other initiatives so unlikely that we (Gruntwork) will get to this anytime soon. If anyone wants to contribute this from the community, the key places to update are: