root / main.cf
module "vpc_dtap" {
source = "../modules/aws-vpc-dtap"
}
module "aws-ec2-instance-domain-controller-server" {
source = "../modules/aws-ec2-instance-domain-controller-server"
}
root / multi-domain-controller-servers / main.cf
module "ec2_instance_domain_controller_servers" {
source = "D:/Users/user/terraform/modules/aws-ec2-instance-domain-controller-server"
### Instance Name and AMI
instance_names = "${var.ec2_instance_domain_controller_server_names}"
ami = "${lookup(var.ami_windows_base, var.region_name)}"
### Tags
env_name = "${var.env_name}"
global_tags = "${var.global_tags}"
instance_tags = "${var.ec2_instance_domain_controller_server_instance_tags}"
### VPC Data
vpc_id = "${module.vpc_dtap.vpc_id}"
availability_zones = "${module.vpc_dtap.availablity_zones}"
}
并获取:模块'ec2_instance_domain_controller_servers':引用的未知模块:vpc_dtap
如何将vpc_dtap模块引用到aws-ec2-instance-domain-controller-server模块?
答案 0 :(得分:0)
通过在root / multi-domain-controller-servers下创建vpc.tf解决了该问题
module "vpc_dtap" {
source = "D:/Users/user/terraform/modules/aws-vpc-dtap"
global_tags = "${var.global_tags}"
### Parameters ###
# CIDR block of the VPC. This block will be used as a base for all subnet ranges.
cidr_block = "${var.cidr_block}"
# Currently the VPC module supports only 2 availablity zones.
availability_zones = "${var.availability_zones}"
# The environment name is used all over the place as a prefix to all VPC specifics, subnets , route tables, etc.
env_name = "${var.env_name}"
# The domain name is used for the DHCP option set.
domain_name = "${var.domain_name}"
}