-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auth0_action runtime cannot be assigned "node18-actions" #1026
Comments
I closed this ticket prematurely as I had only upgrade the provider to the latest version |
Can you show your terraform code. The error suggests your passing an invalid value that doesn't match the validation
|
Yeah I see what you mean, I have just tested creating an action via the API using So I take your point on if the API supports it should the provider support it. I am not sure the answer to that as I am not sure whats the difference between |
This post from a auth0 employee suggests terraform should support it. If I get the chance tonight I will raise a PR to add it to the enumeration validation then it will be up to the maintainers to accept it or not. |
Ok no need for a PR, it seems the provider is silently changing this before invoking the API. When creating the actions resource before invoking the API it will call the https://github.com/auth0/terraform-provider-auth0/blob/main/internal/auth0/action/resource.go#L136 func createAction(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics {
api := meta.(*config.Config).GetAPI()
action := expandAction(data)
if err := api.Action.Create(ctx, action); err != nil {
return diag.FromErr(err)
} If we look in the expand function we can see that if the runtime is node18, it will switch it out to if action.GetRuntime() == "node18" {
action.Runtime = auth0.String("node18-actions")
} It also does the reverse in the flatten function when its reads data from the API and stores it in the state if action.GetRuntime() == "node18-actions" {
result = multierror.Append(result, data.Set("runtime", "node18"))
} So the provider is masking this and switching them out when calling the API or reading data back. I have tested this using your example with terraform but with the runtime as Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# auth0_action.session_timeout_override will be created
+ resource "auth0_action" "session_timeout_override" {
+ code = "exports.onExecutePostLogin = async (event, api) => {};"
+ deploy = true
+ id = (known after apply)
+ name = "Session Timeout Override"
+ runtime = "node18"
+ version_id = (known after apply)
+ supported_triggers {
+ id = "post-login"
+ version = "v3"
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
auth0_action.session_timeout_override: Creating...
auth0_action.session_timeout_override: Creation complete after 2s [id=868cd089-9b4c-425c-ae11-5c11a1df4c7c] If i then check the get an action API I can see that in the backend it is set as |
Is it possible this is unreleased provider code you're working with? My experience applying "node18" has been that it hasn't transparently changed the value to To expand on my exact situation we've been upgrading from old runtimes (node12, node16) as they're now deprecated to node18. In our pre-production environment I upgraded via the UI which caused drift as the runtime was assigned |
This change was over 1 year ago as part of a dev ex PR for runtime actions and has been in the provider since v1.0.0 |
Checklist
Description
When upgrading the runtime of actions via the Auth0 UI the runtime is set to "node18-actions". However, when attempting to set the value to this string in terraform the provider responds with the following error message:
When using the "node18" value the Auth0 UI displays the runtime as:
which is likely not ideal
Expectation
it should be possible to set the runtime value to "node18-actions"
Reproduction
Given you have a auth0_action resource
When you set the runtime attribute to "node18-actions"
Then terraform should be able to apply the change
Auth0 Terraform Provider version
1.6.1
Terraform version
1.9.6
The text was updated successfully, but these errors were encountered: