google::compute-backend-service

Creates a backend service.

Example

google::compute-backend-service backend-service-example
    name: 'backend-service-example'
    description: 'backend-service-example-desc'

    backend
        group
            instance-group: $(google::compute-instance-group instance-group-example-regional-backend-service)
        end
    end

    health-check: [ $(google::compute-health-check health-check-example-backend-service) ]

    security-policy: $(google::compute-security-policy security-policy-example-backend-service)

    connection-draining
        draining-timeout-sec: 30
    end

    load-balancing-scheme: "EXTERNAL"

    enable-cdn: false
    protocol: "HTTPS"
    session-affinity: "NONE"
    port-name: "http"

    cdn-policy
        signed-url-max-age: 30000

        cache-key-policy
            include-host: true
            include-protocol: true
        end
    end

    signed-url-key
        key: "xyz"
        value: "ZWVsbG8gZnJvbSBHb29nbA=="
    end
end

Attributes

Attribute Description
affinity-cookie-ttl-sec If set to 0, the cookie is non-persistent and lasts only until the end of the browser session (or equivalent). Defaults to 0. Valid values are between 0 to 86400.
backend list The list of backend that serve this backend service. (Required)
connection-draining subresource

Connection draining configuration for the backend service.

draining-timeout-sec
The amount of time in seconds to allow existing connections to persist while on unhealthy backend instances. Only applicable if the protocol is not UDP. Valid values are between 0 to 3600.
custom-request-headers map Headers that the HTTP/S load balancer should add to proxied requests. Can only be set when protocol is set as HTTP or HTTPS.
description An optional description of this resource. Provide this property when you create the resource.
enable-cdn If true, enables Cloud CDN for the backend service.
health-check list A list of health check for the backend service. Currently only one health check is supported. (Required)
load-balancing-scheme Indicates whether the backend service will be used with internal or external load balancing.Valid values are INTERNAL, INTERNAL_MANAGED`, ``INTERNAL_SELF_MANAGED or EXTERNAL. Defaults to EXTERNAL. See Balance Modes Valid values are INTERNAL, INTERNAL_MANAGED, INTERNAL_SELF_MANAGED or EXTERNAL.
locality-lb-policy The load balancing algorithm used within the scope of the locality. Valid values are ROUND_ROBIN, LEAST_REQUEST, RING_HASH, RANDOM, ORIGINAL_DESTINATION or MAGLEV.
name The name of the backend service. Must be a string 1-63 characters long and the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. Valid values satisfy the regex: [(?:(?:[-a-z0-9]{1,63}\\.)*(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?))]. (Required)
protocol The protocol this backend service uses to communicate. Default to HTTPS Valid values are HTTP, HTTPS, TCP, SSL or UDP.
session-affinity Type of session affinity to use. When the load-balancing-scheme is EXTERNAL, valid values are NONE, CLIENT_IP or GENERATED_COOKIE,``GENERATED_COOKIE`` only if protocol is HTTP or HTTPS. load-balancing-scheme is INTERNAL, valid values are NONE, CLIENT_IP, CLIENT_IP_PROTO or CLIENT_IP_PORT_PROTO. When the load-balancing-scheme is INTERNAL_SELF_MANAGED, valid values are NONE, CLIENT_IP, GENERATED_COOKIE, HEADER_FIELD, or HTTP_COOKIE. Defaults to NONE. Valid values are NONE, CLIENT_IP, GENERATED_COOKIE, CLIENT_IP_PROTO, CLIENT_IP_PORT_PROTO, HEADER_FIELD or HTTP_COOKIE.
timeout-sec The backend service timeout. Defaults to 30 seconds.
cdn-policy subresource

CDN configuration for this backend service.

signed-url-max-age
Maximum number of seconds the response to a signed URL request will be considered fresh. (Required)
cache-key-policy subresource

The cache key configuration for this backend service cdn configuration.

include-host
If true, requests to different hosts will be cached separately.
include-protocol
If true, http and https requests will be cached separately.
include-query-string
If true, include query string parameters in the cache key according to query_string_whitelist or query_string_blacklist
query-string-blacklist list
Names of query string parameters to exclude from cache keys.
query-string-whitelist list
Names of query string parameters to include in cache keys.
signed-url-key list Signed Url key configuration for the backend service.
port-name A named port on a backend instance group representing the port for communication to the backend instances.
security-policy The security policy associated with this backend service. This can only be added when enableCdn is false.

Outputs

Attribute Description
self-link Server-defined URL for the resource.