mirror of https://github.com/mitchell/shortnr.git
Refactor terraform config and remove deletion protection var
This commit is contained in:
parent
80d6cfbb31
commit
e212eee751
|
@ -3,8 +3,8 @@
|
|||
provider "google" {
|
||||
version = "3.8.0"
|
||||
project = var.project_id
|
||||
region = "us-east4"
|
||||
zone = "us-east4-b"
|
||||
region = var.region
|
||||
zone = var.zone
|
||||
}
|
||||
|
||||
variable "ssh_keys" {
|
||||
|
@ -17,10 +17,14 @@ variable "project_id" {
|
|||
description = "The name of the google cloud project you're deploying to."
|
||||
}
|
||||
|
||||
variable "deletion_protection" {
|
||||
type = bool
|
||||
description = "Whether to apply deletion protection to the shortnr-instance."
|
||||
default = true
|
||||
variable "region" {
|
||||
type = string
|
||||
description = "The region you want your infrastructure to deploy to."
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
type = string
|
||||
description = "The zone, within the region, that you want to deploy to."
|
||||
}
|
||||
|
||||
output "shortnr_static_ip" {
|
||||
|
@ -35,12 +39,12 @@ data "google_compute_image" "debian_image" {
|
|||
|
||||
resource "google_compute_address" "shortnr" {
|
||||
name = "shortnr-address"
|
||||
network_tier = "STANDARD"
|
||||
}
|
||||
|
||||
resource "google_compute_instance" "shortnr" {
|
||||
name = "shortnr-instance"
|
||||
machine_type = "f1-micro"
|
||||
deletion_protection = var.deletion_protection
|
||||
|
||||
boot_disk {
|
||||
auto_delete = true
|
||||
|
@ -54,6 +58,7 @@ resource "google_compute_instance" "shortnr" {
|
|||
network = "default"
|
||||
access_config {
|
||||
nat_ip = google_compute_address.shortnr.address
|
||||
network_tier = "STANDARD"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue