» google_cloud_run_domain_mapping

Resource to hold the state and status of a user's domain mapping.

To get more information about DomainMapping, see:

» Example Usage - Cloud Run Domain Mapping Basic


resource "google_cloud_run_service" "default" {
  name     = "tftest-cloudrun"
  location = "us-central1"

  metadata {
    namespace = "my-project-name"
  }

  template {
    spec {
      containers {
        image = "gcr.io/cloudrun/hello"
      }
    }
  }
}

resource "google_cloud_run_domain_mapping" "default" {
  location = "us-central1"
  name     = "verified-domain.com"

  metadata {
    namespace = "my-project-name"
  }

  spec {
    route_name = google_cloud_run_service.default.name
  }
}

» Argument Reference

The following arguments are supported:

  • name - (Required) Name should be a verified domain

  • spec - (Required) The spec for this DomainMapping. Structure is documented below.

  • metadata - (Required) Metadata associated with this DomainMapping. Structure is documented below.

  • location - (Required) The location of the cloud run instance. eg us-central1

The spec block supports:

  • force_override - (Optional) 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.

  • route_name - (Required) The name of the Cloud Run Service that this DomainMapping applies to. The route must exist.

  • certificate_mode - (Optional) The mode of the certificate.

The metadata block supports:


  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

» Attributes Reference

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

  • status - The current status of the DomainMapping. Structure is documented below.

The status block contains:

  • conditions - Array of observed DomainMappingConditions, indicating the current state of the DomainMapping. Structure is documented below.

  • observed_generation - ObservedGeneration is the 'Generation' of the DomainMapping that was last processed by the controller.

  • resource_records - (Optional) The resource records required to configure this domain mapping. These records must be added to the domain's DNS configuration in order to serve the application via this domain mapping. Structure is documented below.

  • mapped_route_name - The name of the route that the mapping currently points to.

The conditions block contains:

  • message - Human readable message indicating details about the current status.

  • status - Status of the condition, one of True, False, Unknown.

  • reason - One-word CamelCase reason for the condition's current status.

  • type - Type of domain mapping condition.

The resource_records block supports:

  • type - (Optional) Resource record type. Example: AAAA.

  • rrdata - Data for this record. Values vary by record type, as defined in RFC 1035 (section 5) and RFC 1034 (section 3.6.1).

  • name - Relative name of the object affected by this record. Only applicable for CNAME records. Example: 'www'.

» Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 4 minutes.
  • update - Default is 4 minutes.
  • delete - Default is 4 minutes.

» Import

DomainMapping can be imported using any of these accepted formats:

$ terraform import google_cloud_run_domain_mapping.default locations/{{location}}/namespaces/{{project}}/domainmappings/{{name}}
$ terraform import google_cloud_run_domain_mapping.default {{location}}/{{project}}/{{name}}
$ terraform import google_cloud_run_domain_mapping.default {{location}}/{{name}}

» User Project Overrides

This resource supports User Project Overrides.