Terraform-provider-cloudflare: Unknown field origin_port when creating spectrum application

Created on 6 Nov 2020  路  8Comments  路  Source: cloudflare/terraform-provider-cloudflare

While creating a Spectrum application via terraform, the following error was returned:

Error: error creating spectrum application for zone: error from makeRequest: HTTP status 400: content "{\n  \"result\": null,\n  \"success\": false,\n  \"errors\": [\n    {\n      \"code\": 10012,\n      \"message\": \"json: unknown field \\\"origin_port\\\"\"\n    }\n  ],\n  \"messages\": []\n}\n"

Terraform version

v0.13.4

Provider version

v2.13.2

Affected resource(s)

  • cloudflare_spectrum_application

Terraform configuration files

resource "cloudflare_spectrum_application" "foo" {
  zone_id      = cloudflare_zone.myzone.id
  protocol     = "tcp/22"
  origin_port = 22
  traffic_type = "direct"

  dns {
    type = "CNAME"
    name = "subdomain.mydomain.com"
  }

  origin_dns {
    name = my.origin.domain.com
  }
}

Debug output

gist

Panic output

Expected behavior

A spectrum app would have been created

Actual behavior

API returns a 400 following the POST request

Steps to reproduce

  1. Create resource and provider
  2. terraform plan -out tfplan
  3. terraform apply tfplan

Important factoids

  • This might be an API issue

References

Community note

  • Please vote on this issue by adding a 馃憤 reaction
    to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull
    request, please leave a comment
kinbug workflopending-upstream-library triagaccepted

All 8 comments

Are you able to please post the full TF_LOG output with your sensitive details redacted?

@jacobbednarz gist updated and scrubbed

It looks like the underlying API has changed and the origin values are in their own block instead of individually - docs. This will need to be addressed in cloudflare/cloudflare-go before we can address it here.

Have raised cloudflare/cloudflare-go#555 to track this upstream.

Having another look at this, it seems like the schema already supports this but we need it configured differently. Can you try:

resource "cloudflare_spectrum_application" "foo" {
  zone_id      = cloudflare_zone.myzone.id
  protocol     = "tcp/22"
  traffic_type = "direct"

  dns {
    type = "CNAME"
    name = "subdomain.mydomain.com"
  }

  origin_direct = [
    "tcp://my.origin.domain.com:22"
  ]
}

Same error, different attribute.

Error: error creating spectrum application for zone: error from makeRequest: HTTP status 400: content "{\n  \"result\": null,\n  \"success\": false,\n  \"errors\": [\n    {\n      \"code\": 10012,\n      \"message\": \"json: unknown field \\\"ip_firewall\\\"\"\n    }\n  ],\n  \"messages\": []\n}\n"

  on spectrum.tf line 1, in resource "cloudflare_spectrum_application" "foo":
   1: resource "cloudflare_spectrum_application" "foo" {

Have you tried configuring it via the dashboard and inspecting the payload as to what to use here? It feels like there is a mix up with attribute combinations to get your desired outcome.

Closing due to inactivity. Please let me know if this is still an issue and we can continue the discussion.

Was this page helpful?
0 / 5 - 0 ratings