workers library

Cloudflare Workers scripts, routes, KV, and Workers for Platforms.

Classes

AppConstant<T>
A value the Stack hands to application code as a static const in the generated AppExports file — known when synth runs, so the app compiles against it.
AppExports
Where synth writes the Dart file application code imports: the Stack's constants, as the static const members of <name>Constants, and a typed reader of its Terraform outputs, <name>Outputs.
AttributeRef<T>
Public for sealed pattern matching, but constructor is private — only TfRef.attribute() may construct instances.
CloudflareWorker
Factory wrapper for cloudflare_worker.
CloudflareWorkersCronTrigger
Factory wrapper for cloudflare_workers_cron_trigger.
CloudflareWorkersCustomDomain
Factory wrapper for cloudflare_workers_custom_domain.
CloudflareWorkersDeployment
Factory wrapper for cloudflare_workers_deployment.
CloudflareWorkersForPlatformsDispatchNamespace
Factory wrapper for cloudflare_workers_for_platforms_dispatch_namespace.
CloudflareWorkersKv
Factory wrapper for cloudflare_workers_kv.
CloudflareWorkersKvNamespace
Factory wrapper for cloudflare_workers_kv_namespace.
CloudflareWorkersRoute
Factory wrapper for cloudflare_workers_route.
CloudflareWorkersScript
Factory wrapper for cloudflare_workers_script.
CloudflareWorkersScriptSubdomain
Factory wrapper for cloudflare_workers_script_subdomain.
CloudflareWorkerVersion
Factory wrapper for cloudflare_worker_version.
DartDefineOutput
An output whose value is the client build's --dart-define file, registered with Stack.addDartDefineOutput.
Data
Base of every user-instantiable Terraform data block.
DataCloudflareWorker
Factory wrapper for cloudflare_worker.
DataCloudflareWorkers
Factory wrapper for cloudflare_workers.
DataCloudflareWorkersCronTrigger
Factory wrapper for cloudflare_workers_cron_trigger.
DataCloudflareWorkersCustomDomain
Factory wrapper for cloudflare_workers_custom_domain.
DataCloudflareWorkersCustomDomains
Factory wrapper for cloudflare_workers_custom_domains.
DataCloudflareWorkersDeployment
Factory wrapper for cloudflare_workers_deployment.
DataCloudflareWorkersDeployments
Factory wrapper for cloudflare_workers_deployments.
DataCloudflareWorkersForPlatformsDispatchNamespace
Factory wrapper for cloudflare_workers_for_platforms_dispatch_namespace.
DataCloudflareWorkersForPlatformsDispatchNamespaces
Factory wrapper for cloudflare_workers_for_platforms_dispatch_namespaces.
DataCloudflareWorkersKv
Factory wrapper for cloudflare_workers_kv.
DataCloudflareWorkersKvNamespace
Factory wrapper for cloudflare_workers_kv_namespace.
DataCloudflareWorkersKvNamespaces
Factory wrapper for cloudflare_workers_kv_namespaces.
DataCloudflareWorkersRoute
Factory wrapper for cloudflare_workers_route.
DataCloudflareWorkersRoutes
Factory wrapper for cloudflare_workers_routes.
DataCloudflareWorkersScript
Factory wrapper for cloudflare_workers_script.
DataCloudflareWorkersScripts
Factory wrapper for cloudflare_workers_scripts.
DataCloudflareWorkersScriptSubdomain
Factory wrapper for cloudflare_workers_script_subdomain.
DataCloudflareWorkerVersion
Factory wrapper for cloudflare_worker_version.
DataRef<T>
Public for sealed pattern matching, but constructor is private — only TfRef.data() may construct instances.
DataWorkerFilter
Typed helper for the filter block of cloudflare_worker (derived from provider schema).
DataWorkersCustomDomainFilter
Typed helper for the filter block of cloudflare_workers_custom_domain (derived from provider schema).
DataWorkersKvNamespaceFilter
Typed helper for the filter block of cloudflare_workers_kv_namespace (derived from provider schema).
DataWorkersScriptFilter
Typed helper for the filter block of cloudflare_workers_script (derived from provider schema).
EnvironmentConstant
The AppConstant.fromEnvironment choice.
GcsBackend
terraform { backend "gcs" { ... } } configuration.
IgnoreAllChanges
IgnoreChanges.all.
IgnoreAttributes
IgnoreChanges.of.
IgnoreChanges
What ignore_changes covers: every attribute, or the listed ones.
InvalidDartDefineOutput
An output of Stack.addDartDefineOutput that cannot carry what it names: an output that is not registered, is sensitive or has no environment value, two outputs read from one variable, or no output at all.
InvalidLifecycle
A lifecycle block Terraform rejects: a data source (or one of its attributes) in replaceTriggeredBy, all inside IgnoreChanges.of, or a condition with an empty error message.
InvalidMoveTarget
A moved block whose to names no resource of the Stack.
InvalidTimeout
A negative timeouts duration.
LifecycleCondition
A precondition or postcondition block: Terraform fails the plan (LifecycleCondition.pre) or the apply (LifecycleCondition.post) with errorMessage when condition is false.
LifecycleOptions
lifecycle { ... } block on a resource.
LocalBackend
terraform { backend "local" { ... } } configuration.
MissingProvider
A block needs a provider configuration the Stack does not register: the provider its type implies (google for google_pubsub_topic), the one its provider meta-argument names, or one a module call passes on.
ModuleCall
A module "<localName>" { ... } call as a Dart value.
NoProviders
The Stack registers no provider, but declares resources or data sources.
ProviderConflict
Two provider registrations Terraform rejects together: two defaults of one name, a repeated alias, an alias that is not an identifier, or configurations of one name with different source / version constraints.
RefConstant<T>
The AppConstant.ref choice.
ReplaceTrigger
What lifecycle.replaceTriggeredBy lists: a resource of the Stack or an attribute getter of one. Resource and TfRef implement it; synth reports a data source or a data-source attribute as an InvalidLifecycle.
Resource
Base of every user-instantiable Terraform resource.
ResourceRef
Public for sealed pattern matching, but constructor is private — only TfRef.resource() may construct instances.
S3Backend
terraform { backend "s3" { ... } } configuration.
Sensitive<T>
What an argument Terraform marks sensitive takes: a variable, an expression or an attribute getter — a value Terraform resolves, never a Dart literal that would be written into main.tf.json.
SensitiveLiteral
A sensitive field is set to a literal, which would write the secret in plain text into main.tf.json.
Stack
User-extended IaC composition root.
StackBackend
Lightweight backend hook. Core ships GcsBackend, S3Backend, and LocalBackend; anything else implements this interface in the caller. The Stack only stores the value and exposes a discriminator for synth's terraform { backend ... } emitter.
StackProvider
Coordination interface between Stack (in this package) and concrete providers (e.g. GoogleProvider in terradart_google). Concrete providers implement every getter using their baked-in constants from Stage 2 codegen.
SynthIssue
One reason a Stack cannot be synthesized.
SynthResult
Bundle returned by StackSynth.synth.
TfAddressed
Anything that exposes a Terraform address, e.g. google_pubsub_topic.orders.
TfArg<T>
A Terraform argument: a Dart-side literal, a reference to another block's attribute (TfRef), a variable or a raw expression.
TfArgExpression<T>
A raw Terraform expression — the tf.json template string, verbatim.
TfArgLiteral<T>
TfArgVariable<T>
TfCollectionType
list(...), set(...) or map(...).
TfMoved
One moved { from = ... to = ... } block: the state object at from now belongs to the resource at to, so a rename does not become a destroy-and-create.
TfObjectType
object({ ... }).
TfOptionalType
optional(<type>[, <default>]).
TfOutput<T>
An output "<name>" { value = ... } block, registered with Stack.addOutput.
TfPrimitiveType
string, number, bool or any.
TfRef<T>
A Terraform-side reference: an attribute of a resource (AttributeRef) or a data source (DataRef), or a whole resource (ResourceRef).
TfTimeouts
timeouts { ... } on a resource or data source: how long Terraform waits for each operation before giving up.
TfTupleType
tuple([...]).
TfType
A Terraform type constraint: string, list(number), object({ name = string }).
TfVariable
One variable "<name>" { ... } declaration.
UndeclaredVariable
A TfArg.variable or var.<name> in an expression names a variable the Stack does not declare.
UnregisteredReference
A block references another block that was never registered on the Stack: built, but not passed to add(...) / addModule(...).
UnresolvableConstant
An AppConstant.ref whose value is not known at synth: the attribute is not set to a literal, is sensitive, does not match the constant's type, or belongs to a block that is not registered.
ValueConstant<T>
The AppConstant.value choice.
WorkerCacheOptions
Typed helper for the previews_base_config.cache_options block of cloudflare_worker (derived from provider schema).
WorkerEnv
Typed helper for the previews_base_config.env block of cloudflare_worker (derived from provider schema).
WorkerIssues
Typed helper for the observability.issues block of cloudflare_worker (derived from provider schema). Shared by every block of this shape in the resource.
WorkerLimits
Typed helper for the previews_base_config.limits block of cloudflare_worker (derived from provider schema).
WorkerLogs
Typed helper for the observability.logs block of cloudflare_worker (derived from provider schema). Shared by every block of this shape in the resource.
WorkerObservability
Typed helper for the observability block of cloudflare_worker (derived from provider schema).
WorkerPlacement
Typed helper for the previews_base_config.placement block of cloudflare_worker (derived from provider schema).
WorkerPreviewsBaseConfig
Typed helper for the previews_base_config block of cloudflare_worker (derived from provider schema).
WorkerPreviewsBaseConfigObservability
Typed helper for the previews_base_config.observability block of cloudflare_worker (derived from provider schema).
WorkersCronTriggerSchedules
Typed helper for the schedules block of cloudflare_workers_cron_trigger (derived from provider schema).
WorkersDeploymentAnnotations
Typed helper for the annotations block of cloudflare_workers_deployment (derived from provider schema).
WorkersDeploymentVersions
Typed helper for the versions block of cloudflare_workers_deployment (derived from provider schema).
WorkersScriptAnnotations
Typed helper for the annotations block of cloudflare_workers_script (derived from provider schema).
WorkersScriptAssets
Typed helper for the assets block of cloudflare_workers_script (derived from provider schema).
WorkersScriptBindings
Typed helper for the bindings block of cloudflare_workers_script (derived from provider schema).
WorkersScriptCache
Typed helper for the exports.cache block of cloudflare_workers_script (derived from provider schema).
WorkersScriptCacheOptions
Typed helper for the cache_options block of cloudflare_workers_script (derived from provider schema).
WorkersScriptConfig
Typed helper for the assets.config block of cloudflare_workers_script (derived from provider schema).
WorkersScriptContent
At most one of content, content_file on cloudflare_workers_script: the provider rejects more than one, so each variant sets one of them and a null choice sets none.
WorkersScriptContentChoice
The WorkersScriptContent.content choice: sets content.
WorkersScriptContentFile
The WorkersScriptContent.contentFile choice: sets content_file.
WorkersScriptExports
Typed helper for the exports block of cloudflare_workers_script (derived from provider schema).
WorkersScriptFiles
Typed helper for the files block of cloudflare_workers_script (derived from provider schema).
WorkersScriptFilesContent
Exactly one of content_base64, content_file on the files block of cloudflare_workers_script: the provider rejects none and more than one, so each variant sets one of them.
WorkersScriptFilesContentBase64
The WorkersScriptFilesContent.contentBase64 choice: sets content_base64.
WorkersScriptFilesContentFile
The WorkersScriptFilesContent.contentFile choice: sets content_file.
WorkersScriptIssues
Typed helper for the observability.issues block of cloudflare_workers_script (derived from provider schema).
WorkersScriptLimits
Typed helper for the limits block of cloudflare_workers_script (derived from provider schema).
WorkersScriptLogs
Typed helper for the observability.logs block of cloudflare_workers_script (derived from provider schema).
WorkersScriptMigrations
Typed helper for the migrations block of cloudflare_workers_script (derived from provider schema).
WorkersScriptObservability
Typed helper for the observability block of cloudflare_workers_script (derived from provider schema).
WorkersScriptOutbound
Typed helper for the bindings.outbound block of cloudflare_workers_script (derived from provider schema).
WorkersScriptPackageDependencies
Typed helper for the package_dependencies block of cloudflare_workers_script (derived from provider schema).
WorkersScriptPlacement
Typed helper for the placement block of cloudflare_workers_script (derived from provider schema).
WorkersScriptRenamedClasses
Typed helper for the migrations.renamed_classes block of cloudflare_workers_script (derived from provider schema). Shared by every block of this shape in the resource.
WorkersScriptSimple
Typed helper for the bindings.simple block of cloudflare_workers_script (derived from provider schema).
WorkersScriptSource
At most one of directory, jwt on the assets block of cloudflare_workers_script: the provider rejects more than one, so each variant sets one of them and a null choice sets none.
WorkersScriptSourceDirectory
The WorkersScriptSource.directory choice: sets directory.
WorkersScriptSourceJwt
The WorkersScriptSource.jwt choice: sets jwt.
WorkersScriptSteps
Typed helper for the migrations.steps block of cloudflare_workers_script (derived from provider schema).
WorkersScriptTailConsumers
Typed helper for the tail_consumers block of cloudflare_workers_script (derived from provider schema).
WorkersScriptTraces
Typed helper for the observability.traces block of cloudflare_workers_script (derived from provider schema).
WorkersScriptTransferredClasses
Typed helper for the migrations.transferred_classes block of cloudflare_workers_script (derived from provider schema). Shared by every block of this shape in the resource.
WorkersScriptWorker
Typed helper for the bindings.outbound.worker block of cloudflare_workers_script (derived from provider schema).
WorkerSubdomain
Typed helper for the subdomain block of cloudflare_worker (derived from provider schema).
WorkerTailConsumers
Typed helper for the tail_consumers block of cloudflare_worker (derived from provider schema). Shared by every block of this shape in the resource.
WorkerTarget
Typed helper for the previews_base_config.placement.target block of cloudflare_worker (derived from provider schema).
WorkerTraces
Typed helper for the observability.traces block of cloudflare_worker (derived from provider schema). Shared by every block of this shape in the resource.
WorkerVersionAnnotations
Typed helper for the annotations block of cloudflare_worker_version (derived from provider schema).
WorkerVersionAssets
Typed helper for the assets block of cloudflare_worker_version (derived from provider schema).
WorkerVersionAssetsSource
At most one of directory, jwt on the assets block of cloudflare_worker_version: the provider rejects more than one, so each variant sets one of them and a null choice sets none.
WorkerVersionAssetsSourceDirectory
The WorkerVersionAssetsSource.directory choice: sets directory.
WorkerVersionAssetsSourceJwt
The WorkerVersionAssetsSource.jwt choice: sets jwt.
WorkerVersionBindings
Typed helper for the bindings block of cloudflare_worker_version (derived from provider schema).
WorkerVersionCache
Typed helper for the exports.cache block of cloudflare_worker_version (derived from provider schema).
WorkerVersionCacheOptions
Typed helper for the cache_options block of cloudflare_worker_version (derived from provider schema).
WorkerVersionConfig
Typed helper for the assets.config block of cloudflare_worker_version (derived from provider schema).
WorkerVersionContainers
Typed helper for the containers block of cloudflare_worker_version (derived from provider schema).
WorkerVersionContent
Exactly one of content_base64, content_file on the modules block of cloudflare_worker_version: the provider rejects none and more than one, so each variant sets one of them.
WorkerVersionContentBase64
The WorkerVersionContent.contentBase64 choice: sets content_base64.
WorkerVersionContentFile
The WorkerVersionContent.contentFile choice: sets content_file.
WorkerVersionExports
Typed helper for the exports block of cloudflare_worker_version (derived from provider schema).
WorkerVersionLimits
Typed helper for the limits block of cloudflare_worker_version (derived from provider schema).
WorkerVersionMigrations
Typed helper for the migrations block of cloudflare_worker_version (derived from provider schema).
WorkerVersionModules
Typed helper for the modules block of cloudflare_worker_version (derived from provider schema).
WorkerVersionOutbound
Typed helper for the bindings.outbound block of cloudflare_worker_version (derived from provider schema).
WorkerVersionPackageDependencies
Typed helper for the package_dependencies block of cloudflare_worker_version (derived from provider schema).
WorkerVersionParams
Typed helper for the bindings.outbound.params block of cloudflare_worker_version (derived from provider schema).
WorkerVersionPlacement
Typed helper for the placement block of cloudflare_worker_version (derived from provider schema).
WorkerVersionRenamedClasses
Typed helper for the migrations.renamed_classes block of cloudflare_worker_version (derived from provider schema). Shared by every block of this shape in the resource.
WorkerVersionSimple
Typed helper for the bindings.simple block of cloudflare_worker_version (derived from provider schema).
WorkerVersionSteps
Typed helper for the migrations.steps block of cloudflare_worker_version (derived from provider schema).
WorkerVersionTarget
Typed helper for the placement.target block of cloudflare_worker_version (derived from provider schema).
WorkerVersionTransferredClasses
Typed helper for the migrations.transferred_classes block of cloudflare_worker_version (derived from provider schema). Shared by every block of this shape in the resource.
WorkerVersionWorker
Typed helper for the bindings.outbound.worker block of cloudflare_worker_version (derived from provider schema).

