Skip to content

lookup

Source: src/Cloudflare/VpcService/VpcServiceLookup.ts

Look up an existing Cloudflare VPC service (managed outside this stack) without managing its lifecycle — the data-source form (what Terraform calls a data source and Pulumi an invoke). Reads the service by serviceId or name and returns an Output of its Attributes, resolved during plan/deploy and inert inside deployed bundles. Place it in a Worker’s env to attach a vpc_service binding.

Look up by ID

const service = Cloudflare.VpcService.lookup({
serviceId: "123e4567-e89b-12d3-a456-426614174000",
});

Look up by name

const service = Cloudflare.VpcService.lookup({ name: "my-vpc-service" });

Bind to a Worker

const worker = yield* Cloudflare.Worker("Worker", {
main: "./src/worker.ts",
env: { VPC: Cloudflare.VpcService.lookup({ name: "my-vpc-service" }) },
});