Skip to main content

Certification track: Associate Cloud Engineer (ACE)

OpenEMR on GKE Autopilot

OpenEMR on GKE Autopilot

OpenEMR is the world's most widely adopted open-source Electronic Health Records (EHR) and practice management system, used by 100,000+ healthcare providers across 100+ countries. This module deploys OpenEMR on GKE Autopilot on top of the App_GKE foundation, which provisions and manages the shared Google Cloud and Kubernetes infrastructure.

This guide focuses on the cloud services OpenEMR uses and how to explore and operate them from the Google Cloud Console and the command line. For the mechanics common to every GKE application — Workload Identity, ingress, autoscaling, CI/CD, Cloud Armor, IAP, Binary Authorization, VPC Service Controls, backups, and the deployment lifecycle — refer to the App_GKE foundation guide rather than repeating them here.


1. Overview

OpenEMR runs as an Apache/PHP 8.3 FPM workload on Alpine 3.20. The deployment wires together a focused set of Google Cloud services:

CapabilityGoogle Cloud serviceNotes
ComputeGKE AutopilotApache/PHP pods, 2 vCPU / 4 GiB by default, horizontally autoscaled
DatabaseCloud SQL for MySQL 8.0Required — OpenEMR does not support PostgreSQL
Patient documentsFilestore (NFS)sites/ directory with patient documents, session cache, and application state shared across all replicas
Object storageCloud StorageA general-purpose data bucket
Session storeRedisEnabled by default; falls back to the NFS server IP when no Redis host is given
SecretsSecret ManagerAuto-generated admin password (OE_PASS) and database password (MYSQL_PASS)
IngressCloud Load BalancingExternal LoadBalancer, optional custom domain + managed certificate

Sensible defaults worth knowing up front:

  • MySQL 8.0 is mandatory. The database engine is fixed; selecting PostgreSQL or NONE breaks startup.
  • NFS is mandatory. OpenEMR's sites/ directory — containing sqlconf.php, patient documents, Twig/Smarty caches, and uploaded files — must be on a shared NFS volume. The application cannot function without it.
  • Redis is enabled by default. When max_instance_count > 1, a shared session store is required to prevent PHP session loss across pods.
  • Session affinity is ClientIP. OpenEMR relies on PHP sessions, so requests from a browser are pinned to one pod.
  • First-boot installation is automated and slow. On first deploy, three initialization jobs run in sequence: nfs-init (NFS directory setup), db-init (MySQL user and database creation), and openemr-install (schema installation via auto_configure.php). The startup probe allows up to 120 seconds for the application to become ready after jobs complete.
  • The OpenEMR admin password is generated automatically and stored in Secret Manager; you never set it in plain text.
  • min_instance_count defaults to 1. Scale-to-zero is not recommended for clinical EHR systems — cold starts add 20–40 seconds of latency that clinicians may interpret as a system failure.

2. Google Cloud Services & How to Explore Them

All commands assume you have run gcloud container clusters get-credentials <cluster> --region <region> --project <project> and that PROJECT, REGION, and NAMESPACE are set. The namespace and other identifiers are reported in the deployment Outputs.

A. GKE Autopilot — the OpenEMR workload

OpenEMR pods are scheduled on Autopilot, which bills for the CPU/memory the pods actually request. Horizontal Pod Autoscaling sizes the deployment between the minimum and maximum replica counts.

  • Console: Kubernetes Engine → Workloads → select the OpenEMR workload to see pods, events, and probe status. Kubernetes Engine → Services & Ingress shows the external IP.
  • CLI:
    kubectl get pods,svc,hpa -n "$NAMESPACE"
    kubectl logs -n "$NAMESPACE" deploy/<service-name> --tail=100
    kubectl describe hpa -n "$NAMESPACE" # current vs target utilisation

See App_GKE for how Autopilot, scaling, and the workload type (Deployment vs StatefulSet) are managed.

