添加SSL Certifcate时出错-使用Terraform模块

添加SSL Certifcate时出错-使用Terraform模块,terraform,aws-load-balancer,Terraform,Aws Load Balancer,对不起,我的英语不好 模块:terraform aws elb版本:2.0 链接: 我正在尝试使用此模块,但当我添加来自SSL的ARN证书时,会显示以下消息: terraform apply myplan module.elb_http.module.elb.aws_elb.this: Creating... Error: Error creating ELB: ValidationError: Secure Listeners need to specify a SSLCertificat

对不起,我的英语不好

模块:terraform aws elb版本:2.0 链接:

我正在尝试使用此模块,但当我添加来自SSL的ARN证书时,会显示以下消息:

terraform apply myplan 

module.elb_http.module.elb.aws_elb.this: Creating...
Error: Error creating ELB: ValidationError: Secure Listeners need to specify a SSLCertificateId
        status code: 400, request id: id-for-my-request1

  on .terraform/modules/elb_http/terraform-aws-modules-terraform-aws-elb-43e3e76/modules/elb/main.tf line 1, in resource "aws_elb" "this":
   1: resource "aws_elb" "this" {

对于测试,我正在更改此文件:

.terraform/modules/elb_http/terraform-aws-modules-terraform-aws-elb-43e3e76/modules/elb/main.tf
并且,将查找(listener.value,“ssl\u certificate\u id”,null)ssl\u certificate\u id参数从我的证书更改为我的ARN,ACM模块和ELB工作正常

如果有人经历过这种情况,如果你能提供帮助,谢谢你。如果这是我的错误配置,我道歉


环境配置
  • 地形版本:地形v0.12.18
  • provider.aws v2.43.0

  • ACM模块版本:2.0

  • ELB_HTTP模块版本:2.0

  • 操作系统:Ubuntu 19.04

main.tf

provider "aws" {
    region = var.aws_region
}

module "acm" {
  source  = "terraform-aws-modules/acm/aws"
  version = "~> v2.0"

validate_certificate  = false

  domain_name  = "domain.name.example"
  zone_id      = "zone-id"

  subject_alternative_names = [
    "*.example.domain.name",
  ]

  tags = {
    Name = "example.domain.name"
  }
}


module "elb_http" {
  source  = "terraform-aws-modules/elb/aws"
  version = "~> 2.0"

  name = var.name

  subnets         = var.lb_subnets
  security_groups = var.sgs
  internal        = false

  listener = [
    {
      instance_port     = var.instance_port
      instance_protocol = var.instance_protocol
      lb_port           = var.lb_port
      lb_protocol       = var.lb_protocol
    },
    {
      instance_port     = var.instance_port
      instance_protocol = var.instance_protocol
      lb_port           = var.lb_port
      lb_protocol       = var.lb_protocol
      ssl_certificate_id  = "ssl_ARN"

    },
  ]

  health_check = {
    target              = "HTTP:80/"
    interval            = 30
    healthy_threshold   = 2
    unhealthy_threshold = 2
    timeout             = 5
  }


  // ELB attachments
  number_of_instances = var.instaces_number
  instances           = var.instances_id

  tags = {
    Owner       = var.owner
    Environment = var.tag
  }
}
变量.tf

variable "aws_region" {
  description = "AWS Region"
}

variable "name" {
  description = "Cluster Name"
}
variable "lb_subnets" {
  description = "Cluster subnets"
  type  = list(string)
}

variable "sgs" {
  description = "Security Groups"
  type  = list(string)
}

variable "instance_port" {
  description = "Instance port"
  type  = number
}
variable "instance_protocol" {
  description = "Instance protocol"
  type  = string
}
variable "lb_port" {
  description = "LB port"
  type  = number
}
variable "lb_protocol" {
  description = "LB protocol"
  type  = string
}
variable "instaces_number" {
  description = "instances numbers"
  type  = number
}
variable "instances_id" {
  description = "Instance IDs"
  type  = list(string)
}

variable "owner" {
  description = "lb owner"
  type  = string
}
variable "tag" {
  description = "lb tag"
  type  = string
}


问候

main.tf
中,我有以下几行:

listener = [
  {
    instance_port     = var.instance_port
    instance_protocol = var.instance_protocol
    lb_port           = var.lb_port
    lb_protocol       = var.lb_protocol
  },
  {
    instance_port     = var.instance_port
    instance_protocol = var.instance_protocol
    lb_port           = var.lb_port
    lb_protocol       = var.lb_protocol
    ssl_certificate_id  = "ssl_ARN"
},
但是,我不需要两次声明值。我改为:

listener = [
  {
    instance_port     = var.instance_port
    instance_protocol = var.instance_protocol
    lb_port           = var.lb_port
    lb_protocol       = var.lb_protocol
  },

你能把你修改过的那一行贴出来吗?你能编辑你的问题,把你的地形代码包括进去吗?最好是在一个能再现你错误的地方!!在模块中,我修改了第21行。我正在编辑文章并添加配置示例。