The init directory in the GroundX operator uses Terraform conditional logic to decide whether to provision new infrastructure services or connect to existing ones.
Integration vs. Provisioning Logic
For most core services (Cache, Database, File Storage, Search, Streaming, and Summary), the operator follows a pattern: if you provide a complete set of connection details for an existing service via the *_existing variables, the operator will skip provisioning a new instance and instead use your provided values. If any required parameter is missing (null), the operator sets a create_* flag to true and provisions the service internally.
Key Decision Variables
- Storage Class: Created only if
var.app_internal.pv_class is not set to "empty". - OCR Credentials: A
kubernetes_config_map for layout_ocr_credentials is only created if var.layout.ocr.type is "google" and the credentials path is not empty. - Cluster Type: The
is_openshift local variable is derived from var.cluster.type == "openshift", allowing for platform-specific configurations.