You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After many years of using ngrok and creating ad-hoc configs via web UI I've recently decided it's about time to move all of that into Terraform code. In order to put it all together I started with ngrok_reserved_domain resource.
Unfortunately the migration process revealed quite a few hiccups, therefore I decided to sum it all up in a ticket (please let me know if there's a better way to report such issues). Long story short - it does work, although developer experience wasn't particularly great and there was more rough edges than anticipated.
It's going to be quite lengthy (sorry in advance!).
Issues
1. Required vs optional arguments
Documentation says that all the arguments are optional. That simply doesn't make any sense since user has to provide either a string (so it becomes a subdomain of <user-provided-string>.ngrok.app) or an FQDN.
resource"ngrok_reserved_domain""this" {
}
Luckily the API returns ERR_NGROK_422 with "The reserved domain name update failed because no values were provided. Specify at least one value." message in case of above.
Suggested actions:
Documentation update (I guess it may require provider codebase changes as well)
Input validation - if user didn't provide required arguments it doesn't make sense to even initiate HTTP communication with the API
2. domain vs name dilemma
According to the docs either name or domain can be specified. Here's what it says at the time of writing:
domain - (String) hostname of the reserved domain
name - (String) the domain name to reserve. It may be a full domain name like app.example.com. If the name does not contain a '.' it will reserve that subdomain on ngrok.io.
I find above extremely confusing. Let's say I'd like to use dev.example.com as my ngrok domain. Which of the following should I use?
resource"ngrok_reserved_domain""foo" {
name="dev.example.com"
}
# OR...resource"ngrok_reserved_domain""bar" {
domain="dev.example.com"
}
# OR... perhaps both arguments should be provided?
What's interesting is that according to API reference/reserved_domains endpoint does not support name parameter at all, but... ReservedDomainCreate struct (which becomes POST /reserved_domains payload) does include it.
ERR_NGROK_449 response with "You may only specify one of 'name' or 'domain'." message
Expected state/things to consider:
It should be a no brainer which argument to use in order to register a custom domain - at the time of writing both name = "foo.example.com" and domain = "foo.example.com" result in the exact same state. To avoid unnecessary confusion ngrok_reserved_domain should expose only one argument that controls this aspect (probably name as it supports both scenarios - FQDN + <placeholder>.ngrok.(app|dev|pro|pizza|<etc>))
API reference should list all the params supported by POST /reserved_domain endpoint
Resource docs do not mention how to deal with <foo>.ngrok.(dev|pro|pizza|io) and <bar>.ngrok-free.(app|dev) cases
Yet another doc glitch - by default ngrok.app gets used, not ngrok.io (I'm on the OG Pro plan, free account may behave differently)
Aside from above I stumbled upon a few other minor issues while experimenting with ngrok_reserved_domain resource:
2a. certificate_management_status discrepancies in HTTP response (click to expand)
2a certificate_management_status discrepancies in HTTP response
That's probably irrelevant and depends on some async background process, but it caught my attention anyway. Response body of successful POST /reserved_domains request sometimes includes "certificate_management_status": null element.
I thought that perhaps ERR_NGROK_448 wasn't listed for some reason and visited https://ngrok.com/docs/errors/err_ngrok_448/. Here's how it looks for me (some .js and .css requests end with 404):
Apologies for the slow response, I just wanted to let you know that we really appreciate the detailed writeup and thoughts here, thank you!
No promise on timelines or anything, but these all seem like things to fix, and we'll comment back here when we get em sorted.
Just wanted to make sure you got some sort of response since we really do appreciate the report!
Overview
After many years of using ngrok and creating ad-hoc configs via web UI I've recently decided it's about time to move all of that into Terraform code. In order to put it all together I started with
ngrok_reserved_domain
resource.Unfortunately the migration process revealed quite a few hiccups, therefore I decided to sum it all up in a ticket (please let me know if there's a better way to report such issues). Long story short - it does work, although developer experience wasn't particularly great and there was more rough edges than anticipated.
For reference:
It's going to be quite lengthy (sorry in advance!).
Issues
1. Required vs optional arguments
Documentation says that all the arguments are optional. That simply doesn't make any sense since user has to provide either a string (so it becomes a subdomain of
<user-provided-string>.ngrok.app
) or an FQDN.Luckily the API returns ERR_NGROK_422 with "The reserved domain name update failed because no values were provided. Specify at least one value." message in case of above.
Suggested actions:
2.
domain
vsname
dilemmaAccording to the docs either
name
ordomain
can be specified. Here's what it says at the time of writing:domain
- (String) hostname of the reserved domainname
- (String) the domain name to reserve. It may be a full domain name like app.example.com. If the name does not contain a '.' it will reserve that subdomain on ngrok.io.I find above extremely confusing. Let's say I'd like to use
dev.example.com
as my ngrok domain. Which of the following should I use?What's interesting is that according to API reference
/reserved_domains
endpoint does not supportname
parameter at all, but... ReservedDomainCreate struct (which becomesPOST /reserved_domains
payload) does include it.Let's break it down how it behaves in real life.
name = "01b747d1"
01b747d1.ngrok.app
created successfully; mind the name string must be uniquename = "a2158993.ngrok.pro"
<whatever>.ngrok.app
name = "0f31e481.example.com"
domain = "45c97ae6"
ERR_NGROK_448
domain = "334b8d11.example.com"
name = "foo" + domain = "bar.example.com"
ERR_NGROK_449
response with "You may only specify one of 'name' or 'domain'." messageExpected state/things to consider:
name = "foo.example.com"
anddomain = "foo.example.com"
result in the exact same state. To avoid unnecessary confusionngrok_reserved_domain
should expose only one argument that controls this aspect (probablyname
as it supports both scenarios - FQDN +<placeholder>.ngrok.(app|dev|pro|pizza|<etc>)
)POST /reserved_domain
endpoint<foo>.ngrok.(dev|pro|pizza|io)
and<bar>.ngrok-free.(app|dev)
casesngrok.app
gets used, notngrok.io
(I'm on the OG Pro plan, free account may behave differently)Aside from above I stumbled upon a few other minor issues while experimenting with
ngrok_reserved_domain
resource:2a. certificate_management_status discrepancies in HTTP response (click to expand)
2a
certificate_management_status
discrepancies in HTTP responseThat's probably irrelevant and depends on some async background process, but it caught my attention anyway. Response body of successful
POST /reserved_domains
request sometimes includes"certificate_management_status": null
element.vs
2b. Undocumented ERR_NGROK_448 and ERR_NGROK_449 codes (click to expand)
2b. Undocumented
ERR_NGROK_448
andERR_NGROK_449
codesNeither
ERR_NGROK_448
norERR_NGROK_449
is documented here.2c. Broken 404s for https://ngrok.com/docs/* URLs (click to expand)
2c. Broken 404s for https://ngrok.com/docs/* URLs
I thought that perhaps
ERR_NGROK_448
wasn't listed for some reason and visited https://ngrok.com/docs/errors/err_ngrok_448/. Here's how it looks for me (some.js
and.css
requests end with 404):The problem affects any
https://ngrok.com/docs/*
URL that does not exist, i.e. https://ngrok.com/docs/foo or https://ngrok.com/docs/bar3.
certificate_management_policy
defaultsThere's a glitch in the docs - it says that the
certificate_management_policy
block supports the following values:The thing is all my attempts (without explicitly defined
certificate_management_policy
block) ended with the following response body:Could it be that
rsa
is no longer the default?The text was updated successfully, but these errors were encountered: