Getting information about a resource
- In the management console
, select the folder containing your resource. - Select Cloud CDN.
- Select a CDN resource.
- The Overview page will show the resource details.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
-
View the description of the CLI command to get information about a resource:
yc cdn resource get --help -
Get information about the resource by specifying its ID or name:
yc cdn resource get <resource_ID>Result:
id: bc8v43fzihmv******** folder_id: b1ggmp8es27t******** cname: cdn-res-group.test.com created_at: "2023-10-25T11:18:13.630839Z" updated_at: "2023-10-25T11:18:13.630858Z" active: true options: edge_cache_settings: enabled: true default_value: "345600" query_params_options: ignore_query_string: enabled: true value: true stale: enabled: true value: - error - updating origin_group_id: "27272********" origin_group_name: test-cdn-group origin_protocol: HTTP ssl_certificate: type: DONT_USE status: READY
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To get information about a resource using Terraform:
-
Add the
dataandoutputsections to the Terraform configuration file:data "yandex_cdn_resource" "my_resource" { resource_id = "<resource_ID>" } output "resource_active" { value = data.yandex_cdn_resource.my_resource.active }Where:
data "yandex_cdn_resource": Description of the CDN resource as a data source:resource_id: Resource ID.
output "resource_active": Output variable that shows whether the CDN resource is active:value: Return value.
You can replace
activewith any other parameter to get the information you need. For more information about theyandex_cdn_resourcedata source parameters, see the relevant provider documentation. -
Create the resources:
-
In the terminal, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validateIf the configuration is correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Terraform will create the required resources and display their output variables. To check the results, run this command:
terraform outputResult:
resource_active = true -
To get detailed information about a resource, use the get REST API method for the Resource resource or the ResourceService/Get gRPC API call.
Getting the domain name of a Cloud CDN provider
- In the management console
, select the folder containing your resource. - Select Cloud CDN.
- Select the CDN resource you created.
- Under DNS settings on the Overview page, you will see a domain name in
328938ed********.a.yccdn.cloud.yandex.netorcl-msa87*****.edgecdn.ruformat, depending on your CDN provider.
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To get information about a resource using Terraform:
-
Add the
dataandoutputsections to the Terraform configuration file:data "yandex_cdn_resource" "my_resource" { resource_id = "<resource_ID>" } output "provider_cname" { value = data.yandex_cdn_resource.my_resource.provider_cname }Where:
data "yandex_cdn_resource": Description of the CDN resource as a data source:resource_id: Resource ID.
output "provider_cname": Output variable that contains information about the domain name:value: Return value.
You can replace
provider_cnamewith any other parameter to get the information you need. For more information about theyandex_cdn_resourcedata source properties, see this Terraform provider article. -
Get information about resources:
-
In the terminal, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validateIf the configuration is correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Terraform will create the required resources and display their output variables. To check the results, run this command:
terraform outputResult:
provider_cname = "328938ed********.a.yccdn.cloud.yandex.net" -