cloudflare.Worker
Explore with Pulumi AI
Example Usage
Example coming soon!
Example coming soon!
Example coming soon!
Example coming soon!
Example coming soon!
resources:
exampleWorker:
type: cloudflare:Worker
name: example_worker
properties:
accountId: 023e105f4ecef8ad9ca31a8372d0c353
name: my-worker
logpush: true
observability:
enabled: true
head_sampling_rate: 0
logs:
enabled: true
headSamplingRate: 0
invocationLogs: true
subdomain:
enabled: true
previews_enabled: true
tags:
- my-team
- my-public-api
tailConsumers:
- name: my-tail-consumer
Create Worker Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Worker(name: string, args: WorkerArgs, opts?: CustomResourceOptions);
@overload
def Worker(resource_name: str,
args: WorkerArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Worker(resource_name: str,
opts: Optional[ResourceOptions] = None,
account_id: Optional[str] = None,
name: Optional[str] = None,
logpush: Optional[bool] = None,
observability: Optional[WorkerObservabilityArgs] = None,
subdomain: Optional[WorkerSubdomainArgs] = None,
tags: Optional[Sequence[str]] = None,
tail_consumers: Optional[Sequence[WorkerTailConsumerArgs]] = None)
func NewWorker(ctx *Context, name string, args WorkerArgs, opts ...ResourceOption) (*Worker, error)
public Worker(string name, WorkerArgs args, CustomResourceOptions? opts = null)
public Worker(String name, WorkerArgs args)
public Worker(String name, WorkerArgs args, CustomResourceOptions options)
type: cloudflare:Worker
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 WorkerArgs
- 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 WorkerArgs
- 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 WorkerArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args WorkerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args WorkerArgs
- 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 workerResource = new Cloudflare.Worker("workerResource", new()
{
AccountId = "string",
Name = "string",
Logpush = false,
Observability = new Cloudflare.Inputs.WorkerObservabilityArgs
{
Enabled = false,
HeadSamplingRate = 0,
Logs = new Cloudflare.Inputs.WorkerObservabilityLogsArgs
{
Enabled = false,
HeadSamplingRate = 0,
InvocationLogs = false,
},
},
Subdomain = new Cloudflare.Inputs.WorkerSubdomainArgs
{
Enabled = false,
PreviewsEnabled = false,
},
Tags = new[]
{
"string",
},
TailConsumers = new[]
{
new Cloudflare.Inputs.WorkerTailConsumerArgs
{
Name = "string",
},
},
});
example, err := cloudflare.NewWorker(ctx, "workerResource", &cloudflare.WorkerArgs{
AccountId: pulumi.String("string"),
Name: pulumi.String("string"),
Logpush: pulumi.Bool(false),
Observability: &cloudflare.WorkerObservabilityArgs{
Enabled: pulumi.Bool(false),
HeadSamplingRate: pulumi.Float64(0),
Logs: &cloudflare.WorkerObservabilityLogsArgs{
Enabled: pulumi.Bool(false),
HeadSamplingRate: pulumi.Float64(0),
InvocationLogs: pulumi.Bool(false),
},
},
Subdomain: &cloudflare.WorkerSubdomainArgs{
Enabled: pulumi.Bool(false),
PreviewsEnabled: pulumi.Bool(false),
},
Tags: pulumi.StringArray{
pulumi.String("string"),
},
TailConsumers: cloudflare.WorkerTailConsumerArray{
&cloudflare.WorkerTailConsumerArgs{
Name: pulumi.String("string"),
},
},
})
var workerResource = new Worker("workerResource", WorkerArgs.builder()
.accountId("string")
.name("string")
.logpush(false)
.observability(WorkerObservabilityArgs.builder()
.enabled(false)
.headSamplingRate(0.0)
.logs(WorkerObservabilityLogsArgs.builder()
.enabled(false)
.headSamplingRate(0.0)
.invocationLogs(false)
.build())
.build())
.subdomain(WorkerSubdomainArgs.builder()
.enabled(false)
.previewsEnabled(false)
.build())
.tags("string")
.tailConsumers(WorkerTailConsumerArgs.builder()
.name("string")
.build())
.build());
worker_resource = cloudflare.Worker("workerResource",
account_id="string",
name="string",
logpush=False,
observability={
"enabled": False,
"head_sampling_rate": 0,
"logs": {
"enabled": False,
"head_sampling_rate": 0,
"invocation_logs": False,
},
},
subdomain={
"enabled": False,
"previews_enabled": False,
},
tags=["string"],
tail_consumers=[{
"name": "string",
}])
const workerResource = new cloudflare.Worker("workerResource", {
accountId: "string",
name: "string",
logpush: false,
observability: {
enabled: false,
headSamplingRate: 0,
logs: {
enabled: false,
headSamplingRate: 0,
invocationLogs: false,
},
},
subdomain: {
enabled: false,
previewsEnabled: false,
},
tags: ["string"],
tailConsumers: [{
name: "string",
}],
});
type: cloudflare:Worker
properties:
accountId: string
logpush: false
name: string
observability:
enabled: false
headSamplingRate: 0
logs:
enabled: false
headSamplingRate: 0
invocationLogs: false
subdomain:
enabled: false
previewsEnabled: false
tags:
- string
tailConsumers:
- name: string
Worker 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 Worker resource accepts the following input properties:
- Account
Id string - Identifier.
- Name string
- Name of the Worker.
- Logpush bool
- Whether logpush is enabled for the Worker.
- Observability
Worker
Observability - Observability settings for the Worker.
- Subdomain
Worker
Subdomain - Subdomain settings for the Worker.
- List<string>
- Tags associated with the Worker.
- Tail
Consumers List<WorkerTail Consumer> - Other Workers that should consume logs from the Worker.
- Account
Id string - Identifier.
- Name string
- Name of the Worker.
- Logpush bool
- Whether logpush is enabled for the Worker.
- Observability
Worker
Observability Args - Observability settings for the Worker.
- Subdomain
Worker
Subdomain Args - Subdomain settings for the Worker.
- []string
- Tags associated with the Worker.
- Tail
Consumers []WorkerTail Consumer Args - Other Workers that should consume logs from the Worker.
- account
Id String - Identifier.
- name String
- Name of the Worker.
- logpush Boolean
- Whether logpush is enabled for the Worker.
- observability
Worker
Observability - Observability settings for the Worker.
- subdomain
Worker
Subdomain - Subdomain settings for the Worker.
- List<String>
- Tags associated with the Worker.
- tail
Consumers List<WorkerTail Consumer> - Other Workers that should consume logs from the Worker.
- account
Id string - Identifier.
- name string
- Name of the Worker.
- logpush boolean
- Whether logpush is enabled for the Worker.
- observability
Worker
Observability - Observability settings for the Worker.
- subdomain
Worker
Subdomain - Subdomain settings for the Worker.
- string[]
- Tags associated with the Worker.
- tail
Consumers WorkerTail Consumer[] - Other Workers that should consume logs from the Worker.
- account_
id str - Identifier.
- name str
- Name of the Worker.
- logpush bool
- Whether logpush is enabled for the Worker.
- observability
Worker
Observability Args - Observability settings for the Worker.
- subdomain
Worker
Subdomain Args - Subdomain settings for the Worker.
- Sequence[str]
- Tags associated with the Worker.
- tail_
consumers Sequence[WorkerTail Consumer Args] - Other Workers that should consume logs from the Worker.
- account
Id String - Identifier.
- name String
- Name of the Worker.
- logpush Boolean
- Whether logpush is enabled for the Worker.
- observability Property Map
- Observability settings for the Worker.
- subdomain Property Map
- Subdomain settings for the Worker.
- List<String>
- Tags associated with the Worker.
- tail
Consumers List<Property Map> - Other Workers that should consume logs from the Worker.
Outputs
All input properties are implicitly available as output properties. Additionally, the Worker resource produces the following output properties:
- created_
on str - When the Worker was created.
- id str
- The provider-assigned unique ID for this managed resource.
- updated_
on str - When the Worker was most recently updated.
Look up Existing Worker Resource
Get an existing Worker 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?: WorkerState, opts?: CustomResourceOptions): Worker
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
account_id: Optional[str] = None,
created_on: Optional[str] = None,
logpush: Optional[bool] = None,
name: Optional[str] = None,
observability: Optional[WorkerObservabilityArgs] = None,
subdomain: Optional[WorkerSubdomainArgs] = None,
tags: Optional[Sequence[str]] = None,
tail_consumers: Optional[Sequence[WorkerTailConsumerArgs]] = None,
updated_on: Optional[str] = None) -> Worker
func GetWorker(ctx *Context, name string, id IDInput, state *WorkerState, opts ...ResourceOption) (*Worker, error)
public static Worker Get(string name, Input<string> id, WorkerState? state, CustomResourceOptions? opts = null)
public static Worker get(String name, Output<String> id, WorkerState state, CustomResourceOptions options)
resources: _: type: cloudflare:Worker 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.
- Account
Id string - Identifier.
- Created
On string - When the Worker was created.
- Logpush bool
- Whether logpush is enabled for the Worker.
- Name string
- Name of the Worker.
- Observability
Worker
Observability - Observability settings for the Worker.
- Subdomain
Worker
Subdomain - Subdomain settings for the Worker.
- List<string>
- Tags associated with the Worker.
- Tail
Consumers List<WorkerTail Consumer> - Other Workers that should consume logs from the Worker.
- Updated
On string - When the Worker was most recently updated.
- Account
Id string - Identifier.
- Created
On string - When the Worker was created.
- Logpush bool
- Whether logpush is enabled for the Worker.
- Name string
- Name of the Worker.
- Observability
Worker
Observability Args - Observability settings for the Worker.
- Subdomain
Worker
Subdomain Args - Subdomain settings for the Worker.
- []string
- Tags associated with the Worker.
- Tail
Consumers []WorkerTail Consumer Args - Other Workers that should consume logs from the Worker.
- Updated
On string - When the Worker was most recently updated.
- account
Id String - Identifier.
- created
On String - When the Worker was created.
- logpush Boolean
- Whether logpush is enabled for the Worker.
- name String
- Name of the Worker.
- observability
Worker
Observability - Observability settings for the Worker.
- subdomain
Worker
Subdomain - Subdomain settings for the Worker.
- List<String>
- Tags associated with the Worker.
- tail
Consumers List<WorkerTail Consumer> - Other Workers that should consume logs from the Worker.
- updated
On String - When the Worker was most recently updated.
- account
Id string - Identifier.
- created
On string - When the Worker was created.
- logpush boolean
- Whether logpush is enabled for the Worker.
- name string
- Name of the Worker.
- observability
Worker
Observability - Observability settings for the Worker.
- subdomain
Worker
Subdomain - Subdomain settings for the Worker.
- string[]
- Tags associated with the Worker.
- tail
Consumers WorkerTail Consumer[] - Other Workers that should consume logs from the Worker.
- updated
On string - When the Worker was most recently updated.
- account_
id str - Identifier.
- created_
on str - When the Worker was created.
- logpush bool
- Whether logpush is enabled for the Worker.
- name str
- Name of the Worker.
- observability
Worker
Observability Args - Observability settings for the Worker.
- subdomain
Worker
Subdomain Args - Subdomain settings for the Worker.
- Sequence[str]
- Tags associated with the Worker.
- tail_
consumers Sequence[WorkerTail Consumer Args] - Other Workers that should consume logs from the Worker.
- updated_
on str - When the Worker was most recently updated.
- account
Id String - Identifier.
- created
On String - When the Worker was created.
- logpush Boolean
- Whether logpush is enabled for the Worker.
- name String
- Name of the Worker.
- observability Property Map
- Observability settings for the Worker.
- subdomain Property Map
- Subdomain settings for the Worker.
- List<String>
- Tags associated with the Worker.
- tail
Consumers List<Property Map> - Other Workers that should consume logs from the Worker.
- updated
On String - When the Worker was most recently updated.
Supporting Types
WorkerObservability, WorkerObservabilityArgs
- Enabled bool
- Whether observability is enabled for the Worker.
- Head
Sampling doubleRate - The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%).
- Logs
Worker
Observability Logs - Log settings for the Worker.
- Enabled bool
- Whether observability is enabled for the Worker.
- Head
Sampling float64Rate - The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%).
- Logs
Worker
Observability Logs - Log settings for the Worker.
- enabled Boolean
- Whether observability is enabled for the Worker.
- head
Sampling DoubleRate - The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%).
- logs
Worker
Observability Logs - Log settings for the Worker.
- enabled boolean
- Whether observability is enabled for the Worker.
- head
Sampling numberRate - The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%).
- logs
Worker
Observability Logs - Log settings for the Worker.
- enabled bool
- Whether observability is enabled for the Worker.
- head_
sampling_ floatrate - The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%).
- logs
Worker
Observability Logs - Log settings for the Worker.
- enabled Boolean
- Whether observability is enabled for the Worker.
- head
Sampling NumberRate - The sampling rate for observability. From 0 to 1 (1 = 100%, 0.1 = 10%).
- logs Property Map
- Log settings for the Worker.
WorkerObservabilityLogs, WorkerObservabilityLogsArgs
- Enabled bool
- Whether logs are enabled for the Worker.
- Head
Sampling doubleRate - The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%).
- Invocation
Logs bool - Whether invocation logs are enabled for the Worker.
- Enabled bool
- Whether logs are enabled for the Worker.
- Head
Sampling float64Rate - The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%).
- Invocation
Logs bool - Whether invocation logs are enabled for the Worker.
- enabled Boolean
- Whether logs are enabled for the Worker.
- head
Sampling DoubleRate - The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%).
- invocation
Logs Boolean - Whether invocation logs are enabled for the Worker.
- enabled boolean
- Whether logs are enabled for the Worker.
- head
Sampling numberRate - The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%).
- invocation
Logs boolean - Whether invocation logs are enabled for the Worker.
- enabled bool
- Whether logs are enabled for the Worker.
- head_
sampling_ floatrate - The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%).
- invocation_
logs bool - Whether invocation logs are enabled for the Worker.
- enabled Boolean
- Whether logs are enabled for the Worker.
- head
Sampling NumberRate - The sampling rate for logs. From 0 to 1 (1 = 100%, 0.1 = 10%).
- invocation
Logs Boolean - Whether invocation logs are enabled for the Worker.
WorkerSubdomain, WorkerSubdomainArgs
- Enabled bool
- Whether the *.workers.dev subdomain is enabled for the Worker.
- Previews
Enabled bool - Whether preview URLs are enabled for the Worker.
- Enabled bool
- Whether the *.workers.dev subdomain is enabled for the Worker.
- Previews
Enabled bool - Whether preview URLs are enabled for the Worker.
- enabled Boolean
- Whether the *.workers.dev subdomain is enabled for the Worker.
- previews
Enabled Boolean - Whether preview URLs are enabled for the Worker.
- enabled boolean
- Whether the *.workers.dev subdomain is enabled for the Worker.
- previews
Enabled boolean - Whether preview URLs are enabled for the Worker.
- enabled bool
- Whether the *.workers.dev subdomain is enabled for the Worker.
- previews_
enabled bool - Whether preview URLs are enabled for the Worker.
- enabled Boolean
- Whether the *.workers.dev subdomain is enabled for the Worker.
- previews
Enabled Boolean - Whether preview URLs are enabled for the Worker.
WorkerTailConsumer, WorkerTailConsumerArgs
- Name string
- Name of the consumer Worker.
- Name string
- Name of the consumer Worker.
- name String
- Name of the consumer Worker.
- name string
- Name of the consumer Worker.
- name str
- Name of the consumer Worker.
- name String
- Name of the consumer Worker.
Import
$ pulumi import cloudflare:index/worker:Worker example '<account_id>/<worker_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
cloudflare
Terraform Provider.