Commit fb0d8041 authored by vchalamalsetty's avatar vchalamalsetty

initial checkin

parents
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"my-vm","Source":"./modules","Dir":"modules"}]}
\ No newline at end of file
variable "vm-name" {
type = string
default = "ascend-terraform"
}
resource "random_string" "vm-name" {
length = 12
upper = false
number = false
lower = true
special = false
}
\ No newline at end of file
resource "google_compute_instance" "default" {
name = "vmc-${random_string.vm-name.result}"
machine_type = "e2-medium"
zone = "us-central1-a"
project = "terraformexplore-343004"
tags=["foo","bar"]
allow_stopping_for_update = true
boot_disk {
initialize_params {
image = "debian-cloud/debian-9"
}
}
network_interface {
network = "default"
access_config {
// Ephemeral public IP
}
}
provisioner "remote-exec" {
connection {
type = "ssh"
port = 22
user = "vchalamalasetty"
host=google_compute_instance.default.network_interface[0].access_config[0].nat_ip
agent = "false"
private_key = "${file("/Users/vchalamalasetty/.ssh/id_rsa")}"
}
inline = [
"sudo apt-get -y update",
"sudo apt-get -y install apache2",
]
}
}
{
"version": 4,
"terraform_version": "1.1.6",
"serial": 1,
"lineage": "c94a1cb2-9a2f-7a40-d442-7761ebf3739c",
"outputs": {},
"resources": []
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment