Skip to content

googleCloudRunDomainMapping

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

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleCloudRunServiceDefault = new google.cloudRunService.CloudRunService(
  this,
  "default",
  {
    location: "us-central1",
    metadata: [
      {
        namespace: "my-project-name",
      },
    ],
    name: "cloudrun-srv",
    template: [
      {
        spec: [
          {
            containers: [
              {
                image: "us-docker.pkg.dev/cloudrun/container/hello",
              },
            ],
          },
        ],
      },
    ],
  }
);
const googleCloudRunDomainMappingDefault =
  new google.cloudRunDomainMapping.CloudRunDomainMapping(this, "default_1", {
    location: "us-central1",
    metadata: [
      {
        namespace: "my-project-name",
      },
    ],
    name: "verified-domain.com",
    spec: [
      {
        route_name: googleCloudRunServiceDefault.name,
      },
    ],
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleCloudRunDomainMappingDefault.overrideLogicalId("default");

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:

  • forceOverride - (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.

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

  • certificateMode - (Optional) The mode of the certificate. Default value is automatic. Possible values are none and automatic.

The metadata block supports:

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

  • generation - (Output) A sequence number representing a specific generation of the desired state.

  • resourceVersion - (Output) 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 - (Output) SelfLink is a URL representing this object.

  • uid - (Output) 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

  • namespace - (Required) In Cloud Run the namespace must be equal to either the project ID or project number.

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


  • 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:

  • id - an identifier for the resource with format locations/{{location}}/namespaces/{{project}}/domainmappings/{{name}}

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

The status block contains:

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

  • observedGeneration - (Output) ObservedGeneration is the 'Generation' of the DomainMapping that was last processed by the controller.

  • resourceRecords - (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.

  • mappedRouteName - (Output) The name of the route that the mapping currently points to.

The conditions block contains:

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

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

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

  • type - (Output) Type of domain mapping condition.

The resourceRecords block supports:

  • type - (Optional) Resource record type. Example: aaaa. Possible values are a, aaaa, and cname.

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

  • name - (Output) 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 20 minutes.
  • delete - Default is 20 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.