From be2a65d7193604c0e9d2b57e09c3219bb109ad60 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Thu, 11 Sep 2025 16:48:27 -0700 Subject: [PATCH] Update main.tf --- terraform/main.tf | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/terraform/main.tf b/terraform/main.tf index 04008bb..7c615a7 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -20,6 +20,10 @@ resource "google_compute_firewall" "yunohost_allow" { target_tags = ["yunohost"] } +resource "google_compute_address" "static_ip" { + name = "yunohost-static-ip" +} + resource "google_compute_instance" "yunohost" { name = "yunohost" machine_type = "e2-small" @@ -34,7 +38,9 @@ resource "google_compute_instance" "yunohost" { } network_interface { network = "default" - access_config {} + access_config { + nat_ip = google_compute_address.static_ip.address + } } metadata = { startup-script = file("${path.module}/startup.sh") @@ -45,3 +51,4 @@ resource "google_compute_instance" "yunohost" { output "external_ip" { value = google_compute_instance.yunohost.network_interface[0].access_config[0].nat_ip } +