Provisions a single Document AI schema (
google_document_ai_schema) β a named metadata container β targetinghashicorp/google ~> 7.0on Terraform>= 1.12.0.
- π·οΈ Manages one Document AI schema (
google_document_ai_schema) β a thin, named metadata container with adisplay_name,location, andlabels. - π GENUINE FINDING: this resource has no nested schema-content block β confirmed via both
the schema-JSON dump and the provider's own single live example. Do not confuse this with
terraform-google-document-ai-warehouse-document-schema(a different product with aproperty_definitionsstructure). - π§―
deletion_policydefaults to"PREVENT"β a house extension.
π‘ Why it matters: This is one of a small number of resources in this library where the Terraform surface is genuinely thinner than the resource name suggests β documenting that plainly prevents a caller from expecting a schema-content input that does not exist.
If these Terraform modules have been helpful to you or your organization, I'd appreciate your support in any of the following ways:
- β Star this repository to help others discover this Terraform module.
- π€ Connect with me on LinkedIn: linkedin.com/in/microsoftexpert
- β Buy me a coffee: buymeacoffee.com/microsoftexpert
Whether it's a star, a professional connection, or a coffee, every gesture helps keep these modules actively maintained and continually improving. Thank you for being part of the community!
flowchart LR
SCHEMA["terraform-google-document-ai-schema\n(google_document_ai_schema)"]:::this
classDef this fill:#4285F4,color:#ffffff,stroke:#333333
No sibling module cross-references this resource β stated explicitly rather than inventing a fictional consumer. Validated via the Mermaid Chart MCP before embedding.
flowchart LR
subgraph Inputs["Inputs"]
I1["display_name, location"]
I2["deletion_policy,\nlabels, timeouts"]
end
THIS["google_document_ai_schema.this"]:::this
subgraph Outputs["Outputs"]
O1["id, name"]
O2["create_time, update_time,\nlabels surfaces"]
end
I1 --> THIS
I2 --> THIS
THIS --> O1
THIS --> O2
classDef this fill:#4285F4,color:#ffffff,stroke:#333333
Resource inventory: one keystone resource, google_document_ai_schema.this. No
for_each-managed children β this is a standalone module (see SCOPE.md).
| Terraform | >= 1.12.0 |
hashicorp/google |
~> 7.0 |
| Provider block | None β the caller configures google (ADC, WIF, or a service account key per our authentication model) |
Schema notes that bite:
- No nested schema-content block exists β a genuine finding, not an oversight.
labelsIS supported β unliketerraform-google-looker-instanceandterraform-google-document-ai-processor, this resource has a real labels surface.- No
self_link. - All three
create/update/deletetimeouts are supported.
roles/documentai.editor(orroles/documentai.admin) on the target project.
documentai.googleapis.comenabled.
terraform-google-document-ai-schema/
βββ providers.tf # required_providers + required_version β no provider {} block
βββ variables.tf # google_document_ai_schema.this schema β no schema-content block exists
βββ main.tf # google_document_ai_schema.this β the sole keystone resource
βββ outputs.tf # id, name β no self_link (none exists)
βββ README.md # this file
βββ SCOPE.md # lightweight standalone scope
βββ examples/
βββ basic/ # smallest real call
module "schema" {
source = "git::https://github.com/microsoftexpert/terraform-google-document-ai-schema.git?ref=v1.0.0"
display_name = "loan-document-schema"
location = "us"
}Consumes: none β this resource has no cross-references to other resources in this family.
Emits
| Output | Description |
|---|---|
id |
Terraform-internal id |
name |
Computed resource name |
create_time / update_time |
RFC3339 timestamps |
effective_labels / terraform_labels |
Label surfaces |
1 Β· Minimal schema
module "schema" {
source = "git::https://github.com/microsoftexpert/terraform-google-document-ai-schema.git?ref=v1.0.0"
location = "us"
}2 Β· Named schema with a display name
module "loan_schema" {
source = "git::https://github.com/microsoftexpert/terraform-google-document-ai-schema.git?ref=v1.0.0"
display_name = "loan-document-schema"
location = "us"
}3 Β· EU location
module "eu_schema" {
source = "git::https://github.com/microsoftexpert/terraform-google-document-ai-schema.git?ref=v1.0.0"
display_name = "eu-loan-schema"
location = "eu"
}4 Β· Custom labels
module "labeled_schema" {
source = "git::https://github.com/microsoftexpert/terraform-google-document-ai-schema.git?ref=v1.0.0"
display_name = "labeled-schema"
location = "us"
labels = {
environment = "prod"
team = "lending"
}
}5 Β· Relaxed deletion_policy for a scratch/dev schema
module "dev_schema" {
source = "git::https://github.com/microsoftexpert/terraform-google-document-ai-schema.git?ref=v1.0.0"
display_name = "dev-scratch-schema"
location = "us"
deletion_policy = "DELETE"
}6 Β· Custom timeouts
module "slow_schema" {
source = "git::https://github.com/microsoftexpert/terraform-google-document-ai-schema.git?ref=v1.0.0"
display_name = "large-schema"
location = "us"
timeouts = {
create = "10m"
update = "10m"
delete = "10m"
}
}7 Β· Multiple schemas via a caller-side for_each
locals {
schemas = ["loan-schema", "tax-form-schema", "id-document-schema"]
}
module "schemas" {
source = "git::https://github.com/microsoftexpert/terraform-google-document-ai-schema.git?ref=v1.0.0"
for_each = toset(local.schemas)
display_name = each.value
location = "us"
}8 Β· ποΈ End-to-end composition
module "processor" {
source = "git::https://github.com/microsoftexpert/terraform-google-document-ai-processor.git?ref=v1.0.0"
display_name = "loan-application-ocr"
location = "us"
type = "OCR_PROCESSOR"
}
module "schema" {
source = "git::https://github.com/microsoftexpert/terraform-google-document-ai-schema.git?ref=v1.0.0"
display_name = "loan-document-schema"
location = "us"
labels = {
environment = "prod"
}
}
output "processor_id" {
value = module.processor.id
}
output "schema_id" {
value = module.schema.id
}βΉοΈ These two modules have no direct Terraform cross-reference to each other (confirmed β neither resource's schema references the other); they are composed side-by-side in the same Document AI deployment rather than wired input-to-output.
Required: location.
Grouped summary: identity (display_name, location), operations (deletion_policy,
timeouts), universal tail (labels).
Full object schemas
variable "display_name" {
type = string
default = null
}
variable "location" {
type = string
}
variable "deletion_policy" {
type = string
default = "PREVENT" # "DELETE" | "ABANDON" | "PREVENT"
}
variable "labels" {
type = map(string)
default = {}
}
variable "timeouts" {
type = object({
create = optional(string)
update = optional(string)
delete = optional(string)
})
default = null
}| Output | Description | Notes |
|---|---|---|
id |
Terraform-internal id | No self_link exists |
name |
Computed resource name | Always populated |
create_time / update_time |
RFC3339 timestamps | Always populated |
effective_labels |
All labels present on the resource in GCP | Always populated |
terraform_labels |
Labels from Terraform config + provider defaults | Always populated |
- No nested schema-content block. A genuine finding β this resource is a thin metadata container, not a document-type field definition.
labelsIS supported here, unlike several Document AI/Looker siblings in this batch.location/display_nameare effectively force-new. No rename/re-region API exists.deletion_policydefault is a house extension."PREVENT"is not the provider's own default.
| Concern | Secure default | Opt-out (explicit) |
|---|---|---|
| Deletion guard | deletion_policy = "PREVENT" (house extension) |
Caller sets "DELETE" or "ABANDON" explicitly |
cd terraform-google-document-ai-schema
terraform init -backend=false
terraform validate
terraform fmt -checkPin ?ref=v1.0.0 β never a branch. This library is plan-only; a human applies from CI with valid
ADC/WIF credentials.
terraform validate/fmt -check confirm internal type/reference consistency and formatting only
β they cannot catch GCP API-level rejections. A real terraform plan/apply against a live
project is the only way to confirm this module's behavior end-to-end.
$ terraform output
id = "projects/casey-prod/locations/us/schemas/abcdef0123456789"
name = "projects/casey-prod/locations/us/schemas/abcdef0123456789"
| Symptom | Cause | Fix |
|---|---|---|
destroy fails with a deletion-policy error |
deletion_policy = "PREVENT" (this module's default) |
Apply once with deletion_policy = "DELETE" or "ABANDON", then run the destroy |
| Caller expects a schema-content/field-definition input and finds none | This resource genuinely has no such block (see Architecture Notes) | Use terraform-google-document-ai-warehouse-document-schema if property_definitions-style structured schema content is actually needed β a different product |
google_document_ai_schemaβ Terraform Registry- Document AI β Google Cloud documentation
terraform-google-document-ai-warehouse-document-schema(the structured-schema equivalent in Document AI Warehouse)- This module's
SCOPE.md