我以模块化方式使用Terraform以构建我的基础结构。我通过在不同模块中调用配置文件来实现这一点。我想传递一个基础结构变量,该变量挑选应用程序应构建的Github存储库的标记版本。最重要的是,我试图弄清楚如何在配置文件的“source”变量中进行串联。Terraform - 将变量传递给“Source”参数
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}"
}
我想它来编译和源看起来像这样(例如):混帐:: https://github.com/ORG/REPONAME.git?ref=v1
人对如何使这项工作有什么想法?
感谢, 可人
P.S.抱歉可怕的格式化...无法提交此代码块bc堆栈溢出抱怨格式化... – Keren
它尚未支持。请检查 - https://github.com/hashicorp/terraform/issues/1439 – Baskar