我有两个具有相同输入变量的不同 terraform 模块,但名称和域除外。有没有办法共享输入变量?也许有一个外部文件或类似的东西?
这是我的模块
module "autoscaling_docker_frontend" {
source = "../../_/autoscaling_docker"
domain = "domain-1.com"
has_keychain = true
instance_type = "t3.micro"
name = "name-1"
certificate = var.certificate
ami = var.ami
account_id = var.account_id
dns_zone_id = var.dns_zone_id
environment = var.environment
key_name = var.key_name
subnets = var.subnets
vpc_id = var.vpc_id
policies = var.policies
region = var.region
security_groups_alb = var.security_groups_alb
security_groups_ec2 = var.security_groups_ec2
}
module "autoscaling_docker_backend" {
source = "../../_/autoscaling_docker"
domain = "domain-2.com"
has_keychain = true
instance_type = "t3.micro"
name = "name-2"
certificate = var.certificate
ami = var.ami
account_id = var.account_id
dns_zone_id = var.dns_zone_id
environment = var.environment
key_name = var.key_name
subnets = var.subnets
vpc_id = var.vpc_id
policies = var.policies
region = var.region
security_groups_alb = var.security_groups_alb
security_groups_ec2 = var.security_groups_ec2
}
谢谢