Google Cloud Run Domain Mapping

This page shows how to write Terraform for Cloud Run Domain Mapping and write them securely.

google_cloud_run_domain_mapping (Terraform)

The Domain Mapping in Cloud Run can be configured in Terraform with the resource name google_cloud_run_domain_mapping. The following sections describe 2 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L60
resource "google_cloud_run_domain_mapping" "web-ui-domain" {
  location = var.gcpRegion
  name     = var.serviceDomainWeb

  metadata {
    namespace = var.gcpProjectId
terraform.tf#L99
resource "google_cloud_run_domain_mapping" "graphql_api_service" {
    location = var.region
    name     = var.domain

    metadata {
        namespace = var.project_id

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

The location of the cloud run instance. eg us-central1

Name should be a verified domain

  • project optional computed - string
  • status optional computed - list of object

The current status of the DomainMapping.

  • conditions - list of object
  • mapped_route_name - string
  • observed_generation - number
  • resource_records - list of object
  • metadata list block

    Annotations is a key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. More info: http://kubernetes.io/docs/user-guide/annotations Note: The Cloud Run API may add additional annotations that were not provided in your config. If terraform plan shows a diff where a server-side annotation is added, you can add it to your config or apply the lifecycle.ignore_changes rule to the metadata.0.annotations field.

    A sequence number representing a specific generation of the desired state.

    • labels optional computed - map from string to string

    Map of string keys and values that can be used to organize and categorize (scope and select) objects. May match selectors of replication controllers and routes. More info: http://kubernetes.io/docs/user-guide/labels

    In Cloud Run the namespace must be equal to either the project ID or project number.

    An opaque value that represents the internal version of this object that can be used by clients to determine when objects have changed. May be used for optimistic concurrency, change detection, and the watch operation on a resource or set of resources. They may only be valid for a particular resource or set of resources. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#concurrency-control-and-consistency

    SelfLink is a URL representing this object.

    • uid optional computed - string

    UID is a unique id generated by the server on successful creation of a resource and is not allowed to change on PUT operations. More info: http://kubernetes.io/docs/user-guide/identifiers#uids

  • spec list block

    The mode of the certificate. Default value: "AUTOMATIC" Possible values: ["NONE", "AUTOMATIC"]

    If set, the mapping will override any mapping set before this spec was set. It is recommended that the user leaves this empty to receive an error warning about a potential conflict and only set it once the respective UI has given such a warning.

    The name of the Cloud Run Service that this DomainMapping applies to. The route must exist.

  • timeouts single block

Explanation in Terraform Registry

Resource to hold the state and status of a user's domain mapping. To get more information about DomainMapping, see:

Frequently asked questions

What is Google Cloud Run Domain Mapping?

Google Cloud Run Domain Mapping is a resource for Cloud Run of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Cloud Run Domain Mapping?

For Terraform, the vinnie357/nim and chemistry/crystallography.io source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.