Auth0

Pulumi Official
Package maintained by Pulumi
v2.9.0 published on Thursday, May 26, 2022 by Pulumi

Action

Actions are secure, tenant-specific, versioned functions written in Node.js that execute at certain points during the Auth0 runtime. Actions are used to customize and extend Auth0’s capabilities with custom logic.

Example Usage

using Pulumi;
using Auth0 = Pulumi.Auth0;

class MyStack : Stack
{
    public MyStack()
    {
        var myAction = new Auth0.Action("myAction", new Auth0.ActionArgs
        {
            Code = @"/**
 * Handler that will be called during the execution of a PostLogin flow.
 *
 * @param {Event} event - Details about the user and the context in which they are logging in.
 * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
 */
 exports.onExecutePostLogin = async (event, api) => {
	 console.log(event)
 };

",
            Dependencies = 
            {
                new Auth0.Inputs.ActionDependencyArgs
                {
                    Name = "lodash",
                    Version = "latest",
                },
                new Auth0.Inputs.ActionDependencyArgs
                {
                    Name = "request",
                    Version = "latest",
                },
            },
            Deploy = true,
            Runtime = "node16",
            Secrets = 
            {
                new Auth0.Inputs.ActionSecretArgs
                {
                    Name = "FOO",
                    Value = "Foo",
                },
                new Auth0.Inputs.ActionSecretArgs
                {
                    Name = "BAR",
                    Value = "Bar",
                },
            },
            SupportedTriggers = new Auth0.Inputs.ActionSupportedTriggersArgs
            {
                Id = "post-login",
                Version = "v2",
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-auth0/sdk/v2/go/auth0"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := auth0.NewAction(ctx, "myAction", &auth0.ActionArgs{
			Code: pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v", "/**\n", " * Handler that will be called during the execution of a PostLogin flow.\n", " *\n", " * @param {Event} event - Details about the user and the context in which they are logging in.\n", " * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.\n", " */\n", " exports.onExecutePostLogin = async (event, api) => {\n", "	 console.log(event)\n", " };\n", "\n")),
			Dependencies: ActionDependencyArray{
				&ActionDependencyArgs{
					Name:    pulumi.String("lodash"),
					Version: pulumi.String("latest"),
				},
				&ActionDependencyArgs{
					Name:    pulumi.String("request"),
					Version: pulumi.String("latest"),
				},
			},
			Deploy:  pulumi.Bool(true),
			Runtime: pulumi.String("node16"),
			Secrets: ActionSecretArray{
				&ActionSecretArgs{
					Name:  pulumi.String("FOO"),
					Value: pulumi.String("Foo"),
				},
				&ActionSecretArgs{
					Name:  pulumi.String("BAR"),
					Value: pulumi.String("Bar"),
				},
			},
			SupportedTriggers: &ActionSupportedTriggersArgs{
				Id:      pulumi.String("post-login"),
				Version: pulumi.String("v2"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var myAction = new Action("myAction", ActionArgs.builder()        
            .code("""
/**
 * Handler that will be called during the execution of a PostLogin flow.
 *
 * @param {Event} event - Details about the user and the context in which they are logging in.
 * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
 */
 exports.onExecutePostLogin = async (event, api) => {
	 console.log(event)
 };

            """)
            .dependencies(            
                ActionDependencyArgs.builder()
                    .name("lodash")
                    .version("latest")
                    .build(),
                ActionDependencyArgs.builder()
                    .name("request")
                    .version("latest")
                    .build())
            .deploy(true)
            .runtime("node16")
            .secrets(            
                ActionSecretArgs.builder()
                    .name("FOO")
                    .value("Foo")
                    .build(),
                ActionSecretArgs.builder()
                    .name("BAR")
                    .value("Bar")
                    .build())
            .supportedTriggers(ActionSupportedTriggersArgs.builder()
                .id("post-login")
                .version("v2")
                .build())
            .build());

    }
}
import pulumi
import pulumi_auth0 as auth0

my_action = auth0.Action("myAction",
    code="""/**
 * Handler that will be called during the execution of a PostLogin flow.
 *
 * @param {Event} event - Details about the user and the context in which they are logging in.
 * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
 */
 exports.onExecutePostLogin = async (event, api) => {
	 console.log(event)
 };

""",
    dependencies=[
        auth0.ActionDependencyArgs(
            name="lodash",
            version="latest",
        ),
        auth0.ActionDependencyArgs(
            name="request",
            version="latest",
        ),
    ],
    deploy=True,
    runtime="node16",
    secrets=[
        auth0.ActionSecretArgs(
            name="FOO",
            value="Foo",
        ),
        auth0.ActionSecretArgs(
            name="BAR",
            value="Bar",
        ),
    ],
    supported_triggers=auth0.ActionSupportedTriggersArgs(
        id="post-login",
        version="v2",
    ))
import * as pulumi from "@pulumi/pulumi";
import * as auth0 from "@pulumi/auth0";

const myAction = new auth0.Action("my_action", {
    code: `/**
 * Handler that will be called during the execution of a PostLogin flow.
 *
 * @param {Event} event - Details about the user and the context in which they are logging in.
 * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
 */
 exports.onExecutePostLogin = async (event, api) => {
	 console.log(event)
 };
`,
    dependencies: [
        {
            name: "lodash",
            version: "latest",
        },
        {
            name: "request",
            version: "latest",
        },
    ],
    deploy: true,
    runtime: "node16",
    secrets: [
        {
            name: "FOO",
            value: "Foo",
        },
        {
            name: "BAR",
            value: "Bar",
        },
    ],
    supportedTriggers: {
        id: "post-login",
        version: "v2",
    },
});
resources:
  myAction:
    type: auth0:Action
    properties:
      code: |+
        /**
         * Handler that will be called during the execution of a PostLogin flow.
         *
         * @param {Event} event - Details about the user and the context in which they are logging in.
         * @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
         */
         exports.onExecutePostLogin = async (event, api) => {
        	 console.log(event)
         };        

      dependencies:
        - name: lodash
          version: latest
        - name: request
          version: latest
      deploy: true
      runtime: node16
      secrets:
        - name: FOO
          value: Foo
        - name: BAR
          value: Bar
      supportedTriggers:
        id: post-login
        version: v2

Create a Action Resource

new Action(name: string, args: ActionArgs, opts?: CustomResourceOptions);
@overload
def Action(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           code: Optional[str] = None,
           dependencies: Optional[Sequence[ActionDependencyArgs]] = None,
           deploy: Optional[bool] = None,
           name: Optional[str] = None,
           runtime: Optional[str] = None,
           secrets: Optional[Sequence[ActionSecretArgs]] = None,
           supported_triggers: Optional[ActionSupportedTriggersArgs] = None)
@overload
def Action(resource_name: str,
           args: ActionArgs,
           opts: Optional[ResourceOptions] = None)
func NewAction(ctx *Context, name string, args ActionArgs, opts ...ResourceOption) (*Action, error)
public Action(string name, ActionArgs args, CustomResourceOptions? opts = null)
public Action(String name, ActionArgs args)
public Action(String name, ActionArgs args, CustomResourceOptions options)
type: auth0:Action
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ActionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ActionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ActionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ActionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ActionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Action Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Action resource accepts the following input properties:

Code string

The source code of the action.

SupportedTriggers ActionSupportedTriggersArgs

List of triggers that this action supports. At this time, an action can only target a single trigger at a time.

Dependencies List<ActionDependencyArgs>

List of third party npm modules, and their versions, that this action depends on.

Deploy bool

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. Default is false.

Name string

Secret name.

Runtime string

The Node runtime. For example node16, defaults to node12.

Secrets List<ActionSecretArgs>

List of secrets that are included in an action or a version of an action.

Code string

The source code of the action.

SupportedTriggers ActionSupportedTriggersArgs

List of triggers that this action supports. At this time, an action can only target a single trigger at a time.

Dependencies []ActionDependencyArgs

List of third party npm modules, and their versions, that this action depends on.

Deploy bool

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. Default is false.

Name string

Secret name.

Runtime string

The Node runtime. For example node16, defaults to node12.

Secrets []ActionSecretArgs

List of secrets that are included in an action or a version of an action.

code String

The source code of the action.

supportedTriggers ActionSupportedTriggersArgs

List of triggers that this action supports. At this time, an action can only target a single trigger at a time.

dependencies List<ActionDependencyArgs>

List of third party npm modules, and their versions, that this action depends on.

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. Default is false.

name String

Secret name.

runtime String

The Node runtime. For example node16, defaults to node12.

secrets List<ActionSecretArgs>

List of secrets that are included in an action or a version of an action.

code string

The source code of the action.

supportedTriggers ActionSupportedTriggersArgs

List of triggers that this action supports. At this time, an action can only target a single trigger at a time.

dependencies ActionDependencyArgs[]

List of third party npm modules, and their versions, that this action depends on.

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. Default is false.

name string

Secret name.

runtime string

The Node runtime. For example node16, defaults to node12.

secrets ActionSecretArgs[]

List of secrets that are included in an action or a version of an action.

code str

The source code of the action.

supported_triggers ActionSupportedTriggersArgs

List of triggers that this action supports. At this time, an action can only target a single trigger at a time.

dependencies Sequence[ActionDependencyArgs]

List of third party npm modules, and their versions, that this action depends on.

deploy bool

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. Default is false.

name str

Secret name.

runtime str

The Node runtime. For example node16, defaults to node12.

secrets Sequence[ActionSecretArgs]

List of secrets that are included in an action or a version of an action.

code String

The source code of the action.

supportedTriggers Property Map

List of triggers that this action supports. At this time, an action can only target a single trigger at a time.

dependencies List<Property Map>

List of third party npm modules, and their versions, that this action depends on.

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. Default is false.

name String

Secret name.

runtime String

The Node runtime. For example node16, defaults to node12.

secrets List<Property Map>

List of secrets that are included in an action or a version of an action.

Outputs

All input properties are implicitly available as output properties. Additionally, the Action resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

VersionId string

Version ID of the action. This value is available if deploy is set to true.

Id string

The provider-assigned unique ID for this managed resource.

VersionId string

Version ID of the action. This value is available if deploy is set to true.

id String

The provider-assigned unique ID for this managed resource.

versionId String

Version ID of the action. This value is available if deploy is set to true.

id string

The provider-assigned unique ID for this managed resource.

versionId string

Version ID of the action. This value is available if deploy is set to true.

id str

The provider-assigned unique ID for this managed resource.

version_id str

Version ID of the action. This value is available if deploy is set to true.

id String

The provider-assigned unique ID for this managed resource.

versionId String

Version ID of the action. This value is available if deploy is set to true.

Look up an Existing Action Resource

Get an existing Action resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ActionState, opts?: CustomResourceOptions): Action
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        code: Optional[str] = None,
        dependencies: Optional[Sequence[ActionDependencyArgs]] = None,
        deploy: Optional[bool] = None,
        name: Optional[str] = None,
        runtime: Optional[str] = None,
        secrets: Optional[Sequence[ActionSecretArgs]] = None,
        supported_triggers: Optional[ActionSupportedTriggersArgs] = None,
        version_id: Optional[str] = None) -> Action
func GetAction(ctx *Context, name string, id IDInput, state *ActionState, opts ...ResourceOption) (*Action, error)
public static Action Get(string name, Input<string> id, ActionState? state, CustomResourceOptions? opts = null)
public static Action get(String name, Output<String> id, ActionState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Code string

The source code of the action.

Dependencies List<ActionDependencyArgs>

List of third party npm modules, and their versions, that this action depends on.

Deploy bool

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. Default is false.

Name string

Secret name.

Runtime string

The Node runtime. For example node16, defaults to node12.

Secrets List<ActionSecretArgs>

List of secrets that are included in an action or a version of an action.

SupportedTriggers ActionSupportedTriggersArgs

List of triggers that this action supports. At this time, an action can only target a single trigger at a time.

VersionId string

Version ID of the action. This value is available if deploy is set to true.

Code string

The source code of the action.

Dependencies []ActionDependencyArgs

List of third party npm modules, and their versions, that this action depends on.

Deploy bool

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. Default is false.

Name string

Secret name.

Runtime string

The Node runtime. For example node16, defaults to node12.

Secrets []ActionSecretArgs

List of secrets that are included in an action or a version of an action.

SupportedTriggers ActionSupportedTriggersArgs

List of triggers that this action supports. At this time, an action can only target a single trigger at a time.

VersionId string

Version ID of the action. This value is available if deploy is set to true.

code String

The source code of the action.

dependencies List<ActionDependencyArgs>

List of third party npm modules, and their versions, that this action depends on.

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. Default is false.

name String

Secret name.

runtime String

The Node runtime. For example node16, defaults to node12.

secrets List<ActionSecretArgs>

List of secrets that are included in an action or a version of an action.

supportedTriggers ActionSupportedTriggersArgs

List of triggers that this action supports. At this time, an action can only target a single trigger at a time.

versionId String

Version ID of the action. This value is available if deploy is set to true.

code string

The source code of the action.

dependencies ActionDependencyArgs[]

List of third party npm modules, and their versions, that this action depends on.

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. Default is false.

name string

Secret name.

runtime string

The Node runtime. For example node16, defaults to node12.

secrets ActionSecretArgs[]

List of secrets that are included in an action or a version of an action.

supportedTriggers ActionSupportedTriggersArgs

List of triggers that this action supports. At this time, an action can only target a single trigger at a time.

versionId string

Version ID of the action. This value is available if deploy is set to true.

code str

The source code of the action.

dependencies Sequence[ActionDependencyArgs]

List of third party npm modules, and their versions, that this action depends on.

deploy bool

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. Default is false.

name str

Secret name.

runtime str

The Node runtime. For example node16, defaults to node12.

secrets Sequence[ActionSecretArgs]

List of secrets that are included in an action or a version of an action.

supported_triggers ActionSupportedTriggersArgs

List of triggers that this action supports. At this time, an action can only target a single trigger at a time.

version_id str

Version ID of the action. This value is available if deploy is set to true.

code String

The source code of the action.

dependencies List<Property Map>

List of third party npm modules, and their versions, that this action depends on.

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. Default is false.

name String

Secret name.

runtime String

The Node runtime. For example node16, defaults to node12.

secrets List<Property Map>

List of secrets that are included in an action or a version of an action.

supportedTriggers Property Map

List of triggers that this action supports. At this time, an action can only target a single trigger at a time.

versionId String

Version ID of the action. This value is available if deploy is set to true.

Supporting Types

ActionDependency

Name string

Secret name.

Version string

Trigger version.

Name string

Secret name.

Version string

Trigger version.

name String

Secret name.

version String

Trigger version.

name string

Secret name.

version string

Trigger version.

name str

Secret name.

version str

Trigger version.

name String

Secret name.

version String

Trigger version.

ActionSecret

Name string

Secret name.

Value string

Secret value.

Name string

Secret name.

Value string

Secret value.

name String

Secret name.

value String

Secret value.

name string

Secret name.

value string

Secret value.

name str

Secret name.

value str

Secret value.

name String

Secret name.

value String

Secret value.

ActionSupportedTriggers

Id string

Trigger ID.

Version string

Trigger version.

Id string

Trigger ID.

Version string

Trigger version.

id String

Trigger ID.

version String

Trigger version.

id string

Trigger ID.

version string

Trigger version.

id str

Trigger ID.

version str

Trigger version.

id String

Trigger ID.

version String

Trigger version.

Import

An action can be imported using the action’s ID, e.g.

 $ pulumi import auth0:index/action:Action my_action 12f4f21b-017a-319d-92e7-2291c1ca36c4

~> For security reasons importing secrets is not allowed. Therefore, it is advised to import the action without secrets and adding them back after the action has been imported.

Package Details

Repository
https://github.com/pulumi/pulumi-auth0
License
Apache-2.0
Notes

This Pulumi package is based on the auth0 Terraform Provider.