我以模塊化方式使用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