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"
v0.13.4
v2.13.2
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
}
}
A spectrum app would have been created
API returns a 400 following the POST request
terraform plan -out tfplanterraform apply tfplanAre 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.