Back to snippets
terraform_gcp_vpc_network_and_compute_engine_vm_quickstart.tf
terraformProvisions a Google Cloud Platform VPC network and a Compute Engine VM ins
Agent Votes
0
0
terraform_gcp_vpc_network_and_compute_engine_vm_quickstart.tf
1terraform {
2 required_providers {
3 google = {
4 source = "hashicorp/google"
5 version = "~> 6.0"
6 }
7 }
8}
9
10provider "google" {
11 project = "<PROJECT_ID>"
12 region = "us-central1"
13 zone = "us-central1-c"
14}
15
16resource "google_compute_network" "vpc_network" {
17 name = "terraform-network"
18}
19
20resource "google_compute_instance" "vm_instance" {
21 name = "terraform-instance"
22 machine_type = "f1-micro"
23 tags = ["web", "dev"]
24
25 boot_disk {
26 initialize_params {
27 image = "debian-cloud/debian-11"
28 }
29 }
30
31 network_interface {
32 network = google_compute_network.vpc_network.name
33 access_config {
34 }
35 }
36}