Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

WorkerScript

Provides a Cloudflare worker script resource. In order for a script to be active, you’ll also need to setup a cloudflare.WorkerRoute. NOTE: This resource uses the Cloudflare account APIs. This requires setting the CLOUDFLARE_ACCOUNT_ID environment variable or account_id provider argument.

Create a WorkerScript Resource

new WorkerScript(name: string, args: WorkerScriptArgs, opts?: CustomResourceOptions);
def WorkerScript(resource_name: str, opts: Optional[ResourceOptions] = None, content: Optional[str] = None, kv_namespace_bindings: Optional[Sequence[WorkerScriptKvNamespaceBindingArgs]] = None, name: Optional[str] = None, plain_text_bindings: Optional[Sequence[WorkerScriptPlainTextBindingArgs]] = None, secret_text_bindings: Optional[Sequence[WorkerScriptSecretTextBindingArgs]] = None, webassembly_bindings: Optional[Sequence[WorkerScriptWebassemblyBindingArgs]] = None)
func NewWorkerScript(ctx *Context, name string, args WorkerScriptArgs, opts ...ResourceOption) (*WorkerScript, error)
public WorkerScript(string name, WorkerScriptArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args WorkerScriptArgs
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 WorkerScriptArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args WorkerScriptArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

WorkerScript Resource Properties

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

Inputs

The WorkerScript resource accepts the following input properties:

Outputs

All input properties are implicitly available as output properties. Additionally, the WorkerScript 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing WorkerScript Resource

Get an existing WorkerScript 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?: WorkerScriptState, opts?: CustomResourceOptions): WorkerScript
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, content: Optional[str] = None, kv_namespace_bindings: Optional[Sequence[WorkerScriptKvNamespaceBindingArgs]] = None, name: Optional[str] = None, plain_text_bindings: Optional[Sequence[WorkerScriptPlainTextBindingArgs]] = None, secret_text_bindings: Optional[Sequence[WorkerScriptSecretTextBindingArgs]] = None, webassembly_bindings: Optional[Sequence[WorkerScriptWebassemblyBindingArgs]] = None) -> WorkerScript
func GetWorkerScript(ctx *Context, name string, id IDInput, state *WorkerScriptState, opts ...ResourceOption) (*WorkerScript, error)
public static WorkerScript Get(string name, Input<string> id, WorkerScriptState? 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:

Supporting Types

WorkerScriptKvNamespaceBinding

Name string

The global variable for the binding in your Worker code.

NamespaceId string
Name string

The global variable for the binding in your Worker code.

NamespaceId string
name string

The global variable for the binding in your Worker code.

namespaceId string
name str

The global variable for the binding in your Worker code.

namespace_id str

WorkerScriptPlainTextBinding

Name string

The global variable for the binding in your Worker code.

Text string

The secret text you want to store.

Name string

The global variable for the binding in your Worker code.

Text string

The secret text you want to store.

name string

The global variable for the binding in your Worker code.

text string

The secret text you want to store.

name str

The global variable for the binding in your Worker code.

text str

The secret text you want to store.

WorkerScriptSecretTextBinding

Name string

The global variable for the binding in your Worker code.

Text string

The secret text you want to store.

Name string

The global variable for the binding in your Worker code.

Text string

The secret text you want to store.

name string

The global variable for the binding in your Worker code.

text string

The secret text you want to store.

name str

The global variable for the binding in your Worker code.

text str

The secret text you want to store.

WorkerScriptWebassemblyBinding

Module string

The base64 encoded wasm module you want to store.

Name string

The global variable for the binding in your Worker code.

Module string

The base64 encoded wasm module you want to store.

Name string

The global variable for the binding in your Worker code.

module string

The base64 encoded wasm module you want to store.

name string

The global variable for the binding in your Worker code.

module str

The base64 encoded wasm module you want to store.

name str

The global variable for the binding in your Worker code.

Import

To import a script, use a script name, e.g. script_name

 $ pulumi import cloudflare:index/workerScript:WorkerScript default script_name

where* script_name - the script name

Package Details

Repository
https://github.com/pulumi/pulumi-cloudflare
License
Apache-2.0
Notes
This Pulumi package is based on the cloudflare Terraform Provider.