Enums

ResourceKind
Whether a Stack entry is a resource block or a data block in Terraform JSON.

Extension Types

DataWorkerOrder
order — derived from the provider schema description.
DataWorkerOrderBy
order_by — derived from the provider schema description.
DataWorkersKvNamespaceDirection
direction — derived from the provider schema description.
DataWorkersKvNamespaceOrder
order — derived from the provider schema description.
OutputEnvironment
The environment Stack.outputEnvironment returns: each variable and its value, in registration order.
RefTo
A reference to a resource of type R, for an argument that names another resource (network, vpc_id, role_arn, ...).
WorkerMode
mode — derived from the provider schema description.
WorkerPropagationPolicy
propagation_policy — derived from the provider schema description.
WorkersDeploymentStrategy
Workers Deployment enum for strategy.
WorkersKvNamespaceJurisdiction
Workers Kv Namespace enum for jurisdiction.
WorkersScriptContentType
Workers Script Content enum for content_type.
WorkersScriptFormat
format — derived from the provider schema description.
WorkersScriptHtmlHandling
html_handling — derived from the provider schema description.
WorkersScriptJurisdiction
jurisdiction — derived from the provider schema description.
WorkersScriptMode
mode — derived from the provider schema description.
WorkersScriptNotFoundHandling
not_found_handling — derived from the provider schema description.
WorkersScriptPropagationPolicy
propagation_policy — derived from the provider schema description.
WorkersScriptType
type — derived from the provider schema description.
WorkersScriptUsageModel
Workers Script Usage enum for usage_model.
WorkersScriptUsages
usages — derived from the provider schema description.
WorkerVersionBindingsType
type — derived from the provider schema description.
WorkerVersionExportsType
type — derived from the provider schema description.
WorkerVersionFormat
format — derived from the provider schema description.
WorkerVersionHtmlHandling
html_handling — derived from the provider schema description.
WorkerVersionIdentity
identity — derived from the provider schema description.
WorkerVersionInclude
Worker Version enum for include.
WorkerVersionJurisdiction
jurisdiction — derived from the provider schema description.
WorkerVersionMode
mode — derived from the provider schema description.
WorkerVersionNotFoundHandling
not_found_handling — derived from the provider schema description.
WorkerVersionState
state — derived from the provider schema description.
WorkerVersionStorage
storage — derived from the provider schema description.
WorkerVersionUsageModel
Worker Version Usage enum for usage_model.

