Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect jump host zone from copier responses #125

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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