Working Instance creation.
This commit is contained in:
parent
d83774fc80
commit
b8b56c9b7e
41
main.tf
Normal file
41
main.tf
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
google = {
|
||||||
|
source = "hashicorp/google"
|
||||||
|
version = "6.27.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "google" {
|
||||||
|
# Configuration options
|
||||||
|
project = "network-getting-started"
|
||||||
|
region = "europe-central2"
|
||||||
|
zone = "europe-central2-b"
|
||||||
|
}
|
||||||
|
|
||||||
|
data "google_project" "project" {
|
||||||
|
project_id = "network-getting-started"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "google_compute_instance" "vm_1" {
|
||||||
|
name = "tftest-vm"
|
||||||
|
machine_type = "e2-micro"
|
||||||
|
can_ip_forward = false
|
||||||
|
description = "Terraform test instance"
|
||||||
|
|
||||||
|
boot_disk {
|
||||||
|
initialize_params {
|
||||||
|
image = "debian-cloud/debian-12"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
network_interface {
|
||||||
|
network = "dom-lab-vpc"
|
||||||
|
subnetwork = "pl-hub"
|
||||||
|
}
|
||||||
|
|
||||||
|
metadata = {
|
||||||
|
ssh-keys = "${var.ssh[0].public_key} ${var.ssh[0].ssh_user}"
|
||||||
|
}
|
||||||
|
}
|
BIN
main.tfplan
Normal file
BIN
main.tfplan
Normal file
Binary file not shown.
7
variables.tf
Normal file
7
variables.tf
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
variable "ssh" {
|
||||||
|
description = "SSH Key(s) definition"
|
||||||
|
type = list(object({
|
||||||
|
public_key = string
|
||||||
|
ssh_user = string
|
||||||
|
}))
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user