@@ -291,7 +291,7 @@ In order to get a custom domain up and running, we'll create a CDN with a load b
291
291
1. Create a new file `cdn.tf` and add the CDN:
292
292
293
293
```terraform
294
- resource "google_compute_backend_bucket" "cdn_backend_bucket " {
294
+ resource "google_compute_backend_bucket" "cdn_bucket " {
295
295
name = "cdn-bucket-${local.id}"
296
296
description = "Backend bucket for serving static content through CDN"
297
297
bucket_name = google_storage_bucket.frontend.name
@@ -320,18 +320,18 @@ In order to get a custom domain up and running, we'll create a CDN with a load b
320
320
2. Time to set up the load balancer:
321
321
322
322
```terraform
323
- resource "google_compute_url_map" "frontend_lb " {
323
+ resource "google_compute_url_map" "lb " {
324
324
name = "cdn-url-map-${local.id}"
325
- default_service = google_compute_backend_bucket.cdn_backend_bucket .self_link
325
+ default_service = google_compute_backend_bucket.cdn_bucket .self_link
326
326
}
327
327
328
328
resource "google_compute_target_http_proxy" "frontend" {
329
329
name = "http-proxy-${local.id}"
330
- url_map = google_compute_url_map.frontend_lb .id
330
+ url_map = google_compute_url_map.lb .id
331
331
}
332
332
333
- resource "google_compute_global_forwarding_rule" "default " {
334
- name = "website -forwarding-rule-${local.id}"
333
+ resource "google_compute_global_forwarding_rule" "frontend " {
334
+ name = "frontend -forwarding-rule-${local.id}"
335
335
target = google_compute_target_http_proxy.frontend.id
336
336
port_range = "80"
337
337
load_balancing_scheme = "EXTERNAL"
@@ -359,8 +359,7 @@ We will use `cloudlabs-gcp.no` for this workshop. It is already configured in a
359
359
2. Add the IP to the DNS zone:
360
360
361
361
```terraform
362
- resource "google_dns_record_set" "website" {
363
- provider = google
362
+ resource "google_dns_record_set" "frontend" {
364
363
name = "${local.id}.${data.google_dns_managed_zone.cloudlabs_gcp_no.dns_name}"
365
364
type = "A"
366
365
ttl = 60
@@ -396,9 +395,9 @@ To enable HTTPS for the CDN we need to create a certificate. Managed SSL certifi
396
395
```terraform
397
396
resource "google_compute_managed_ssl_certificate" "frontend" {
398
397
provider = google-beta
399
- name = "website -certificate-${local.id}"
398
+ name = "frontend -certificate-${local.id}"
400
399
managed {
401
- domains = [google_dns_record_set.website .name]
400
+ domains = [google_dns_record_set.frontend .name]
402
401
}
403
402
}
404
403
```
@@ -407,8 +406,8 @@ To enable HTTPS for the CDN we need to create a certificate. Managed SSL certifi
407
406
408
407
```terraform
409
408
resource "google_compute_target_https_proxy" "frontend" {
410
- name = "website -target-proxy-https-${local.id}"
411
- url_map = google_compute_url_map.frontend_lb .self_link
409
+ name = "frontend -target-proxy-https-${local.id}"
410
+ url_map = google_compute_url_map.lb .self_link
412
411
ssl_certificates = [google_compute_managed_ssl_certificate.frontend.self_link]
413
412
}
414
413
```
@@ -417,7 +416,7 @@ To enable HTTPS for the CDN we need to create a certificate. Managed SSL certifi
417
416
418
417
```terraform
419
418
resource "google_compute_global_forwarding_rule" "frontend_https" {
420
- name = "website -forwarding-rule-https-${local.id}"
419
+ name = "frontend -forwarding-rule-https-${local.id}"
421
420
load_balancing_scheme = "EXTERNAL"
422
421
ip_address = google_compute_global_address.cdn_public_address.address
423
422
ip_protocol = "TCP"
0 commit comments