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 command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
See 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
Terraform
For more information about the provider resources, see the documentation on the Terraform
If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To get information about a resource using Terraform:
-
Add the
data
andoutput
sections 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 contains information about the activity status of the CDN resource:value
: Returned value.
You can replace
active
with any other parameter to get the information you need. For more information about theyandex_cdn_resource
data source parameters, see the relevant provider documentation . -
Create resources:
-
In the terminal, change to the folder where you edited the configuration file.
-
Make sure the configuration file is correct using the command:
terraform validate
If the configuration is correct, the following message is returned:
Success! The configuration is valid.
-
Run the command:
terraform plan
The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
in the terminal and press Enter.
Terraform will create the required resources and display the output variable values in the terminal. To check the results, run:
terraform output
Result:
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 created CDN resource.
- The Overview section on the DNS settings page will show the
.edgecdn.ru
domain name generated by the service.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
See the description of the CLI command to get information about a resource:
yc cdn resource get-provider-cname --help
-
Get information about the resource by specifying its ID or name:
yc cdn resource get-provider-cname
Result:
cname: cl-54b75255.edgecdn.ru folder_id: b1geoelk7fld*******
Terraform
For more information about the provider resources, see the documentation on the Terraform
If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To get information about a resource using Terraform:
-
Add the
data
andoutput
sections to the Terraform configuration file:data "yandex_cdn_resource" "my_resource" { resource_id = "<resource_ID>" } output "resource_cname" { value = data.yandex_cdn_resource.my_resource.cname }
Where:
data "yandex_cdn_resource"
: Description of the CDN resource as a data source:resource_id
: Resource ID.
output "resource_cname"
: Output variable that contains information about the domain name:value
: Returned value.
You can replace
cname
with any other parameter to get the information you need. For more information about theyandex_cdn_resource
data source parameters, see the relevant provider documentation . -
Create resources:
-
In the terminal, change to the folder where you edited the configuration file.
-
Make sure the configuration file is correct using the command:
terraform validate
If the configuration is correct, the following message is returned:
Success! The configuration is valid.
-
Run the command:
terraform plan
The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
in the terminal and press Enter.
Terraform will create the required resources and display the output variable values in the terminal. To check the results, run:
terraform output
Result:
resource_cname = "cl-54b75255.edgecdn.ru"
-