【发布时间】:2019-06-14 14:47:13
【问题描述】:
我有一个模块,它定义了一个提供者,如下所示
provider "aws" {
region = "${var.region}"
shared_credentials_file = "${module.global_variables.shared_credentials_file}"
profile = "${var.profile}"
}
还有一个EC实例如下
resource "aws_instance" "node" {
ami = "${lookup(var.ami, var.region)}"
key_name = "ib-us-east-2-production"
instance_type = "${var.instance_type}"
count = "${var.count}"
security_groups = "${var.security_groups}"
tags {
Name = "${var.name}"
}
root_block_device {
volume_size = 100
}
在调用此模块的 terraform 脚本中,我现在想创建一个 ELB 并将其附加到实例,其中包含类似于
的内容resource "aws_elb" "node_elb" {
name = "${var.name}-elb"
.........
但是 terraform 不断提示我输入模块中已定义的 aws 区域。解决此问题的唯一方法是将提供程序块复制到调用模块的文件中。有没有更清洁的方法来解决这个问题?
【问题讨论】:
标签: amazon-web-services terraform