Step 6 - Hosting the CDN¶
In this step we will provision hosting of CDN under the client's domain.
- All the below operations are to be performed under the terraform organization created in the step 2.
- Setting up the workspace
- Create a workspace with name
cdnprefixed with the organization's environment type. For e.g. if env isprodthen the workspace name will beprod-cdn. - Choose
/cdnin theterraformgithub repository for version control with default branch pointing tomaster. - Configure the following variables for the workspace
cdn_domains- (HCL) client's domain on which CDN is hosted. Replace<domain>with the client's domain. if domain iscdn.example.comthen the variable will besdk_version- version of SDK to host
- Create a workspace with name
- Attach this workspace to the respective variable set of the organization created in Step 2.
-
Run the pipeline by Actions.
- Click on
Actionsand thenStart new runto start a new run. - Below variables are present in the output
cdn_domains_mappings- DNS authentication for CDN domainscdn_cloudfront_mappings- DNS authentication to SDK domains. For e.g.
- Click on
-
The above pipeline creates a SSL/TLS certificate under the client's domain. This certificate needs to be verified via the DNS strategy.
- Client needs to create a CNAME record with the above
record_nameandrecord_valuegiven in the variable outputcdn_domains_mappingas name and target respectively. - Proxy status for the CNAME record should be kept off.
- Create another CNAME record for client's domain, where the name is
domainand target iscloudfront_endpointas represented in thecdn_cloudfront_mappings. This step points the client's domain to the cloudfront endpoint.
- Client needs to create a CNAME record with the above
- Edit
dns_map_ack_successkey incdn_domainsvariable totrueonce the DNS records are in place. Taking the above example - - Click on
Actionsand thenStart new runto start a new run. - To verify the changes, hit the
/index.jsendpoint over client's endpoint. This will give your SDK hosted on CDN.