» google_app_engine_standard_app_version

Standard App Version resource to create a new version of standard GAE Application. Currently supporting Zip and File Containers. Currently does not support async operation checking.

To get more information about StandardAppVersion, see:

» Example Usage - App Engine Standard App Version

resource "google_app_engine_standard_app_version" "myapp_v1" {
  version_id = "v1"
  service    = "myapp"
  runtime    = "nodejs10"

  entrypoint {
    shell = "node ./app.js"

  deployment {
    zip {
      source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}"

  env_variables = {
    port = "8080"

  delete_service_on_destroy = true

resource "google_app_engine_standard_app_version" "myapp_v2" {
  version_id = "v2"
  service    = "myapp"
  runtime    = "nodejs10"

  entrypoint {
    shell = "node ./app.js"

  deployment {
    zip {
      source_url = "https://storage.googleapis.com/${google_storage_bucket.bucket.name}/${google_storage_bucket_object.object.name}"

  env_variables = {
    port = "8080"

  noop_on_destroy = true

resource "google_storage_bucket" "bucket" {
  name = "appengine-static-content"

resource "google_storage_bucket_object" "object" {
  name   = "hello-world.zip"
  bucket = google_storage_bucket.bucket.name
  source = "./test-fixtures/appengine/hello-world.zip"

» Argument Reference

The following arguments are supported:

  • runtime - (Required) Desired runtime. Example python27.

  • version_id - (Optional) 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-".

  • threadsafe - (Optional) Whether multiple requests can be dispatched to this version at once.

  • runtime_api_version - (Optional) 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

  • handlers - (Optional) An ordered list of URL-matching patterns that should be applied to incoming requests. The first matching URL handles the request and other request handlers are not attempted. Structure is documented below.

  • libraries - (Optional) Configuration for third-party Python runtime libraries that are required by the application. Structure is documented below.

  • env_variables - (Optional) Environment variables available to the application.

  • deployment - (Optional) Code and application artifacts that make up this version. Structure is documented below.

  • entrypoint - (Optional) The entrypoint for the application. Structure is documented below.

  • instance_class - (Optional) Instance class that is used to run this version. Valid values are AutomaticScaling F1, F2, F4, F4_1G (Only AutomaticScaling is supported at the moment)

  • service - (Optional) AppEngine service resource

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

  • noop_on_destroy - (Optional) If set to true, the application version will not be deleted.

  • delete_service_on_destroy - (Optional) If set to true, the service will be deleted if it is the last version.

The handlers block supports:

  • url_regex - (Optional) 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.

  • security_level - (Optional) Security (HTTPS) enforcement for this URL.

  • login - (Optional) Methods to restrict access to a URL based on login status.

  • auth_fail_action - (Optional) Actions to take when the user is not logged in.

  • redirect_http_response_code - (Optional) Redirect codes.

  • script - (Optional) Executes a script to handle the requests that match this URL pattern. Only the auto value is supported for Node.js in the App Engine standard environment, for example "script:" "auto". Structure is documented below.

  • static_files - (Optional) Files served directly to the user for a given URL, such as images, CSS stylesheets, or JavaScript source files. Static file handlers describe which files in the application directory are static files, and which URLs serve them. Structure is documented below.

The script block supports:

  • script_path - (Required) Path to the script from the application root directory.

The static_files block supports:

  • path - (Optional) 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.

  • upload_path_regex - (Optional) Regular expression that matches the file paths for all files that should be referenced by this handler.

  • http_headers - (Optional) HTTP headers to use for all responses from these URLs. An object containing a list of "key:value" value pairs.".

  • mime_type - (Optional) 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.

  • expiration - (Optional) 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".

  • require_matching_file - (Optional) Whether this handler should match the request if the file referenced by the handler does not exist.

  • application_readable - (Optional) 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.

The libraries block supports:

  • name - (Optional) Name of the library. Example "django".

  • version - (Optional) Version of the library to select, or "latest".

The deployment block supports:

  • zip - (Optional) Zip File Structure is documented below.

  • files - (Optional) Manifest of the files stored in Google Cloud Storage that are included as part of this version. All files must be readable using the credentials supplied with this call. Structure is documented below.

The zip block supports:

The files block supports:

  • name - (Required) The identifier for this object. Format specified above.

  • sha1_sum - (Optional) SHA1 checksum of the file

  • source_url - (Required) Source URL

The entrypoint block supports:

  • shell - (Required) The format should be a shell command that can be fed to bash -c.

» Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

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

» Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 4 minutes.
  • update - Default is 4 minutes.
  • delete - Default is 4 minutes.

» Import

StandardAppVersion can be imported using any of these accepted formats:

$ terraform import google_app_engine_standard_app_version.default apps/{{project}}/services/{{service}}/versions/{{version_id}}
$ terraform import google_app_engine_standard_app_version.default {{project}}/{{service}}/{{version_id}}
$ terraform import google_app_engine_standard_app_version.default {{service}}/{{version_id}}

» User Project Overrides

This resource supports User Project Overrides.