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

Cannot create more than one endpoint (https) #67

Closed Jrc356 closed 2 years ago

Jrc356 commented 2 years ago

Description

It seems that only 1 endpoint can be created using aptible_endpoint and this endpoint can only be a default_domain endpoint. If there are attempts to create another endpoints, the provider errors out with a poorly formatted error message.

Note that the only endpoint type I have tried with this is https. This might or might not apply to TCP and TLS endpoints

Versions

Terraform: 1.2.7 Aptible Provider: 0.2.2

Reproduction steps

  1. terraform an aptible app
  2. terraform an endpoint with default_domain=true
  3. add another endpoint to terraform with any options
  4. apply terraform
  5. see error

Terraform code

this is the terraform I am using to test

terraform {
  required_version = ">= 1.0"
  required_providers {
    aptible = {
      source  = "aptible/aptible"
      version = "0.2.2"
    }
  }
}

provider "aptible" {}

data "aptible_environment" "environment" {
  handle = "staging1"
}

resource "aptible_app" "app" {
  handle = "jrc-test-app"
  env_id = data.aptible_environment.environment.env_id

  config = {
    APTIBLE_DOCKER_IMAGE = "nginx"
  }

  service {
    container_count        = 1
    container_memory_limit = 1024
    process_type           = "cmd"
  }
}

# Can be created but only if its the only one defined
resource "aptible_endpoint" "internal_default" {
  env_id         = data.aptible_environment.environment.env_id
  resource_type  = "app"
  resource_id    = aptible_app.app.app_id
  endpoint_type  = "https"
  process_type   = "cmd"
  platform       = "alb"
  managed        = false
  internal       = true
  default_domain = true
}

# Can be created but only if its the only one defined
resource "aptible_endpoint" "external_default" {
  env_id         = data.aptible_environment.environment.env_id
  resource_type  = "app"
  resource_id    = aptible_app.app.app_id
  endpoint_type  = "https"
  process_type   = "cmd"
  platform       = "alb"
  managed        = false
  internal       = false
  default_domain = true
}

# Cannot be created
resource "aptible_endpoint" "internal_notdefault" {
  env_id         = data.aptible_environment.environment.env_id
  resource_type  = "app"
  resource_id    = aptible_app.app.app_id
  endpoint_type  = "https"
  process_type   = "cmd"
  platform       = "alb"
  managed        = false
  internal       = true
  default_domain = false
}

# Cannot be created
resource "aptible_endpoint" "external_notdefault" {
  env_id         = data.aptible_environment.environment.env_id
  resource_type  = "app"
  resource_id    = aptible_app.app.app_id
  endpoint_type  = "https"
  process_type   = "cmd"
  platform       = "alb"
  managed        = false
  internal       = false
  default_domain = false
}
Jrc356 commented 2 years ago

After #68 was closed, retried this and noticed that the issue is managed = false for each of the _notdefault endpoints. managed = false resulted in an error asking for a certificate. Closing as it is now apparent that this issue is not actually an issue with the functionality but instead the error messages. Also calls into question the docs but that can be opened as a separate issue