Extensions

RefToList on TfArg<List<RefTo<R>>>
A list-valued reference argument (security_group_ids, subnet_ids): a literal list of RefTos, or one value that is the whole list (TfArg.variable('subnet_ids'), TfArg.expression(...)).
TerraformDurationExt on Duration
Converts a Dart Duration into a Terraform duration string ("604800s").

Constants

terradartManifestVariable → const String
The environment variable the terradart command sets to the file runStack and runEnvironments describe what they wrote in.

Functions

runEnvironments<E extends Enum>(List<String> args, List<E> environments, Stack build(E env), {String dir(E env)?, String? workspace(E env)?, List<String> backendConfig(E env)?, E? defaultEnv}) → Future<void>
The entry point of a project with one Stack per environment. The environments are the members of an enum of the project's own — any names, each carrying its values — so the Stack takes a typed env and derives everything per environment from it, its backend included:
runStack(List<String> args, Stack build(), {String out = 'tf-out'}) → Future<void>
The entry point of a project with one Stack: writes it to out.

Exceptions / Errors

DuplicateModuleError
A ModuleCall registered twice under one name.
DuplicateResourceError
Thrown by Stack.add when an entry with the same (kind, terraformType, localName) triple is registered twice.
SynthException
Thrown by Stack.synth() and Stack.writeTo() when the Stack has one or more SynthIssues. Nothing is written.