【发布时间】:2022-11-15 10:30:26
【问题描述】:
我无法输出 vpc 端点。我有
module.vpc-endpoints-oregon 是一个对象。此对象没有名为“端点”的属性。
在 modules/vpc_endpoints 文件夹中,有三个文件,
main.tf 输出.tf 变量.tf
猫模块/vpc_endpoints/main.tf
module "vpc_endpoints" {
source = "terraform-aws-modules/vpc/aws//modules/vpc-endpoints"
version = "3.16.0"
vpc_id = var.vpc_id
security_group_ids = [data.aws_security_group.default.id]
endpoints = {
s3 = {
service = "s3"
tags = { Name = "s3-vpc-endpoint" }
},
dynamodb = {
service = "dynamodb"
service_type = "Gateway"
route_table_ids = flatten([var.intra_route_table_ids,
var.private_route_table_ids,
var.public_route_table_ids])
policy = data.aws_iam_policy_document.dynamodb_endpoint_policy.json
tags = { Name = "dynamodb-vpc-endpoint" }
},
lambda = {
service = "lambda"
private_dns_enabled = true
subnet_ids = var.private_subnets
tags = { Name = "lambda-vpc-endpoint" }
},
}
}
猫模块/vpc_endpoints/outputs.tf
cat outputs.tf
# VPC endpoints
output "vpc_endpoints" {
description = "Array containing the full resource object and attributes for all endpoints created"
value = module.vpc_endpoints.endpoints
}
在 vpc_endpoints 文件夹中,有三个文件, main.tf 输出.tf 变量.tf
猫主.tf
module "vpc-endpoints-oregon" {
source = "../../modules/vpc_endpoints"
#version = "3.16.0"
cluster_name = var.cluster_name
environment = var.environment
vpc_id = var.vpc_id
intra_route_table_ids = var.intra_route_table_ids
private_route_table_ids = var.private_route_table_ids
public_route_table_ids = var.public_route_table_ids
private_subnets = var.private_subnets
vpc_cidr_block = var.vpc_cidr_block
name_prefix = "vpc_tls"
}
猫输出.tf:
output "vpc-endpoints-oregon" {
description = "Array containing the full resource object and attributes for all endpoints created"
value = module.vpc-endpoints-oregon.endpoints
}
terragrunt 验证
Error: Unsupported attribute
on outputs.tf line 4, in output "vpc-endpoints-oregon":
4: value = module.vpc-endpoints-oregon.endpoints
module.vpc-endpoints-oregon is a object
This object does not have an attribute named "endpoints".
ERRO[0002] Terraform invocation failed in path-to/vpc_endpoints
ERRO[0002] 1 error occurred:
* exit status 1
为什么它声称 This object does not have an attribute named "endpoints"?
【问题讨论】:
标签: amazon-web-services terraform amazon-vpc vpc-endpoint