A
Size: a a a
A
S
vpc_security_group_ids = [data.ssh_sg_id.value]
Error: Reference to undeclared resource
on test.tf line 3, in data "aws_vpc" "infra":
3: id = data.vpc_id.value
A data resource "vpc_id" "value" has not been declared in the root module.
Error: Reference to undeclared resource
on test.tf line 51, in module "ec2-test":
51: vpc_security_group_ids = [data.ssh_sg_id.value]
A data resource "ssh_sg_id" "value" has not been declared in the root module.
ZR
ZR
ZR
S
S
S
dependency "network" {
config_path = "../network"
}
inputs = {
vpc_id = dependency.network.outputs.vpc_id
ssh_sg_id = dependency.network.outputs.ssh_security_group_id
}
test.tf
module "ec2-test" {Конкретно здесь не ясно, как аутпуты из одного модуля передать в текущий.
source = "github.com/terraform-aws-modules/terraform-aws-ec2-instance"
name = "test-instance"
instance_count = 1
ami = data.aws_ami.amazon_linux.id
instance_type = "t2.micro"
subnet_id = tolist(data.aws_subnet_ids.all.ids)[0]
...
AD
S
variable "vpc_id" {
type = string
}
variable "ssh_sg_id"{
type = string
}
data "aws_vpc" "infra" {
id = var.vpc_id
}
data "aws_subnet_ids" "all" {
vpc_id = data.aws_vpc.infra.id
}
...
ZR
variable "vpc_id" {
type = string
}
variable "ssh_sg_id"{
type = string
}
data "aws_vpc" "infra" {
id = var.vpc_id
}
data "aws_subnet_ids" "all" {
vpc_id = data.aws_vpc.infra.id
}
...
AD
AD
AK
A
JH
AK
SM
AK
SM