1. Packages
  2. Auth0
  3. API Docs
  4. TriggerAction
Auth0 v3.3.1 published on Thursday, Mar 14, 2024 by Pulumi

auth0.TriggerAction

Explore with Pulumi AI

auth0 logo
Auth0 v3.3.1 published on Thursday, Mar 14, 2024 by Pulumi

    With this resource, you can bind an action to a trigger. Once an action is created and deployed, it can be attached (i.e. bound) to a trigger so that it will be executed as part of a flow.

    Ordering of an action within a specific flow is not currently supported when using this resource; the action will get appended to the end of the flow. To precisely manage ordering, it is advised to either do so with the dashboard UI or with the auth0_trigger_bindings resource.

    !> This resource appends an action to the trigger binding. In contrast, the auth0.TriggerActions resource manages all the action bindings to a trigger. To avoid potential issues, it is recommended not to use this resource in conjunction with the auth0.TriggerAction resource when binding actions to the same trigger.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as auth0 from "@pulumi/auth0";
    
    const loginAlert = new auth0.Action("loginAlert", {
        code: `exports.onContinuePostLogin = async (event, api) => {
      console.log("foo");
    };"
    `,
        deploy: true,
        supportedTriggers: {
            id: "post-login",
            version: "v3",
        },
    });
    const postLoginAlertAction = new auth0.TriggerAction("postLoginAlertAction", {
        trigger: "post-login",
        actionId: loginAlert.id,
    });
    
    import pulumi
    import pulumi_auth0 as auth0
    
    login_alert = auth0.Action("loginAlert",
        code="""exports.onContinuePostLogin = async (event, api) => {
      console.log("foo");
    };"
    """,
        deploy=True,
        supported_triggers=auth0.ActionSupportedTriggersArgs(
            id="post-login",
            version="v3",
        ))
    post_login_alert_action = auth0.TriggerAction("postLoginAlertAction",
        trigger="post-login",
        action_id=login_alert.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-auth0/sdk/v3/go/auth0"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		loginAlert, err := auth0.NewAction(ctx, "loginAlert", &auth0.ActionArgs{
    			Code:   pulumi.String("exports.onContinuePostLogin = async (event, api) => {\n  console.log(\"foo\");\n};\"\n"),
    			Deploy: pulumi.Bool(true),
    			SupportedTriggers: &auth0.ActionSupportedTriggersArgs{
    				Id:      pulumi.String("post-login"),
    				Version: pulumi.String("v3"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = auth0.NewTriggerAction(ctx, "postLoginAlertAction", &auth0.TriggerActionArgs{
    			Trigger:  pulumi.String("post-login"),
    			ActionId: loginAlert.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Auth0 = Pulumi.Auth0;
    
    return await Deployment.RunAsync(() => 
    {
        var loginAlert = new Auth0.Action("loginAlert", new()
        {
            Code = @"exports.onContinuePostLogin = async (event, api) => {
      console.log(""foo"");
    };""
    ",
            Deploy = true,
            SupportedTriggers = new Auth0.Inputs.ActionSupportedTriggersArgs
            {
                Id = "post-login",
                Version = "v3",
            },
        });
    
        var postLoginAlertAction = new Auth0.TriggerAction("postLoginAlertAction", new()
        {
            Trigger = "post-login",
            ActionId = loginAlert.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.auth0.Action;
    import com.pulumi.auth0.ActionArgs;
    import com.pulumi.auth0.inputs.ActionSupportedTriggersArgs;
    import com.pulumi.auth0.TriggerAction;
    import com.pulumi.auth0.TriggerActionArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var loginAlert = new Action("loginAlert", ActionArgs.builder()        
                .code("""
    exports.onContinuePostLogin = async (event, api) => {
      console.log("foo");
    };"
                """)
                .deploy(true)
                .supportedTriggers(ActionSupportedTriggersArgs.builder()
                    .id("post-login")
                    .version("v3")
                    .build())
                .build());
    
            var postLoginAlertAction = new TriggerAction("postLoginAlertAction", TriggerActionArgs.builder()        
                .trigger("post-login")
                .actionId(loginAlert.id())
                .build());
    
        }
    }
    
    resources:
      loginAlert:
        type: auth0:Action
        properties:
          code: |
            exports.onContinuePostLogin = async (event, api) => {
              console.log("foo");
            };"        
          deploy: true
          supportedTriggers:
            id: post-login
            version: v3
      postLoginAlertAction:
        type: auth0:TriggerAction
        properties:
          trigger: post-login
          actionId: ${loginAlert.id}
    

    Create TriggerAction Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new TriggerAction(name: string, args: TriggerActionArgs, opts?: CustomResourceOptions);
    @overload
    def TriggerAction(resource_name: str,
                      args: TriggerActionArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def TriggerAction(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      action_id: Optional[str] = None,
                      trigger: Optional[str] = None,
                      display_name: Optional[str] = None)
    func NewTriggerAction(ctx *Context, name string, args TriggerActionArgs, opts ...ResourceOption) (*TriggerAction, error)
    public TriggerAction(string name, TriggerActionArgs args, CustomResourceOptions? opts = null)
    public TriggerAction(String name, TriggerActionArgs args)
    public TriggerAction(String name, TriggerActionArgs args, CustomResourceOptions options)
    
    type: auth0:TriggerAction
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args TriggerActionArgs
    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 TriggerActionArgs
    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 TriggerActionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TriggerActionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TriggerActionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var triggerActionResource = new Auth0.TriggerAction("triggerActionResource", new()
    {
        ActionId = "string",
        Trigger = "string",
        DisplayName = "string",
    });
    
    example, err := auth0.NewTriggerAction(ctx, "triggerActionResource", &auth0.TriggerActionArgs{
    	ActionId:    pulumi.String("string"),
    	Trigger:     pulumi.String("string"),
    	DisplayName: pulumi.String("string"),
    })
    
    var triggerActionResource = new TriggerAction("triggerActionResource", TriggerActionArgs.builder()        
        .actionId("string")
        .trigger("string")
        .displayName("string")
        .build());
    
    trigger_action_resource = auth0.TriggerAction("triggerActionResource",
        action_id="string",
        trigger="string",
        display_name="string")
    
    const triggerActionResource = new auth0.TriggerAction("triggerActionResource", {
        actionId: "string",
        trigger: "string",
        displayName: "string",
    });
    
    type: auth0:TriggerAction
    properties:
        actionId: string
        displayName: string
        trigger: string
    

    TriggerAction 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 TriggerAction resource accepts the following input properties:

    ActionId string
    The ID of the action to bind to the trigger.
    Trigger string
    The ID of the trigger to bind with. Available options: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge, iga-approval, iga-certification, iga-fulfillment-assignment, iga-fulfillment-execution.
    DisplayName string
    The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger. Defaults to action name when not provided.
    ActionId string
    The ID of the action to bind to the trigger.
    Trigger string
    The ID of the trigger to bind with. Available options: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge, iga-approval, iga-certification, iga-fulfillment-assignment, iga-fulfillment-execution.
    DisplayName string
    The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger. Defaults to action name when not provided.
    actionId String
    The ID of the action to bind to the trigger.
    trigger String
    The ID of the trigger to bind with. Available options: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge, iga-approval, iga-certification, iga-fulfillment-assignment, iga-fulfillment-execution.
    displayName String
    The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger. Defaults to action name when not provided.
    actionId string
    The ID of the action to bind to the trigger.
    trigger string
    The ID of the trigger to bind with. Available options: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge, iga-approval, iga-certification, iga-fulfillment-assignment, iga-fulfillment-execution.
    displayName string
    The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger. Defaults to action name when not provided.
    action_id str
    The ID of the action to bind to the trigger.
    trigger str
    The ID of the trigger to bind with. Available options: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge, iga-approval, iga-certification, iga-fulfillment-assignment, iga-fulfillment-execution.
    display_name str
    The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger. Defaults to action name when not provided.
    actionId String
    The ID of the action to bind to the trigger.
    trigger String
    The ID of the trigger to bind with. Available options: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge, iga-approval, iga-certification, iga-fulfillment-assignment, iga-fulfillment-execution.
    displayName String
    The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger. Defaults to action name when not provided.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing TriggerAction Resource

    Get an existing TriggerAction 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?: TriggerActionState, opts?: CustomResourceOptions): TriggerAction
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            action_id: Optional[str] = None,
            display_name: Optional[str] = None,
            trigger: Optional[str] = None) -> TriggerAction
    func GetTriggerAction(ctx *Context, name string, id IDInput, state *TriggerActionState, opts ...ResourceOption) (*TriggerAction, error)
    public static TriggerAction Get(string name, Input<string> id, TriggerActionState? state, CustomResourceOptions? opts = null)
    public static TriggerAction get(String name, Output<String> id, TriggerActionState 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:
    ActionId string
    The ID of the action to bind to the trigger.
    DisplayName string
    The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger. Defaults to action name when not provided.
    Trigger string
    The ID of the trigger to bind with. Available options: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge, iga-approval, iga-certification, iga-fulfillment-assignment, iga-fulfillment-execution.
    ActionId string
    The ID of the action to bind to the trigger.
    DisplayName string
    The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger. Defaults to action name when not provided.
    Trigger string
    The ID of the trigger to bind with. Available options: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge, iga-approval, iga-certification, iga-fulfillment-assignment, iga-fulfillment-execution.
    actionId String
    The ID of the action to bind to the trigger.
    displayName String
    The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger. Defaults to action name when not provided.
    trigger String
    The ID of the trigger to bind with. Available options: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge, iga-approval, iga-certification, iga-fulfillment-assignment, iga-fulfillment-execution.
    actionId string
    The ID of the action to bind to the trigger.
    displayName string
    The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger. Defaults to action name when not provided.
    trigger string
    The ID of the trigger to bind with. Available options: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge, iga-approval, iga-certification, iga-fulfillment-assignment, iga-fulfillment-execution.
    action_id str
    The ID of the action to bind to the trigger.
    display_name str
    The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger. Defaults to action name when not provided.
    trigger str
    The ID of the trigger to bind with. Available options: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge, iga-approval, iga-certification, iga-fulfillment-assignment, iga-fulfillment-execution.
    actionId String
    The ID of the action to bind to the trigger.
    displayName String
    The name for this action within the trigger. This can be useful for distinguishing between multiple instances of the same action bound to a trigger. Defaults to action name when not provided.
    trigger String
    The ID of the trigger to bind with. Available options: post-login, credentials-exchange, pre-user-registration, post-user-registration, post-change-password, send-phone-message, password-reset-post-challenge, iga-approval, iga-certification, iga-fulfillment-assignment, iga-fulfillment-execution.

    Import

    This resource can be imported by specifying the

    trigger and action ID separated by “::” (note the double colon)

    ::

    Example:

    $ pulumi import auth0:index/triggerAction:TriggerAction post_login_action "post-login::28b5c8fa-d371-5734-acf6-d0cf80ead918"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Auth0 pulumi/pulumi-auth0
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the auth0 Terraform Provider.
    auth0 logo
    Auth0 v3.3.1 published on Thursday, Mar 14, 2024 by Pulumi