在Terraform中如何创建应用程序负载均衡器和VPC连接?

0

【以下的问题经过翻译处理】 根据《使用VPC链接HTTP API》文档:

VPC链接使您能够创建连接HTTP API路由到VPC中的私有资源(例如应用负载平衡器或基于Amazon ECS容器的应用程序)的私有集成。

但是:

resource "aws_api_gateway_vpc_link" "example_vpc_link" {
  name        = "example_vpc_link"
  target_arns = [aws_lb.example_lb.arn]
}
resource "aws_lb" "example_lb" {
  name               = "example-lb"
  internal           = true
  load_balancer_type = "application"
  security_groups    = [aws_security_group.example_sg.id]
  subnets            = local.subnet_ids
}

返回以下错误:

│ Error: creating API Gateway VPC Link (example_vpc_link): waiting for completion: FAILED: NLB ARN is malformed
│ 
│   with aws_api_gateway_vpc_link.example_vpc_link,
│   on main.tf line 139, in resource "aws_api_gateway_vpc_link" "example_vpc_link":
│  139: resource "aws_api_gateway_vpc_link" "example_vpc_link" {
│ 
╵

看起来aws_api_gateway_vpc_link确实是指NLB而不是ALB。

因此,我认为这是Terraform中aws_api_gateway_vpc_link选项的不完整集(没有target_type =“application”的选项),我们需要使用自定义Terraform资源进行处理。

1 Resposta
0

【以下的回答经过翻译处理】 这似乎是Terraform中的一个错误。Terraform AWS Provider GitHub存储库通常非常擅长响应错误报告。

profile picture
ESPECIALISTA
respondido há 5 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas