Skip to content

Commit 4d011dc

Browse files
vertex.tf
1 parent eecd636 commit 4d011dc

2 files changed

Lines changed: 88 additions & 13 deletions

File tree

code/simple_ec2.tf

Lines changed: 0 additions & 13 deletions
This file was deleted.

code/vertex.tf

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Use variables for easy customization
2+
variable "project_id" {
3+
description = "The ID of the Google Cloud project."
4+
type = string
5+
default = "qwiklabs-gcp-03-fa7edfd03d8e"
6+
}
7+
8+
variable "region" {
9+
description = "The region where the instance will be created."
10+
type = string
11+
default = "us-central1"
12+
}
13+
14+
# -------------------------------------------------------------------------------------
15+
# Required variables
16+
# -------------------------------------------------------------------------------------
17+
18+
variable "zone" {
19+
default = "us-central1-a"
20+
}
21+
22+
variable "service_account_key_file" {
23+
type = string
24+
}
25+
26+
# -------------------------------------------------------------------------------------
27+
# Locals
28+
# -------------------------------------------------------------------------------------
29+
30+
locals {
31+
project_id = var.project_id
32+
region = var.region
33+
zone = var.zone
34+
service_account_key_file = var.service_account_key_file
35+
}
36+
37+
38+
# -------------------------------------------------------------------------------------
39+
# Enable required APIs
40+
# -------------------------------------------------------------------------------------
41+
module "la_api_batch" {
42+
source = "gcs::https://www.googleapis.com/storage/v1/terraform-lab-foundation/basics/api_service/dev"
43+
gcp_project_id = var.project_id
44+
gcp_region = var.region
45+
gcp_zone = var.zone
46+
api_services = [
47+
"cloudresourcemanager.googleapis.com",
48+
"storage.googleapis.com",
49+
"compute.googleapis.com",
50+
"iam.googleapis.com",
51+
"notebooks.googleapis.com",
52+
"aiplatform.googleapis.com",
53+
"datacatalog.googleapis.com",
54+
"visionai.googleapis.com"
55+
]
56+
}
57+
58+
59+
60+
# -------------------------------------------------------------------------------------
61+
# Create GSC bucket & log router for VPC flow logs
62+
# -------------------------------------------------------------------------------------
63+
64+
resource "random_string" "main" {
65+
length = 16
66+
min_lower = 8
67+
min_numeric = 8
68+
special = false
69+
}
70+
resource "google_workbench_instance" "instance" {
71+
name = "workbench-instance"
72+
location = local.zone
73+
gce_setup {
74+
machine_type = "n1-standard-2"
75+
76+
77+
shielded_instance_config {
78+
enable_secure_boot = false
79+
enable_vtpm = false
80+
enable_integrity_monitoring = false
81+
}
82+
83+
disable_public_ip = false
84+
85+
tags = ["notebook-instance"]
86+
}
87+
depends_on = [module.la_api_batch]
88+
}

0 commit comments

Comments
 (0)