allan.simon
allan.simon

Reputation: 4306

Terraform - GCP - link an ip address to a load balancer linked to a cloud storage bucket

What I want:

I would like to have a static.example.com DNS records that link to a bucket in GCS containing my static images.

As I manage my DNS through Cloudflare, I think I need to use the fact that GCP can attribute me an anycast-IP , to link that IP to a GCP load balancer , that will be linked to bucket

What I currently have:

What I'm missing:

Upvotes: 4

Views: 1502

Answers (1)

mg12
mg12

Reputation: 76

Looks like you're just missing a forwarding rule and target proxy.

The terraform docs on google_compute_global_forwarding_rule have a good example.

e.g.:

resource "google_compute_global_forwarding_rule" "default" {
  name = "default-rule"
  target = "${google_compute_target_http_proxy.default.self_link}"
  port_range = 80     // or other e.g. for ssl

  ip_address = "${google_compute_global_address.my_ip.address}"
}

resource "google_compute_target_http_proxy" "default" {  // or https proxy
  name        = "default-proxy"
  description = "an HTTP proxy"
  url_map     = "${google_compute_url_map.urlmap.self_link}"
}

hope this helps!

Upvotes: 3

Related Questions