我正在使用aws_vpc_endpoint_service
Terraform (v0.11.14) 在我的 AWS 账户上为 S3 创建一个 AWS VPC 端点,最近开始面临以下错误:Error: multiple VPC Endpoint Services matched; use additional constraints to reduce matches to a single VPC Endpoint Service
相同的代码之前运行良好。分辨率是多少?
我找到了解决办法。
问题原因:
如果 AWS 提供商版本 >= v3.10.0 的解决方案:
data "aws_vpc_endpoint_service" "s3" {
service = "s3"
service_type = "Gateway"
}
如果 AWS Provider Version < v3.10.0 的解决方案:
如果您无法更新到提供程序的最新版本,作为临时解决方法,您还可以使用 com.amazonaws.REGION.s3 作为下游配置中的端点值,而不是使用数据源。
data "aws_region" "current" {}
resource "aws_vpc_endpoint" "s3" {
vpc_id = "${local.vpc_id}"
service_name = "com.amazonaws.${data.aws_region.current.name}.s3"
}
就这些。
以前不再工作的参考代码:
data "aws_vpc_endpoint_service" "s3" {
service = "s3"
}
resource "aws_vpc_endpoint" "s3" {
vpc_id = "${local.vpc_id}"
service_name = "${data.aws_vpc_endpoint_service.s3.service_name}"
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句