Start with a Versioned Capability Inventory
A product page is not a schema. It can announce a capability that the pinned provider cannot manage. The defensible inventory starts from the release you will run: Terraform 1.17.1 and Cloudflare provider 5.28.1.
Three sources disagree by design. Marketing pages describe the newest platform; the API reference describes the live contract; the provider schema describes what this build can create, read, update, import and destroy. When they differ, the schema decides ownership and the API decides behavior.
Absence is evidence, not proof. Provider 5.28.1 ships no Vectorize resource or data source and no top-level Containers resource page. That does not prove the API lacks the operation; it proves Terraform cannot own it in this release.
Import support is part of the test. A resource that can create but not import is harder to adopt and recover. Read the documented import path before promising a migration, and record a missing path as an adoption risk.
Entitlement is the third gate. A schema can accept a field the account cannot use. AI Gateway, AI Search, Pipelines and Containers carry plan or permission requirements, so record the entitlement check beside the resource name.
A name in a binding is not a resource. The Worker version schema accepts a Vectorize index name, a Pipeline name and a container class. Each reference implies an object Terraform did not create, which is exactly the boundary this inventory has to expose.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
P["Product page or API doc
claims a capability"] --> R{"Resource page in
provider 5.28.1?"}
R -->|"no"| N["No Terraform ownership
binding or external owner"]
R -->|"yes"| S{"Schema has the field
and an import path?"}
S -->|"no"| B["Partial support
verify update and drift"]
S -->|"yes"| E{"Entitlement and
token permission?"}
E -->|"no"| D["Plan fails at apply
control-plane denial"]
E -->|"yes"| T["Terraform-owned config
runtime proof still needed"]
T --> V["Probe a request,
query or event"]
V -->|"fails"| F["Config-only boundary
assign a runtime owner"]
V -->|"passes"| OK["Verified capability"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class P,R,S,E primary;
class T,V secondary;
class OK ok;
class D,F danger;
class N,B warn;
The inventory was built from the tagged provider docs tree and the schema, then checked against the API reference. Product landing pages were not treated as evidence. That order matters because a field can exist in the API months before the provider exposes it, and a provider field can lag an API rename by a release.
The matrix has four verdicts. Terraform-owned, binding-only, externally provisioned and unverified. The last two are not failures; they are ownership assignments, and they belong in the same document as the resources you do manage.
One row is a decision, not a wish. If the Terraform column says configuration only, the runtime column needs a named owner, a probe and a cleanup path. A blank owner is how a proof of concept becomes an unowned production dependency.
Version the matrix with the lock file. Provider upgrades add resources and rename fields; an inventory without a version is a rumor. Re-run the schema check when the lock file changes, not when a product page changes.
| Capability | 5.28.1 evidence | Terraform owns | Import shape | Runtime or external owner |
|---|---|---|---|---|
| AI Gateway | cloudflare_ai_gateway and data sources | gateway settings and policies | account/id | model requests, logs and spend |
| AI Gateway routing | cloudflare_ai_gateway_dynamic_routing | element graph | account/gateway/id | route activation if separate |
| AI Search | cloudflare_ai_search_* resources | source config and endpoint policy | account/id (instance) | crawl, index build, queries |
| Vectorize | no resource or data source | index binding only | not available | index, embeddings and vectors |
| Hyperdrive | cloudflare_hyperdrive_config | pool and cache policy | account/hyperdrive_id | SQL, rows and pool restart |
| Pipelines | cloudflare_pipeline_* resources | topology and SQL | account/pipeline_id | events and processing health |
| Containers | no top-level resource | class attachment on the version | account/worker/version | image build, push and scan |
| Agents and Sandboxes | no dedicated resource | Durable Object or Workflow bindings | not available | prompts, tools and session lifecycle |
Separate AI Gateway Configuration from Model Requests
A gateway is a configuration object with a request path attached. Terraform owns the object: cache TTL, log collection, rate limits, retries, authentication, DLP, guardrails, spend limits and zero-data-retention flags. It does not own a prompt, a completion or a token count.
Authentication is a one-way door. The API requires new gateways to enable authentication and states that it cannot be disabled once enabled. Treat that field as a creation-time decision, not a toggle for a later experiment.
Provider credentials belong behind a reference. The gateway schema accepts a Secrets Store identifier, so the key can live outside HCL while Terraform owns the gateway's link to the store. The key value and its rotation remain a store operation.
Dynamic routing is configuration, with a deployment caveat. The routing resource takes an element graph of start, conditional, percentage, rate, model and end nodes. Deployment and version are computed rather than declared, so verify whether create activates the route before claiming live traffic moved.
Logs are a runtime artifact. Collecting logs, shipping them with Logpush or OTel, and classifying them are settings; the log lines appear only after requests. A green apply with an empty log stream proves neither traffic nor a working log path.
The request path has its own failures. An unauthenticated call, a DLP block, a guardrail flag, a rate limit and a spend cap all reject or alter traffic without changing Terraform state. Those outcomes belong in runtime probes.
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart LR
HCL["HCL gateway config
cache, auth, limits"] --> GW["cloudflare_ai_gateway
account-scoped object"]
HCL --> RT["dynamic routing
element graph"]
RT --> GW
STORE["Secrets Store
provider key"] -.->|"store_id reference"| GW
APP["Worker or API client"] -->|"model and prompt"| GW
GW -->|"policy allows"| PROV["Model provider
inference"]
GW -->|"DLP or guardrail"| BLOCK["Blocked or flagged
runtime decision"]
GW -->|"rate or spend cap"| LIMIT["Rejected request
runtime decision"]
PROV --> RESP["Completion and usage
data plane"]
RESP --> APP
GW -->|"logs and OTel"| LOG["Request logs
observability store"]
RT -->|"deployment computed"| ACT["Activation is not
a Terraform argument"]
classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
class HCL,APP,GW primary;
class RT,STORE,RESP secondary;
class PROV ok;
class BLOCK danger;
class LIMIT,LOG,ACT warn;
Cache TTL is not a cache guarantee. The setting enables eligibility; the request's provider, prompt and headers decide whether a hit occurs. Measure the hit rate before claiming cost control.
Retries hide provider latency and multiply cost. Retry counts and backoff are declarative; the extra attempts are billable runtime events. Bound attempts and record the observed retry rate.
A spend limit is a guardrail, not a budget. It caps what the gateway allows; it does not reconcile invoices or attribute spend to a team. Keep cost attribution in the observability or finance layer.
Dynamic routes change the failure story. A conditional or percentage node can send one prompt to two models with different limits, latency and data handling. The routing graph is Terraform's; the chosen branch is a runtime decision that needs its own evidence.
One gateway can serve several applications without becoming theirs. The account-level object is shared infrastructure, while prompts and evaluation belong to each application team. Name both owners before the first request, or the gateway becomes a shared dependency with no shared contract.
Model Vector Indexes and Database Connections at the Right Layer
A vector index is data infrastructure, not application configuration. In provider 5.28.1, Vectorize has no resource page and no data source. The Worker version can bind an index by name, but the index, its dimensions, its metric and every vector remain outside Terraform.
The binding is the only clean join point. A vectorize binding carries index_name into the version. Terraform can prove the name was written; it cannot prove the index exists, has the right dimension or contains a single vector.
Embeddings are a data pipeline. Chunking, embedding model choice, upserts, deletes and re-embedding after a model change are runtime data workflows. Give them a pipeline owner and a versioned dataset, not a Terraform module.
Hyperdrive is the opposite case. Provider 5.28.1 ships a real configuration resource with origin, caching, mTLS and connection-limit fields, plus import support. Terraform owns the pool definition; it does not own the queries or the rows.
The origin password is write-only at the API, sensitive in Terraform. The API never returns the value, and the schema marks it sensitive, but that is not the same as a Terraform write-only argument. If the value must stay out of state, create the configuration through an external secret workflow.
Pool restart is an operation, not a resource. The schema exposes restarted_on as computed, and the restart endpoint has no matching Terraform resource. Treat a pool restart as an explicit runbook step with an owner and a post-restart probe.
Cache behavior belongs to the data layer. Hyperdrive caching can serve stale reads, and a write does not invalidate them. The configuration exposes cache age and stale-while-revalidate; the consistency decision belongs to the application and its data owner.
A database connection is not a schema migration. Terraform can create the Hyperdrive config and the Worker binding, but table creation, indexes and migrations need a migration tool. Mixing those into a provisioner hides the schema's real owner.
Two layers need two proofs. For Vectorize, prove the index and a nearest-neighbour query; for Hyperdrive, prove a pooled connection and a read. A plan only proves the references were accepted.
The inventory row should say which layer is missing. "Vectorize unsupported" is too coarse; the accurate record is "binding supported, index lifecycle external." That sentence tells the next engineer where to look when the first query fails.
Evaluate AI Search, Agents, Sandboxes, Containers and Pipelines Honestly
AI Search is the most Terraform-shaped AI product in the release. Namespace, instance and token each have a resource. The instance and token document an import path; the namespace does not, so an existing namespace is an adoption decision rather than a routine import.
The instance schema carries the retrieval design. Source type, chunking, embedding and reranking models, index method, retrieval options and a public endpoint policy are all declarative. That is a lot of surface for one resource, and it is still only the configuration of the index, not the index itself.
Configuration is not ingestion. Source, sync interval and index method are declarative; the crawl, chunk, embed and index build run asynchronously. status and last_activity are computed, so wait for the reported status to settle and query a known document before declaring success.
The public endpoint is a separate exposure decision. Enabling search, chat completions or MCP creates reachable surfaces with their own authorized hosts and rate limits. Review that block as security configuration, not as a feature flag.
Agents have no resource because an agent is code. The Agents SDK runs on Workers, Durable Objects and Workflows; Terraform can bind a namespace or a workflow, but the prompts, tools, state machine and schedules live in the application.
Sandboxes are deliberately ephemeral. A sandbox is a runtime container lifecycle, often created per task, so modelling each one as a Terraform object would fight its purpose. Provision the surrounding Worker and container attachment; let the SDK create and destroy sandboxes.
Containers are half-supported in a precise way. The top-level Containers product has no resource page in 5.28.1, but the Worker version schema has a containers block that attaches a container to a Durable Object class. The image itself is declared in upload metadata.
That split is the boundary. Terraform can record which class is container-enabled; it cannot build, push, scan or roll back the image. Those belong to a container registry and deployment pipeline.
Pipelines are genuinely declarative at the topology layer. Pipeline, stream and sink resources exist, and the pipeline takes SQL over named connections. The schema exposes status and failure reason as computed, which is a warning: creation is asynchronous.
A pipeline apply is not a data test. Send a known event through the stream, confirm it reaches the sink, and check the failure reason after the first window. A pipeline that exists but never processes is the most expensive kind of green apply.
The honest verdict differs per product. AI Search is configurable but ingestion is not; Agents and Sandboxes are code-shaped; Containers are attachable but not buildable; Pipelines are declarative at the topology and asynchronous at the data. One label for the whole group would hide every one of those differences.
Read the computed fields as warnings. Status, failure reason, last activity and deployment are returned, not accepted. When a schema exposes the outcome as read-only, creation and successful operation are separate events, and the gap belongs in the runbook.
A public endpoint is still production. Enabling AI Search chat completions or MCP creates an internet-facing path whose authorization, rate-limit enforcement and answer quality a plan cannot prove. Treat the runtime owner as a security reviewer as well as an application owner.
Build One Small Supported AI or Data Integration
The smallest honest integration is a gateway plus one request. It exercises the boundary that matters most: Terraform creates a policy object, while a client creates the only evidence that the policy works. It needs no index, no crawl, no container build and no pipeline.
Verify an advanced platform capability
Execution status: design-only. No Cloudflare account, token or model request was used to produce this article. Every identifier below is a placeholder, and every expected result is an acceptance criterion rather than observed output.
Goal. Build one authenticated AI Gateway with a bounded spend limit and a single runtime probe, then record which parts Terraform owns and which remain manual. This is a lab about evidence, not about prompt quality.
Prerequisites. Terraform 1.17.1, Cloudflare provider 5.28.1, an account entitled to AI Gateway, permission to create and destroy a gateway, and read access to its logs. A provider key must already exist in a Secrets Store, created outside this root. Use a disposable account or a dedicated lab gateway name.
| Layer | Terraform owns | Manual owner | Evidence to keep |
|---|---|---|---|
| Gateway object | ID, cache, auth, limits, logs | platform | plan plus read-back |
| Provider key | store reference only | security | store audit record |
| Model request | nothing | application | one response and request ID |
| Policy outcome | DLP and guardrail settings | security | one blocked or flagged test |
| Cost signal | spend limit and rate limit | finance or observability | usage record, redacted |
| Cleanup | gateway destroy | platform | empty gateway list |
- Record the Terraform and provider versions, the account ID and the entitlement check in the lab log. Do not create anything until the versions in the lock file match the ones being evaluated.
- Create or select the provider key in the Secrets Store outside Terraform. Record the store identifier and key name, never the key value, and confirm the gateway's permission model can read that store.
- Declare a gateway with authentication enabled, log collection on, a small cache TTL, a conservative rate limit and a spend limit. Reference the store, keep the key out of HCL, and apply the root.
- Read the gateway back and compare the fields that matter to the plan: authentication, cache, logs, limits and store reference. A successful apply is not yet a read-back check.
- Send one bounded request through the gateway with a harmless prompt and an output-token cap. Capture the status, request ID and usage fields, but do not record the prompt or the key.
- Send the same request without the gateway credential. Expect a rejection before inference, and record the status and error class. This is the authentication proof.
- Send a request that the configured DLP or guardrail policy is designed to catch. Expect a block or a flag, not a normal completion. If the policy does not trigger, fix the policy or narrow the claim; do not describe the control as verified.
- Inspect the request log and usage record. Confirm that the successful request appears with a timestamp, model, status and token count, and that the rejected requests did not create billable completions.
- Destroy the gateway, delete the lab secret only if it was created for this lab, and confirm the gateway list no longer contains the lab object. Check that no dynamic route or store reference survived the destroy.
Expected observation. The apply creates configuration only. The first successful request creates the first log line. The unauthenticated request fails without changing state. The policy test is blocked or flagged according to its configuration. Destroy removes the gateway, while the provider key remains until its own owner removes it.
Failure checks. The lab fails if an unauthenticated request succeeds, if a successful request leaves no log line, if the policy test passes silently, if the spend limit cannot be distinguished from a provider-side quota, or if the key value appears in state, a plan file or the evidence bundle.
Cost and cleanup. One gateway and a handful of short requests stay within ordinary lab usage; there is no indexing, crawl, image build or pipeline run. Destroy the gateway and its lab root, remove the test secret if it was lab-only, and delete the saved plan. Confirm the account's gateway list is empty before closing the lab.
What remains manual. Key creation and rotation, the model request, log verification, policy tuning, spend reconciliation and any dynamic-route activation are outside Terraform. That list is the deliverable as much as the green apply: it names the owners the next incident will call.
The boundary is stable even when the catalog grows. A future provider may add Vectorize, Containers or Agents resources. The test does not change: check the pinned schema, name the fields Terraform can own, name the runtime owner for everything else, and prove the join with one probe.
Keep the lab small enough to destroy. One gateway, one key reference, one request and one policy test produce more defensible evidence than a sprawling AI stack that nobody can afford to re-run. The point is not to avoid advanced products; it is to adopt only the parts you can explain, observe and remove.
Next in the Series
In Observe the Edge: Logpush, Alerts, Audit and Run Evidence, we'll explore Connect delivery and security telemetry to a verified destination while protecting tokens and request data.