cloudflare.WorkersScript
Explore with Pulumi AI
Provides a Cloudflare worker script resource. In order for a script to be active, you’ll also need to setup a cloudflare.WorkerRoute
.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
import * as std from "@pulumi/std";
const myNamespace = new cloudflare.WorkersKvNamespace("my_namespace", {
accountId: "f037e56e89293a057740de681ac9abbe",
title: "example",
});
// Sets the script with the name "script_1"
const myScript = new cloudflare.WorkersScript("my_script", {
accountId: "f037e56e89293a057740de681ac9abbe",
name: "script_1",
content: std.file({
input: "script.js",
}).then(invoke => invoke.result),
kvNamespaceBindings: [{
name: "MY_EXAMPLE_KV_NAMESPACE",
namespaceId: myNamespace.id,
}],
plainTextBindings: [{
name: "MY_EXAMPLE_PLAIN_TEXT",
text: "foobar",
}],
secretTextBindings: [{
name: "MY_EXAMPLE_SECRET_TEXT",
text: secretFooValue,
}],
webassemblyBindings: [{
name: "MY_EXAMPLE_WASM",
module: std.filebase64({
input: "example.wasm",
}).then(invoke => invoke.result),
}],
serviceBindings: [{
name: "MY_SERVICE_BINDING",
service: "MY_SERVICE",
environment: "production",
}],
r2BucketBindings: [{
name: "MY_BUCKET",
bucketName: "MY_BUCKET_NAME",
}],
analyticsEngineBindings: [{
name: "MY_DATASET",
dataset: "dataset1",
}],
});
import pulumi
import pulumi_cloudflare as cloudflare
import pulumi_std as std
my_namespace = cloudflare.WorkersKvNamespace("my_namespace",
account_id="f037e56e89293a057740de681ac9abbe",
title="example")
# Sets the script with the name "script_1"
my_script = cloudflare.WorkersScript("my_script",
account_id="f037e56e89293a057740de681ac9abbe",
name="script_1",
content=std.file(input="script.js").result,
kv_namespace_bindings=[{
"name": "MY_EXAMPLE_KV_NAMESPACE",
"namespace_id": my_namespace.id,
}],
plain_text_bindings=[{
"name": "MY_EXAMPLE_PLAIN_TEXT",
"text": "foobar",
}],
secret_text_bindings=[{
"name": "MY_EXAMPLE_SECRET_TEXT",
"text": secret_foo_value,
}],
webassembly_bindings=[{
"name": "MY_EXAMPLE_WASM",
"module": std.filebase64(input="example.wasm").result,
}],
service_bindings=[{
"name": "MY_SERVICE_BINDING",
"service": "MY_SERVICE",
"environment": "production",
}],
r2_bucket_bindings=[{
"name": "MY_BUCKET",
"bucket_name": "MY_BUCKET_NAME",
}],
analytics_engine_bindings=[{
"name": "MY_DATASET",
"dataset": "dataset1",
}])
package main
import (
"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
"github.com/pulumi/pulumi-std/sdk/go/std"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myNamespace, err := cloudflare.NewWorkersKvNamespace(ctx, "my_namespace", &cloudflare.WorkersKvNamespaceArgs{
AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
Title: pulumi.String("example"),
})
if err != nil {
return err
}
invokeFile, err := std.File(ctx, &std.FileArgs{
Input: "script.js",
}, nil)
if err != nil {
return err
}
invokeFilebase641, err := std.Filebase64(ctx, &std.Filebase64Args{
Input: "example.wasm",
}, nil)
if err != nil {
return err
}
// Sets the script with the name "script_1"
_, err = cloudflare.NewWorkersScript(ctx, "my_script", &cloudflare.WorkersScriptArgs{
AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
Name: pulumi.String("script_1"),
Content: pulumi.String(invokeFile.Result),
KvNamespaceBindings: cloudflare.WorkersScriptKvNamespaceBindingArray{
&cloudflare.WorkersScriptKvNamespaceBindingArgs{
Name: pulumi.String("MY_EXAMPLE_KV_NAMESPACE"),
NamespaceId: myNamespace.ID(),
},
},
PlainTextBindings: cloudflare.WorkersScriptPlainTextBindingArray{
&cloudflare.WorkersScriptPlainTextBindingArgs{
Name: pulumi.String("MY_EXAMPLE_PLAIN_TEXT"),
Text: pulumi.String("foobar"),
},
},
SecretTextBindings: cloudflare.WorkersScriptSecretTextBindingArray{
&cloudflare.WorkersScriptSecretTextBindingArgs{
Name: pulumi.String("MY_EXAMPLE_SECRET_TEXT"),
Text: pulumi.Any(secretFooValue),
},
},
WebassemblyBindings: cloudflare.WorkersScriptWebassemblyBindingArray{
&cloudflare.WorkersScriptWebassemblyBindingArgs{
Name: pulumi.String("MY_EXAMPLE_WASM"),
Module: pulumi.String(invokeFilebase641.Result),
},
},
ServiceBindings: cloudflare.WorkersScriptServiceBindingArray{
&cloudflare.WorkersScriptServiceBindingArgs{
Name: pulumi.String("MY_SERVICE_BINDING"),
Service: pulumi.String("MY_SERVICE"),
Environment: pulumi.String("production"),
},
},
R2BucketBindings: cloudflare.WorkersScriptR2BucketBindingArray{
&cloudflare.WorkersScriptR2BucketBindingArgs{
Name: pulumi.String("MY_BUCKET"),
BucketName: pulumi.String("MY_BUCKET_NAME"),
},
},
AnalyticsEngineBindings: cloudflare.WorkersScriptAnalyticsEngineBindingArray{
&cloudflare.WorkersScriptAnalyticsEngineBindingArgs{
Name: pulumi.String("MY_DATASET"),
Dataset: pulumi.String("dataset1"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
using Std = Pulumi.Std;
return await Deployment.RunAsync(() =>
{
var myNamespace = new Cloudflare.WorkersKvNamespace("my_namespace", new()
{
AccountId = "f037e56e89293a057740de681ac9abbe",
Title = "example",
});
// Sets the script with the name "script_1"
var myScript = new Cloudflare.WorkersScript("my_script", new()
{
AccountId = "f037e56e89293a057740de681ac9abbe",
Name = "script_1",
Content = Std.File.Invoke(new()
{
Input = "script.js",
}).Apply(invoke => invoke.Result),
KvNamespaceBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptKvNamespaceBindingArgs
{
Name = "MY_EXAMPLE_KV_NAMESPACE",
NamespaceId = myNamespace.Id,
},
},
PlainTextBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptPlainTextBindingArgs
{
Name = "MY_EXAMPLE_PLAIN_TEXT",
Text = "foobar",
},
},
SecretTextBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptSecretTextBindingArgs
{
Name = "MY_EXAMPLE_SECRET_TEXT",
Text = secretFooValue,
},
},
WebassemblyBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptWebassemblyBindingArgs
{
Name = "MY_EXAMPLE_WASM",
Module = Std.Filebase64.Invoke(new()
{
Input = "example.wasm",
}).Apply(invoke => invoke.Result),
},
},
ServiceBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptServiceBindingArgs
{
Name = "MY_SERVICE_BINDING",
Service = "MY_SERVICE",
Environment = "production",
},
},
R2BucketBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptR2BucketBindingArgs
{
Name = "MY_BUCKET",
BucketName = "MY_BUCKET_NAME",
},
},
AnalyticsEngineBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptAnalyticsEngineBindingArgs
{
Name = "MY_DATASET",
Dataset = "dataset1",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.WorkersKvNamespace;
import com.pulumi.cloudflare.WorkersKvNamespaceArgs;
import com.pulumi.cloudflare.WorkersScript;
import com.pulumi.cloudflare.WorkersScriptArgs;
import com.pulumi.cloudflare.inputs.WorkersScriptKvNamespaceBindingArgs;
import com.pulumi.cloudflare.inputs.WorkersScriptPlainTextBindingArgs;
import com.pulumi.cloudflare.inputs.WorkersScriptSecretTextBindingArgs;
import com.pulumi.cloudflare.inputs.WorkersScriptWebassemblyBindingArgs;
import com.pulumi.cloudflare.inputs.WorkersScriptServiceBindingArgs;
import com.pulumi.cloudflare.inputs.WorkersScriptR2BucketBindingArgs;
import com.pulumi.cloudflare.inputs.WorkersScriptAnalyticsEngineBindingArgs;
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 myNamespace = new WorkersKvNamespace("myNamespace", WorkersKvNamespaceArgs.builder()
.accountId("f037e56e89293a057740de681ac9abbe")
.title("example")
.build());
// Sets the script with the name "script_1"
var myScript = new WorkersScript("myScript", WorkersScriptArgs.builder()
.accountId("f037e56e89293a057740de681ac9abbe")
.name("script_1")
.content(StdFunctions.file(FileArgs.builder()
.input("script.js")
.build()).result())
.kvNamespaceBindings(WorkersScriptKvNamespaceBindingArgs.builder()
.name("MY_EXAMPLE_KV_NAMESPACE")
.namespaceId(myNamespace.id())
.build())
.plainTextBindings(WorkersScriptPlainTextBindingArgs.builder()
.name("MY_EXAMPLE_PLAIN_TEXT")
.text("foobar")
.build())
.secretTextBindings(WorkersScriptSecretTextBindingArgs.builder()
.name("MY_EXAMPLE_SECRET_TEXT")
.text(secretFooValue)
.build())
.webassemblyBindings(WorkersScriptWebassemblyBindingArgs.builder()
.name("MY_EXAMPLE_WASM")
.module(StdFunctions.filebase64(Filebase64Args.builder()
.input("example.wasm")
.build()).result())
.build())
.serviceBindings(WorkersScriptServiceBindingArgs.builder()
.name("MY_SERVICE_BINDING")
.service("MY_SERVICE")
.environment("production")
.build())
.r2BucketBindings(WorkersScriptR2BucketBindingArgs.builder()
.name("MY_BUCKET")
.bucketName("MY_BUCKET_NAME")
.build())
.analyticsEngineBindings(WorkersScriptAnalyticsEngineBindingArgs.builder()
.name("MY_DATASET")
.dataset("dataset1")
.build())
.build());
}
}
resources:
myNamespace:
type: cloudflare:WorkersKvNamespace
name: my_namespace
properties:
accountId: f037e56e89293a057740de681ac9abbe
title: example
# Sets the script with the name "script_1"
myScript:
type: cloudflare:WorkersScript
name: my_script
properties:
accountId: f037e56e89293a057740de681ac9abbe
name: script_1
content:
fn::invoke:
Function: std:file
Arguments:
input: script.js
Return: result
kvNamespaceBindings:
- name: MY_EXAMPLE_KV_NAMESPACE
namespaceId: ${myNamespace.id}
plainTextBindings:
- name: MY_EXAMPLE_PLAIN_TEXT
text: foobar
secretTextBindings:
- name: MY_EXAMPLE_SECRET_TEXT
text: ${secretFooValue}
webassemblyBindings:
- name: MY_EXAMPLE_WASM
module:
fn::invoke:
Function: std:filebase64
Arguments:
input: example.wasm
Return: result
serviceBindings:
- name: MY_SERVICE_BINDING
service: MY_SERVICE
environment: production
r2BucketBindings:
- name: MY_BUCKET
bucketName: MY_BUCKET_NAME
analyticsEngineBindings:
- name: MY_DATASET
dataset: dataset1
Create WorkersScript Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new WorkersScript(name: string, args: WorkersScriptArgs, opts?: CustomResourceOptions);
@overload
def WorkersScript(resource_name: str,
args: WorkersScriptArgs,
opts: Optional[ResourceOptions] = None)
@overload
def WorkersScript(resource_name: str,
opts: Optional[ResourceOptions] = None,
content: Optional[str] = None,
name: Optional[str] = None,
account_id: Optional[str] = None,
module: Optional[bool] = None,
placements: Optional[Sequence[WorkersScriptPlacementArgs]] = None,
d1_database_bindings: Optional[Sequence[WorkersScriptD1DatabaseBindingArgs]] = None,
dispatch_namespace: Optional[str] = None,
hyperdrive_config_bindings: Optional[Sequence[WorkersScriptHyperdriveConfigBindingArgs]] = None,
kv_namespace_bindings: Optional[Sequence[WorkersScriptKvNamespaceBindingArgs]] = None,
logpush: Optional[bool] = None,
compatibility_date: Optional[str] = None,
analytics_engine_bindings: Optional[Sequence[WorkersScriptAnalyticsEngineBindingArgs]] = None,
compatibility_flags: Optional[Sequence[str]] = None,
plain_text_bindings: Optional[Sequence[WorkersScriptPlainTextBindingArgs]] = None,
queue_bindings: Optional[Sequence[WorkersScriptQueueBindingArgs]] = None,
r2_bucket_bindings: Optional[Sequence[WorkersScriptR2BucketBindingArgs]] = None,
secret_text_bindings: Optional[Sequence[WorkersScriptSecretTextBindingArgs]] = None,
service_bindings: Optional[Sequence[WorkersScriptServiceBindingArgs]] = None,
tags: Optional[Sequence[str]] = None,
webassembly_bindings: Optional[Sequence[WorkersScriptWebassemblyBindingArgs]] = None)
func NewWorkersScript(ctx *Context, name string, args WorkersScriptArgs, opts ...ResourceOption) (*WorkersScript, error)
public WorkersScript(string name, WorkersScriptArgs args, CustomResourceOptions? opts = null)
public WorkersScript(String name, WorkersScriptArgs args)
public WorkersScript(String name, WorkersScriptArgs args, CustomResourceOptions options)
type: cloudflare:WorkersScript
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 WorkersScriptArgs
- 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 WorkersScriptArgs
- 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 WorkersScriptArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args WorkersScriptArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args WorkersScriptArgs
- 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 workersScriptResource = new Cloudflare.WorkersScript("workersScriptResource", new()
{
Content = "string",
Name = "string",
AccountId = "string",
Module = false,
Placements = new[]
{
new Cloudflare.Inputs.WorkersScriptPlacementArgs
{
Mode = "string",
},
},
D1DatabaseBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptD1DatabaseBindingArgs
{
DatabaseId = "string",
Name = "string",
},
},
DispatchNamespace = "string",
HyperdriveConfigBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptHyperdriveConfigBindingArgs
{
Binding = "string",
Id = "string",
},
},
KvNamespaceBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptKvNamespaceBindingArgs
{
Name = "string",
NamespaceId = "string",
},
},
Logpush = false,
CompatibilityDate = "string",
AnalyticsEngineBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptAnalyticsEngineBindingArgs
{
Dataset = "string",
Name = "string",
},
},
CompatibilityFlags = new[]
{
"string",
},
PlainTextBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptPlainTextBindingArgs
{
Name = "string",
Text = "string",
},
},
QueueBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptQueueBindingArgs
{
Binding = "string",
Queue = "string",
},
},
R2BucketBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptR2BucketBindingArgs
{
BucketName = "string",
Name = "string",
},
},
SecretTextBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptSecretTextBindingArgs
{
Name = "string",
Text = "string",
},
},
ServiceBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptServiceBindingArgs
{
Name = "string",
Service = "string",
Environment = "string",
},
},
Tags = new[]
{
"string",
},
WebassemblyBindings = new[]
{
new Cloudflare.Inputs.WorkersScriptWebassemblyBindingArgs
{
Module = "string",
Name = "string",
},
},
});
example, err := cloudflare.NewWorkersScript(ctx, "workersScriptResource", &cloudflare.WorkersScriptArgs{
Content: pulumi.String("string"),
Name: pulumi.String("string"),
AccountId: pulumi.String("string"),
Module: pulumi.Bool(false),
Placements: cloudflare.WorkersScriptPlacementArray{
&cloudflare.WorkersScriptPlacementArgs{
Mode: pulumi.String("string"),
},
},
D1DatabaseBindings: cloudflare.WorkersScriptD1DatabaseBindingArray{
&cloudflare.WorkersScriptD1DatabaseBindingArgs{
DatabaseId: pulumi.String("string"),
Name: pulumi.String("string"),
},
},
DispatchNamespace: pulumi.String("string"),
HyperdriveConfigBindings: cloudflare.WorkersScriptHyperdriveConfigBindingArray{
&cloudflare.WorkersScriptHyperdriveConfigBindingArgs{
Binding: pulumi.String("string"),
Id: pulumi.String("string"),
},
},
KvNamespaceBindings: cloudflare.WorkersScriptKvNamespaceBindingArray{
&cloudflare.WorkersScriptKvNamespaceBindingArgs{
Name: pulumi.String("string"),
NamespaceId: pulumi.String("string"),
},
},
Logpush: pulumi.Bool(false),
CompatibilityDate: pulumi.String("string"),
AnalyticsEngineBindings: cloudflare.WorkersScriptAnalyticsEngineBindingArray{
&cloudflare.WorkersScriptAnalyticsEngineBindingArgs{
Dataset: pulumi.String("string"),
Name: pulumi.String("string"),
},
},
CompatibilityFlags: pulumi.StringArray{
pulumi.String("string"),
},
PlainTextBindings: cloudflare.WorkersScriptPlainTextBindingArray{
&cloudflare.WorkersScriptPlainTextBindingArgs{
Name: pulumi.String("string"),
Text: pulumi.String("string"),
},
},
QueueBindings: cloudflare.WorkersScriptQueueBindingArray{
&cloudflare.WorkersScriptQueueBindingArgs{
Binding: pulumi.String("string"),
Queue: pulumi.String("string"),
},
},
R2BucketBindings: cloudflare.WorkersScriptR2BucketBindingArray{
&cloudflare.WorkersScriptR2BucketBindingArgs{
BucketName: pulumi.String("string"),
Name: pulumi.String("string"),
},
},
SecretTextBindings: cloudflare.WorkersScriptSecretTextBindingArray{
&cloudflare.WorkersScriptSecretTextBindingArgs{
Name: pulumi.String("string"),
Text: pulumi.String("string"),
},
},
ServiceBindings: cloudflare.WorkersScriptServiceBindingArray{
&cloudflare.WorkersScriptServiceBindingArgs{
Name: pulumi.String("string"),
Service: pulumi.String("string"),
Environment: pulumi.String("string"),
},
},
Tags: pulumi.StringArray{
pulumi.String("string"),
},
WebassemblyBindings: cloudflare.WorkersScriptWebassemblyBindingArray{
&cloudflare.WorkersScriptWebassemblyBindingArgs{
Module: pulumi.String("string"),
Name: pulumi.String("string"),
},
},
})
var workersScriptResource = new WorkersScript("workersScriptResource", WorkersScriptArgs.builder()
.content("string")
.name("string")
.accountId("string")
.module(false)
.placements(WorkersScriptPlacementArgs.builder()
.mode("string")
.build())
.d1DatabaseBindings(WorkersScriptD1DatabaseBindingArgs.builder()
.databaseId("string")
.name("string")
.build())
.dispatchNamespace("string")
.hyperdriveConfigBindings(WorkersScriptHyperdriveConfigBindingArgs.builder()
.binding("string")
.id("string")
.build())
.kvNamespaceBindings(WorkersScriptKvNamespaceBindingArgs.builder()
.name("string")
.namespaceId("string")
.build())
.logpush(false)
.compatibilityDate("string")
.analyticsEngineBindings(WorkersScriptAnalyticsEngineBindingArgs.builder()
.dataset("string")
.name("string")
.build())
.compatibilityFlags("string")
.plainTextBindings(WorkersScriptPlainTextBindingArgs.builder()
.name("string")
.text("string")
.build())
.queueBindings(WorkersScriptQueueBindingArgs.builder()
.binding("string")
.queue("string")
.build())
.r2BucketBindings(WorkersScriptR2BucketBindingArgs.builder()
.bucketName("string")
.name("string")
.build())
.secretTextBindings(WorkersScriptSecretTextBindingArgs.builder()
.name("string")
.text("string")
.build())
.serviceBindings(WorkersScriptServiceBindingArgs.builder()
.name("string")
.service("string")
.environment("string")
.build())
.tags("string")
.webassemblyBindings(WorkersScriptWebassemblyBindingArgs.builder()
.module("string")
.name("string")
.build())
.build());
workers_script_resource = cloudflare.WorkersScript("workersScriptResource",
content="string",
name="string",
account_id="string",
module=False,
placements=[{
"mode": "string",
}],
d1_database_bindings=[{
"database_id": "string",
"name": "string",
}],
dispatch_namespace="string",
hyperdrive_config_bindings=[{
"binding": "string",
"id": "string",
}],
kv_namespace_bindings=[{
"name": "string",
"namespace_id": "string",
}],
logpush=False,
compatibility_date="string",
analytics_engine_bindings=[{
"dataset": "string",
"name": "string",
}],
compatibility_flags=["string"],
plain_text_bindings=[{
"name": "string",
"text": "string",
}],
queue_bindings=[{
"binding": "string",
"queue": "string",
}],
r2_bucket_bindings=[{
"bucket_name": "string",
"name": "string",
}],
secret_text_bindings=[{
"name": "string",
"text": "string",
}],
service_bindings=[{
"name": "string",
"service": "string",
"environment": "string",
}],
tags=["string"],
webassembly_bindings=[{
"module": "string",
"name": "string",
}])
const workersScriptResource = new cloudflare.WorkersScript("workersScriptResource", {
content: "string",
name: "string",
accountId: "string",
module: false,
placements: [{
mode: "string",
}],
d1DatabaseBindings: [{
databaseId: "string",
name: "string",
}],
dispatchNamespace: "string",
hyperdriveConfigBindings: [{
binding: "string",
id: "string",
}],
kvNamespaceBindings: [{
name: "string",
namespaceId: "string",
}],
logpush: false,
compatibilityDate: "string",
analyticsEngineBindings: [{
dataset: "string",
name: "string",
}],
compatibilityFlags: ["string"],
plainTextBindings: [{
name: "string",
text: "string",
}],
queueBindings: [{
binding: "string",
queue: "string",
}],
r2BucketBindings: [{
bucketName: "string",
name: "string",
}],
secretTextBindings: [{
name: "string",
text: "string",
}],
serviceBindings: [{
name: "string",
service: "string",
environment: "string",
}],
tags: ["string"],
webassemblyBindings: [{
module: "string",
name: "string",
}],
});
type: cloudflare:WorkersScript
properties:
accountId: string
analyticsEngineBindings:
- dataset: string
name: string
compatibilityDate: string
compatibilityFlags:
- string
content: string
d1DatabaseBindings:
- databaseId: string
name: string
dispatchNamespace: string
hyperdriveConfigBindings:
- binding: string
id: string
kvNamespaceBindings:
- name: string
namespaceId: string
logpush: false
module: false
name: string
placements:
- mode: string
plainTextBindings:
- name: string
text: string
queueBindings:
- binding: string
queue: string
r2BucketBindings:
- bucketName: string
name: string
secretTextBindings:
- name: string
text: string
serviceBindings:
- environment: string
name: string
service: string
tags:
- string
webassemblyBindings:
- module: string
name: string
WorkersScript 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 WorkersScript resource accepts the following input properties:
- Account
Id string - The account identifier to target for the resource.
- Content string
- The script content.
- Name string
- The name for the script. Modifying this attribute will force creation of a new resource.
- Analytics
Engine List<WorkersBindings Script Analytics Engine Binding> - Compatibility
Date string - The date to use for the compatibility flag.
- Compatibility
Flags List<string> - Compatibility flags used for Worker Scripts.
- D1Database
Bindings List<WorkersScript D1Database Binding> - Dispatch
Namespace string - Name of the Workers for Platforms dispatch namespace.
- Hyperdrive
Config List<WorkersBindings Script Hyperdrive Config Binding> - Kv
Namespace List<WorkersBindings Script Kv Namespace Binding> - Logpush bool
- Enabling allows Worker events to be sent to a defined Logpush destination.
- Module bool
- Whether to upload Worker as a module.
- Placements
List<Workers
Script Placement> - Plain
Text List<WorkersBindings Script Plain Text Binding> - Queue
Bindings List<WorkersScript Queue Binding> - R2Bucket
Bindings List<WorkersScript R2Bucket Binding> - Secret
Text List<WorkersBindings Script Secret Text Binding> - Service
Bindings List<WorkersScript Service Binding> - List<string>
- Webassembly
Bindings List<WorkersScript Webassembly Binding>
- Account
Id string - The account identifier to target for the resource.
- Content string
- The script content.
- Name string
- The name for the script. Modifying this attribute will force creation of a new resource.
- Analytics
Engine []WorkersBindings Script Analytics Engine Binding Args - Compatibility
Date string - The date to use for the compatibility flag.
- Compatibility
Flags []string - Compatibility flags used for Worker Scripts.
- D1Database
Bindings []WorkersScript D1Database Binding Args - Dispatch
Namespace string - Name of the Workers for Platforms dispatch namespace.
- Hyperdrive
Config []WorkersBindings Script Hyperdrive Config Binding Args - Kv
Namespace []WorkersBindings Script Kv Namespace Binding Args - Logpush bool
- Enabling allows Worker events to be sent to a defined Logpush destination.
- Module bool
- Whether to upload Worker as a module.
- Placements
[]Workers
Script Placement Args - Plain
Text []WorkersBindings Script Plain Text Binding Args - Queue
Bindings []WorkersScript Queue Binding Args - R2Bucket
Bindings []WorkersScript R2Bucket Binding Args - Secret
Text []WorkersBindings Script Secret Text Binding Args - Service
Bindings []WorkersScript Service Binding Args - []string
- Webassembly
Bindings []WorkersScript Webassembly Binding Args
- account
Id String - The account identifier to target for the resource.
- content String
- The script content.
- name String
- The name for the script. Modifying this attribute will force creation of a new resource.
- analytics
Engine List<WorkersBindings Script Analytics Engine Binding> - compatibility
Date String - The date to use for the compatibility flag.
- compatibility
Flags List<String> - Compatibility flags used for Worker Scripts.
- d1Database
Bindings List<WorkersScript D1Database Binding> - dispatch
Namespace String - Name of the Workers for Platforms dispatch namespace.
- hyperdrive
Config List<WorkersBindings Script Hyperdrive Config Binding> - kv
Namespace List<WorkersBindings Script Kv Namespace Binding> - logpush Boolean
- Enabling allows Worker events to be sent to a defined Logpush destination.
- module Boolean
- Whether to upload Worker as a module.
- placements
List<Workers
Script Placement> - plain
Text List<WorkersBindings Script Plain Text Binding> - queue
Bindings List<WorkersScript Queue Binding> - r2Bucket
Bindings List<WorkersScript R2Bucket Binding> - secret
Text List<WorkersBindings Script Secret Text Binding> - service
Bindings List<WorkersScript Service Binding> - List<String>
- webassembly
Bindings List<WorkersScript Webassembly Binding>
- account
Id string - The account identifier to target for the resource.
- content string
- The script content.
- name string
- The name for the script. Modifying this attribute will force creation of a new resource.
- analytics
Engine WorkersBindings Script Analytics Engine Binding[] - compatibility
Date string - The date to use for the compatibility flag.
- compatibility
Flags string[] - Compatibility flags used for Worker Scripts.
- d1Database
Bindings WorkersScript D1Database Binding[] - dispatch
Namespace string - Name of the Workers for Platforms dispatch namespace.
- hyperdrive
Config WorkersBindings Script Hyperdrive Config Binding[] - kv
Namespace WorkersBindings Script Kv Namespace Binding[] - logpush boolean
- Enabling allows Worker events to be sent to a defined Logpush destination.
- module boolean
- Whether to upload Worker as a module.
- placements
Workers
Script Placement[] - plain
Text WorkersBindings Script Plain Text Binding[] - queue
Bindings WorkersScript Queue Binding[] - r2Bucket
Bindings WorkersScript R2Bucket Binding[] - secret
Text WorkersBindings Script Secret Text Binding[] - service
Bindings WorkersScript Service Binding[] - string[]
- webassembly
Bindings WorkersScript Webassembly Binding[]
- account_
id str - The account identifier to target for the resource.
- content str
- The script content.
- name str
- The name for the script. Modifying this attribute will force creation of a new resource.
- analytics_
engine_ Sequence[Workersbindings Script Analytics Engine Binding Args] - compatibility_
date str - The date to use for the compatibility flag.
- compatibility_
flags Sequence[str] - Compatibility flags used for Worker Scripts.
- d1_
database_ Sequence[Workersbindings Script D1Database Binding Args] - dispatch_
namespace str - Name of the Workers for Platforms dispatch namespace.
- hyperdrive_
config_ Sequence[Workersbindings Script Hyperdrive Config Binding Args] - kv_
namespace_ Sequence[Workersbindings Script Kv Namespace Binding Args] - logpush bool
- Enabling allows Worker events to be sent to a defined Logpush destination.
- module bool
- Whether to upload Worker as a module.
- placements
Sequence[Workers
Script Placement Args] - plain_
text_ Sequence[Workersbindings Script Plain Text Binding Args] - queue_
bindings Sequence[WorkersScript Queue Binding Args] - r2_
bucket_ Sequence[Workersbindings Script R2Bucket Binding Args] - secret_
text_ Sequence[Workersbindings Script Secret Text Binding Args] - service_
bindings Sequence[WorkersScript Service Binding Args] - Sequence[str]
- webassembly_
bindings Sequence[WorkersScript Webassembly Binding Args]
- account
Id String - The account identifier to target for the resource.
- content String
- The script content.
- name String
- The name for the script. Modifying this attribute will force creation of a new resource.
- analytics
Engine List<Property Map>Bindings - compatibility
Date String - The date to use for the compatibility flag.
- compatibility
Flags List<String> - Compatibility flags used for Worker Scripts.
- d1Database
Bindings List<Property Map> - dispatch
Namespace String - Name of the Workers for Platforms dispatch namespace.
- hyperdrive
Config List<Property Map>Bindings - kv
Namespace List<Property Map>Bindings - logpush Boolean
- Enabling allows Worker events to be sent to a defined Logpush destination.
- module Boolean
- Whether to upload Worker as a module.
- placements List<Property Map>
- plain
Text List<Property Map>Bindings - queue
Bindings List<Property Map> - r2Bucket
Bindings List<Property Map> - secret
Text List<Property Map>Bindings - service
Bindings List<Property Map> - List<String>
- webassembly
Bindings List<Property Map>
Outputs
All input properties are implicitly available as output properties. Additionally, the WorkersScript 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 WorkersScript Resource
Get an existing WorkersScript 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?: WorkersScriptState, opts?: CustomResourceOptions): WorkersScript
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
account_id: Optional[str] = None,
analytics_engine_bindings: Optional[Sequence[WorkersScriptAnalyticsEngineBindingArgs]] = None,
compatibility_date: Optional[str] = None,
compatibility_flags: Optional[Sequence[str]] = None,
content: Optional[str] = None,
d1_database_bindings: Optional[Sequence[WorkersScriptD1DatabaseBindingArgs]] = None,
dispatch_namespace: Optional[str] = None,
hyperdrive_config_bindings: Optional[Sequence[WorkersScriptHyperdriveConfigBindingArgs]] = None,
kv_namespace_bindings: Optional[Sequence[WorkersScriptKvNamespaceBindingArgs]] = None,
logpush: Optional[bool] = None,
module: Optional[bool] = None,
name: Optional[str] = None,
placements: Optional[Sequence[WorkersScriptPlacementArgs]] = None,
plain_text_bindings: Optional[Sequence[WorkersScriptPlainTextBindingArgs]] = None,
queue_bindings: Optional[Sequence[WorkersScriptQueueBindingArgs]] = None,
r2_bucket_bindings: Optional[Sequence[WorkersScriptR2BucketBindingArgs]] = None,
secret_text_bindings: Optional[Sequence[WorkersScriptSecretTextBindingArgs]] = None,
service_bindings: Optional[Sequence[WorkersScriptServiceBindingArgs]] = None,
tags: Optional[Sequence[str]] = None,
webassembly_bindings: Optional[Sequence[WorkersScriptWebassemblyBindingArgs]] = None) -> WorkersScript
func GetWorkersScript(ctx *Context, name string, id IDInput, state *WorkersScriptState, opts ...ResourceOption) (*WorkersScript, error)
public static WorkersScript Get(string name, Input<string> id, WorkersScriptState? state, CustomResourceOptions? opts = null)
public static WorkersScript get(String name, Output<String> id, WorkersScriptState 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.
- Account
Id string - The account identifier to target for the resource.
- Analytics
Engine List<WorkersBindings Script Analytics Engine Binding> - Compatibility
Date string - The date to use for the compatibility flag.
- Compatibility
Flags List<string> - Compatibility flags used for Worker Scripts.
- Content string
- The script content.
- D1Database
Bindings List<WorkersScript D1Database Binding> - Dispatch
Namespace string - Name of the Workers for Platforms dispatch namespace.
- Hyperdrive
Config List<WorkersBindings Script Hyperdrive Config Binding> - Kv
Namespace List<WorkersBindings Script Kv Namespace Binding> - Logpush bool
- Enabling allows Worker events to be sent to a defined Logpush destination.
- Module bool
- Whether to upload Worker as a module.
- Name string
- The name for the script. Modifying this attribute will force creation of a new resource.
- Placements
List<Workers
Script Placement> - Plain
Text List<WorkersBindings Script Plain Text Binding> - Queue
Bindings List<WorkersScript Queue Binding> - R2Bucket
Bindings List<WorkersScript R2Bucket Binding> - Secret
Text List<WorkersBindings Script Secret Text Binding> - Service
Bindings List<WorkersScript Service Binding> - List<string>
- Webassembly
Bindings List<WorkersScript Webassembly Binding>
- Account
Id string - The account identifier to target for the resource.
- Analytics
Engine []WorkersBindings Script Analytics Engine Binding Args - Compatibility
Date string - The date to use for the compatibility flag.
- Compatibility
Flags []string - Compatibility flags used for Worker Scripts.
- Content string
- The script content.
- D1Database
Bindings []WorkersScript D1Database Binding Args - Dispatch
Namespace string - Name of the Workers for Platforms dispatch namespace.
- Hyperdrive
Config []WorkersBindings Script Hyperdrive Config Binding Args - Kv
Namespace []WorkersBindings Script Kv Namespace Binding Args - Logpush bool
- Enabling allows Worker events to be sent to a defined Logpush destination.
- Module bool
- Whether to upload Worker as a module.
- Name string
- The name for the script. Modifying this attribute will force creation of a new resource.
- Placements
[]Workers
Script Placement Args - Plain
Text []WorkersBindings Script Plain Text Binding Args - Queue
Bindings []WorkersScript Queue Binding Args - R2Bucket
Bindings []WorkersScript R2Bucket Binding Args - Secret
Text []WorkersBindings Script Secret Text Binding Args - Service
Bindings []WorkersScript Service Binding Args - []string
- Webassembly
Bindings []WorkersScript Webassembly Binding Args
- account
Id String - The account identifier to target for the resource.
- analytics
Engine List<WorkersBindings Script Analytics Engine Binding> - compatibility
Date String - The date to use for the compatibility flag.
- compatibility
Flags List<String> - Compatibility flags used for Worker Scripts.
- content String
- The script content.
- d1Database
Bindings List<WorkersScript D1Database Binding> - dispatch
Namespace String - Name of the Workers for Platforms dispatch namespace.
- hyperdrive
Config List<WorkersBindings Script Hyperdrive Config Binding> - kv
Namespace List<WorkersBindings Script Kv Namespace Binding> - logpush Boolean
- Enabling allows Worker events to be sent to a defined Logpush destination.
- module Boolean
- Whether to upload Worker as a module.
- name String
- The name for the script. Modifying this attribute will force creation of a new resource.
- placements
List<Workers
Script Placement> - plain
Text List<WorkersBindings Script Plain Text Binding> - queue
Bindings List<WorkersScript Queue Binding> - r2Bucket
Bindings List<WorkersScript R2Bucket Binding> - secret
Text List<WorkersBindings Script Secret Text Binding> - service
Bindings List<WorkersScript Service Binding> - List<String>
- webassembly
Bindings List<WorkersScript Webassembly Binding>
- account
Id string - The account identifier to target for the resource.
- analytics
Engine WorkersBindings Script Analytics Engine Binding[] - compatibility
Date string - The date to use for the compatibility flag.
- compatibility
Flags string[] - Compatibility flags used for Worker Scripts.
- content string
- The script content.
- d1Database
Bindings WorkersScript D1Database Binding[] - dispatch
Namespace string - Name of the Workers for Platforms dispatch namespace.
- hyperdrive
Config WorkersBindings Script Hyperdrive Config Binding[] - kv
Namespace WorkersBindings Script Kv Namespace Binding[] - logpush boolean
- Enabling allows Worker events to be sent to a defined Logpush destination.
- module boolean
- Whether to upload Worker as a module.
- name string
- The name for the script. Modifying this attribute will force creation of a new resource.
- placements
Workers
Script Placement[] - plain
Text WorkersBindings Script Plain Text Binding[] - queue
Bindings WorkersScript Queue Binding[] - r2Bucket
Bindings WorkersScript R2Bucket Binding[] - secret
Text WorkersBindings Script Secret Text Binding[] - service
Bindings WorkersScript Service Binding[] - string[]
- webassembly
Bindings WorkersScript Webassembly Binding[]
- account_
id str - The account identifier to target for the resource.
- analytics_
engine_ Sequence[Workersbindings Script Analytics Engine Binding Args] - compatibility_
date str - The date to use for the compatibility flag.
- compatibility_
flags Sequence[str] - Compatibility flags used for Worker Scripts.
- content str
- The script content.
- d1_
database_ Sequence[Workersbindings Script D1Database Binding Args] - dispatch_
namespace str - Name of the Workers for Platforms dispatch namespace.
- hyperdrive_
config_ Sequence[Workersbindings Script Hyperdrive Config Binding Args] - kv_
namespace_ Sequence[Workersbindings Script Kv Namespace Binding Args] - logpush bool
- Enabling allows Worker events to be sent to a defined Logpush destination.
- module bool
- Whether to upload Worker as a module.
- name str
- The name for the script. Modifying this attribute will force creation of a new resource.
- placements
Sequence[Workers
Script Placement Args] - plain_
text_ Sequence[Workersbindings Script Plain Text Binding Args] - queue_
bindings Sequence[WorkersScript Queue Binding Args] - r2_
bucket_ Sequence[Workersbindings Script R2Bucket Binding Args] - secret_
text_ Sequence[Workersbindings Script Secret Text Binding Args] - service_
bindings Sequence[WorkersScript Service Binding Args] - Sequence[str]
- webassembly_
bindings Sequence[WorkersScript Webassembly Binding Args]
- account
Id String - The account identifier to target for the resource.
- analytics
Engine List<Property Map>Bindings - compatibility
Date String - The date to use for the compatibility flag.
- compatibility
Flags List<String> - Compatibility flags used for Worker Scripts.
- content String
- The script content.
- d1Database
Bindings List<Property Map> - dispatch
Namespace String - Name of the Workers for Platforms dispatch namespace.
- hyperdrive
Config List<Property Map>Bindings - kv
Namespace List<Property Map>Bindings - logpush Boolean
- Enabling allows Worker events to be sent to a defined Logpush destination.
- module Boolean
- Whether to upload Worker as a module.
- name String
- The name for the script. Modifying this attribute will force creation of a new resource.
- placements List<Property Map>
- plain
Text List<Property Map>Bindings - queue
Bindings List<Property Map> - r2Bucket
Bindings List<Property Map> - secret
Text List<Property Map>Bindings - service
Bindings List<Property Map> - List<String>
- webassembly
Bindings List<Property Map>
Supporting Types
WorkersScriptAnalyticsEngineBinding, WorkersScriptAnalyticsEngineBindingArgs
WorkersScriptD1DatabaseBinding, WorkersScriptD1DatabaseBindingArgs
- Database
Id string - Database ID of D1 database to use.
- Name string
- The global variable for the binding in your Worker code.
- Database
Id string - Database ID of D1 database to use.
- Name string
- The global variable for the binding in your Worker code.
- database
Id String - Database ID of D1 database to use.
- name String
- The global variable for the binding in your Worker code.
- database
Id string - Database ID of D1 database to use.
- name string
- The global variable for the binding in your Worker code.
- database_
id str - Database ID of D1 database to use.
- name str
- The global variable for the binding in your Worker code.
- database
Id String - Database ID of D1 database to use.
- name String
- The global variable for the binding in your Worker code.
WorkersScriptHyperdriveConfigBinding, WorkersScriptHyperdriveConfigBindingArgs
WorkersScriptKvNamespaceBinding, WorkersScriptKvNamespaceBindingArgs
- Name string
- The global variable for the binding in your Worker code.
- Namespace
Id string - ID of the KV namespace you want to use.
- Name string
- The global variable for the binding in your Worker code.
- Namespace
Id string - ID of the KV namespace you want to use.
- name String
- The global variable for the binding in your Worker code.
- namespace
Id String - ID of the KV namespace you want to use.
- name string
- The global variable for the binding in your Worker code.
- namespace
Id string - ID of the KV namespace you want to use.
- name str
- The global variable for the binding in your Worker code.
- namespace_
id str - ID of the KV namespace you want to use.
- name String
- The global variable for the binding in your Worker code.
- namespace
Id String - ID of the KV namespace you want to use.
WorkersScriptPlacement, WorkersScriptPlacementArgs
- Mode string
- The placement mode for the Worker. Available values:
smart
.
- Mode string
- The placement mode for the Worker. Available values:
smart
.
- mode String
- The placement mode for the Worker. Available values:
smart
.
- mode string
- The placement mode for the Worker. Available values:
smart
.
- mode str
- The placement mode for the Worker. Available values:
smart
.
- mode String
- The placement mode for the Worker. Available values:
smart
.
WorkersScriptPlainTextBinding, WorkersScriptPlainTextBindingArgs
WorkersScriptQueueBinding, WorkersScriptQueueBindingArgs
WorkersScriptR2BucketBinding, WorkersScriptR2BucketBindingArgs
- Bucket
Name string - The name of the Bucket to bind to.
- Name string
- The global variable for the binding in your Worker code.
- Bucket
Name string - The name of the Bucket to bind to.
- Name string
- The global variable for the binding in your Worker code.
- bucket
Name String - The name of the Bucket to bind to.
- name String
- The global variable for the binding in your Worker code.
- bucket
Name string - The name of the Bucket to bind to.
- name string
- The global variable for the binding in your Worker code.
- bucket_
name str - The name of the Bucket to bind to.
- name str
- The global variable for the binding in your Worker code.
- bucket
Name String - The name of the Bucket to bind to.
- name String
- The global variable for the binding in your Worker code.
WorkersScriptSecretTextBinding, WorkersScriptSecretTextBindingArgs
WorkersScriptServiceBinding, WorkersScriptServiceBindingArgs
- Name string
- The global variable for the binding in your Worker code.
- Service string
- The name of the Worker to bind to.
- Environment string
- The name of the Worker environment to bind to.
- Name string
- The global variable for the binding in your Worker code.
- Service string
- The name of the Worker to bind to.
- Environment string
- The name of the Worker environment to bind to.
- name String
- The global variable for the binding in your Worker code.
- service String
- The name of the Worker to bind to.
- environment String
- The name of the Worker environment to bind to.
- name string
- The global variable for the binding in your Worker code.
- service string
- The name of the Worker to bind to.
- environment string
- The name of the Worker environment to bind to.
- name str
- The global variable for the binding in your Worker code.
- service str
- The name of the Worker to bind to.
- environment str
- The name of the Worker environment to bind to.
- name String
- The global variable for the binding in your Worker code.
- service String
- The name of the Worker to bind to.
- environment String
- The name of the Worker environment to bind to.
WorkersScriptWebassemblyBinding, WorkersScriptWebassemblyBindingArgs
Import
$ pulumi import cloudflare:index/workersScript:WorkersScript example <account_id>/<script_name>
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
cloudflare
Terraform Provider.