Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const exampleTokenValidationRules = new cloudflare.TokenValidationRules("example_token_validation_rules", {
zoneId: "023e105f4ecef8ad9ca31a8372d0c353",
action: "log",
description: "Long description for Token Validation Rule",
enabled: true,
expression: "is_jwt_valid(\"52973293-cb04-4a97-8f55-e7d2ad1107dd\") or is_jwt_valid(\"46eab8d1-6376-45e3-968f-2c649d77d423\")",
selector: {
excludes: [{
operationIds: [
"f9c5615e-fe15-48ce-bec6-cfc1946f1bec",
"56828eae-035a-4396-ba07-51c66d680a04",
],
}],
includes: [{
host: [
"v1.example.com",
"v2.example.com",
],
}],
},
title: "Example Token Validation Rule",
});
import pulumi
import pulumi_cloudflare as cloudflare
example_token_validation_rules = cloudflare.TokenValidationRules("example_token_validation_rules",
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
action="log",
description="Long description for Token Validation Rule",
enabled=True,
expression="is_jwt_valid(\"52973293-cb04-4a97-8f55-e7d2ad1107dd\") or is_jwt_valid(\"46eab8d1-6376-45e3-968f-2c649d77d423\")",
selector={
"excludes": [{
"operation_ids": [
"f9c5615e-fe15-48ce-bec6-cfc1946f1bec",
"56828eae-035a-4396-ba07-51c66d680a04",
],
}],
"includes": [{
"host": [
"v1.example.com",
"v2.example.com",
],
}],
},
title="Example Token Validation Rule")
package main
import (
"github.com/pulumi/pulumi-cloudflare/sdk/v6/go/cloudflare"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudflare.NewTokenValidationRules(ctx, "example_token_validation_rules", &cloudflare.TokenValidationRulesArgs{
ZoneId: pulumi.String("023e105f4ecef8ad9ca31a8372d0c353"),
Action: pulumi.String("log"),
Description: pulumi.String("Long description for Token Validation Rule"),
Enabled: pulumi.Bool(true),
Expression: pulumi.String("is_jwt_valid(\"52973293-cb04-4a97-8f55-e7d2ad1107dd\") or is_jwt_valid(\"46eab8d1-6376-45e3-968f-2c649d77d423\")"),
Selector: &cloudflare.TokenValidationRulesSelectorArgs{
Excludes: cloudflare.TokenValidationRulesSelectorExcludeArray{
&cloudflare.TokenValidationRulesSelectorExcludeArgs{
OperationIds: pulumi.StringArray{
pulumi.String("f9c5615e-fe15-48ce-bec6-cfc1946f1bec"),
pulumi.String("56828eae-035a-4396-ba07-51c66d680a04"),
},
},
},
Includes: cloudflare.TokenValidationRulesSelectorIncludeArray{
&cloudflare.TokenValidationRulesSelectorIncludeArgs{
Host: []string{
"v1.example.com",
"v2.example.com",
},
},
},
},
Title: pulumi.String("Example Token Validation Rule"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
return await Deployment.RunAsync(() =>
{
var exampleTokenValidationRules = new Cloudflare.TokenValidationRules("example_token_validation_rules", new()
{
ZoneId = "023e105f4ecef8ad9ca31a8372d0c353",
Action = "log",
Description = "Long description for Token Validation Rule",
Enabled = true,
Expression = "is_jwt_valid(\"52973293-cb04-4a97-8f55-e7d2ad1107dd\") or is_jwt_valid(\"46eab8d1-6376-45e3-968f-2c649d77d423\")",
Selector = new Cloudflare.Inputs.TokenValidationRulesSelectorArgs
{
Excludes = new[]
{
new Cloudflare.Inputs.TokenValidationRulesSelectorExcludeArgs
{
OperationIds = new[]
{
"f9c5615e-fe15-48ce-bec6-cfc1946f1bec",
"56828eae-035a-4396-ba07-51c66d680a04",
},
},
},
Includes = new[]
{
new Cloudflare.Inputs.TokenValidationRulesSelectorIncludeArgs
{
Host = new[]
{
"v1.example.com",
"v2.example.com",
},
},
},
},
Title = "Example Token Validation Rule",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.TokenValidationRules;
import com.pulumi.cloudflare.TokenValidationRulesArgs;
import com.pulumi.cloudflare.inputs.TokenValidationRulesSelectorArgs;
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 exampleTokenValidationRules = new TokenValidationRules("exampleTokenValidationRules", TokenValidationRulesArgs.builder()
.zoneId("023e105f4ecef8ad9ca31a8372d0c353")
.action("log")
.description("Long description for Token Validation Rule")
.enabled(true)
.expression("is_jwt_valid(\"52973293-cb04-4a97-8f55-e7d2ad1107dd\") or is_jwt_valid(\"46eab8d1-6376-45e3-968f-2c649d77d423\")")
.selector(TokenValidationRulesSelectorArgs.builder()
.excludes(TokenValidationRulesSelectorExcludeArgs.builder()
.operationIds(
"f9c5615e-fe15-48ce-bec6-cfc1946f1bec",
"56828eae-035a-4396-ba07-51c66d680a04")
.build())
.includes(TokenValidationRulesSelectorIncludeArgs.builder()
.host(List.of(
"v1.example.com",
"v2.example.com"))
.build())
.build())
.title("Example Token Validation Rule")
.build());
}
}
resources:
exampleTokenValidationRules:
type: cloudflare:TokenValidationRules
name: example_token_validation_rules
properties:
zoneId: 023e105f4ecef8ad9ca31a8372d0c353
action: log
description: Long description for Token Validation Rule
enabled: true
expression: is_jwt_valid("52973293-cb04-4a97-8f55-e7d2ad1107dd") or is_jwt_valid("46eab8d1-6376-45e3-968f-2c649d77d423")
selector:
excludes:
- operationIds:
- f9c5615e-fe15-48ce-bec6-cfc1946f1bec
- 56828eae-035a-4396-ba07-51c66d680a04
includes:
- host:
- v1.example.com
- v2.example.com
title: Example Token Validation Rule
Create TokenValidationRules Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new TokenValidationRules(name: string, args: TokenValidationRulesArgs, opts?: CustomResourceOptions);@overload
def TokenValidationRules(resource_name: str,
args: TokenValidationRulesArgs,
opts: Optional[ResourceOptions] = None)
@overload
def TokenValidationRules(resource_name: str,
opts: Optional[ResourceOptions] = None,
action: Optional[str] = None,
description: Optional[str] = None,
enabled: Optional[bool] = None,
expression: Optional[str] = None,
selector: Optional[TokenValidationRulesSelectorArgs] = None,
title: Optional[str] = None,
zone_id: Optional[str] = None,
position: Optional[TokenValidationRulesPositionArgs] = None)func NewTokenValidationRules(ctx *Context, name string, args TokenValidationRulesArgs, opts ...ResourceOption) (*TokenValidationRules, error)public TokenValidationRules(string name, TokenValidationRulesArgs args, CustomResourceOptions? opts = null)
public TokenValidationRules(String name, TokenValidationRulesArgs args)
public TokenValidationRules(String name, TokenValidationRulesArgs args, CustomResourceOptions options)
type: cloudflare:TokenValidationRules
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 TokenValidationRulesArgs
- 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 TokenValidationRulesArgs
- 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 TokenValidationRulesArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TokenValidationRulesArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args TokenValidationRulesArgs
- 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 tokenValidationRulesResource = new Cloudflare.TokenValidationRules("tokenValidationRulesResource", new()
{
Action = "string",
Description = "string",
Enabled = false,
Expression = "string",
Selector = new Cloudflare.Inputs.TokenValidationRulesSelectorArgs
{
Excludes = new[]
{
new Cloudflare.Inputs.TokenValidationRulesSelectorExcludeArgs
{
OperationIds = new[]
{
"string",
},
},
},
Includes = new[]
{
new Cloudflare.Inputs.TokenValidationRulesSelectorIncludeArgs
{
Hosts = new[]
{
"string",
},
},
},
},
Title = "string",
ZoneId = "string",
Position = new Cloudflare.Inputs.TokenValidationRulesPositionArgs
{
After = "string",
Before = "string",
Index = 0,
},
});
example, err := cloudflare.NewTokenValidationRules(ctx, "tokenValidationRulesResource", &cloudflare.TokenValidationRulesArgs{
Action: pulumi.String("string"),
Description: pulumi.String("string"),
Enabled: pulumi.Bool(false),
Expression: pulumi.String("string"),
Selector: &cloudflare.TokenValidationRulesSelectorArgs{
Excludes: cloudflare.TokenValidationRulesSelectorExcludeArray{
&cloudflare.TokenValidationRulesSelectorExcludeArgs{
OperationIds: pulumi.StringArray{
pulumi.String("string"),
},
},
},
Includes: cloudflare.TokenValidationRulesSelectorIncludeArray{
&cloudflare.TokenValidationRulesSelectorIncludeArgs{
Hosts: pulumi.StringArray{
pulumi.String("string"),
},
},
},
},
Title: pulumi.String("string"),
ZoneId: pulumi.String("string"),
Position: &cloudflare.TokenValidationRulesPositionArgs{
After: pulumi.String("string"),
Before: pulumi.String("string"),
Index: pulumi.Int(0),
},
})
var tokenValidationRulesResource = new TokenValidationRules("tokenValidationRulesResource", TokenValidationRulesArgs.builder()
.action("string")
.description("string")
.enabled(false)
.expression("string")
.selector(TokenValidationRulesSelectorArgs.builder()
.excludes(TokenValidationRulesSelectorExcludeArgs.builder()
.operationIds("string")
.build())
.includes(TokenValidationRulesSelectorIncludeArgs.builder()
.hosts("string")
.build())
.build())
.title("string")
.zoneId("string")
.position(TokenValidationRulesPositionArgs.builder()
.after("string")
.before("string")
.index(0)
.build())
.build());
token_validation_rules_resource = cloudflare.TokenValidationRules("tokenValidationRulesResource",
action="string",
description="string",
enabled=False,
expression="string",
selector={
"excludes": [{
"operation_ids": ["string"],
}],
"includes": [{
"hosts": ["string"],
}],
},
title="string",
zone_id="string",
position={
"after": "string",
"before": "string",
"index": 0,
})
const tokenValidationRulesResource = new cloudflare.TokenValidationRules("tokenValidationRulesResource", {
action: "string",
description: "string",
enabled: false,
expression: "string",
selector: {
excludes: [{
operationIds: ["string"],
}],
includes: [{
hosts: ["string"],
}],
},
title: "string",
zoneId: "string",
position: {
after: "string",
before: "string",
index: 0,
},
});
type: cloudflare:TokenValidationRules
properties:
action: string
description: string
enabled: false
expression: string
position:
after: string
before: string
index: 0
selector:
excludes:
- operationIds:
- string
includes:
- hosts:
- string
title: string
zoneId: string
TokenValidationRules 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 TokenValidationRules resource accepts the following input properties:
- Action string
- Action to take on requests that match operations included in
selectorand failexpression. Available values: "log", "block". - Description string
- A human-readable description that gives more details than
title. - Enabled bool
- Toggle rule on or off.
- Expression string
- Rule expression. Requests that fail to match this expression will be subject to
action. - Selector
Token
Validation Rules Selector Select operations covered by this rule.
For details on selectors, see the Cloudflare Docs.
- Title string
- A human-readable name for the rule.
- Zone
Id string - Identifier.
- Position
Token
Validation Rules Position - Update rule order among zone rules.
- Action string
- Action to take on requests that match operations included in
selectorand failexpression. Available values: "log", "block". - Description string
- A human-readable description that gives more details than
title. - Enabled bool
- Toggle rule on or off.
- Expression string
- Rule expression. Requests that fail to match this expression will be subject to
action. - Selector
Token
Validation Rules Selector Args Select operations covered by this rule.
For details on selectors, see the Cloudflare Docs.
- Title string
- A human-readable name for the rule.
- Zone
Id string - Identifier.
- Position
Token
Validation Rules Position Args - Update rule order among zone rules.
- action String
- Action to take on requests that match operations included in
selectorand failexpression. Available values: "log", "block". - description String
- A human-readable description that gives more details than
title. - enabled Boolean
- Toggle rule on or off.
- expression String
- Rule expression. Requests that fail to match this expression will be subject to
action. - selector
Token
Validation Rules Selector Select operations covered by this rule.
For details on selectors, see the Cloudflare Docs.
- title String
- A human-readable name for the rule.
- zone
Id String - Identifier.
- position
Token
Validation Rules Position - Update rule order among zone rules.
- action string
- Action to take on requests that match operations included in
selectorand failexpression. Available values: "log", "block". - description string
- A human-readable description that gives more details than
title. - enabled boolean
- Toggle rule on or off.
- expression string
- Rule expression. Requests that fail to match this expression will be subject to
action. - selector
Token
Validation Rules Selector Select operations covered by this rule.
For details on selectors, see the Cloudflare Docs.
- title string
- A human-readable name for the rule.
- zone
Id string - Identifier.
- position
Token
Validation Rules Position - Update rule order among zone rules.
- action str
- Action to take on requests that match operations included in
selectorand failexpression. Available values: "log", "block". - description str
- A human-readable description that gives more details than
title. - enabled bool
- Toggle rule on or off.
- expression str
- Rule expression. Requests that fail to match this expression will be subject to
action. - selector
Token
Validation Rules Selector Args Select operations covered by this rule.
For details on selectors, see the Cloudflare Docs.
- title str
- A human-readable name for the rule.
- zone_
id str - Identifier.
- position
Token
Validation Rules Position Args - Update rule order among zone rules.
- action String
- Action to take on requests that match operations included in
selectorand failexpression. Available values: "log", "block". - description String
- A human-readable description that gives more details than
title. - enabled Boolean
- Toggle rule on or off.
- expression String
- Rule expression. Requests that fail to match this expression will be subject to
action. - selector Property Map
Select operations covered by this rule.
For details on selectors, see the Cloudflare Docs.
- title String
- A human-readable name for the rule.
- zone
Id String - Identifier.
- position Property Map
- Update rule order among zone rules.
Outputs
All input properties are implicitly available as output properties. Additionally, the TokenValidationRules resource produces the following output properties:
- Created
At string - Id string
- The provider-assigned unique ID for this managed resource.
- Last
Updated string
- Created
At string - Id string
- The provider-assigned unique ID for this managed resource.
- Last
Updated string
- created
At String - id String
- The provider-assigned unique ID for this managed resource.
- last
Updated String
- created
At string - id string
- The provider-assigned unique ID for this managed resource.
- last
Updated string
- created_
at str - id str
- The provider-assigned unique ID for this managed resource.
- last_
updated str
- created
At String - id String
- The provider-assigned unique ID for this managed resource.
- last
Updated String
Look up Existing TokenValidationRules Resource
Get an existing TokenValidationRules 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?: TokenValidationRulesState, opts?: CustomResourceOptions): TokenValidationRules@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
action: Optional[str] = None,
created_at: Optional[str] = None,
description: Optional[str] = None,
enabled: Optional[bool] = None,
expression: Optional[str] = None,
last_updated: Optional[str] = None,
position: Optional[TokenValidationRulesPositionArgs] = None,
selector: Optional[TokenValidationRulesSelectorArgs] = None,
title: Optional[str] = None,
zone_id: Optional[str] = None) -> TokenValidationRulesfunc GetTokenValidationRules(ctx *Context, name string, id IDInput, state *TokenValidationRulesState, opts ...ResourceOption) (*TokenValidationRules, error)public static TokenValidationRules Get(string name, Input<string> id, TokenValidationRulesState? state, CustomResourceOptions? opts = null)public static TokenValidationRules get(String name, Output<String> id, TokenValidationRulesState state, CustomResourceOptions options)resources: _: type: cloudflare:TokenValidationRules get: id: ${id}- 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.
- Action string
- Action to take on requests that match operations included in
selectorand failexpression. Available values: "log", "block". - Created
At string - Description string
- A human-readable description that gives more details than
title. - Enabled bool
- Toggle rule on or off.
- Expression string
- Rule expression. Requests that fail to match this expression will be subject to
action. - Last
Updated string - Position
Token
Validation Rules Position - Update rule order among zone rules.
- Selector
Token
Validation Rules Selector Select operations covered by this rule.
For details on selectors, see the Cloudflare Docs.
- Title string
- A human-readable name for the rule.
- Zone
Id string - Identifier.
- Action string
- Action to take on requests that match operations included in
selectorand failexpression. Available values: "log", "block". - Created
At string - Description string
- A human-readable description that gives more details than
title. - Enabled bool
- Toggle rule on or off.
- Expression string
- Rule expression. Requests that fail to match this expression will be subject to
action. - Last
Updated string - Position
Token
Validation Rules Position Args - Update rule order among zone rules.
- Selector
Token
Validation Rules Selector Args Select operations covered by this rule.
For details on selectors, see the Cloudflare Docs.
- Title string
- A human-readable name for the rule.
- Zone
Id string - Identifier.
- action String
- Action to take on requests that match operations included in
selectorand failexpression. Available values: "log", "block". - created
At String - description String
- A human-readable description that gives more details than
title. - enabled Boolean
- Toggle rule on or off.
- expression String
- Rule expression. Requests that fail to match this expression will be subject to
action. - last
Updated String - position
Token
Validation Rules Position - Update rule order among zone rules.
- selector
Token
Validation Rules Selector Select operations covered by this rule.
For details on selectors, see the Cloudflare Docs.
- title String
- A human-readable name for the rule.
- zone
Id String - Identifier.
- action string
- Action to take on requests that match operations included in
selectorand failexpression. Available values: "log", "block". - created
At string - description string
- A human-readable description that gives more details than
title. - enabled boolean
- Toggle rule on or off.
- expression string
- Rule expression. Requests that fail to match this expression will be subject to
action. - last
Updated string - position
Token
Validation Rules Position - Update rule order among zone rules.
- selector
Token
Validation Rules Selector Select operations covered by this rule.
For details on selectors, see the Cloudflare Docs.
- title string
- A human-readable name for the rule.
- zone
Id string - Identifier.
- action str
- Action to take on requests that match operations included in
selectorand failexpression. Available values: "log", "block". - created_
at str - description str
- A human-readable description that gives more details than
title. - enabled bool
- Toggle rule on or off.
- expression str
- Rule expression. Requests that fail to match this expression will be subject to
action. - last_
updated str - position
Token
Validation Rules Position Args - Update rule order among zone rules.
- selector
Token
Validation Rules Selector Args Select operations covered by this rule.
For details on selectors, see the Cloudflare Docs.
- title str
- A human-readable name for the rule.
- zone_
id str - Identifier.
- action String
- Action to take on requests that match operations included in
selectorand failexpression. Available values: "log", "block". - created
At String - description String
- A human-readable description that gives more details than
title. - enabled Boolean
- Toggle rule on or off.
- expression String
- Rule expression. Requests that fail to match this expression will be subject to
action. - last
Updated String - position Property Map
- Update rule order among zone rules.
- selector Property Map
Select operations covered by this rule.
For details on selectors, see the Cloudflare Docs.
- title String
- A human-readable name for the rule.
- zone
Id String - Identifier.
Supporting Types
TokenValidationRulesPosition, TokenValidationRulesPositionArgs
TokenValidationRulesSelector, TokenValidationRulesSelectorArgs
- Excludes
List<Token
Validation Rules Selector Exclude> - Ignore operations that were otherwise included by
include. - Includes
List<Token
Validation Rules Selector Include> - Select all matching operations.
- Excludes
[]Token
Validation Rules Selector Exclude - Ignore operations that were otherwise included by
include. - Includes
[]Token
Validation Rules Selector Include - Select all matching operations.
- excludes
List<Token
Validation Rules Selector Exclude> - Ignore operations that were otherwise included by
include. - includes
List<Token
Validation Rules Selector Include> - Select all matching operations.
- excludes
Token
Validation Rules Selector Exclude[] - Ignore operations that were otherwise included by
include. - includes
Token
Validation Rules Selector Include[] - Select all matching operations.
- excludes
Sequence[Token
Validation Rules Selector Exclude] - Ignore operations that were otherwise included by
include. - includes
Sequence[Token
Validation Rules Selector Include] - Select all matching operations.
- excludes List<Property Map>
- Ignore operations that were otherwise included by
include. - includes List<Property Map>
- Select all matching operations.
TokenValidationRulesSelectorExclude, TokenValidationRulesSelectorExcludeArgs
- Operation
Ids List<string> - Excluded operation IDs.
- Operation
Ids []string - Excluded operation IDs.
- operation
Ids List<String> - Excluded operation IDs.
- operation
Ids string[] - Excluded operation IDs.
- operation_
ids Sequence[str] - Excluded operation IDs.
- operation
Ids List<String> - Excluded operation IDs.
TokenValidationRulesSelectorInclude, TokenValidationRulesSelectorIncludeArgs
- Hosts List<string>
- Included hostnames.
- Hosts []string
- Included hostnames.
- hosts List<String>
- Included hostnames.
- hosts string[]
- Included hostnames.
- hosts Sequence[str]
- Included hostnames.
- hosts List<String>
- Included hostnames.
Import
$ pulumi import cloudflare:index/tokenValidationRules:TokenValidationRules example '<zone_id>/<rule_id>'
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Cloudflare pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflareTerraform Provider.
