2016-05-28 10 views
1

Ich versuche, Map Variable zu suchen, aber es gibt einen Fehler. Hier sind ein paar Auszüge aus meinem Code.Terraform-Lookup funktioniert nicht

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)}" 
    .... 
    .... 
} 

Ausgabe von terraform apply

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

Wie können wir dieses Problem lösen?

Antwort

0

Nichts ist falsch mit Syntax hier, Sieht aus wie Anbieter kein gültiger Parameter für aws_key_pair Ressource ist, sind nur gültig, pamams (key_name und public_key). https://www.terraform.io/docs/providers/aws/r/key_pair.html

+0

'Provider' ist ein Meta-Parameter für alle Ressourcen. Sie gibt an, welcher Provider zum Erstellen der Ressource verwendet werden soll. Siehe https://www.terraform.io/docs/configuration/resources.html#provider –

Verwandte Themen