B. Cloud SQL for MySQL 8.0

OpenEMR stores all clinical data (patient records, scheduling, billing) in a managed Cloud SQL for MySQL 8.0 instance. Pods reach it privately through the Cloud SQL Auth Proxy sidecar over a Unix socket, so no public IP is exposed. On first deploy the db-init job creates the application database and user before the openemr-install job runs the OpenEMR schema installer.

  • Console: SQL → select the instance for connections, backups, flags, and metrics.
  • CLI:
    gcloud sql instances list --project "$PROJECT"
    gcloud sql instances describe <instance-name> --project "$PROJECT"
    # Open an interactive shell to inspect schema/data:
    gcloud sql connect <instance-name> --user=<db-user> --project "$PROJECT"

The instance name, database name, user, and the Secret Manager secret holding the password are all surfaced in the Outputs. For the connection model, automated backups, and password rotation, see App_GKE.

C. Filestore (NFS) and Cloud Storage

OpenEMR's sites/ directory is written to a Filestore (NFS) share mounted into every pod at /var/www/localhost/htdocs/openemr/sites. This directory contains sqlconf.php (which signals installation completion), patient-uploaded documents, Twig/Smarty template caches, and session data. All replicas must share the same NFS mount. A general-purpose Cloud Storage bucket is also provisioned.

  • Console: Filestore → Instances for the NFS share; Cloud Storage → Buckets for the data bucket.
  • CLI:
    gcloud filestore instances list --project "$PROJECT"
    gcloud storage buckets list --project "$PROJECT"
    # Confirm the NFS share is mounted and sites directory exists:
    kubectl exec -n "$NAMESPACE" deploy/<service-name> -- \
    ls /var/www/localhost/htdocs/openemr/sites/default/

See App_GKE for NFS provisioning, GCS Fuse, and CMEK options.

D. Redis session store

Redis backs OpenEMR's PHP session store. When redis_host is left empty and NFS is enabled, the NFS server's co-located Redis instance is used automatically. In multi-replica deployments, a shared session store is required to prevent session loss.

  • Console: Memorystore → Redis (if using a managed Memorystore instance).
  • CLI:
    redis-cli -h <redis-host> ping        # from a host with network access
    redis-cli -h <redis-host> info keyspace
    # Confirm REDIS_SERVER is set inside the pod:
    kubectl exec -n "$NAMESPACE" deploy/<service-name> -- env | grep REDIS

E. Secret Manager

The OpenEMR admin password (OE_PASS) and the MySQL database password (MYSQL_PASS) are stored as Secret Manager secrets and injected into pods at runtime via the Secret Store CSI driver. Plaintext never appears in configuration.

  • Console: Security → Secret Manager.
  • CLI:
    gcloud secrets list --project "$PROJECT"
    # Retrieve the admin password to log in for the first time:
    gcloud secrets versions access latest \
    --secret=<admin-password-secret-id> --project "$PROJECT"

The admin password secret ID is exposed as the admin_password_secret_id output. The database password secret name is in database_password_secret. See App_GKE for the Secret Store CSI integration and rotation.

F. Networking & ingress

By default the workload is exposed through an external Cloud Load Balancing IP. A custom domain with a Google-managed certificate can be enabled, and a static IP can be reserved so the address survives redeploys.

  • Console: Network services → Load balancing; VPC network → IP addresses.
  • CLI:
    kubectl get ingress,svc -n "$NAMESPACE"
    gcloud compute addresses list --project "$PROJECT"
    # Test the login page from within the cluster:
    kubectl exec -n "$NAMESPACE" deploy/<service-name> -- \
    curl -s -o /dev/null -w "%{http_code}" http://localhost/interface/login/login.php

See App_GKE for custom domains, Cloud CDN, and static IP details.

G. Cloud Logging & Monitoring

