我正在尝试将 eu-central-1 颁发的证书用于我的 apigateway,该证书是区域性的并且在同一区域工作。
我的terraform代码如下:
//ACM Certificate
provider "aws" {
region = "eu-central-1"
alias = "eu-central-1"
}
resource "aws_acm_certificate" "certificate" {
provider = "aws.eu-central-1"
domain_name = "*.kumite.xyz"
validation_method = "EMAIL"
}
//Apigateway
resource "aws_api_gateway_rest_api" "kumite_writer_api" {
name = "kumite_writer_api"
endpoint_configuration {
types = ["REGIONAL"]
}
}
resource "aws_api_gateway_domain_name" "domain_name" {
certificate_arn = aws_acm_certificate.certificate.arn
domain_name = "recorder.kumite.xyz"
endpoint_configuration {
types = ["REGIONAL"]
}
}
不幸的是,我不断收到此错误:
错误:创建 API 网关域名时出错:BadRequestException:当 REGIONAL 处于活动状态时,无法导入 EDGE 证书。
我在这里缺少什么?我认为我的 ApiGateway 不是 EDGE,而是 REGIONAL,因此找不到错误的意义...
将
certificate_arn
更改为 regional_certificate_arn
。
来自文档(强调我的):
引用 AWS 托管证书时,支持以下参数:
-(可选)AWS 托管证书的 ARN。 AWS Certificate Manager 是唯一受支持的源。 在需要边缘优化域名时使用。 与certificate_name、certificate_body、certificate_chain、certificate_private_key、regional_certificate_arn 和regional_certificate_name 冲突。certificate_arn
-(可选)AWS 托管证书的 ARN。 AWS Certificate Manager 是唯一受支持的源。 在需要区域域名时使用。 与certificate_arn、certificate_name、certificate_body、certificate_chain 和certificate_private_key 冲突。regional_certificate_arn
谢谢,这也解决了我的问题。