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
Data source auth0_resource_server returns a map of 'null' values when the requested resource server does not exist. I would prefer an error be raised, so that we'll know immediately that invalid input was given.
Here is the current state.
data "auth0_resource_server" "default" {
resource_server_id = "abcdefghkijklmnopqrstuvwxyz0123456789"
}
output "default_auth0_resource_server" {
value = data.auth0_resource_server.default
}
The resource_server_id shown above doesn't exist, but the data provider returns the following rather then an error. The same happens with the identifier input variable.
data "auth0_resource_server" "default" {
identifier = data.auth0_tenant.main.management_api_identifier
lifecycle {
# This `postcondition` is necessary because the auth0 provider returns null, rather then an error, when
# looking up resource servers which do not exist.
postcondition {
condition = self.identifier != null
error_message = "Could not find default Resource Server for tenant ${data.auth0_tenant.main.domain}"
}
}
}
data "auth0_tenant" "main" {}
@jeffreymlewis Thanks for providing this feedback, your suggestion is certainly reasonable. And in fact it is an opportunity to review all of our data sources to ensure that they handle 404s appropriately.
We've earmarked this as a must-have for our upcoming major release. This work has been completed in #698 but not available until that release goes out; will keep this ticket open in the meantime.
Checklist
Describe the problem you'd like to have solved
Data source
auth0_resource_server
returns a map of 'null' values when the requested resource server does not exist. I would prefer an error be raised, so that we'll know immediately that invalid input was given.Here is the current state.
The
resource_server_id
shown above doesn't exist, but the data provider returns the following rather then an error. The same happens with theidentifier
input variable.Describe the ideal solution
I would prefer data source
auth0_resource_server
return an error, rather then a map of 'null' values, in the case of invalid input.Alternatives and current workarounds
It should be possible (not tested) to check
.id
using a custom precondition, ternary operator, or the terraform try function. May not be possible in all cases.Ex.
Additional context
No response
The text was updated successfully, but these errors were encountered: