-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
variable "agi" { | ||
default = false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
resource "google_compute_network" "vpc_network" { | ||
name = "terraform-network" | ||
} | ||
|
||
resource "google_compute_instance" "vm_instance" { | ||
name = var.instance_name | ||
machine_type = var.machine_type | ||
|
||
boot_disk { | ||
initialize_params { | ||
image = "debian-cloud/debian-11" | ||
} | ||
} | ||
|
||
network_interface { | ||
network = google_compute_network.vpc_network.name | ||
access_config { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "ip" { | ||
value = google_compute_instance.vm_instance.network_interface[0].network_ip | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "instance_name" { | ||
type = string | ||
description = "Name of the compute instance" | ||
} | ||
|
||
variable "machine_type" { | ||
type = string | ||
default = "f1-micro" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
terraform { | ||
required_providers { | ||
google = { | ||
source = "hashicorp/google" | ||
version = "~> 4.0" | ||
} | ||
} | ||
} | ||
|
||
provider "google" { | ||
credentials = file(var.credentials_file) | ||
|
||
project = var.project | ||
region = var.region | ||
zone = var.zone | ||
} | ||
|
||
module "compute" { | ||
source = "./compute" | ||
|
||
instance_name = "terraform-machine" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
zone = "us-central1-c" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
variable "project" { | ||
type = string | ||
} | ||
|
||
variable "credentials_file" { | ||
type = string | ||
} | ||
|
||
variable "region" { | ||
default = "us-central1" | ||
} | ||
|
||
variable "zone" { | ||
default = "us-central1-c" | ||
} |