google_app_engine_standard_app_version

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:

Example Usage - App Engine Standard App Version

resource "google_service_account" "custom_service_account" {
  account_id   = "my-account"
  display_name = "Custom Service Account"
}

resource "google_project_iam_member" "gae_api" {
  project = google_service_account.custom_service_account.project
  role    = "roles/compute.networkUser"
  member  = "serviceAccount:${google_service_account.custom_service_account.email}"
}

resource "google_project_iam_member" "storage_viewer" {
  project = google_service_account.custom_service_account.project
  role    = "roles/storage.objectViewer"
  member  = "serviceAccount:${google_service_account.custom_service_account.email}"
}

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

  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"
  }

  automatic_scaling {
    max_concurrent_requests = 10
    min_idle_instances = 1
    max_idle_instances = 3
    min_pending_latency = "1s"
    max_pending_latency = "5s"
    standard_scheduler_settings {
      target_cpu_utilization = 0.5
      target_throughput_utilization = 0.75
      min_instances = 2
      max_instances = 10
    }
  }

  delete_service_on_destroy = true
  service_account = google_service_account.custom_service_account.email
}

resource "google_app_engine_standard_app_version" "myapp_v2" {
  version_id      = "v2"
  service         = "myapp"
  runtime         = "nodejs20"
  app_engine_apis = true

  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"
  }

  basic_scaling {
    max_instances = 5
  }

  noop_on_destroy = true
  service_account = google_service_account.custom_service_account.email
}

resource "google_storage_bucket" "bucket" {
  name     = "appengine-static-content"
  location = "US"
}

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

Argument Reference

The following arguments are supported:

The deployment block supports:

The zip block supports:

The files block supports:

The entrypoint block supports:


The handlers block supports:

The script block supports:

The static_files block supports:

The libraries block supports:

The vpc_access_connector block supports:

The automatic_scaling block supports:

The standard_scheduler_settings block supports:

The basic_scaling block supports:

The manual_scaling block supports:

Attributes Reference

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

Timeouts

This resource provides the following Timeouts configuration options:

Import

StandardAppVersion can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import StandardAppVersion using one of the formats above. For example:

import {
  id = "apps/{{project}}/services/{{service}}/versions/{{version_id}}"
  to = google_app_engine_standard_app_version.default
}

When using the terraform import command, StandardAppVersion can be imported using one of the formats above. For example:

$ 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.