-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmain.tf
More file actions
83 lines (79 loc) · 2.57 KB
/
Copy pathmain.tf
File metadata and controls
83 lines (79 loc) · 2.57 KB
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
/**
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module "instance_template" {
source = "terraform-google-modules/vm/google///modules/instance_template"
version = "15.2.1"
project_id = var.project_id
name_prefix = "xwiki-${var.zones[0]}-temp-"
machine_type = "n2-standard-2"
min_cpu_platform = "Intel Cascade Lake"
source_image = "https://www.googleapis.com/compute/beta/projects/${var.xwiki_img_info.image_project}/global/images/${var.xwiki_img_info.image_name}"
disk_size_gb = 30
disk_type = "pd-balanced"
tags = [
var.xwiki_vm_tag,
]
network = var.private_network_id
service_account = {
email = var.service_account.email
scopes = var.service_account.scopes
}
startup_script = var.startup_script
labels = var.labels
}
module "mig" {
source = "terraform-google-modules/vm/google//modules/mig"
version = "15.2.1"
project_id = var.project_id
mig_name = "xwiki-${var.region}-group-autoscale"
hostname = "xwiki-${var.region}-group-autoscale"
instance_template = module.instance_template.self_link
region = var.region
distribution_policy_zones = var.zones
autoscaling_enabled = true
max_replicas = 2
min_replicas = 1
cooldown_period = 120
autoscaler_name = "autoscaler"
autoscaling_cpu = [
{
target = 0.5,
predictive_method = null
},
]
health_check_name = "xwiki-health-check-http-8080"
health_check = {
type = "http"
port = 8080
proxy_header = "NONE"
request = ""
response = ""
check_interval_sec = 5
timeout_sec = 5
healthy_threshold = 2
unhealthy_threshold = 2
host = ""
initial_delay_sec = 600
request_path = "/xwiki/bin/view/Main"
enable_logging = true
}
named_ports = [
{
name = var.xwiki_lb_port_name
port = 8080
},
]
}