generated from kyleabenson/new-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maint.tf
105 lines (83 loc) · 3.09 KB
/
maint.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
variable "gcp_project_id" {
type = string
description = "Project ID where issues occur and where you'll create an investigation"
}
variable "user_id" {
type = string
description = "Name of the principle who will access investigations. Should be in a format like: [email protected]:user"
}
resource "google_project_service" "resourcemanagerapi" {
service = "cloudresourcemanager.googleapis.com"
disable_on_destroy = true
project = var.gcp_project_id
}
resource "google_project_service" "computeapi" {
service = "compute.googleapis.com"
disable_on_destroy = true
project = var.gcp_project_id
}
resource "google_project_service" "aicompnaionapi" {
service = "cloudaicompanion.googleapis.com"
disable_on_destroy = true
project = var.gcp_project_id
}
resource "google_project_service" "geminiapi" {
service = "geminicloudassist.googleapis.com"
disable_on_destroy = true
project = var.gcp_project_id
}
resource "google_project_service" "k8sapi" {
service = "container.googleapis.com"
disable_on_destroy = true
project = var.gcp_project_id
}
resource "google_project_iam_member" "gemini_cloud_assist_investigation_admin" {
project = var.gcp_project_id # Assuming project ID is stored in a variable
role = "roles/geminicloudassist.investigationAdmin"
member = var.user_id# Assuming member is stored in a variable
}
resource "google_project_iam_member" "gemini_for_google_cloud_user" {
project = var.gcp_project_id
role = "roles/cloudaicompanion.user"
member = var.user_id
}
resource "google_compute_network" "default" {
name = "example-network"
auto_create_subnetworks = false
enable_ula_internal_ipv6 = true
}
resource "google_compute_subnetwork" "default" {
name = "example-subnetwork"
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"
stack_type = "IPV4_IPV6"
ipv6_access_type = "INTERNAL" # Change to "EXTERNAL" if creating an external loadbalancer
network = google_compute_network.default.id
secondary_ip_range {
range_name = "services-range"
ip_cidr_range = "192.168.0.0/24"
}
secondary_ip_range {
range_name = "pod-ranges"
ip_cidr_range = "192.168.1.0/24"
}
}
resource "google_container_cluster" "default" {
name = "example-autopilot-cluster"
location = "us-central1"
enable_autopilot = true
enable_l4_ilb_subsetting = true
network = google_compute_network.default.id
subnetwork = google_compute_subnetwork.default.id
ip_allocation_policy {
stack_type = "IPV4_IPV6"
services_secondary_range_name = google_compute_subnetwork.default.secondary_ip_range[0].range_name
cluster_secondary_range_name = google_compute_subnetwork.default.secondary_ip_range[1].range_name
}
# Set `deletion_protection` to `true` will ensure that one cannot
# accidentally delete this instance by use of Terraform.
deletion_protection = false
}
output "investigation_url" {
value = format("%s/%s","https://console.cloud.google.com/troubleshooting/investigations/list?project=",var.gcp_project_id)
}