Pod stdout/stderr flow to Cloud Logging; GKE and Cloud SQL metrics flow to Cloud Monitoring. Optional uptime checks and alert policies are available.

  • Console: Logging → Logs Explorer; Monitoring → Dashboards / Alerting.
  • CLI:
    gcloud logging read \
    'resource.type="k8s_container" AND resource.labels.namespace_name="'"$NAMESPACE"'"' \
    --project "$PROJECT" --limit 50

3. OpenEMR Application Behaviour

  • Three-stage first-deploy initialization. The following Kubernetes Jobs run in sequence on every apply:

    JobPurposeDepends on
    nfs-initPrepares the NFS sites/ directory structure, sets ownership to UID 1000 (Apache), and optionally restores a backup
    db-initCreates the MySQL database and application user
    openemr-installRuns auto_configure.php in K8S=admin mode to install the database schema and create the admin account; writes $config=1 to sqlconf.php on NFSnfs-init, db-init

    The main application pod starts only after openemr-install completes and sees $config=1 in sqlconf.php — it then skips the installer and begins serving. Inspect the jobs:

    kubectl get jobs -n "$NAMESPACE"
    kubectl logs -n "$NAMESPACE" job/nfs-init
    kubectl logs -n "$NAMESPACE" job/openemr-install
  • Startup can take 5–20 minutes on first boot. The openemr-install job runs the full PHP schema installer, which is slow. The startup probe (TCP on port 80, 12 failure threshold) allows 120 seconds for the pod to become ready after jobs complete. On a truly fresh install consider raising failure_threshold in the startup probe.

  • Version-aware upgrades. On subsequent deployments the startup script compares the image version against the NFS-stored version and runs the appropriate upgrade scripts (fsupgrade-N.sh) automatically.

  • Temporary health probe server. During the installation phase openemr.sh starts a PHP built-in web server on port 80 that returns HTTP 200 on the health probe path, preventing the pod from being killed while the installer runs.

  • Admin login. The initial administrator username is admin. The password is auto-generated and stored in Secret Manager — retrieve it with:

    gcloud secrets versions access latest \
    --secret=<admin_password_secret_id> --project "$PROJECT"

    If the admin account is locked after failed login attempts, use the /root/unlock_admin.sh <new_password> utility inside the container.

  • K8S=yes environment variable. The application receives K8S=yes at runtime, which instructs openemr.sh to use the Kubernetes-aware startup path (skipping slow recursive chown operations that would cause timeout failures).


4. Configuration Variables

Variables are grouped exactly as they appear on the deployment platform. Only settings specific to or notable for OpenEMR are listed; every other input is inherited from App_GKE with its standard behaviour and defaults.

Group 0 — Module Metadata

VariableDefaultDescription
module_description / module_documentation / module_dependency / module_services(set)Platform catalogue metadata.
credit_cost300Platform credits consumed per deployment.
require_credit_purchasesfalseRequire credit balance check before deploy.
enable_purgetrueAllow full resource deletion on destroy.
public_accesstrueMake the module visible in the public catalogue.
require_services_gcp_moduletrueFail at plan time if no Services_GCP-managed VPC is detected in the project.
shared_users / technical_support_users[]Users granted access / routed support requests, regardless of public_access.
resource_creator_identityrad-module-creator@YOUR_PLATFORM_PROJECT.iam.gserviceaccount.comService account Terraform uses to create resources.
impersonation_service_account""SA to impersonate for shell scripts (discovery, image mirroring, NFS setup). Leave empty to use runner credentials.
job_execution_wait_timeout900Max seconds a deployment waits for the db-init job before aborting the apply.
explicit_secret_values / scripts_dir{} / ""Foundation-mirrored, not referenced by this module.
requires_services(create_postgres=true, create_mysql=false, create_redis=false, create_network_filesystem=true, create_google_kubernetes_engine=true, others false)Tells the platform which Services_GCP resources to auto-provision for this module.

Group 1 — Project & Identity

