Resource to hold the state and status of a user's domain mapping.
To get more information about DomainMapping, see:
resource "google_cloud_run_service" "default" {
name = "cloudrun-srv"
location = "us-central1"
metadata {
namespace = "my-project-name"
}
template {
spec {
containers {
image = "us-docker.pkg.dev/cloudrun/container/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
}
}
The following arguments are supported:
name
-
(Required)
Name should be a verified domain
spec
-
(Required)
The spec for this DomainMapping.
Structure is documented below.
location
-
(Required)
The location of the cloud run instance. eg us-central1
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.
Default value is AUTOMATIC
.
Possible values are: NONE
, AUTOMATIC
.
metadata
-
(Optional)
Metadata associated with this DomainMapping.
Structure is documented below.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
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: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
Note: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field effective_labels
for all of the labels present on the resource.
generation
-
(Output)
A sequence number representing a specific generation of the desired state.
resource_version
-
(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
self_link
-
(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: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#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: https://kubernetes.io/docs/concepts/overview/working-with-objects/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.
Note: This field is non-authoritative, and will only manage the annotations present in your configuration.
Please refer to the field effective_annotations
for all of the annotations present on the resource.
terraform_labels
-
(Output)
The combination of labels configured directly on the resource
and default labels configured on the provider.
effective_labels
-
(Output)
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
effective_annotations
-
(Output)
All of annotations (key/value pairs) present on the resource in GCP, including the annotations configured through Terraform, other clients and services.
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.
conditions
-
(Output)
Array of observed DomainMappingConditions, indicating the current state
of the DomainMapping.
Structure is documented below.
observed_generation
-
(Output)
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
-
(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 resource_records
block supports:
type
-
(Optional)
Resource record type. Example: AAAA
.
Possible values are: A
, AAAA
, 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'.
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.delete
- Default is 20 minutes.DomainMapping can be imported using any of these accepted formats:
locations/{{location}}/namespaces/{{project}}/domainmappings/{{name}}
{{location}}/{{project}}/{{name}}
{{location}}/{{name}}
In Terraform v1.5.0 and later, use an import
block to import DomainMapping using one of the formats above. For example:
import {
id = "locations/{{location}}/namespaces/{{project}}/domainmappings/{{name}}"
to = google_cloud_run_domain_mapping.default
}
When using the terraform import
command, DomainMapping can be imported using one of the formats above. For example:
$ 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}}
This resource supports User Project Overrides.