gruntwork-io/terragrunt-infrastructure-live-example

[sample] Need a sample on several conditions

ozbillwang opened this issue · 1 comments

could you please show me a sample, which can

  1. reference module source version?
module "consul" {
  source  = "hashicorp/consul/aws"
  version = "0.0.5"
}

If I put in terragrunt.hcl

terraform {
  source  = "hashicorp/consul/aws"
  version = "0.0.5"
}

it prompted the error message, that doesn't know version

  1. how to manage the tfstate file with terraform cloud?

Reference document: https://learn.hashicorp.com/terraform/getting-started/remote.html

The version param is not natively supported by Terragrunt right now. A PR to add that would be very welcome! In the meantime, the workaround is to use a Git URL with a ref parameter instead. E.g.,

terraform {
  source = "github.com/hashicorp/terraform-aws-consul?ref=v0.0.5"
}

The Terraform Cloud backend should work like any of the others. In your Terraform code:

terraform {
  # Partial configuration. Config will be filled in by Terragrunt.
  backend "remote" {}
}

In terragrunt.hcl:

remote_state {
  backend = "remote"

  config = {
    organization = "Cloud-Org"

    workspaces {
      name = "Dev-QA"
    }
  }
}