WorkerRoute
Provides a Cloudflare worker route resource. A route will also require a cloudflare..WorkerScript. NOTE: This resource uses the Cloudflare account APIs. This requires setting the CLOUDFLARE_ACCOUNT_ID environment variable or account_id provider argument.
Example Usage
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
class MyStack : Stack
{
public MyStack()
{
var myScript = new Cloudflare.WorkerScript("myScript", new Cloudflare.WorkerScriptArgs
{
});
// see "cloudflare..WorkerScript" documentation ...
// Runs the specified worker script for all URLs that match `example.com/*`
var myRoute = new Cloudflare.WorkerRoute("myRoute", new Cloudflare.WorkerRouteArgs
{
ZoneId = "d41d8cd98f00b204e9800998ecf8427e",
Pattern = "example.com/*",
ScriptName = myScript.Name,
});
}
}
Coming soon!
import pulumi
import pulumi_cloudflare as cloudflare
my_script = cloudflare.WorkerScript("myScript")
# see "cloudflare..WorkerScript" documentation ...
# Runs the specified worker script for all URLs that match `example.com/*`
my_route = cloudflare.WorkerRoute("myRoute",
zone_id="d41d8cd98f00b204e9800998ecf8427e",
pattern="example.com/*",
script_name=my_script.name)import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const myScript = new cloudflare.WorkerScript("myScript", {});
// see "cloudflare..WorkerScript" documentation ...
// Runs the specified worker script for all URLs that match `example.com/*`
const myRoute = new cloudflare.WorkerRoute("myRoute", {
zoneId: "d41d8cd98f00b204e9800998ecf8427e",
pattern: "example.com/*",
scriptName: myScript.name,
});Create a WorkerRoute Resource
new WorkerRoute(name: string, args: WorkerRouteArgs, opts?: CustomResourceOptions);def WorkerRoute(resource_name, opts=None, pattern=None, script_name=None, zone_id=None, __props__=None);func NewWorkerRoute(ctx *Context, name string, args WorkerRouteArgs, opts ...ResourceOption) (*WorkerRoute, error)public WorkerRoute(string name, WorkerRouteArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args WorkerRouteArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args WorkerRouteArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args WorkerRouteArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
WorkerRoute Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The WorkerRoute resource accepts the following input properties:
- Pattern string
The route pattern
- Zone
Id string The zone ID to add the route to.
- Script
Name string Which worker script to run for requests that match the route pattern. If
script_nameis empty, workers will be skipped for matching requests.
- Pattern string
The route pattern
- Zone
Id string The zone ID to add the route to.
- Script
Name string Which worker script to run for requests that match the route pattern. If
script_nameis empty, workers will be skipped for matching requests.
- pattern string
The route pattern
- zone
Id string The zone ID to add the route to.
- script
Name string Which worker script to run for requests that match the route pattern. If
script_nameis empty, workers will be skipped for matching requests.
- pattern str
The route pattern
- zone_
id str The zone ID to add the route to.
- script_
name str Which worker script to run for requests that match the route pattern. If
script_nameis empty, workers will be skipped for matching requests.
Outputs
All input properties are implicitly available as output properties. Additionally, the WorkerRoute resource produces the following output properties:
Look up an Existing WorkerRoute Resource
Get an existing WorkerRoute 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?: WorkerRouteState, opts?: CustomResourceOptions): WorkerRoutestatic get(resource_name, id, opts=None, pattern=None, script_name=None, zone_id=None, __props__=None);func GetWorkerRoute(ctx *Context, name string, id IDInput, state *WorkerRouteState, opts ...ResourceOption) (*WorkerRoute, error)public static WorkerRoute Get(string name, Input<string> id, WorkerRouteState? state, CustomResourceOptions? opts = null)- 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.
The following state arguments are supported:
- Pattern string
The route pattern
- Script
Name string Which worker script to run for requests that match the route pattern. If
script_nameis empty, workers will be skipped for matching requests.- Zone
Id string The zone ID to add the route to.
- Pattern string
The route pattern
- Script
Name string Which worker script to run for requests that match the route pattern. If
script_nameis empty, workers will be skipped for matching requests.- Zone
Id string The zone ID to add the route to.
- pattern string
The route pattern
- script
Name string Which worker script to run for requests that match the route pattern. If
script_nameis empty, workers will be skipped for matching requests.- zone
Id string The zone ID to add the route to.
- pattern str
The route pattern
- script_
name str Which worker script to run for requests that match the route pattern. If
script_nameis empty, workers will be skipped for matching requests.- zone_
id str The zone ID to add the route to.
Package Details
- Repository
- https://github.com/pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflareTerraform Provider.