Skip to content

Commit c05053e

Browse files
committed
removing step git reset --hard $CI_COMMIT_SHA
1 parent 628596b commit c05053e

File tree

7 files changed

+57
-71
lines changed

7 files changed

+57
-71
lines changed

terraform/gcp/high-availability/README.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ project = "project-id"
117117
# --- Check Point Deployment ---
118118
prefix = "chkp-tf-ha"
119119
license = "BYOL"
120-
image_name = "check-point-r8120-gw-byol-cluster-631-991001335-v20230622"
120+
image_name = "check-point-r8120-gw-byol-cluster-631-991001669-v20240923"
121121
os_version = "R8120"
122122

123123
# --- Instances Configuration ---
124124
region = "us-central1"
125-
zoneA = "us-central1-a"
126-
zoneB = "us-central1-a"
125+
zone_a = "us-central1-a"
126+
zone_b = "us-central1-a"
127127
machine_type = "n1-standard-4"
128128
disk_type = "SSD Persistent Disk"
129129
disk_size = 100
@@ -223,17 +223,17 @@ internal_network1_subnetwork_name = ""
223223
| Name | Description | Type | Allowed values | Default | Required |
224224
| ------------- | ------------- | ------------- | ------------- | ------------- | ------------- |
225225
| service_account_path | User service account path in JSON format - From the service account key page in the Cloud Console choose an existing account or create a new one. Next, download the JSON key file. Name it something you can remember, store it somewhere secure on your machine, and supply the path to the location is stored. (e.g. "service-accounts/service-account-name.json") | string | N/A | "" | yes |
226-
| project | Personal project id. The project indicates the default GCP project all of your resources will be created in. | string | N/A | "" | yes |
226+
| project | Personal project ID. The project indicates the default GCP project all of your resources will be created in. The project ID must be 6-30 characters long, start with a letter, and can only include lowercase letters, numbers, hyphenst and cannot end with a hyphen. | string | N/A | "" | yes |
227227
| | | | | |
228228
| prefix | (Optional) Resources name prefix. | string | N/A | "chkp-tf-ha" | no |
229229
| license | Checkpoint license (BYOL or PAYG). | string | - BYOL <br/> - PAYG <br/> | "BYOL" | no |
230-
| image_name | The High Availability (cluster) image name (e.g. check-point-r8120-gw-byol-cluster-631-991001335-v20230622). You can choose the desired cluster image value from [Github](https://github.com/CheckPointSW/CloudGuardIaaS/blob/master/gcp/deployment-packages/ha-byol/images.py). | string | N/A | N/A | yes |
230+
| image_name | The High Availability (cluster) image name (e.g. check-point-r8120-gw-byol-cluster-631-991001669-v20240923). You can choose the desired cluster image value from [Github](https://github.com/CheckPointSW/CloudGuardIaaS/blob/master/gcp/deployment-packages/ha-byol/images.py). | string | N/A | N/A | yes |
231231
| | | | | |
232-
| os_version |GAIA OS Version | string | R81;<br/> R8110;<br/> R8120;<br/> R82 | R8120 | yes |
232+
| os_version |GAIA OS Version | string | R81;<br/> R8110;<br/> R8120;<br/> R82; | R8120 | yes |
233233
| | | | | |
234234
| region | GCP region | string | N/A | "us-central1" | no |
235-
| zoneA | Member A Zone. The zone determines what computing resources are available and where your data is stored and used. | string | N/A | "us-central1-a" | no |
236-
| zoneB | Member B Zone. | string | N/A | "us-central1-a" | no |
235+
| zone_a | Member A Zone. The zone determines what computing resources are available and where your data is stored and used. | string | N/A | "us-central1-a" | no |
236+
| zone_b | Member B Zone. | string | N/A | "us-central1-a" | no |
237237
| machine_type | Machine types determine the specifications of your machines, such as the amount of memory, virtual cores, and persistent disk limits an instance will have. | string | N/A | "n1-standard-4" | no |
238238
| disk_type | Storage space is much less expensive for a standard Persistent Disk. An SSD Persistent Disk is better for random IOPS or streaming throughput with low latency. | string | - SSD Persistent Disk <br/> - Standard Persistent Disk | "SSD Persistent Disk" | no |
239239
| disk_size | Disk size in GB - Persistent disk performance is tied to the size of the persistent disk volume. You are charged for the actual amount of provisioned disk space. | number | number between 100 and 4096 | 100 | no |
@@ -304,9 +304,7 @@ In order to check the template version refer to the [sk116585](https://supportce
304304
305305
| Template Version | Description |
306306
| ---------------- | ------------- |
307-
| 20241027 | Added R82 support |
308-
| | | |
309-
| 20230910 | - R81.20 is the default version |
307+
| 20230910 | R81.20 is the default version. |
310308
| | | |
311309
| 20230209 | Added Smart-1 Cloud support. |
312310
| | | |

terraform/gcp/high-availability/locals.tf

+5-35
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
11
locals {
2-
license_allowed_values = [
3-
"BYOL",
4-
"PAYG"]
5-
// will fail if [var.license] is invalid:
6-
validate_license = index(local.license_allowed_values, upper(var.license))
7-
8-
regex_validate_image_name = "^check-point-${lower(var.os_version)}-gw-.*[0-9]{3}-([0-9]{3,}|[a-z]+)-v[0-9]{8,}.*"
9-
// will fail if the image name is not in the right syntax
10-
validate_image_name = length(regexall(local.regex_validate_image_name, var.image_name)) > 0 ? 0 : index(split("-", var.image_name), "INVALID IMAGE NAME")
11-
12-
version_allowed_values = [
13-
"R81",
14-
"R8110",
15-
"R8120",
16-
"R82"
17-
]
18-
// Will fail if var.os_version is invalid:
19-
validate_os_version = index(local.version_allowed_values, var.os_version)
20-
21-
split_zoneA = split("-", var.zoneA)
22-
split_zoneB = split("-", var.zoneB)
2+
3+
split_zoneA = split("-", var.zone_a)
4+
split_zoneB = split("-", var.zone_b)
235
// will fail if the var.zoneA and var.zoneB are not at the same region:
246
validate_zones = index(local.split_zoneA, local.split_zoneB[0]) == local.split_zoneA[0] && index(local.split_zoneA, local.split_zoneB[1]) == local.split_zoneA[0] ? 0 : "var.zoneA and var.zoneB are not at the same region"
257

@@ -42,13 +24,6 @@ locals {
4224
// Will fail if var.disk_type is invalid
4325
validate_disk_type = index(local.disk_type_allowed_values, var.disk_type)
4426

45-
admin_shell_allowed_values = [
46-
"/etc/cli.sh",
47-
"/bin/bash",
48-
"/bin/csh",
49-
"/bin/tcsh"]
50-
// Will fail if var.admin_shell is invalid
51-
validate_admin_shell = index(local.admin_shell_allowed_values, var.admin_shell)
5227

5328
// Will fail if var.cluster_network_name or var.cluster_network_subnetwork_name are empty double quotes in case of use existing network.
5429
validate_cluster_network = var.cluster_network_cidr == "" && var.cluster_network_name == "" ? index("error:", "using existing cluster network - cluster network name is missing") : 0
@@ -83,15 +58,10 @@ locals {
8358
validate_internal_network6_subnet = var.num_internal_networks >= 6 && var.internal_network6_cidr == "" && var.internal_network6_subnetwork_name == "" ? index("error:", "using existing network6 - internal network6 subnet name is missing") : 0
8459

8560

86-
regex_valid_admin_SSH_key = "^(^$|ssh-rsa AAAA[0-9A-Za-z+/]+[=]{0,3})"
87-
// Will fail if var.admin_SSH_key is invalid
88-
regex_admin_SSH_key = regex(local.regex_valid_admin_SSH_key, var.admin_SSH_key) == var.admin_SSH_key ? 0 : "Please enter a valid SSH public key or leave empty"
89-
9061
regex_valid_sic_key = "^([a-z0-9A-Z]{8,30})$"
9162
// Will fail if var.sic_key is invalid
92-
regex_sic_key = regex(local.regex_valid_sic_key, var.sic_key) == var.sic_key ? 0 : "Variable [sic_key] must be at least 8 alpha numeric characters."
93-
94-
63+
regex_sic_key = length(regexall(local.regex_valid_sic_key, var.sic_key) )> 0 ? 0 : "Variable [sicKey] must be at least 8 alphanumeric characters."
64+
index_sic_key = index(["0"], local.regex_sic_key)
9565

9666

9767
create_cluster_network_condition = var.cluster_network_cidr == "" ? false : true

terraform/gcp/high-availability/main.tf

+11-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ provider "google" {
44
region = var.region
55
}
66

7+
module "common" {
8+
source = "../common/common"
9+
installation_type = "Cluster"
10+
os_version = var.os_version
11+
image_name = var.image_name
12+
admin_shell = var.admin_shell
13+
license = var.license
14+
admin_SSH_key = var.admin_SSH_key
15+
}
716
resource "random_string" "random_string" {
817
length = 5
918
special = false
@@ -211,8 +220,8 @@ module "members_a_b" {
211220

212221
prefix = "${var.prefix}-${random_string.random_string.result}"
213222
region = var.region
214-
zoneA = var.zoneA
215-
zoneB = var.zoneB
223+
zone_a = var.zone_a
224+
zone_b = var.zone_b
216225
machine_type = var.machine_type
217226
disk_size = var.disk_size
218227
disk_type = var.disk_type

terraform/gcp/high-availability/output.tf

+2-14
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,48 @@ output "cluster_new_created_network" {
44
output "cluster_new_created_subnet" {
55
value = module.cluster_network_and_subnet.new_created_subnet_name
66
}
7-
87
output "mgmt_new_created_network" {
98
value = module.mgmt_network_and_subnet.new_created_network_name
109
}
1110
output "mgmt_new_created_subnet" {
1211
value = module.mgmt_network_and_subnet.new_created_subnet_name
1312
}
14-
1513
output "int_network1_new_created_network" {
1614
value = module.internal_network1_and_subnet.new_created_network_name
1715
}
1816
output "int_network1_new_created_subnet" {
1917
value = module.internal_network1_and_subnet.new_created_subnet_name
2018
}
21-
2219
output "int_network2_new_created_network" {
2320
value = module.internal_network2_and_subnet[*].new_created_network_name
2421
}
2522
output "int_network2_new_created_subnet" {
2623
value = module.internal_network2_and_subnet[*].new_created_subnet_name
2724
}
28-
2925
output "int_network3_new_created_network" {
3026
value = module.internal_network3_and_subnet[*].new_created_network_name
3127
}
3228
output "int_network3_new_created_subnet" {
3329
value = module.internal_network3_and_subnet[*].new_created_subnet_name
3430
}
35-
3631
output "int_network4_new_created_network" {
3732
value = module.internal_network4_and_subnet[*].new_created_network_name
3833
}
3934
output "int_network4_new_created_subnet" {
4035
value = module.internal_network4_and_subnet[*].new_created_subnet_name
4136
}
42-
4337
output "int_network5_new_created_network" {
4438
value = module.internal_network5_and_subnet[*].new_created_network_name
4539
}
4640
output "int_network5_new_created_subnet" {
4741
value = module.internal_network5_and_subnet[*].new_created_subnet_name
4842
}
49-
5043
output "int_network6_new_created_network" {
5144
value = module.internal_network6_and_subnet[*].new_created_network_name
5245
}
5346
output "int_network6_new_created_subnet" {
5447
value = module.internal_network6_and_subnet[*].new_created_subnet_name
5548
}
56-
5749
output "cluster_ICMP_firewall_rule" {
5850
value = module.cluster_ICMP_firewall_rules[*].firewall_rule_name
5951
}
@@ -69,7 +61,6 @@ output "cluster_SCTP_firewall_rule" {
6961
output "cluster_ESP_firewall_rule" {
7062
value = module.cluster_ESP_firewall_rules[*].firewall_rule_name
7163
}
72-
7364
output "mgmt_ICMP_firewall_rule" {
7465
value = module.mgmt_ICMP_firewall_rules[*].firewall_rule_name
7566
}
@@ -85,7 +76,6 @@ output "mgmt_SCTP_firewall_rule" {
8576
output "mgmt_ESP_firewall_rule" {
8677
value = module.mgmt_ESP_firewall_rules[*].firewall_rule_name
8778
}
88-
8979
output "cluster_ip_external_address" {
9080
value = google_compute_address.primary_cluster_ip_ext_address.address
9181
}
@@ -95,23 +85,21 @@ output "admin_password" {
9585
output "sic_key" {
9686
value = var.sic_key
9787
}
98-
9988
output "member_a_name" {
10089
value = module.members_a_b.member_a_name
10190
}
10291
output "member_a_external_ip" {
10392
value = module.members_a_b.member_a_external_ip
10493
}
10594
output "member_a_zone" {
106-
value = var.zoneA
95+
value = var.zone_a
10796
}
108-
10997
output "member_b_name" {
11098
value = module.members_a_b.member_b_name
11199
}
112100
output "member_b_external_ip" {
113101
value = module.members_a_b.member_b_external_ip
114102
}
115103
output "member_b_zone" {
116-
value = var.zoneB
104+
value = var.zone_b
117105
}

terraform/gcp/high-availability/terraform.tfvars

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ project = "PLEASE ENTER PROJECT ID"
55
# --- Check Point Deployment ---
66
prefix = "PLEASE ENTER PREFIX" # "chkp-tf-ha"
77
license = "PLEASE ENTER LICENSE" # "BYOL"
8-
image_name = "PLEASE ENTER IMAGE NAME" # "check-point-r8120-gw-byol-cluster-631-991001335-v20230622"
8+
image_name = "PLEASE ENTER IMAGE NAME" # "check-point-r8120-gw-byol-cluster-631-991001669-v20240923"
99
os_version = "PLEASE ENTER GAIA OS VERSION" # "R8120"
1010

1111
# --- Instances Configuration ---
1212
region = "PLEASE ENTER REGION" # "us-central1"
13-
zoneA = "PLEASE ENTER ZONE A" # "us-central1-a"
14-
zoneB = "PLEASE ENTER ZONE B" # "us-central1-a"
13+
zone_a = "PLEASE ENTER ZONE A" # "us-central1-a"
14+
zone_b = "PLEASE ENTER ZONE B" # "us-central1-a"
1515
machine_type = "PLEASE ENTER MACHINE TYPE" # "n1-standard-4"
1616
disk_type = "PLEASE ENTER DISK TYPE" # "SSD Persistent Disk"
1717
disk_size = "PLEASE ENTER DISK SIZE" # 100
@@ -27,8 +27,8 @@ admin_shell = "PLEASE ENTER ADMIN SHELL"
2727
maintenance_mode_password_hash = "PLEASE ENTER MAINTENANCE MODE PASSWORD HASH" # "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
2828

2929
# --- Quick connect to Smart-1 Cloud ---
30-
smart_1_cloud_token_a = "PASTE TOKEN FROM SMART-1 CLOUD PORTAL" # ""
31-
smart_1_cloud_token_b = "PASTE TOKEN FROM SMART-1 CLOUD PORTAL" # ""
30+
smart_1_cloud_token_a = "PASTE TOKEN FROM SMART-1 CLOUD PORTAL" # ""
31+
smart_1_cloud_token_b = "PASTE TOKEN FROM SMART-1 CLOUD PORTAL" # ""
3232

3333
# --- Networking ---
3434
cluster_network_cidr = "PLEASE ENTER CLUSTER NETWORK CIDR" # "10.0.1.0/24"

terraform/gcp/high-availability/variables.tf

+7-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ variable "project" {
1010
type = string
1111
description = "Personal project id. The project indicates the default GCP project all of your resources will be created in."
1212
default = ""
13+
validation {
14+
condition = can(regex("^[a-z][a-z0-9-]{4,28}[a-z0-9]$", var.project)) && length(var.project) >= 6 && length(var.project) <= 30
15+
error_message = "The project ID must be 6-30 characters long, start with a letter, and can only include lowercase letters, numbers, hyphenst and cannot end with a hyphen."
16+
}
1317
}
1418

1519
# --- Check Point Deployment ---
@@ -32,20 +36,19 @@ variable "os_version" {
3236
description = "GAIA OS version"
3337
default = "R8120"
3438
}
35-
3639
# --- Instances Configuration ---
3740
data "google_compute_regions" "available_regions" {
3841
}
3942
variable "region" {
4043
type = string
4144
default = "us-central1"
4245
}
43-
variable "zoneA" {
46+
variable "zone_a" {
4447
type = string
4548
description = "Member A Zone. The zone determines what computing resources are available and where your data is stored and used."
4649
default = "us-central1-a"
4750
}
48-
variable "zoneB" {
51+
variable "zone_b" {
4952
type = string
5053
description = "Member B Zone."
5154
default = "us-central1-a"
@@ -75,7 +78,6 @@ variable "enable_monitoring" {
7578
description = "Enable Stackdriver monitoring"
7679
default = false
7780
}
78-
7981
# --- Check Point ---
8082
variable "management_network" {
8183
type = string
@@ -130,6 +132,7 @@ resource "null_resource" "validate_both_tokens" {
130132
resource "null_resource" "validate_different_tokens" {
131133
count = var.smart_1_cloud_token_a != "" && var.smart_1_cloud_token_a == var.smart_1_cloud_token_b ? "To connect to Smart-1 Cloud, you must provide two different tokens" : 0
132134
}
135+
133136
# --- Networking ---
134137
variable "cluster_network_cidr" {
135138
type = string
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
terraform {
2+
required_version = ">= 0.13"
3+
required_providers {
4+
google = {
5+
source = "hashicorp/google"
6+
version = ">= 3.53, < 5.0"
7+
}
8+
9+
random = {
10+
source = "hashicorp/random"
11+
version = "~>3.4"
12+
}
13+
}
14+
15+
provider_meta "google" {
16+
module_name = "blueprints/terraform/canonical-mp/v0.0.1"
17+
}
18+
}

0 commit comments

Comments
 (0)