我以模块化方式使用 Terraform 来构建我的基础架构。我通过拥有一个调用不同模块的配置文件来做到这一点。我想传递一个基础结构变量,该变量获取应用程序应该构建的 Github 存储库的标记版本。最重要的是,我试图弄清楚如何在配置文件的“源”变量中连接字符串。
module "athenaelb" {
source = "${concat("git::https://github.com/ORG/REPONAME.git?ref=",var.infra_version)}"
aws_access_key = "${var.aws_access_key}"
aws_secret_key = "${var.aws_secret_key}"
aws_region = "${var.aws_region}"
availability_zones = "${var.availability_zones}"
subnet_id = "${var.subnet_id}"
security_group = "${var.athenaelb_security_group}"
branch_name = "${var.branch_name}"
env = "${var.env}"
sns_topic = "${var.sns_topic}"
s3_bucket = "${var.elb_s3_bucket}"
athena_elb_sns_topic = "${var.athena_elb_sns_topic}"
infra_version = "${var.infra_version}"
}
我希望它编译并且源看起来像这样(例如):git :: https://github.com/ORG/REPONAME.git?ref=v1
有人对如何使这项工作有任何想法吗?
谢谢,克伦