Skip to content

Variables with type = any are not encoded properly for Terraform 0.12 #1211

Closed
@antonbabenko

Description

# terragrunt.hcl
terraform {
  source = "..."
}

inputs = {
  name ="something"                 # <-- this does not work
  # name = jsonencode("something")  # <-- this works
}
# module/main.tf
variable "name" {
  type    = any      # Works as expected when type is not `any`
  default = null
}

The error message:

Error: Invalid expression

  on <value for var.name> line 1:
  (source code not available)

Expected the start of an expression, but found an invalid expression token.

It looks like terragrunt should do JSON encode for all variables, but I am not sure if it is a BC break, or not.

Using terragrunt version v0.23.23 and Terraform 0.12.26.

The workaround, for now, is to know which variables have "type = any" and wrap value with jsonencode().

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds designWe need to flesh out the design before we can resolve the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions