1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. WorkersSecret
Cloudflare v5.49.1 published on Tuesday, Feb 18, 2025 by Pulumi

cloudflare.WorkersSecret

Explore with Pulumi AI

Provides a Cloudflare Worker secret resource.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";

const mySecret = new cloudflare.WorkersSecret("my_secret", {
    accountId: "f037e56e89293a057740de681ac9abbe",
    name: "MY_EXAMPLE_SECRET_TEXT",
    scriptName: "script_1",
    secretText: "my_secret_value",
});
Copy
import pulumi
import pulumi_cloudflare as cloudflare

my_secret = cloudflare.WorkersSecret("my_secret",
    account_id="f037e56e89293a057740de681ac9abbe",
    name="MY_EXAMPLE_SECRET_TEXT",
    script_name="script_1",
    secret_text="my_secret_value")
Copy
package main

import (
	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := cloudflare.NewWorkersSecret(ctx, "my_secret", &cloudflare.WorkersSecretArgs{
			AccountId:  pulumi.String("f037e56e89293a057740de681ac9abbe"),
			Name:       pulumi.String("MY_EXAMPLE_SECRET_TEXT"),
			ScriptName: pulumi.String("script_1"),
			SecretText: pulumi.String("my_secret_value"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;

return await Deployment.RunAsync(() => 
{
    var mySecret = new Cloudflare.WorkersSecret("my_secret", new()
    {
        AccountId = "f037e56e89293a057740de681ac9abbe",
        Name = "MY_EXAMPLE_SECRET_TEXT",
        ScriptName = "script_1",
        SecretText = "my_secret_value",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.WorkersSecret;
import com.pulumi.cloudflare.WorkersSecretArgs;
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 mySecret = new WorkersSecret("mySecret", WorkersSecretArgs.builder()
            .accountId("f037e56e89293a057740de681ac9abbe")
            .name("MY_EXAMPLE_SECRET_TEXT")
            .scriptName("script_1")
            .secretText("my_secret_value")
            .build());

    }
}
Copy
resources:
  mySecret:
    type: cloudflare:WorkersSecret
    name: my_secret
    properties:
      accountId: f037e56e89293a057740de681ac9abbe
      name: MY_EXAMPLE_SECRET_TEXT
      scriptName: script_1
      secretText: my_secret_value
Copy

Create WorkersSecret Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new WorkersSecret(name: string, args: WorkersSecretArgs, opts?: CustomResourceOptions);
@overload
def WorkersSecret(resource_name: str,
                  args: WorkersSecretArgs,
                  opts: Optional[ResourceOptions] = None)

@overload
def WorkersSecret(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  account_id: Optional[str] = None,
                  name: Optional[str] = None,
                  script_name: Optional[str] = None,
                  secret_text: Optional[str] = None)
func NewWorkersSecret(ctx *Context, name string, args WorkersSecretArgs, opts ...ResourceOption) (*WorkersSecret, error)
public WorkersSecret(string name, WorkersSecretArgs args, CustomResourceOptions? opts = null)
public WorkersSecret(String name, WorkersSecretArgs args)
public WorkersSecret(String name, WorkersSecretArgs args, CustomResourceOptions options)
type: cloudflare:WorkersSecret
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. WorkersSecretArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. WorkersSecretArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. WorkersSecretArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. WorkersSecretArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. WorkersSecretArgs
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 workersSecretResource = new Cloudflare.WorkersSecret("workersSecretResource", new()
{
    AccountId = "string",
    Name = "string",
    ScriptName = "string",
    SecretText = "string",
});
Copy
example, err := cloudflare.NewWorkersSecret(ctx, "workersSecretResource", &cloudflare.WorkersSecretArgs{
	AccountId:  pulumi.String("string"),
	Name:       pulumi.String("string"),
	ScriptName: pulumi.String("string"),
	SecretText: pulumi.String("string"),
})
Copy
var workersSecretResource = new WorkersSecret("workersSecretResource", WorkersSecretArgs.builder()
    .accountId("string")
    .name("string")
    .scriptName("string")
    .secretText("string")
    .build());
Copy
workers_secret_resource = cloudflare.WorkersSecret("workersSecretResource",
    account_id="string",
    name="string",
    script_name="string",
    secret_text="string")
Copy
const workersSecretResource = new cloudflare.WorkersSecret("workersSecretResource", {
    accountId: "string",
    name: "string",
    scriptName: "string",
    secretText: "string",
});
Copy
type: cloudflare:WorkersSecret
properties:
    accountId: string
    name: string
    scriptName: string
    secretText: string
Copy

WorkersSecret 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 WorkersSecret resource accepts the following input properties:

AccountId This property is required. string
The account identifier to target for the resource.
Name
This property is required.
Changes to this property will trigger replacement.
string
The name of the Worker secret. Modifying this attribute will force creation of a new resource.
ScriptName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Worker script to associate the secret with. Modifying this attribute will force creation of a new resource.
SecretText
This property is required.
Changes to this property will trigger replacement.
string
The text of the Worker secret. Modifying this attribute will force creation of a new resource.
AccountId This property is required. string
The account identifier to target for the resource.
Name
This property is required.
Changes to this property will trigger replacement.
string
The name of the Worker secret. Modifying this attribute will force creation of a new resource.
ScriptName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Worker script to associate the secret with. Modifying this attribute will force creation of a new resource.
SecretText
This property is required.
Changes to this property will trigger replacement.
string
The text of the Worker secret. Modifying this attribute will force creation of a new resource.
accountId This property is required. String
The account identifier to target for the resource.
name
This property is required.
Changes to this property will trigger replacement.
String
The name of the Worker secret. Modifying this attribute will force creation of a new resource.
scriptName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Worker script to associate the secret with. Modifying this attribute will force creation of a new resource.
secretText
This property is required.
Changes to this property will trigger replacement.
String
The text of the Worker secret. Modifying this attribute will force creation of a new resource.
accountId This property is required. string
The account identifier to target for the resource.
name
This property is required.
Changes to this property will trigger replacement.
string
The name of the Worker secret. Modifying this attribute will force creation of a new resource.
scriptName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Worker script to associate the secret with. Modifying this attribute will force creation of a new resource.
secretText
This property is required.
Changes to this property will trigger replacement.
string
The text of the Worker secret. Modifying this attribute will force creation of a new resource.
account_id This property is required. str
The account identifier to target for the resource.
name
This property is required.
Changes to this property will trigger replacement.
str
The name of the Worker secret. Modifying this attribute will force creation of a new resource.
script_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the Worker script to associate the secret with. Modifying this attribute will force creation of a new resource.
secret_text
This property is required.
Changes to this property will trigger replacement.
str
The text of the Worker secret. Modifying this attribute will force creation of a new resource.
accountId This property is required. String
The account identifier to target for the resource.
name
This property is required.
Changes to this property will trigger replacement.
String
The name of the Worker secret. Modifying this attribute will force creation of a new resource.
scriptName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Worker script to associate the secret with. Modifying this attribute will force creation of a new resource.
secretText
This property is required.
Changes to this property will trigger replacement.
String
The text of the Worker secret. Modifying this attribute will force creation of a new resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the WorkersSecret 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 WorkersSecret Resource

Get an existing WorkersSecret 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?: WorkersSecretState, opts?: CustomResourceOptions): WorkersSecret
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[str] = None,
        name: Optional[str] = None,
        script_name: Optional[str] = None,
        secret_text: Optional[str] = None) -> WorkersSecret
func GetWorkersSecret(ctx *Context, name string, id IDInput, state *WorkersSecretState, opts ...ResourceOption) (*WorkersSecret, error)
public static WorkersSecret Get(string name, Input<string> id, WorkersSecretState? state, CustomResourceOptions? opts = null)
public static WorkersSecret get(String name, Output<String> id, WorkersSecretState state, CustomResourceOptions options)
resources:  _:    type: cloudflare:WorkersSecret    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
AccountId string
The account identifier to target for the resource.
Name Changes to this property will trigger replacement. string
The name of the Worker secret. Modifying this attribute will force creation of a new resource.
ScriptName Changes to this property will trigger replacement. string
The name of the Worker script to associate the secret with. Modifying this attribute will force creation of a new resource.
SecretText Changes to this property will trigger replacement. string
The text of the Worker secret. Modifying this attribute will force creation of a new resource.
AccountId string
The account identifier to target for the resource.
Name Changes to this property will trigger replacement. string
The name of the Worker secret. Modifying this attribute will force creation of a new resource.
ScriptName Changes to this property will trigger replacement. string
The name of the Worker script to associate the secret with. Modifying this attribute will force creation of a new resource.
SecretText Changes to this property will trigger replacement. string
The text of the Worker secret. Modifying this attribute will force creation of a new resource.
accountId String
The account identifier to target for the resource.
name Changes to this property will trigger replacement. String
The name of the Worker secret. Modifying this attribute will force creation of a new resource.
scriptName Changes to this property will trigger replacement. String
The name of the Worker script to associate the secret with. Modifying this attribute will force creation of a new resource.
secretText Changes to this property will trigger replacement. String
The text of the Worker secret. Modifying this attribute will force creation of a new resource.
accountId string
The account identifier to target for the resource.
name Changes to this property will trigger replacement. string
The name of the Worker secret. Modifying this attribute will force creation of a new resource.
scriptName Changes to this property will trigger replacement. string
The name of the Worker script to associate the secret with. Modifying this attribute will force creation of a new resource.
secretText Changes to this property will trigger replacement. string
The text of the Worker secret. Modifying this attribute will force creation of a new resource.
account_id str
The account identifier to target for the resource.
name Changes to this property will trigger replacement. str
The name of the Worker secret. Modifying this attribute will force creation of a new resource.
script_name Changes to this property will trigger replacement. str
The name of the Worker script to associate the secret with. Modifying this attribute will force creation of a new resource.
secret_text Changes to this property will trigger replacement. str
The text of the Worker secret. Modifying this attribute will force creation of a new resource.
accountId String
The account identifier to target for the resource.
name Changes to this property will trigger replacement. String
The name of the Worker secret. Modifying this attribute will force creation of a new resource.
scriptName Changes to this property will trigger replacement. String
The name of the Worker script to associate the secret with. Modifying this attribute will force creation of a new resource.
secretText Changes to this property will trigger replacement. String
The text of the Worker secret. Modifying this attribute will force creation of a new resource.

Import

$ pulumi import cloudflare:index/workersSecret:WorkersSecret example <account_id>/<script_name>/<secret_name>
Copy

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.