Skip to content

Commit

Permalink
Detect jump host zone from copier responses (#125)
Browse files Browse the repository at this point in the history
* Detect jump host zone from copier responses

* Change zone variable to jump_host_zone
  • Loading branch information
lavjain authored Sep 19, 2023
1 parent c9656e9 commit 382999e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
13 changes: 12 additions & 1 deletion solutions_builder/template_root/copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ gcp_region:
help: Which Google Cloud region?
default: us-central1

use_jump_host:
type: bool
help: Use a jump-host for running terraform foundations?
default: true

jump_host_zone:
type: str
help: Google Cloud zone for creating the jump host?
default: us-central1-a
when: "{{use_jump_host}}"

has_common:
type: bool
help: Include a common container image for shared libraries, data models, utils, etc?
Expand All @@ -35,7 +46,7 @@ terraform_backend_gcs:

advanced_settings:
type: bool
help: Show advanced settings (VPC, Storage region, etc)?
help: Show advanced settings (VPC, Storage, Region, etc)?
default: false

create_vpc_network:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ sudo ln -s python3.9 python
sudo rm /usr/bin/python3 && sudo ln -s python3.9 python3
popd
python -m pip install --upgrade pip
python -m pip install --upgrade pyopenssl
python -m pip install google-cloud-firestore google-cloud-bigquery firebase-admin
python -m pip install solutions-builder --ignore-installed PyYAML
touch jumphost_ready
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ resource "time_sleep" "wait_60_seconds" {
resource "google_compute_network" "vpc" {
depends_on = [time_sleep.wait_60_seconds]
project = var.project_id
name = "jumphost-vpc"
name = "jump-vpc"
auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "subnet" {
name = "jumphost-vpc-subnet"
name = "jump-vpc-subnet"
region = var.region
network = google_compute_network.vpc.name
ip_cidr_range = "10.0.0.0/24"
Expand All @@ -67,7 +67,7 @@ resource "google_compute_disk" "default" {
depends_on = [time_sleep.wait_60_seconds]
name = "disk-data"
type = "pd-balanced"
zone = var.zone
zone = var.jump_host_zone
size = var.disk_size_gb
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project_id = "{{project_id}}"
region = "{{gcp_region}}"
jump_host_zone = "{{jump_host_zone}}"
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ variable "region" {
}
}

variable "zone" {
variable "jump_host_zone" {
type = string
description = "GCP Zone for the jump host"
}
Expand Down

0 comments on commit 382999e

Please sign in to comment.