VariableDefaultDescription
project_id(required)Target Google Cloud project.
regionus-central1Region for the workload and regional resources.

Group 2 — Deployment Environment

VariableDefaultDescription
tenant_iddemoShort suffix that makes resource names unique per environment.
support_users[]Emails granted project access and monitoring alerts.
resource_labels{}Labels applied to all resources for cost/ownership tracking.

Group 3 — Application Identity

VariableDefaultDescription
application_nameopenemrBase name for resources. Do not change after first deploy.
application_display_name / application_description(Foundation defaults)Foundation-mirrored fields. Not referenced — use display_name / description instead.
application_version7.0.4OpenEMR image version tag; increment to roll out a new version.
display_nameOpenEMRFriendly name shown in the Console and dashboards.
description(set)Workload description annotation.

Group 4 — Runtime & Scaling

VariableDefaultDescription
deploy_applicationtrueSet false to provision infrastructure only.
container_image_source / container_image / container_build_config(Foundation defaults)Foundation-mirrored image sourcing. Not referencedOpenEMR_Common always builds a custom image.
enable_image_mirroringtrueMirror the OpenEMR image into Artifact Registry to avoid Docker Hub rate limits.
container_port8080Foundation-mirrored container port. Not referencedmain.tf hardcodes port 80.
container_protocolhttp1Foundation-mirrored HTTP protocol. Not referenced.
container_resources(Foundation defaults)Foundation-mirrored CPU/memory object. Not referenced — use cpu_limit/memory_limit/ephemeral_storage_limit instead.
cpu_limit2000mCPU per pod; 2 vCPU recommended for concurrent clinical workloads.
memory_limit4GiMemory per pod; 4 GiB minimum for production.
ephemeral_storage_limit8GiEphemeral storage for PHP opcache, Apache logs, and temp files. GKE Autopilot caps total pod ephemeral storage at 10 GiB; the Auth Proxy sidecar uses ~1 GiB, leaving a maximum of 9 GiB.
min_instance_count1Minimum replicas. Keep ≥ 1 to avoid cold-start delays for clinical users.
max_instance_count1Increase only after confirming Redis session sharing is operational.
enable_cloudsql_volumetrueFoundation-mirrored Cloud SQL Auth Proxy sidecar toggle. Not referencedopenemr.tf always forces this to true internally.
cloud_sql_proxy_version2-alpineCloud SQL Auth Proxy sidecar image tag.
cloudsql_volume_mount_path/cloudsqlFoundation-mirrored Auth Proxy socket path. Not referenced.
service_annotations / service_labels{}Custom Kubernetes Service annotations/labels.
enable_vertical_pod_autoscalingfalseLet Autopilot tune resource requests automatically.
timeout_seconds300Max request duration in seconds (0–3600).
deployment_timeout1800Seconds Terraform waits for rollout. Extended for OpenEMR's long first-boot install.

Group 5 — Environment Variables & Secrets

VariableDefaultDescription
environment_variables{}Extra plain-text settings. Core MYSQL_* and OE_* values are set automatically. Common additions: PHP_MEMORY_LIMIT, SMTP_HOST, SMTP_PORT.
secret_environment_variables{}Map of env var → Secret Manager secret name. Use for sensitive values such as SMTP credentials.
secret_rotation_period2592000sSecret Manager rotation notification frequency.
secret_propagation_delay30Seconds to wait after secret creation before proceeding.

Group 6 — GKE Backend & Cluster

