1. Packages
  2. Auth0 Provider
  3. API Docs
  4. RuleConfig
Auth0 v3.17.0 published on Wednesday, Apr 9, 2025 by Pulumi

auth0.RuleConfig

Explore with Pulumi AI

With Auth0, you can create custom Javascript snippets that run in a secure, isolated sandbox as part of your authentication pipeline, which are otherwise known as rules. This resource allows you to create and manage variables that are available to all rules via Auth0’s global configuration object. Used in conjunction with configured rules.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as auth0 from "@pulumi/auth0";

const myRule = new auth0.Rule("my_rule", {
    name: "empty-rule",
    script: `    function (user, context, callback) {
      callback(null, user, context);
    }
`,
    enabled: true,
});
const myRuleConfig = new auth0.RuleConfig("my_rule_config", {
    key: "foo",
    value: "bar",
});
Copy
import pulumi
import pulumi_auth0 as auth0

my_rule = auth0.Rule("my_rule",
    name="empty-rule",
    script="""    function (user, context, callback) {
      callback(null, user, context);
    }
""",
    enabled=True)
my_rule_config = auth0.RuleConfig("my_rule_config",
    key="foo",
    value="bar")
Copy
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 {
		_, err := auth0.NewRule(ctx, "my_rule", &auth0.RuleArgs{
			Name:    pulumi.String("empty-rule"),
			Script:  pulumi.String("    function (user, context, callback) {\n      callback(null, user, context);\n    }\n"),
			Enabled: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = auth0.NewRuleConfig(ctx, "my_rule_config", &auth0.RuleConfigArgs{
			Key:   pulumi.String("foo"),
			Value: pulumi.String("bar"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Auth0 = Pulumi.Auth0;

return await Deployment.RunAsync(() => 
{
    var myRule = new Auth0.Rule("my_rule", new()
    {
        Name = "empty-rule",
        Script = @"    function (user, context, callback) {
      callback(null, user, context);
    }
",
        Enabled = true,
    });

    var myRuleConfig = new Auth0.RuleConfig("my_rule_config", new()
    {
        Key = "foo",
        Value = "bar",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.auth0.Rule;
import com.pulumi.auth0.RuleArgs;
import com.pulumi.auth0.RuleConfig;
import com.pulumi.auth0.RuleConfigArgs;
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 myRule = new Rule("myRule", RuleArgs.builder()
            .name("empty-rule")
            .script("""
    function (user, context, callback) {
      callback(null, user, context);
    }
            """)
            .enabled(true)
            .build());

        var myRuleConfig = new RuleConfig("myRuleConfig", RuleConfigArgs.builder()
            .key("foo")
            .value("bar")
            .build());

    }
}
Copy
resources:
  myRule:
    type: auth0:Rule
    name: my_rule
    properties:
      name: empty-rule
      script: |2
            function (user, context, callback) {
              callback(null, user, context);
            }
      enabled: true
  myRuleConfig:
    type: auth0:RuleConfig
    name: my_rule_config
    properties:
      key: foo
      value: bar
Copy

Create RuleConfig Resource

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

Constructor syntax

new RuleConfig(name: string, args: RuleConfigArgs, opts?: CustomResourceOptions);
@overload
def RuleConfig(resource_name: str,
               args: RuleConfigArgs,
               opts: Optional[ResourceOptions] = None)

@overload
def RuleConfig(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               key: Optional[str] = None,
               value: Optional[str] = None)
func NewRuleConfig(ctx *Context, name string, args RuleConfigArgs, opts ...ResourceOption) (*RuleConfig, error)
public RuleConfig(string name, RuleConfigArgs args, CustomResourceOptions? opts = null)
public RuleConfig(String name, RuleConfigArgs args)
public RuleConfig(String name, RuleConfigArgs args, CustomResourceOptions options)
type: auth0:RuleConfig
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

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

Constructor example

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

var ruleConfigResource = new Auth0.RuleConfig("ruleConfigResource", new()
{
    Key = "string",
    Value = "string",
});
Copy
example, err := auth0.NewRuleConfig(ctx, "ruleConfigResource", &auth0.RuleConfigArgs{
	Key:   pulumi.String("string"),
	Value: pulumi.String("string"),
})
Copy
var ruleConfigResource = new RuleConfig("ruleConfigResource", RuleConfigArgs.builder()
    .key("string")
    .value("string")
    .build());
Copy
rule_config_resource = auth0.RuleConfig("ruleConfigResource",
    key="string",
    value="string")
Copy
const ruleConfigResource = new auth0.RuleConfig("ruleConfigResource", {
    key: "string",
    value: "string",
});
Copy
type: auth0:RuleConfig
properties:
    key: string
    value: string
Copy

RuleConfig Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The RuleConfig resource accepts the following input properties:

Key
This property is required.
Changes to this property will trigger replacement.
string
Key for a rules configuration variable.
Value This property is required. string
Value for a rules configuration variable.
Key
This property is required.
Changes to this property will trigger replacement.
string
Key for a rules configuration variable.
Value This property is required. string
Value for a rules configuration variable.
key
This property is required.
Changes to this property will trigger replacement.
String
Key for a rules configuration variable.
value This property is required. String
Value for a rules configuration variable.
key
This property is required.
Changes to this property will trigger replacement.
string
Key for a rules configuration variable.
value This property is required. string
Value for a rules configuration variable.
key
This property is required.
Changes to this property will trigger replacement.
str
Key for a rules configuration variable.
value This property is required. str
Value for a rules configuration variable.
key
This property is required.
Changes to this property will trigger replacement.
String
Key for a rules configuration variable.
value This property is required. String
Value for a rules configuration variable.

Outputs

All input properties are implicitly available as output properties. Additionally, the RuleConfig 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 RuleConfig Resource

Get an existing RuleConfig 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?: RuleConfigState, opts?: CustomResourceOptions): RuleConfig
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        key: Optional[str] = None,
        value: Optional[str] = None) -> RuleConfig
func GetRuleConfig(ctx *Context, name string, id IDInput, state *RuleConfigState, opts ...ResourceOption) (*RuleConfig, error)
public static RuleConfig Get(string name, Input<string> id, RuleConfigState? state, CustomResourceOptions? opts = null)
public static RuleConfig get(String name, Output<String> id, RuleConfigState state, CustomResourceOptions options)
resources:  _:    type: auth0:RuleConfig    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Key Changes to this property will trigger replacement. string
Key for a rules configuration variable.
Value string
Value for a rules configuration variable.
Key Changes to this property will trigger replacement. string
Key for a rules configuration variable.
Value string
Value for a rules configuration variable.
key Changes to this property will trigger replacement. String
Key for a rules configuration variable.
value String
Value for a rules configuration variable.
key Changes to this property will trigger replacement. string
Key for a rules configuration variable.
value string
Value for a rules configuration variable.
key Changes to this property will trigger replacement. str
Key for a rules configuration variable.
value str
Value for a rules configuration variable.
key Changes to this property will trigger replacement. String
Key for a rules configuration variable.
value String
Value for a rules configuration variable.

Import

Existing rule configs can be imported using their key name.

Example:

$ pulumi import auth0:index/ruleConfig:RuleConfig my_rule_config "foo"
Copy

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.