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
resource "google_app_engine_standard_app_version" "app_engine_front" {
version_id = "v1"
service = "front"
runtime = "nodejs14"
deployment{
resource "google_app_engine_standard_app_version" "todo-app" {
version_id = "v4"
service = "new"
runtime = "nodejs10"
entrypoint {
Parameters
-
delete_service_on_destroyoptional - bool -
env_variablesoptional - map from string to string
Environment variables available to the application.
-
idoptional computed - string -
inbound_servicesoptional - set of string
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_classoptional computed - string
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.
-
nameoptional computed - string
Full path to the Version resource in the API. Example, "v1".
-
noop_on_destroyoptional - bool -
projectoptional computed - string -
runtimerequired - string
Desired runtime. Example python27.
-
runtime_api_versionoptional - string
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
-
servicerequired - string
AppEngine service resource
-
threadsafeoptional - bool
Whether multiple requests can be dispatched to this version at once.
-
version_idoptional - string
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_scalinglist block-
max_concurrent_requestsoptional - number
Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance. Defaults to a runtime-specific value.
-
max_idle_instancesoptional - number
Maximum number of idle instances that should be maintained for this version.
-
max_pending_latencyoptional - string
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".
-
min_idle_instancesoptional - number
Minimum number of idle instances that should be maintained for this version. Only applicable for the default version of a service.
-
min_pending_latencyoptional - string
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_settingslist block-
max_instancesoptional - number
Maximum number of instances to run for this version. Set to zero to disable maxInstances configuration.
-
min_instancesoptional - number
Minimum number of instances to run for this version. Set to zero to disable minInstances configuration.
-
target_cpu_utilizationoptional - number
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_utilizationoptional - number
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_scalinglist block-
idle_timeoutoptional - string
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.
-
max_instancesrequired - number
Maximum number of instances to create for this version. Must be in the range [1.0, 200.0].
-
-
deploymentlist block-
filesset blockSHA1 checksum of the file
-
source_urlrequired - string
Source URL
-
-
ziplist block-
files_countoptional - number
files count
-
source_urlrequired - string
Source URL
-
-
-
entrypointlist block-
shellrequired - string
The format should be a shell command that can be fed to bash -c.
-
-
handlerslist block-
auth_fail_actionoptional - string
Actions to take when the user is not logged in. Possible values: ["AUTH_FAIL_ACTION_REDIRECT", "AUTH_FAIL_ACTION_UNAUTHORIZED"]
-
loginoptional - string
Methods to restrict access to a URL based on login status. Possible values: ["LOGIN_OPTIONAL", "LOGIN_ADMIN", "LOGIN_REQUIRED"]
-
redirect_http_response_codeoptional - string
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_leveloptional - string
Security (HTTPS) enforcement for this URL. Possible values: ["SECURE_DEFAULT", "SECURE_NEVER", "SECURE_OPTIONAL", "SECURE_ALWAYS"]
-
url_regexoptional - string
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.
-
scriptlist block-
script_pathrequired - string
Path to the script from the application root directory.
-
-
static_fileslist block-
application_readableoptional - bool
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.
-
expirationoptional - string
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_headersoptional - map from string to string
HTTP headers to use for all responses from these URLs. An object containing a list of "key:value" value pairs.".
-
mime_typeoptional - string
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.
-
pathoptional - string
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.
-
require_matching_fileoptional - bool
Whether this handler should match the request if the file referenced by the handler does not exist.
-
upload_path_regexoptional - string
Regular expression that matches the file paths for all files that should be referenced by this handler.
-
-
-
librarieslist block-
nameoptional - string
Name of the library. Example "django".
-
versionoptional - string
Version of the library to select, or "latest".
-
-
manual_scalinglist block-
instancesrequired - number
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.
-
-
timeoutssingle block -
vpc_access_connectorlist block-
namerequired - string
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:
- API documentation
- How-to Guides
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.