VariableDefaultDescription
gke_cluster_name""Target cluster name. Leave empty for auto-discovery.
gke_cluster_selection_modeprimaryFoundation-mirrored cluster selection strategy. Not referenced.
namespace_name""Kubernetes namespace. Leave empty to auto-generate.
prereq_gke_subnet_cidr / prereq_subnet_cidr_override / prereq_gke_pod_cidr_override / prereq_gke_service_cidr_override(auto-derived)CIDR overrides for an inline VPC/GKE cluster when Services_GCP does not already exist. Set to previously-applied values on existing deployments to avoid replacement.
service_typeLoadBalancerHow the Service is exposed.
session_affinityClientIPSticky routing required for OpenEMR PHP sessions.
enable_multi_cluster_servicefalseFoundation-mirrored Multi-Cluster Services toggle. Not referenced.
extra_service_ports[]Foundation-mirrored extra Service ports for multi-protocol workloads. Not referenced — declared for convention parity only.
configure_service_meshfalseEnable Istio sidecar injection for the namespace.
enable_network_segmentationfalseCreate Kubernetes NetworkPolicy resources.
termination_grace_period_seconds30Seconds Kubernetes waits after SIGTERM before SIGKILL.
workload_typenullAuto-resolves to StatefulSet when per-pod storage is enabled.
network_tags['nfsserver']Required for NFS connectivity via VPC firewall rules. Do not remove.

Group 7 — StatefulSet

VariableDefaultDescription
stateful_pvc_enablednullEnable PVC templates. OpenEMR uses NFS, not PVCs — leave unset.
stateful_pvc_size / stateful_pvc_mount_path / stateful_pvc_storage_class10Gi / /data / standard-rwoPVC options when StatefulSet mode is explicitly needed.
stateful_headless_servicenullCreate a headless Service for stable network identities.
stateful_pod_management_policynullPod creation order: OrderedReady or Parallel. Defaults to OrderedReady.
stateful_update_strategynullRollingUpdate or OnDelete. Defaults to RollingUpdate.
stateful_fs_group0fsGroup GID set in the pod security context; 0 leaves fsGroup unset.

Group 8 — Resource Quota

VariableDefaultDescription
enable_resource_quotafalseCap namespace CPU/memory/object counts.
quota_cpu_requests / quota_cpu_limits""Total CPU requests/limits allowed across all pods in the namespace.
quota_memory_requests / quota_memory_limits""Must use binary units (4Gi, 8192Mi) — bare integers are read as bytes and block scheduling.
quota_max_pods / quota_max_services / quota_max_pvcs""Maximum pod / Service / PVC counts in the namespace.

Group 9 — Reliability Policies

VariableDefaultDescription
enable_pod_disruption_budgetfalseDisabled by default because max_instance_count = 1 — a PDB with min_available = 1 blocks node drains on a single pod. Enable only when running 2+ replicas.
pdb_min_available1Raise min_instance_count above 1 if you need eviction headroom.
enable_topology_spreadfalseSpread pods across zones.
topology_spread_strictfalseWhen true, reject pods (DoNotSchedule) if the zone spread constraint cannot be satisfied instead of ScheduleAnyway.

Group 10 — Observability & Health

VariableDefaultDescription
startup_probe_config / health_check_config(Foundation defaults)Foundation-mirrored probe objects. Not referenced — use startup_probe / liveness_probe instead.
startup_probeTCP on port 80, 12 failures × 10sTCP probe; allows up to 120 seconds for startup. Increase failure_threshold for first-time deploys with large databases.
liveness_probeHTTP GET /interface/login/login.php, 10 failures × 30sLogin page returns HTTP 200 only when Apache, PHP-FPM, and the database connection are all operational.
uptime_check_configdisabledOptional Cloud Monitoring uptime check.
alert_policies[]Optional metric alert policies.

Group 11 — Workload Automation

VariableDefaultDescription
initialization_jobs[]Leave empty to use the built-in nfs-init / db-init / openemr-install sequence.
cron_jobs[]Scheduled CronJobs (e.g., backup, report generation).
additional_services[]Sidecar or helper GKE services deployed alongside OpenEMR.

Group 12 — CI/CD & GitHub Integration

