地形变量

时间:2019-04-24 14:19:52

标签: variables amazon-ec2 terraform

我正在尝试为aws_key_path和name定义一些变量,但是在Terraform初始化时出现错误

# variables.tf

variable "aws_key_path" {
  aws_key_path = "Users/user/Documents/folder/filename.pem"
}
variable "aws_key_name" {
  aws_key_name = "filename"
}

# main.tf

module "us-west-1" {
  source       = "./some_sorce"
  aws_key_path = "${var.aws_key_path}"
  aws_key_name = "${var.aws_key_name}"
  aws_region   = "us-west-1"
  amis         = "${var.amis}"

  providers = {
    aws.source = "aws.us-west-1"
  }
}

初始化时出错:

  • 变量[aws_key_path]:无效密钥:aws_key_path

怎么了?

谢谢

1 个答案:

答案 0 :(得分:0)

这些不是环境变量。

Terraform变量的定义如下:

variable "aws_key_name" {
  default = "filename"
}