0

我正在运行 terraform 0.12.24

我有一个 api-gateway.tf 文件,用于创建 AWS API Gateway 资源。

我计划像这样部署 AWS API Gateway:

resource "aws_api_gateway_rest_api" "example" {
  name        = "example"
  description = "Example Api Gateway"
}

resource "aws_api_gateway_deployment" "deployment" {
  rest_api_id = aws_api_gateway_rest_api.example.id
  stage_name  = "test"
}

output "base_url" {
  value = aws_api_gateway_deployment.deployment.invoke_url
}

我收到一个错误:

Error: Reference to undeclared resource

  on main.tf line 126, in output "base_url":
 126:   value = aws_api_gateway_deployment.deployment.invoke_url

A managed resource "aws_api_gateway_deployment" "deployment"
has not been declared in the root module.

为什么我在进行 terraform plan 时无法将 API Gateway 链接输出为输出?

4

0 回答 0