Terraform lookup not working -


i trying lookup map variable gives error. here few snippets of code.

variables.tf

variable "count" {   default = 2 } variable "providers" {     default = {         "0" = "aws"         "1" = "aws.west"     } } 

main.tf

resource "aws_key_pair" "default" {   count    = "${var.count}"   provider = "${lookup(var.providers, count.index)}"   ....   .... } 

output of terraform apply

error configuring: .. error(s) occurred:  ....    * aws_key_pair.default: provider ${lookup(var.providers, count.index)} couldn't found .... .... 

how can resolve ?

nothing wrong syntax here, looks provider not valid parameter aws_key_pair resource, valid pamams (key_name , public_key). https://www.terraform.io/docs/providers/aws/r/key_pair.html


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -