BB: Add the new machine to the Terraform scripts

This commit is contained in:
Ilija Lazoroski 2022-09-20 17:52:00 +02:00
parent 07d1062b80
commit 246c78e8c1
2 changed files with 73 additions and 7 deletions

View File

@ -63,6 +63,18 @@ data "google_compute_image" "powershell-3-45" {
name = "powershell-3-45" name = "powershell-3-45"
project = local.monkeyzoo_project project = local.monkeyzoo_project
} }
data "google_compute_image" "credentials-reuse-14" {
name = "credentials-reuse-14"
project = local.monkeyzoo_project
}
data "google_compute_image" "credentials-reuse-15" {
name = "credentials-reuse-15"
project = local.monkeyzoo_project
}
data "google_compute_image" "credentials-reuse-16" {
name = "credentials-reuse-16"
project = local.monkeyzoo_project
}
data "google_compute_image" "log4j-solr-49" { data "google_compute_image" "log4j-solr-49" {
name = "log4j-solr-49" name = "log4j-solr-49"
project = local.monkeyzoo_project project = local.monkeyzoo_project

View File

@ -44,6 +44,18 @@ resource "google_compute_subnetwork" "tunneling2-main" {
network = google_compute_network.tunneling2.self_link network = google_compute_network.tunneling2.self_link
} }
resource "google_compute_subnetwork" "credential-reuse" {
name = "${local.resource_prefix}credential-reuse"
ip_cidr_range = "10.2.4.0/24"
network = google_compute_network.credential-reuse.self_link
}
resource "google_compute_subnetwork" "credential-reuse2" {
name = "${local.resource_prefix}credential-reuse2"
ip_cidr_range = "10.2.5.0/24"
network = google_compute_network.credential-reuse2.self_link
}
resource "google_compute_instance_from_template" "hadoop-2" { resource "google_compute_instance_from_template" "hadoop-2" {
name = "${local.resource_prefix}hadoop-2" name = "${local.resource_prefix}hadoop-2"
source_instance_template = local.default_ubuntu source_instance_template = local.default_ubuntu
@ -309,23 +321,65 @@ resource "google_compute_instance_from_template" "powershell-3-45" {
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="${local.resource_prefix}monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main-1"
network_ip="10.2.3.45" network_ip="10.2.3.45"
} }
} }
resource "google_compute_instance_from_template" "powershell-3-45" { resource "google_compute_instance_from_template" "credentials-reuse-14" {
name = "${local.resource_prefix}powershell-3-45" name = "${local.resource_prefix}credentials-reuse-14"
source_instance_template = local.default_windows source_instance_template = local.default_linux
boot_disk{ boot_disk{
initialize_params { initialize_params {
image = data.google_compute_image.powershell-3-45.self_link image = data.google_compute_image.credentials-reuse-14.self_link
} }
auto_delete = true auto_delete = true
} }
network_interface { network_interface {
subnetwork="${local.resource_prefix}monkeyzoo-main" subnetwork="${local.resource_prefix}monkeyzoo-main-1"
network_ip="10.2.3.45" network_ip="10.2.3.14"
}
network_interface {
subnetwork="${local.resource_prefix}credential-reuse"
network_ip="10.2.4.14"
}
}
resource "google_compute_instance_from_template" "credentials-reuse-15" {
name = "${local.resource_prefix}credentials-reuse-15"
source_instance_template = local.default_linux
boot_disk{
initialize_params {
image = data.google_compute_image.credentials-reuse-15.self_link
}
auto_delete = true
}
network_interface {
subnetwork="${local.resource_prefix}credential-reuse"
network_ip="10.2.4.15"
}
network_interface {
subnetwork="${local.resource_prefix}credential-reuse2"
network_ip="10.2.5.15"
}
}
resource "google_compute_instance_from_template" "credentials-reuse-16" {
name = "${local.resource_prefix}credentials-reuse-16"
source_instance_template = local.default_linux
boot_disk{
initialize_params {
image = data.google_compute_image.credentials-reuse-16.self_link
}
auto_delete = true
}
network_interface {
subnetwork="${local.resource_prefix}credential-reuse2"
network_ip="10.2.5.16"
}
network_interface {
subnetwork="${local.resource_prefix}monkeyzoo-main-1"
network_ip="10.2.3.16"
} }
} }