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_destroy
optional - bool -
env_variables
optional - map from string to string
Environment variables available to the application.
-
id
optional computed - string -
inbound_services
optional - 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_class
optional 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.
-
name
optional computed - string
Full path to the Version resource in the API. Example, "v1".
-
noop_on_destroy
optional - bool -
project
optional computed - string -
runtime
required - string
Desired runtime. Example python27.
-
runtime_api_version
optional - 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
-
service
required - string
AppEngine service resource
-
threadsafe
optional - bool
Whether multiple requests can be dispatched to this version at once.
-
version_id
optional - 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_scaling
list block-
max_concurrent_requests
optional - 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_instances
optional - number
Maximum number of idle instances that should be maintained for this version.
-
max_pending_latency
optional - 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_instances
optional - number
Minimum number of idle instances that should be maintained for this version. Only applicable for the default version of a service.
-
min_pending_latency
optional - 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_settings
list block-
max_instances
optional - number
Maximum number of instances to run for this version. Set to zero to disable maxInstances configuration.
-
min_instances
optional - number
Minimum number of instances to run for this version. Set to zero to disable minInstances configuration.
-
target_cpu_utilization
optional - 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_utilization
optional - 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_scaling
list block-
idle_timeout
optional - 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_instances
required - number
Maximum number of instances to create for this version. Must be in the range [1.0, 200.0].
-
-
deployment
list block-
files
set blockSHA1 checksum of the file
-
source_url
required - string
Source URL
-
-
zip
list block-
files_count
optional - number
files count
-
source_url
required - string
Source URL
-
-
-
entrypoint
list block-
shell
required - string
The format should be a shell command that can be fed to bash -c.
-
-
handlers
list block-
auth_fail_action
optional - string
Actions to take when the user is not logged in. Possible values: ["AUTH_FAIL_ACTION_REDIRECT", "AUTH_FAIL_ACTION_UNAUTHORIZED"]
-
login
optional - string
Methods to restrict access to a URL based on login status. Possible values: ["LOGIN_OPTIONAL", "LOGIN_ADMIN", "LOGIN_REQUIRED"]
-
redirect_http_response_code
optional - 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_level
optional - string
Security (HTTPS) enforcement for this URL. Possible values: ["SECURE_DEFAULT", "SECURE_NEVER", "SECURE_OPTIONAL", "SECURE_ALWAYS"]
-
url_regex
optional - 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.
-
script
list block-
script_path
required - string
Path to the script from the application root directory.
-
-
static_files
list block-
application_readable
optional - 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.
-
expiration
optional - 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_headers
optional - 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_type
optional - 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.
-
path
optional - 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_file
optional - bool
Whether this handler should match the request if the file referenced by the handler does not exist.
-
upload_path_regex
optional - string
Regular expression that matches the file paths for all files that should be referenced by this handler.
-
-
-
libraries
list block-
name
optional - string
Name of the library. Example "django".
-
version
optional - string
Version of the library to select, or "latest".
-
-
manual_scaling
list block-
instances
required - 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.
-
-
timeouts
single block -
vpc_access_connector
list block-
name
required - 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.