Skip to content

Commit

Permalink
DXCDT-346: Add node18 to action resource runtime options (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiught authored Jan 27, 2023
1 parent ac1ab8e commit 2cf9d46
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 44 deletions.
2 changes: 1 addition & 1 deletion docs/resources/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ resource "auth0_action" "my_action" {

- `dependencies` (Block Set) List of third party npm modules, and their versions, that this action depends on. (see [below for nested schema](#nestedblock--dependencies))
- `deploy` (Boolean) Deploying an action will create a new immutable version of the action. If the action is currently bound to a trigger, then the system will begin executing the newly deployed version of the action immediately.
- `runtime` (String) The Node runtime, e.g. `node16`. Defaults to `node12`.
- `runtime` (String) The Node runtime. Defaults to `node12`. Possible values are: `node12`, `node16` or `node18`.
- `secrets` (Block List) List of secrets that are included in an action or a version of an action. (see [below for nested schema](#nestedblock--secrets))

### Read-Only
Expand Down
4 changes: 3 additions & 1 deletion internal/provider/resource_auth0_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ func newAction() *schema.Resource {
ValidateFunc: validation.StringInSlice([]string{
"node12",
"node16",
"node18",
}, false),
Description: "The Node runtime, e.g. `node16`. Defaults to `node12`.",
Description: "The Node runtime. Defaults to `node12`. Possible values are: " +
"`node12`, `node16` or `node18`.",
},
"secrets": {
Type: schema.TypeList,
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/resource_auth0_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const testAccActionConfigUpdateAllFields = `
resource auth0_action my_action {
name = "Test Action {{.testName}}"
code = "exports.onContinuePostLogin = async (event, api) => {};"
runtime = "node16"
runtime = "node18"
deploy = true
supported_triggers {
Expand Down Expand Up @@ -118,7 +118,7 @@ func TestAccAction(t *testing.T) {
resource.TestCheckResourceAttr("auth0_action.my_action", "code", "exports.onExecutePostLogin = async (event, api) => {};"),
resource.TestCheckResourceAttr("auth0_action.my_action", "secrets.#", "0"),
resource.TestCheckResourceAttr("auth0_action.my_action", "dependencies.#", "0"),
resource.TestCheckResourceAttr("auth0_action.my_action", "runtime", "node16"),
resource.TestCheckResourceAttr("auth0_action.my_action", "runtime", "node18"),
resource.TestCheckResourceAttr("auth0_action.my_action", "deploy", "false"),
resource.TestCheckNoResourceAttr("auth0_action.my_action", "version_id"),
resource.TestCheckResourceAttr("auth0_action.my_action", "supported_triggers.#", "1"),
Expand All @@ -131,7 +131,7 @@ func TestAccAction(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_action.my_action", "name", fmt.Sprintf("Test Action %s", t.Name())),
resource.TestCheckResourceAttr("auth0_action.my_action", "code", "exports.onContinuePostLogin = async (event, api) => {};"),
resource.TestCheckResourceAttr("auth0_action.my_action", "runtime", "node16"),
resource.TestCheckResourceAttr("auth0_action.my_action", "runtime", "node18"),
resource.TestCheckResourceAttr("auth0_action.my_action", "deploy", "true"),
resource.TestCheckResourceAttrSet("auth0_action.my_action", "version_id"),
resource.TestCheckResourceAttr("auth0_action.my_action", "supported_triggers.#", "1"),
Expand All @@ -150,7 +150,7 @@ func TestAccAction(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_action.my_action", "name", fmt.Sprintf("Test Action %s", t.Name())),
resource.TestCheckResourceAttr("auth0_action.my_action", "code", "exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(event)\n};\"\n"),
resource.TestCheckResourceAttr("auth0_action.my_action", "runtime", "node16"),
resource.TestCheckResourceAttr("auth0_action.my_action", "runtime", "node18"),
resource.TestCheckResourceAttr("auth0_action.my_action", "deploy", "true"),
resource.TestCheckResourceAttrSet("auth0_action.my_action", "version_id"),
resource.TestCheckResourceAttr("auth0_action.my_action", "supported_triggers.#", "1"),
Expand All @@ -173,7 +173,7 @@ func TestAccAction(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_action.my_action", "name", fmt.Sprintf("Test Action %s", t.Name())),
resource.TestCheckResourceAttr("auth0_action.my_action", "code", "exports.onContinuePostLogin = async (event, api) => {\n\tconsole.log(event)\n};\"\n"),
resource.TestCheckResourceAttr("auth0_action.my_action", "runtime", "node16"),
resource.TestCheckResourceAttr("auth0_action.my_action", "runtime", "node18"),
resource.TestCheckResourceAttrSet("auth0_action.my_action", "version_id"),
resource.TestCheckResourceAttr("auth0_action.my_action", "supported_triggers.#", "1"),
resource.TestCheckResourceAttr("auth0_action.my_action", "supported_triggers.0.id", "post-login"),
Expand All @@ -195,7 +195,7 @@ func TestAccAction(t *testing.T) {
const testAccActionConfigCreateWithFailedBuild = `
resource auth0_action my_action {
name = "Test Action {{.testName}}"
runtime = "node16"
runtime = "node18"
deploy = true
code = <<-EOT
exports.onContinuePostLogin = async (event, api) => {
Expand Down
Loading

0 comments on commit 2cf9d46

Please sign in to comment.