How to create a record set in google cloud platform with dynamic IP?

Viewed 53

I found this code snippet on official documentation of terraform but it doesnt show how to change rrdatas into dynamic ip. anyone tried creating dns record set with dynamic ips?

resource "google_dns_record_set" "a" {
  name         = "backend.${google_dns_managed_zone.prod.dns_name}"
  managed_zone = google_dns_managed_zone.prod.name
  type         = "A"
  ttl          = 300

  rrdatas = ["8.8.8.8"]
}

Im a newbie on gcp and terraform

2 Answers

Dynamic DNS allows you to direct your domain or a subdomain to a resource that is behind a gateway that has a dynamically assigned IP address. Follow this link for DNS A record with dynamic ip and also can use cloudflare to set the Dynamic IP . You can find the code in GitHub.

Related