Skip to content

serverpod/terraform-google-serverpod-cloud-engine

Repository files navigation

Serverpod GCE Terraform module

Terraform module for deploying Serverpod to Google Cloud Engine.

The module will set up a complete Serverpod infrastructure with auto-scaling Cloud Engine instances and a Postgres database. It will also configure all necessary certificates and load balancing. You can opt into using Redis and Google Cloud Storage buckets.

Complete step-by-step instructions are available in the official Serverpod documentation here. See below for all the additional options you can use with this module.

Requirements

Name Version
terraform >= 1.3.9
google >= 4.51.0

Providers

Name Version
google 4.51.0

Modules

No modules.

Resources

Name Type
google_compute_autoscaler.serverpod resource
google_compute_backend_bucket.storage resource
google_compute_backend_service.api resource
google_compute_backend_service.insights resource
google_compute_backend_service.web resource
google_compute_firewall.serverpod-instance resource
google_compute_firewall.serverpod-instance-ssh resource
google_compute_global_address.private-ip resource
google_compute_global_forwarding_rule.api resource
google_compute_global_forwarding_rule.insights resource
google_compute_global_forwarding_rule.storage resource
google_compute_global_forwarding_rule.web resource
google_compute_health_check.serverpod-balancer resource
google_compute_health_check.serverpod-instance-group resource
google_compute_instance_group_manager.serverpod resource
google_compute_instance_template.serverpod resource
google_compute_managed_ssl_certificate.api resource
google_compute_managed_ssl_certificate.insights resource
google_compute_managed_ssl_certificate.storage resource
google_compute_managed_ssl_certificate.web resource
google_compute_managed_ssl_certificate.web-top-domain resource
google_compute_network.serverpod resource
google_compute_target_https_proxy.api resource
google_compute_target_https_proxy.insights resource
google_compute_target_https_proxy.storage resource
google_compute_target_https_proxy.web resource
google_compute_url_map.serverpod resource
google_dns_managed_zone.private-dns resource
google_dns_managed_zone.public-dns resource
google_dns_record_set.api resource
google_dns_record_set.database resource
google_dns_record_set.database-private resource
google_dns_record_set.insights resource
google_dns_record_set.redis-private resource
google_dns_record_set.storage resource
google_dns_record_set.web resource
google_dns_record_set.web-top-domain resource
google_project_service.gcp_services resource
google_redis_instance.serverpod resource
google_service_networking_connection.private-vpc-connection resource
google_sql_database.serverpod resource
google_sql_database_instance.serverpod resource
google_sql_user.serverpod resource
google_storage_bucket.private resource
google_storage_bucket.public resource
google_storage_bucket_iam_member.public resource

Inputs

Name Description Type Default Required
autoscaling_cpu_utilization The CPU utilization to use for the autoscaling group. Defaults to 0.6. number 0.6 no
autoscaling_max_size The maximum number of instances to run in the autoscaling group. Defaults to 2. number 2 no
autoscaling_min_size The minimum number of instances to run in the autoscaling group. Defaults to 1. number 1 no
database_availability_type The availability type of the database to use. Defaults to 'ZONAL', which represents a single zone. string "ZONAL" no
database_backup_enabled Whether to enable backups for the database. Defaults to true. bool true no
database_backup_point_in_time_recovery_enabled Whether to enable point in time recovery for the database. Defaults to false. bool false no
database_deletion_protection Whether to enable deletion protection for the database. Defaults to true. bool true no
database_password The password to use for the database. You can find the password in your 'config/passwords.yaml' file. string n/a yes
database_tier The tier of the database to use. Defaults to 'db-f1-micro'. string "db-f1-micro" no
database_version The version of the database to use. Defaults to 'POSTGRES_14'. Note that only PostgreSQL is supported. string "POSTGRES_14" no
dns_managed_zone The name of the DNS managed zone to use for the Serverpod infrastructure. If this is not set, a new managed zone will be created. string "" no
enable_redis Whether to enable Redis. Defaults to false. bool false no
enable_ssh Whether to enable SSH access to instances in the autoscaling group. Defaults to true. bool true no
enable_storage Whether to enable storage. Defaults to true. bool true no
machine_type The machine type to use for the autoscaling group. Defaults to 'e2-micro'. string "e2-micro" no
project The GCP project ID to deploy your Serverpod infrastructure to. string n/a yes
redis_memory_size_gb The memory size of the Redis instance to use in gigabytes, if it is enabled. Defaults to 1. number 1 no
redis_tier The tier of the Redis instance to use, if it is enabled. Defaults to 'BASIC'. string "BASIC" no
region The GCP region to deploy your Serverpod infrastructure to. Defaults to 'us-central1'. string "us-central1" no
runmode The runmode to deploy your Serverpod infrastructure in. This can be 'production' or 'development'. string "production" no
service_account_email The email address of the service account to use for the Serverpod infrastructure. string "" no
storage_bucket_class The class of the storage buckets. Defaults to 'STANDARD'. string "STANDARD" no
storage_bucket_location The location of the storage buckets. Defaults to 'US'. string "US" no
subdomain_prefix The subdomain prefix to use for the Serverpod infrastructure. This is useful to set for your staging environment, in which case all sub domains will be prefixed with this value. string "" no
subdomain_web The subdomain to use for the web server. Defaults to 'app', but you may want to change it to 'www' if you have set 'use_top_domain_for_web' to true. string "app" no
top_domain The top domain to deploy your Serverpod infrastructure to. E.g. 'example.com'. string n/a yes
use_top_domain_for_web Whether to use the top domain for the web server. Defaults to false. bool false no
zone The GCP zone to deploy your Serverpod infrastructure to. Defaults to 'us-central1-c'. string "us-central1-c" no

Outputs

Name Description
network The name of Serverpod's private network.