I’m sure I’m being stupid here and that this is a 101 question but…
I have a VPC that has been set up and there is a bunch of information I need to access via the terraform state file. In this case I need to return a list
of subnet ids. My problem is that I can’t seem to access them from the tuple
.
e.g.
Setting up a Redis ElasticCache service is AWS using the module-cache.git//modules/redis
requires subnet_ids
to be set as a list(string)
.
At the moment this looks like this…
module "redis" {
...
subnet_ids = data.terraform_remote_state.vpc.outputs.private_persistence_subnet_ids
...
}
data "terraform_remote_state" "vpc" {
backend = "s3"
config = {
region = var.terraform_state_aws_region
bucket = var.terraform_state_s3_bucket
key = "${var.aws_region}/${var.vpc_name}/vpc/terraform.tfstate"
}
}
The tuple
entry from the terraform state file looks like this…
"private_persistence_subnet_ids": {
"value": [
[
"subnet-<subnetid 1>",
"subnet-<subnetid 2>",
"subnet-<subnetid 3>",
"subnet-<subnetid 4>",
"subnet-<subnetid 5>",
"subnet-<subnetid 6>"
]
],
"type": [
"tuple",
[
[
"tuple",
[
"string",
"string",
"string",
"string",
"string",
"string"
]
]
]
]
}
I’ve tried many different ways to access this data but always seem to get a “Error: Invalid value for module argument”
Any help would be greatly appreciated