.wpvars error parse list string

Is this a bug or am I doing something wrong?

For example wpvars

env="dev"
...
...
...
vpc_private_subnets = ["subnet-0b3b8974925e82b0c", "subnet-05612c4965c926075", "subnet-00819f6f1c4c4cfc0"]

Error

waypoint up -app hamster -var-file=waypoint.wpvars     

panic: not a string

goroutine 1 [running]:
github.com/zclconf/go-cty/cty.Value.AsString(0x34cd550, 0xc00041c5e8, 0x29a4ea0, 0xc00041c618, 0x1, 0x1)
        /home/psih/Go/pkg/mod/github.com/zclconf/go-cty@v1.8.4/cty/value_ops.go:1256 +0x1a5
github.com/hashicorp/waypoint/internal/config/variables.parseFileValues(0x7ffd0e374d5b, 0xf, 0x2f9bf3e, 0x4, 0x3500f58, 0xc0009bd500, 0x0, 0x0, 0xc00099fa08, 0xf8621e, ...)
        /home/psih/Go/src/github.com/psihachina/waypoint_main/internal/config/variables/variables.go:498 +0x569
github.com/hashicorp/waypoint/internal/config/variables.LoadVariableValues(0x0, 0xc000965400, 0x1, 0x1, 0x3500f58, 0xc0009bd500, 0x0, 0xc0000c4268, 0x0, 0x0, ...)
        /home/psih/Go/src/github.com/psihachina/waypoint_main/internal/config/variables/variables.go:260 +0x471
github.com/hashicorp/waypoint/internal/cli.(*baseCommand).Init(0xc0000c41a0, 0xc00099fcb8, 0x3, 0x3, 0xc000402000, 0x0)
        /home/psih/Go/src/github.com/psihachina/waypoint_main/internal/cli/base.go:272 +0x6d6
github.com/hashicorp/waypoint/internal/cli.(*UpCommand).Run(0xc0009beac8, 0xc0009bd4a0, 0x3, 0x6, 0xc000964bc0)
        /home/psih/Go/src/github.com/psihachina/waypoint_main/internal/cli/up.go:26 +0xf5
github.com/mitchellh/cli.(*CLI).Run(0xc000959400, 0xc00099fee8, 0x3500f58, 0xc0009bd500)
        /home/psih/Go/pkg/mod/github.com/mitchellh/cli@v1.1.2/cli.go:262 +0x41a
github.com/hashicorp/waypoint/internal/cli.Main(0xc0009bd480, 0x5, 0x8, 0x0)
        /home/psih/Go/src/github.com/psihachina/waypoint_main/internal/cli/main.go:125 +0x57a
main.main()
        /home/psih/Go/src/github.com/psihachina/waypoint_main/cmd/waypoint/main.go:14 +0xa5
1 Like

How are you using this in your waypoint.hcl? And what does your variable definition block look like in the waypoint.hcl?

Sorry, forgot

app "hamster" {
 ...
  deploy {
    use "aws-ecs" {
     ...
      subnets = var.vpc_private_subnets
    }
  }
}

variable "vpc_private_subnets" {
  default = []
  type = list(string)
}

Yeah that’s a bug in our file parser looks like. You can get around it by feeding the complex types via the -var flag, like -var=vpc_private_subnets="[\"subnet-0b3b8974925e82b0c\", \"subnet-05612c4965c926075\", \"subnet-00819f6f1c4c4cfc0\"]". I’ll open an issue here.

You can also set it via the UI to save yourself escaping so many quotes :slight_smile:

The fact is that in my case, the subnets are passed to .wpvars from the SSM. But thanks for the answers

Ah. Yeah that’s a frustrating issue to hit then, with little workaround.
Here’s the issue: https://github.com/hashicorp/waypoint/issues/2208
Hope to get a fix out quickly.

2 Likes