spotinst / terraform-provider-spotinst

Terraform Spotinst provider.
https://registry.terraform.io/providers/spotinst/spotinst/latest/docs
Mozilla Public License 2.0
63 stars 56 forks source link

multai_listener HTTPS creation failed #47

Closed J00MZ closed 5 years ago

J00MZ commented 5 years ago

Trying to create Multai HTTPS listener as follows:

resource "spotinst_multai_listener" "ext_https_listener" {
  balancer_id = "${spotinst_multai_balancer.external_app_mlb.id}"
  protocol    = "https"
  port        = 443
}

Get error:

Error: Error applying plan:

1 error(s) occurred:
* module.ext_mlb.spotinst_multai_listener.ext_https_listener: 1 error(s) occurred:
* spotinst_multai_listener.ext_https_listener: [ERROR] failed to create listener: POST https://api.spotinst.io/loadBalancer/listener?accountId=act-6b7ccf67: 500 (request: "36a1606b-fe73-41ba-928b-91811a30c0a1") GENERAL_ERROR: Please contact your account manager.

I've got a hunch this is since there is no certificate specified.
However in multai_listener documentation cannot see option for attaching certificate.

Can you add/fix ?

Terraform Version

Terraform v0.11.13

Affected Resource(s)

Expected Behavior

Created resource spotinst_multai_listener

Actual Behavior

spotinst_multai_listener not created

Steps to Reproduce

J00MZ commented 5 years ago

After adding below block to the spotinst_multai_listener listener creation does not fail.

  tls_config = {
    certificate_ids             = ["my-cert-name"]
    min_version                 = "TLS10"
    max_version                 = "TLS12"
    cipher_suites               = [""]
    prefer_server_cipher_suites = true
    session_tickets_disabled    = false
  }

However most of this block does not appear in documentation.

Also, where can I get the certificate_id?
I just inserted a string "name" of an existing cert but did not register.

alexindeed commented 5 years ago

@J00MZ sorry about the missing docs, I'll get them added to next week's release. As for the certs, you'll need to enter the certificate id, which is in the format ce-xxxx. Here's one way to get a list of the certificates for your account:

curl -X GET \
  'https://api.spotinst.io/loadBalancer/certificate?accountId=<ACCOUNT>' \
  -H 'Authorization: Bearer <TOKEN>'

which gives the response:

{
  "id" : "ce-123456789",
  "keyPemBlock" : "..."
  "updatedAt" : "2017-07-12T15:32:31.000Z",
  "certificatePemBlock" : "..."
  "createdAt" : "2017-07-12T15:32:31.000Z",
  "name" : "my_cert",
  "tags" : []
}
alexindeed commented 5 years ago

@J00MZ this has been update with release v1.11.0, officially available from Hashicorp