Standard App_GKE Cloud Build / Cloud Deploy integration — see App_GKE. Key inputs: enable_cicd_trigger, github_repository_url, github_token, github_app_installation_id, cicd_trigger_config, enable_cloud_deploy, cloud_deploy_stages, enable_binary_authorization, binauthz_evaluation_mode (enforcement mode — ALWAYS_ALLOW, REQUIRE_ATTESTATION, or ALWAYS_DENY — used only when enable_binary_authorization = true and Services_GCP has not pre-configured the policy).

Group 13 — Filesystem (NFS)

VariableDefaultDescription
enable_nfstrueMust remain true. OpenEMR requires NFS for the sites/ directory.
nfs_mount_path/var/www/localhost/htdocs/openemr/sitesMount path inside the container. Must match the OpenEMR sites directory path.
nfs_volume_namenfs-data-volumeKubernetes volume name for the NFS mount.
nfs_instance_name""Existing NFS GCE VM to target directly. Leave empty for auto-discovery.
nfs_instance_base_nameapp-nfsBase name for an inline NFS GCE VM when none exists.

Group 14 — Cloud Storage & Artifact Registry

VariableDefaultDescription
create_cloud_storagetrueProvision the data bucket.
storage_buckets[{name_suffix="data"}]Additional buckets.
gcs_volumes[]GCS buckets mounted via the GCS Fuse CSI driver.
manage_storage_kms_iam / enable_artifact_registry_cmekfalseCMEK options.
max_images_to_retain7Maximum recent Artifact Registry images to keep.
delete_untagged_imagestrueAutomatically delete untagged images.
image_retention_days30Days after which images become eligible for deletion.

Group 15 — Redis Session Store

VariableDefaultDescription
enable_redistrueUse Redis for PHP session storage.
redis_host""Leave empty to use the NFS server IP; set explicitly for a dedicated Memorystore instance.
redis_port6379Redis port.
redis_auth""Optional Redis auth password (sensitive).

Group 16 — Database Backend

VariableDefaultDescription
database_typePOSTGRESFoundation-mirrored DB engine selector. Not referencedOpenEMR_Common always sets MYSQL_8_0.
sql_instance_name / sql_instance_base_name"" / app-sqlFoundation-mirrored Cloud SQL instance targeting. Not referenced.
application_database_name / application_database_usergkeappdb / gkeappuserFoundation-mirrored DB name/user. Not referenced — use db_name / db_user instead.
db_nameopenemrMySQL database name. Immutable after first deploy.
db_useropenemrApplication user. Immutable after first deploy.
database_password_length32Generated password length (16–64).
enable_postgres_extensions / postgres_extensionsfalse / []Foundation-mirrored PostgreSQL extension installer. Not referenced — OpenEMR uses MySQL.
enable_mysql_plugins / mysql_pluginsfalse / []Foundation-mirrored MySQL plugin installer. Not referenced by this module.
enable_auto_password_rotationfalseZero-downtime DB password rotation. Requires pod restart to pick up the new secret.
rotation_propagation_delay_sec90Seconds to wait after rotation before restarting pods.
db_password_env_var_name""Foundation-mirrored extra password env var. Not referencedmain.tf hardcodes MYSQL_PASS.
db_host_env_var_name / db_user_env_var_name / db_name_env_var_name / db_port_env_var_name""Foundation-mirrored extra DB env var names. Not referenced by this module.

Group 17 — Backup & Maintenance

