[Yandex Cloud documentation](../../../index.md) > [Yandex Certificate Manager](../../index.md) > [Step-by-step guides](../index.md) > Let's Encrypt certificate > Passing a domain rights check

# Checking domain rights

To pass [domain ownership verification](../../concepts/challenges.md):

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder) you added the [certificate](../../concepts/managed-certificate.md) to.
  1. Navigate to **Certificate Manager**.
  1. Select and click the certificate you need checked.
  1. Under **Check rights for domains**, you will see the details required to pass the domain rights check.
  1. As soon as you pass the domain rights check, its status under **Check rights for domains** will change to `Valid`.
  1. After the check status for all the domains changes to `Valid`, a certificate will be issued and its status will change to `Issued`.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. View the command description:

     ```bash
     yc certificate-manager certificate get --help
     ```

  1. Run this command:

     ```bash
     yc certificate-manager certificate get \
       --id fpq6gvvm6piu******** \
       --full
     ```

     Where:
     * `--id`: [Certificate](../../concepts/managed-certificate.md) ID.
     * `--full`: Show the list of active domain ownership verification procedures.

     Result:

     ```text
     id: fpq6gvvm6piu********
     folder_id: b1g7gvsi89m3********
     created_at: "2020-09-15T08:49:11.533771Z"
     name: mymanagedcert
     type: MANAGED
     domains:
     - example.com
     status: VALIDATING
     updated_at: "2020-09-15T08:49:11.533771Z"
     challenges:
     - domain: example.com
       type: HTTP
       created_at: "2020-09-15T08:49:11.533771Z"
       updated_at: "2020-09-15T08:51:44.991065Z"
       status: PENDING
       message: Create a file in your web server's base directory.
       http_challenge:
         url: http://example.com/.well-known/acme-challenge/3LiH-nrTC7GdMbRgVqttEvdTODeNeaD0TtX********
            content: 3LiH-nrTC7GdMbRgVqttEvdTODeNeaD0TtXteWgtAH8.ZHCju15sJiKBwT8G5FTl7UtfmJWp1gKNYYP********
     ```

  1. You can find the information you need to pass the rights check under `http_challenge`.
  1. As soon as you pass the domain rights check, its status will change to `Valid`:

     ```bash
     yc certificate-manager certificate get \
       --id fpq6gvvm6piu******** \
       --full
     ```

     Result:

     ```text
     ...
     domains:
     - example.com
     status: VALID
     ...
     ```

  1. After the check status for all the domains changes to `Valid`, a certificate will be issued and its status will change to `Issued`:

     ```bash
     yc certificate-manager certificate get \
       --id fpq6gvvm6piu******** \
       --full
     ```

     Result:

     ```text
     ...
     domains:
     - example.com
     status: ISSUED
     ...
     ```

- Terraform {#tf}

  With [Terraform](https://www.terraform.io/), you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
  
  Terraform is distributed under the [Business Source License](https://github.com/hashicorp/terraform/blob/main/LICENSE). The [Yandex Cloud provider for Terraform](https://github.com/yandex-cloud/terraform-provider-yandex) is distributed under the [MPL-2.0](https://www.mozilla.org/en-US/MPL/2.0/) license.
  
  For more information about the provider resources, see the guides on the [Terraform](https://www.terraform.io/docs/providers/yandex/index.html) website or [its mirror](../../../terraform/index.md).

  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../../terraform/authentication.md) using the appropriate method.

  With Terraform, you can create a [DNS record](../../../dns/concepts/resource-record.md) required to check your domain rights. Follow these steps:
  1. In the Terraform configuration file, describe the resources you want to create:

     ```hcl
     resource "yandex_cm_certificate" "le-certificate" {
       name    = "<certificate_name>"
       domains = ["<domain>"]

       managed {
         challenge_type = "DNS_CNAME"
       }
     }

     resource "yandex_dns_recordset" "validation-record" {
       zone_id = "<zone_ID>"
       name    = yandex_cm_certificate.le-certificate.challenges[0].dns_name
       type    = yandex_cm_certificate.le-certificate.challenges[0].dns_type
       data    = [yandex_cm_certificate.le-certificate.challenges[0].dns_value]
       ttl     = <record_time_to_live_in_seconds>
     }

     data "yandex_cm_certificate" "example" {
       depends_on      = [yandex_dns_recordset.validation-record]
       certificate_id  = yandex_cm_certificate.le-certificate.id
       wait_validation = true
     }

     # Use data.yandex_cm_certificate.example.id to get a valid certificate.

     output "cert-id" {
       description = "Certificate ID"
       value       = data.yandex_cm_certificate.example.id
     }
     ```

     Where:
     * `yandex_cm_certificate` resource properties:
       * `domains`: Domain you need to create a certificate for.
       * `challenge_type`: Domain owner check method. The possible values are:
         * `DNS_CNAME`: Create a DNS record in [CNAME](../../../dns/concepts/resource-record.md#cname-cname) format with the specified value. We recommend this method for automatic certificate renewal.
         * `DNS_TXT`: Create a DNS record in [TXT](../../../dns/concepts/resource-record.md#txt) format with the specified value.
     * `yandex_dns_recordset` resource properties:
       * `zone_id`: ID of the DNS zone to add the owner verification record to.
       * `name`: Record name.
       * `type`: DNS record type.
       * `data`: Record value.
       * `ttl`: Record time to live (TTL) in seconds before refreshing the record value.
       * `description`: Record set description. This is an optional setting.
     * `yandex_cm_certificate` data source properties:
       * `depends_on`: Indicates the dependence on another Terraform resource.
       * `certificate_id`: Certificate ID.
       * `wait_validation`: Certificate validation wait flag. If `true`, the operation will not be completed until the certificate is `VALIDATING`. The default value is `false`.

     For more information about resource parameters, see [this Terraform provider guide](../../../terraform/index.md).
  1. Create the resources:

     1. In the terminal, navigate to the configuration file directory.
     1. Make sure the configuration is correct using this command:
     
        ```bash
        terraform validate
        ```
     
        If the configuration is valid, you will get this message:
     
        ```bash
        Success! The configuration is valid.
        ```
     
     1. Run this command:
     
        ```bash
        terraform plan
        ```
     
        You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
     1. Apply the configuration changes:
     
        ```bash
        terraform apply
        ```
     
     1. Type `yes` and press **Enter** to confirm the changes.

  This will create a certificate and DNS record in the specified [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder). You can check the new certificate and its settings using the [management console](https://console.yandex.cloud) or this [CLI](../../../cli/index.md) command:

  ```bash
  yc certificate-manager certificate get <certificate_name> --full
  ```

- API {#api}

  To get the information required to pass domain ownership verification, use the [get](../../api-ref/Certificate/get.md) REST API method for the [Certificate](../../api-ref/Certificate/index.md) resource or the [CertificateService/Get](../../api-ref/grpc/Certificate/get.md) gRPC API call with the `view=FULL` flag.

{% endlist %}

{% note info %}

For a successful DNS domain rights check based on a `CNAME` record, make sure the `_acme-challenge` subdomain of the domain name you are checking has no other [resource records](../../../dns/concepts/resource-record.md) except `CNAME`. For example, for the `_acme-challenge.example.com.` domain name, there should only be a CNAME record and no TXT record.

{% endnote %}