If a CDN resource was created via Terraform, you can add an SSL certificate via Terraform. To do this, use the following steps.
1. Open the main.tf file.
2. The file is supposed to contain the code for the creation of your CDN resource. If it is missing, add the code according to the Create a new CDN resource section.
Don't worry, Terraform won't duplicate a resource. Terraform requires the code used for the creation of the resource only to identify a resource that should be changed.
3. At this step, you will add the necessary strings for issuing an SSL certificate.
Add the code below before the following string: resource "gcore_cdn_resource" "(name of your resource in Terraform)" {
. Replace the hints in the brackets with your values and remove the brackets.
4. Add the code below after the secondary_hostnames string, if any (if not, after origin_protocol). Replace the hints in the brackets with your values and remove the brackets.
Here is an example of adding a certificate. Let's suppose your values are as follows:
To add such a certificate, you have inserted the necessary strings into the configuration file. The file is supposed to look as follows:
5. Save the changes in the configuration file.
6. Access the "Terraform" folder in the command-line interface unless you are already in it, and run the terraform plan
command — it will show what changes Terraform is going to make. If the code contains an error, the output will give a brief description of it.
7. Run the terraform apply
command — it will make changes to the CDN. Terraform will ask you to confirm the action — enter "yes".
Was this article helpful?
Learn more about our next-gen CDN