Like the title says, I need to create or update an AWS Route53 record with the (Ephemeral) IP address from a GCP Resource created in a previous step. Currently it looks like this:
data "google_compute_image" "standard_shielded_base" {
family = "ubuntu-1804-lts"
project = "gce-uefi-images"
}
resource "google_compute_instance" "example" {
name = var.gcp_machine_name
machine_type = "n1-standard-2"
zone = var.gcp_zone
tags = ["custom-tag"]
allow_stopping_for_update = true
hostname = "${var.gcp_machine_name}.example.com"
boot_disk {
initialize_params {
image = data.google_compute_image.standard_shielded_base.self_link
size = 40
type = "pd-ssd"
}
}
network_interface {
network = var.gcp_vpc_network
access_config {
# Ephemeral IP
}
}
}
resource "aws_route53_record" "example" {
zone_id = var.aws_hosted_zone_id
name = "${var.gcp_machine_name}.example.com"
type = "A"
ttl = "300"
records = [tostring(google_compute_instance.example.network_interface.0.access_config.0.nat_ip)]
}
but the issue is that the record isn’t getting updated if the IP address changes. Is there a better syntax for this? I tried using “output” but my understanding is that these aren’t available until a plan is fully applied.