VariableDefaultDescription
backup_schedule0 2 * * *Automated backup cron (UTC). Do not disable for HIPAA-regulated deployments.
backup_retention_days7Retention; raise to 30–90 for production/compliance.
enable_backup_importfalseRestore from a backup on deploy.
backup_sourcegcsImport source: gcs or gdrive.
backup_filebackup.sqlFoundation-mirrored backup filename. Not referenced — use backup_uri instead.
backup_uri""GCS URI (gs://bucket/path) or Google Drive file ID. When set, injected into nfs-init as BACKUP_FILEID.
backup_formatsqlBackup file format: sql, tar, gz, tgz, tar.gz, or zip.

Group 18 — Custom SQL Scripts

enable_custom_sql_scripts, custom_sql_scripts_bucket, custom_sql_scripts_path, custom_sql_scripts_use_root — run SQL from a GCS bucket after provisioning. See App_GKE.

Group 19 — Custom Domain, Static IP & Networking

VariableDefaultDescription
enable_custom_domaintrueProvision Kubernetes Gateway for custom hostnames + managed certificate (a Gateway with a static IP is provisioned automatically).
application_domains[]Hostnames to serve. If empty, a nip.io domain based on the auto-generated static IP is used.
gateway_backend_stagedevCloud Deploy stage whose Service the Gateway HTTPRoute targets. Ignored when enable_cloud_deploy is false.
reserve_static_iptrueStable external IP across redeploys.
static_ip_name""Name for the reserved static IP. Leave empty to auto-generate.
network_name""Explicit VPC network name. Leave empty to auto-discover the Services_GCP-managed network. Not referenced by this module.

Group 20 — Identity-Aware Proxy (IAP)

VariableDefaultDescription
enable_iapfalseRequire Google sign-in in front of OpenEMR. Recommended for restricting access to clinical staff.
iap_authorized_users / iap_authorized_groups[]Who may access.
iap_oauth_client_id / iap_oauth_client_secret""Required when IAP is enabled (sensitive).
iap_support_email""Shown on the OAuth consent screen.

Group 21 — Cloud Armor

VariableDefaultDescription
enable_cloud_armorfalseAttach a Cloud Armor (WAF) policy to the Ingress backend.
admin_ip_ranges[]CIDRs allowed privileged access.
cloud_armor_policy_namedefault-waf-policyPolicy name.
enable_cdnfalseEnable Cloud CDN via GCPBackendPolicy on the GKE Ingress backend.

Group 22 — VPC Service Controls & Audit Logging

VariableDefaultDescription
enable_vpc_scfalseEnforce a VPC-SC perimeter. Requires organization_id to be set explicitly. Recommended for HIPAA environments.
vpc_cidr_ranges / vpc_sc_dry_run(set)Access level CIDRs / dry-run mode.
enable_audit_loggingfalseDetailed Cloud Audit Logs (DATA_READ, DATA_WRITE). Recommended for HIPAA compliance.

5. Outputs

These values are returned on a successful deployment and are the quickest way to locate and explore the running resources.

OutputDescription
service_nameKubernetes Service name.
namespaceNamespace the workload runs in.
service_cluster_ipIn-cluster ClusterIP.
stage_service_cluster_ipsMap of ClusterIPs for stage-specific services (Cloud Deploy).
service_external_ipExternal LoadBalancer IP (when a static IP is reserved).
service_urlURL to reach OpenEMR.
admin_password_secret_idSecret Manager secret ID for the OpenEMR admin password (OE_PASS).
database_instance_nameCloud SQL instance name.
database_nameApplication database name.
database_userApplication database user.
database_password_secretSecret Manager secret holding the DB password (MYSQL_PASS).
database_host / database_portDB endpoint (127.0.0.1 via the Auth Proxy) / port.
nfs_server_ipInternal IP of the NFS server (sensitive).
nfs_mount_pathNFS mount path inside the container.
nfs_share_pathNFS share path on the server.
nfs_setup_jobName of the NFS setup job.
storage_bucketsCreated Cloud Storage buckets.
network_name / network_exists / regionsVPC network, presence, available regions.
container_image / container_registryDeployed image and Artifact Registry repo.
monitoring_enabled / monitoring_notification_channelsMonitoring status and channels.
initialization_jobs / db_import_jobNames of the setup and (optional) import jobs.
deployment_id / tenant_id / resource_prefixNaming identifiers.
project_id / project_numberProject identifiers.
cicd_enabled / cicd_configurationCI/CD status and details (repo, trigger, registry).
github_repository_url / github_repository_owner / github_repository_nameGitHub repo details.
artifact_registry_repository / cloudbuild_trigger_name / cloudbuild_trigger_idRegistry and build trigger.
kubernetes_readyWhether the cluster/workload is ready.
vpc_sc_enabled / vpc_sc_perimeter_name / vpc_sc_dry_run_modeVPC-SC status.
audit_logging_enabled / artifact_registry_cmek_enabledAudit logging and CMEK status.

6. Configuration Pitfalls & Sensible Defaults

Risk: Critical (data loss / outage / security) — High (service degraded) — Medium (cost or partial degradation) — Low (minor).

SettingSensible valueRiskConsequence if wrong
enable_nfstrueCriticalOpenEMR cannot function without NFS. The sites/ directory, sqlconf.php, and patient documents all live on NFS. Disabling causes immediate startup failure.
nfs_mount_path/var/www/localhost/htdocs/openemr/sitesCriticalMust match the OpenEMR sites directory path. A mismatch means openemr-install writes sqlconf.php to a location the main pod never checks — the pod waits indefinitely for setup completion.
database_type (via OpenEMR_Common)MYSQL_8_0CriticalOpenEMR requires MySQL; PostgreSQL or NONE breaks the installer and all PHP database calls.
db_name / db_userset onceCriticalImmutable after first deploy; renaming recreates the DB/user and destroys all patient data.
enable_backup_importfalse unless restoringCriticalEnabling without a valid backup_uri fails the import job and can corrupt the NFS sites directory.
quota_memory_requests / _limitsbinary units (4Gi)CriticalBare integers are bytes and block all pod scheduling.
backup_schedule0 2 * * *CriticalDisabling backups for an EHR containing PHI is a HIPAA compliance violation.
ephemeral_storage_limit8GiCriticalOpenEMR writes PHP opcache, Apache logs, and temp files to the container layer. GKE Autopilot's default 1 GiB is insufficient — the pod is evicted during startup.
enable_redistrueHighWith >1 replica, isolated per-pod PHP sessions cause login failures and session loss.
redis_host"" (NFS) or explicitHighAn unreachable Redis host causes PHP session failures and prevents all logins.
memory_limit4GiHighOpenEMR PDF generation and billing reports are memory-intensive. Less than 2 GiB causes OOM kills mid-request.
session_affinityClientIPHighWithout stickiness, multi-replica deployments lose session state between requests.
min_instance_count1HighScale-to-zero causes cold-start delays of 20–40 seconds — unacceptable for clinical access.
enable_pod_disruption_budgetenable when min_instance_count > 1HighDisabled by default because max_instance_count = 1 — a PDB would permanently block node drains on a single-pod deployment. Enable when scaling beyond one replica.
backup_retention_days7 (raise for prod)MediumHIPAA-regulated environments should retain at least 90 days.
enable_iap / enable_cloud_armorenable for healthcareMediumThe OpenEMR admin interface is publicly reachable without these controls.
enable_audit_loggingtrue for HIPAAMediumHIPAA requires audit logging of access to PHI.
enable_vpc_scset organization_id explicitlyMediumWithout an explicit org ID, VPC-SC silently skips perimeter creation — leaving a false sense of security.
container_image_source / container_port / container_resources / database_type / application_database_name / db_password_env_var_name (Group 4/16/10)leave at defaultLowThese are Foundation-mirrored variables declared only for check_conventions.py parity and are not forwarded by main.tf — changing them has no effect. Use cpu_limit/memory_limit/ephemeral_storage_limit, db_name/db_user, and startup_probe/liveness_probe instead.

For the foundation behaviour referenced throughout — IAM and Workload Identity, autoscaling, ingress and certificates, CI/CD, Cloud Armor, IAP, Binary Authorization, VPC-SC, backups, and image mirroring — see App_GKE. OpenEMR-specific application configuration shared with the Cloud Run variant is described in OpenEMR_Common.