From 246c78e8c1baa1fcd66e35bba3dafdbf1a81f47b Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Tue, 20 Sep 2022 17:52:00 +0200 Subject: [PATCH] BB: Add the new machine to the Terraform scripts --- envs/monkey_zoo/terraform/images.tf | 12 +++++ envs/monkey_zoo/terraform/monkey_zoo.tf | 68 ++++++++++++++++++++++--- 2 files changed, 73 insertions(+), 7 deletions(-) diff --git a/envs/monkey_zoo/terraform/images.tf b/envs/monkey_zoo/terraform/images.tf index a33953252..767935f61 100644 --- a/envs/monkey_zoo/terraform/images.tf +++ b/envs/monkey_zoo/terraform/images.tf @@ -63,6 +63,18 @@ data "google_compute_image" "powershell-3-45" { name = "powershell-3-45" 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" { name = "log4j-solr-49" project = local.monkeyzoo_project diff --git a/envs/monkey_zoo/terraform/monkey_zoo.tf b/envs/monkey_zoo/terraform/monkey_zoo.tf index a15e6b9f4..553a85076 100644 --- a/envs/monkey_zoo/terraform/monkey_zoo.tf +++ b/envs/monkey_zoo/terraform/monkey_zoo.tf @@ -44,6 +44,18 @@ resource "google_compute_subnetwork" "tunneling2-main" { 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" { name = "${local.resource_prefix}hadoop-2" source_instance_template = local.default_ubuntu @@ -309,23 +321,65 @@ resource "google_compute_instance_from_template" "powershell-3-45" { auto_delete = true } network_interface { - subnetwork="${local.resource_prefix}monkeyzoo-main" + subnetwork="${local.resource_prefix}monkeyzoo-main-1" network_ip="10.2.3.45" } } -resource "google_compute_instance_from_template" "powershell-3-45" { - name = "${local.resource_prefix}powershell-3-45" - source_instance_template = local.default_windows +resource "google_compute_instance_from_template" "credentials-reuse-14" { + name = "${local.resource_prefix}credentials-reuse-14" + source_instance_template = local.default_linux boot_disk{ 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 } network_interface { - subnetwork="${local.resource_prefix}monkeyzoo-main" - network_ip="10.2.3.45" + subnetwork="${local.resource_prefix}monkeyzoo-main-1" + 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" } }