aptible / terraform-provider-aptible

The official Terraform provider for Aptible Deploy
https://registry.terraform.io/providers/aptible/aptible/latest
10 stars 13 forks source link

Managed HTTPS endpoints don't publish load balancer hostname #37

Closed derylseale closed 3 years ago

derylseale commented 3 years ago

When creating managed HTTPS endpoints, we need the load balancer hostname (e.g. elb-shared-us-east-1-wat-99999.aptible.in) in order to create the DNS records required to generate the associated certificate. In this scenario, however, the endpoint resource outputs only the provided domain for the application.

For example, when creating the following endpoint..

resource "aptible_endpoint" "my-endpoint" {
  resource_type  = "app"
  internal       = false
  managed        = true
  domain         = "app.mydomain.com"
  platform       = "alb"
}

... the virtual_domain output will be "app.mydomain.com" and there is not any other output corresponding to the necessary load balancer hostname. That makes it impossible to use Terraform to create the necessary DNS records automatically.

Would it be possible to add this to the endpoint output? Or is there another way to get this information?

jeremiahbowen commented 3 years ago

Almost created a duplicate issue: Here are my details. Basically mirrors this issue. When creating an aptible endpoint, the aptible_endpoint resources doesn't have an attribute providing the hostname. This makes it impossible to terraform that DNS record and route traffic through automation to that endpoint. In this instance, we would be creating a CNAME record pointing hrz-web-dashboard.[redacted] to the elb-[redacted].aptible.in domain. Can you update the resource to provide the hostname associated with the endpoint?

resource "aptible_endpoint" "endpoint_testing" {
    container_port = 8080
    default_domain = false
    domain         = "hrz-web-dashboard.[redacted]"
    endpoint_id    = [redacted]
    endpoint_type  = "https"
    env_id         = [redacted]
    id             = "[redacted]"
    internal       = true
    managed        = true
    platform       = "alb"
    process_type   = "cmd"
    resource_id    = [redacted]
    resource_type  = "app"
    virtual_domain = "hrz-web-dashboard.[redacted]"
}
aptible endpoints:list --app=web-dashboard --environment [redacted] 
Id: [redacted]
Hostname: elb-[redacted].aptible.in
Status: provisioned
Type: https
Port: 8080
Internal: true
IP Whitelist: all traffic
Default Domain Enabled: false
Managed TLS Enabled: false
Service: cmd
robertfairhead commented 3 years ago

Yes, I'll have a PR to add this up soon. I'd expect a new release end of this week/early next week. I'll update here if the timeline will vary significantly from that.

robertfairhead commented 3 years ago

Terraform provider v0.1.4 is released at https://registry.terraform.io/providers/aptible/aptible/latest and includes the change to address this.