ex
<aside>
root/
vpc/
security_group/
방법
output "name" {
value = aws_vpc.vpcname.id
}
module "vpc" {
source = "./modules/vpc"
}
module "security_groups" {
source = "./modules/security_groups"
vpc_id = module.vpc.vpc_id //값을 참조할 디렉토리에서의 variable 이름 = module + module 명 + module variable
}
variable "vpc_id" {
type = string
}
resource "aws_security_group" "name" {
vpc_d = var.vpc_id
}
</aside>
주의점
<aside>
source 경로 아래에 있는 모든 .tf 파일을 읽음variables.tf)와 출력값(outputs.tf)에 따라 필요한 값만 주입 및 반환.