quintilesims / layer0

Build, Manage, and Deploy Your Applications
Apache License 2.0
44 stars 20 forks source link

Feature Request: Allow certificate ARN to be used for load balancers. #491

Closed Cryowatt closed 6 years ago

Cryowatt commented 6 years ago

Currently the load balancers in layer0 look up certificates in IAM by name. I have a use-case where I've purchased a cert through ACM in AWS, but there doesn't appear to be a way to use that in terraform with layer0. Example:

data "aws_acm_certificate" "oce" {
  domain   = "www.example.com"
}

resource "layer0_load_balancer" "lb" {
  name        = "myloadbalancer"
  environment = "${layer0_environment.environment.id}"

  port {
    host_port      = 443
    container_port = 80
    protocol       = "https"
    certificate_arn    = "${data.aws_acm_certificate.oce.arn}" // <-- Feature request
  }

  /*
   The rest
  */
}
jparsons04 commented 6 years ago

To resolve this for version 0.10.4 (and later, probably), we will need to modify the terraform plugin, the api backend and the cli client. The way the API handles SSL certificate resolution now is it accepts the name of an IAM certificate and later calculates what the ARN is. In this case, an ACM certificate ARN needs to be accepted and passed through layer0 (the workflow goes terraform -> l0 cli client -> l0 api).

IAM and ACM certificates are distinct, and the code only checks IAM for certificates, so that will need to be modified.

This is still doable, I'm just noting here for other people working on layer0 that the change will require more than simply modifying the terraform plugin.