在区域设置处于活动状态时无法导入EDGE证书

25

我正在尝试使用在eu-central-1颁发的证书为我的区域性API网关提供支持,该API网关在同一地区运行。

我的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 Gateway域名出错:BadRequestException:在REGIONAL处于活动状态时无法导入EDGE证书。

我缺少什么? 我认为我的ApiGateway不是EDGE而是REGIONAL,所以找不到错误的原因...

1个回答

44

certificate_arn 更改为 regional_certificate_arn

来自文档(强调我的):

引用 AWS 托管证书时,支持以下参数:

  • certificate_arn - (可选)AWS 托管证书的 ARN。仅支持 AWS Certificate Manager。当需要边缘优化的域名时使用。 与 certificate_name、certificate_body、certificate_chain、certificate_private_key、regional_certificate_arn 和 regional_certificate_name 冲突。
  • regional_certificate_arn - (可选)AWS 托管证书的 ARN。仅支持 AWS Certificate Manager。当需要区域性域名时使用。 与 certificate_arn、certificate_name、certificate_body、certificate_chain 和 certificate_private_key 冲突。

1
嘿@kgadek。感谢您的回答!您能否也提供文档链接? - json singh
已添加。参考信息:当前 AWS 提供商版本为 3.7.0,Terraform 版本为 0.13.3。 - kgadek
1
对于CloudFormation也是一样的:CertificateArn -> RegionalCertificateArn https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigateway-domainname.html - helloPiers

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接