| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** AUTO GENERATED CODE *** Type: MMv1 *** |
| # |
| # ---------------------------------------------------------------------------- |
| # |
| # This file is automatically generated by Magic Modules and manual |
| # changes will be clobbered when the file is regenerated. |
| # |
| # Please read more about how to change this file in |
| # .github/CONTRIBUTING.md. |
| # |
| # ---------------------------------------------------------------------------- |
| subcategory: "Cloud Run" |
| description: |- |
| Resource to hold the state and status of a user's domain mapping. |
| --- |
| |
| # 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: |
| |
| * [API documentation](https://cloud.google.com/run/docs/reference/rest/v1/projects.locations.domainmappings) |
| * How-to Guides |
| * [Official Documentation](https://cloud.google.com/run/docs/mapping-custom-domains) |
| |
| ## Example Usage - Cloud Run Domain Mapping Basic |
| |
| |
| ```hcl |
| |
| 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 |
| } |
| } |
| ``` |
| |
| ## Argument Reference |
| |
| The following arguments are supported: |
| |
| |
| * `name` - |
| (Required) |
| Name should be a [verified](https://support.google.com/webmasters/answer/9008080) domain |
| |
| * `spec` - |
| (Required) |
| The spec for this DomainMapping. |
| Structure is [documented below](#nested_spec). |
| |
| * `location` - |
| (Required) |
| The location of the cloud run instance. eg us-central1 |
| |
| |
| <a name="nested_spec"></a>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. |
| Default value is `AUTOMATIC`. |
| Possible values are: `NONE`, `AUTOMATIC`. |
| |
| - - - |
| |
| |
| * `metadata` - |
| (Optional) |
| Metadata associated with this DomainMapping. |
| Structure is [documented below](#nested_metadata). |
| |
| * `project` - (Optional) The ID of the project in which the resource belongs. |
| If it is not provided, the provider project is used. |
| |
| |
| <a name="nested_metadata"></a>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: 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. |
| |
| ## 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](#nested_status). |
| |
| |
| <a name="nested_status"></a>The `status` block contains: |
| |
| * `conditions` - |
| (Output) |
| Array of observed DomainMappingConditions, indicating the current state |
| of the DomainMapping. |
| Structure is [documented below](#nested_conditions). |
| |
| * `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](#nested_resource_records). |
| |
| * `mapped_route_name` - |
| (Output) |
| The name of the route that the mapping currently points to. |
| |
| |
| <a name="nested_conditions"></a>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. |
| |
| <a name="nested_resource_records"></a>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'. |
| |
| ## Timeouts |
| |
| This resource provides the following |
| [Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: |
| |
| - `create` - Default is 20 minutes. |
| - `delete` - Default is 20 minutes. |
| |
| ## Import |
| |
| |
| 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](https://developer.hashicorp.com/terraform/language/import) to import DomainMapping using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "locations/{{location}}/namespaces/{{project}}/domainmappings/{{name}}" |
| to = google_cloud_run_domain_mapping.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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}} |
| ``` |
| |
| ## User Project Overrides |
| |
| This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |