However, I may have spoken too fast.
Even after it passes plan, it fails apply in that it does not find the "$var.PUBLIC_SUBNETS[0]"
As you are using 0.12 I'd recommend not using the interpolation
syntax at all.
Remove the "" and $
So subnet_id = var.PUBLIC_SUBNETS[0]
And subnet_id = var.ENV == "prod" ?
module.vpc-prod.public_subnets[0] :
module.vpc-dev.public_subnets[0]
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/365c37e4-f1f6-4bc1-9b5d-5b499cb43f0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Stuart Clark
To unsubscribe from this group and stop receiving emails from it, send an email to terrafo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/365c37e4-f1f6-4bc1-9b5d-5b499cb43f0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Stuart Clark
Where and how is var.PUBLIC_SUBNETS defined?
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/1aa24e8f-ce06-4e16-8511-43fe928ed27b%40googlegroups.com.
Please make sure you first upgrade to 0.11.14 as that one is better prepared to migrate to 0.12--
Fernando Miguel
Hi Stuart I have noted in my initial post that it is defined as below, but is being called in from a module - shared between environments dev and prod.
The dev.tf snippet is below, and subnets are defined in a local module vpc.tf (shared between dev and prod) which uses the terraform module: terraform-aws-modules/vpc/aws.
Hope that helps. I can send the files if necessary. Since it is part of a tutorial from Edward Viaene you can see the code here: https://github.com/wardviaene/terraform-course/tree/master/demo-18b
It is set to work in 0.11.7 and should work in 0.11.9 but when I started with 0.12-rc1 - I had to fix some issues with tags through the different demos.
In fact please note this post I made when I started with TF 0.12-rc2: https://groups.google.com/forum/#!searchin/terraform-tool/monosij%7Csort:date/terraform-tool/I9tUoeFDs3U/4jNhMXpsAgAJ
As I stated, the errors are inconsistent across validate/ plan/ apply. And it seems this "${var.SUBNETS[0])" is itself inconsistent when pulling from a array? The old declaration seemd more consistent than: var.SUBNETS[0])
Thanks again....Thus in file instance.tf of dev module, PUBLIC_SUBNETS defined/ used as below. Incorporates instance.tf and vpc.tf from the modules folder, where vpc.tf uses the terraform module: terraform-aws-modules/vpc/aws#-------------------------------------------------#
variable "PUBLIC_SUBNETS" {type = "list"}
I think you want to change this to:
type = list(string)
In general for 0.12 you don't want to be using "" very much at
all - only for direct specification of strings. For numbers,
booleans, variable references, etc. you just enter it directly.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/1aa24e8f-ce06-4e16-8511-43fe928ed27b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Stuart Clark
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/1aa24e8f-ce06-4e16-8511-43fe928ed27b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Stuart Clark
The ${...} inside "" is interpolation, and in general wouldn't be used much in 0.12. Instead the direct (non-quoted) reference to variables would be the way you do things.
This has the advantage of type checking, so if a resource/module
expects a list of strings it won't accept a number or a list of
booleans.
However, as you note the old syntax did sometimes give you a clue
that you were passing a list.
I would strongly suggest removing all "${...}" entries and just using the direct syntax. There is a tool to do this automatically - terraform 0.12upgrade
If you stick with interpolation you lose the type checking
ability, which is a major advantage that 0.12 brings.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/81655121-d620-4515-b916-ca01db22b86f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Stuart Clark
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/81655121-d620-4515-b916-ca01db22b86f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-- Stuart Clark