Google App Engine Standard App Version

This page shows how to write Terraform for App Engine Standard App Version and write them securely.

google_app_engine_standard_app_version (Terraform)

The Standard App Version in App Engine can be configured in Terraform with the resource name google_app_engine_standard_app_version. The following sections describe 2 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L1
resource "google_app_engine_standard_app_version" "app_engine_front" {
  version_id = "v1"
  service    = "front"
  runtime    = "nodejs14"

  deployment{
main.tf#L19
resource "google_app_engine_standard_app_version" "todo-app" {
  version_id = "v4"
  service = "new"
  runtime = "nodejs10"

  entrypoint {

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Environment variables available to the application.

A list of the types of messages that this application is able to receive. Possible values: ["INBOUND_SERVICE_MAIL", "INBOUND_SERVICE_MAIL_BOUNCE", "INBOUND_SERVICE_XMPP_ERROR", "INBOUND_SERVICE_XMPP_MESSAGE", "INBOUND_SERVICE_XMPP_SUBSCRIBE", "INBOUND_SERVICE_XMPP_PRESENCE", "INBOUND_SERVICE_CHANNEL_PRESENCE", "INBOUND_SERVICE_WARMUP"]

Instance class that is used to run this version. Valid values are AutomaticScaling: F1, F2, F4, F4_1G BasicScaling or ManualScaling: B1, B2, B4, B4_1G, B8 Defaults to F1 for AutomaticScaling and B2 for ManualScaling and BasicScaling. If no scaling is specified, AutomaticScaling is chosen.

  • name optional computed - string

Full path to the Version resource in the API. Example, "v1".

Desired runtime. Example python27.

The version of the API in the given runtime environment. Please see the app.yaml reference for valid values at https://cloud.google.com/appengine/docs/standard//config/appref

AppEngine service resource

Whether multiple requests can be dispatched to this version at once.

Relative name of the version within the service. For example, 'v1'. Version names can contain only lowercase letters, numbers, or hyphens. Reserved names,"default", "latest", and any name with the prefix "ah-".

  • automatic_scaling list block

    Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance. Defaults to a runtime-specific value.

    Maximum number of idle instances that should be maintained for this version.

    Maximum amount of time that a request should wait in the pending queue before starting a new instance to handle it. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

    Minimum number of idle instances that should be maintained for this version. Only applicable for the default version of a service.

    Minimum amount of time a request should wait in the pending queue before starting a new instance to handle it. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

    • standard_scheduler_settings list block

      Maximum number of instances to run for this version. Set to zero to disable maxInstances configuration.

      Minimum number of instances to run for this version. Set to zero to disable minInstances configuration.

      Target CPU utilization ratio to maintain when scaling. Should be a value in the range [0.50, 0.95], zero, or a negative value.

      Target throughput utilization ratio to maintain when scaling. Should be a value in the range [0.50, 0.95], zero, or a negative value.

  • basic_scaling list block

    Duration of time after the last request that an instance must wait before the instance is shut down. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Defaults to 900s.

    Maximum number of instances to create for this version. Must be in the range [1.0, 200.0].

  • deployment list block
  • entrypoint list block

    The format should be a shell command that can be fed to bash -c.

  • handlers list block

    Actions to take when the user is not logged in. Possible values: ["AUTH_FAIL_ACTION_REDIRECT", "AUTH_FAIL_ACTION_UNAUTHORIZED"]

    Methods to restrict access to a URL based on login status. Possible values: ["LOGIN_OPTIONAL", "LOGIN_ADMIN", "LOGIN_REQUIRED"]

    30x code to use when performing redirects for the secure field. Possible values: ["REDIRECT_HTTP_RESPONSE_CODE_301", "REDIRECT_HTTP_RESPONSE_CODE_302", "REDIRECT_HTTP_RESPONSE_CODE_303", "REDIRECT_HTTP_RESPONSE_CODE_307"]

    Security (HTTPS) enforcement for this URL. Possible values: ["SECURE_DEFAULT", "SECURE_NEVER", "SECURE_OPTIONAL", "SECURE_ALWAYS"]

    URL prefix. Uses regular expression syntax, which means regexp special characters must be escaped, but should not contain groupings. All URLs that begin with this prefix are handled by this handler, using the portion of the URL after the prefix as part of the file path.

    • script list block

      Path to the script from the application root directory.

    • static_files list block

      Whether files should also be uploaded as code data. By default, files declared in static file handlers are uploaded as static data and are only served to end users; they cannot be read by the application. If enabled, uploads are charged against both your code and static data storage resource quotas.

      Time a static file served by this handler should be cached by web proxies and browsers. A duration in seconds with up to nine fractional digits, terminated by 's'. Example "3.5s".

      HTTP headers to use for all responses from these URLs. An object containing a list of "key:value" value pairs.".

      MIME type used to serve all files served by this handler. Defaults to file-specific MIME types, which are derived from each file's filename extension.

      Path to the static files matched by the URL pattern, from the application root directory. The path can refer to text matched in groupings in the URL pattern.

      Whether this handler should match the request if the file referenced by the handler does not exist.

      Regular expression that matches the file paths for all files that should be referenced by this handler.

  • libraries list block

    Name of the library. Example "django".

    Version of the library to select, or "latest".

  • manual_scaling list block

    Number of instances to assign to the service at the start. Note: When managing the number of instances at runtime through the App Engine Admin API or the (now deprecated) Python 2 Modules API set_num_instances() you must use 'lifecycle.ignore_changes = ["manual_scaling"[0].instances]' to prevent drift detection.

  • timeouts single block
  • vpc_access_connector list block

    Full Serverless VPC Access Connector name e.g. /projects/my-project/locations/us-central1/connectors/c1.

Explanation in Terraform Registry

Standard App Version resource to create a new version of standard GAE Application. Learn about the differences between the standard environment and the flexible environment at https://cloud.google.com/appengine/docs/the-appengine-environments. Currently supporting Zip and File Containers. To get more information about StandardAppVersion, see:

Frequently asked questions

What is Google App Engine Standard App Version?

Google App Engine Standard App Version is a resource for App Engine of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google App Engine Standard App Version?

For Terraform, the n3rdkid/tf-gcp-v3 and danieljcorum/todo-infra source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.