Commit ed7b9d78 authored by Adam Robinson's avatar Adam Robinson
Browse files

use a variable for the datalab zone

parent 988c34a1
......@@ -82,7 +82,7 @@ resource "google_compute_instance_iam_policy" "datalab_user_to_instance_binding"
for_each = var.datalab_user_list
instance_name = "datalab-${split("@", each.key)[0]}"
project = google_project.hipaa_project[each.value].project_id
zone = "us-central1-a"
zone = var.datalab_zone
policy_data = "${data.google_iam_policy.datalab_user_to_instance_policy[each.key].policy_data}"
depends_on = [ null_resource.datalab ]
}
......@@ -99,13 +99,13 @@ resource "null_resource" "datalab" {
provisioner "local-exec" {
//command = "datalab create --project ${google_project.hipaa_project[each.value].project_id} --machine-type n1-standard-1 --zone us-central1-a --no-connect --for-user ${each.key} --service-account ${google_service_account.datalab_service_account[each.key].email} datalab-${split("@", each.key)[0]}"
command = "datalab create --project ${self.triggers.project_id} --machine-type n1-standard-1 --zone us-central1-a --no-connect --for-user ${self.triggers.user} --service-account ${google_service_account.datalab_service_account[self.triggers.user].email} datalab-${split("@", self.triggers.user)[0]}"
command = "datalab create --project ${self.triggers.project_id} --machine-type n1-standard-1 --zone ${var.datalab_zone} --no-connect --for-user ${self.triggers.user} --service-account ${google_service_account.datalab_service_account[self.triggers.user].email} datalab-${split("@", self.triggers.user)[0]}"
}
provisioner "local-exec" {
when = "destroy"
//command = "datalab delete --quiet --delete-disk --project ${google_project.hipaa_project[each.value].project_id} --zone us-central1-a datalab-${split("@", each.key)[0]}"
command = "datalab delete --quiet --delete-disk --project ${self.triggers.project_id} --zone us-central1-a datalab-${split("@", self.triggers.user)[0]}"
command = "datalab delete --quiet --delete-disk --project ${self.triggers.project_id} --zone ${var.datalab_zone} datalab-${split("@", self.triggers.user)[0]}"
}
depends_on = [ google_sourcerepo_repository.datalab-notebooks, google_compute_network.datalab-network, null_resource.install_gcloud_cli ]
}
\ No newline at end of file
......@@ -33,6 +33,11 @@ variable "datalab_user_list" {
default = {}
}
variable "datalab_zone" {
description = "The zone to create datalab instances in"
default = "us-central1-a"
}
locals {
base_projects = ["audit", "data", "network", "monitor"]
projects_storing_data = concat(["data"], local.worker_projects)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment