Skip to content

Instantly share code, notes, and snippets.

@calvinchengx
Created April 29, 2020 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvinchengx/39f4e7ce71dc10dbb70ec82e2d17b8db to your computer and use it in GitHub Desktop.
Save calvinchengx/39f4e7ce71dc10dbb70ec82e2d17b8db to your computer and use it in GitHub Desktop.
resource "google_compute_address" "static" {
name = "ipv4-address"
}
data "google_compute_image" "debian_image" {
family = "debian-9"
project = "debian-cloud"
}
resource "google_compute_instance" "instance_with_ip" {
name = "vm-instance"
machine_type = "f1-micro"
zone = "us-central1-a"
boot_disk {
initialize_params {
image = data.google_compute_image.debian_image.self_link
}
}
network_interface {
network = "default"
access_config {
nat_ip = google_compute_address.static.address
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment