Skip to content

Commit e50b95d

Browse files
committed
init/updateGCPTerraformModules: 1.4.0
Signed-off-by: FTNT-HQCM <hq-devops-admin@fortinet.com>
1 parent b6b655f commit e50b95d

40 files changed

+2573
-136
lines changed

CHANGELOG.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1-
## 1.3.0 (2025)
1+
## 1.4.0 (May, 16, 2025)
2+
3+
FEATURES:
4+
5+
* **New Module**: `module/fortigate/fgt_ha`.
6+
* **New Module**: `module/fortinet/generic_vm_standalone`.
7+
8+
IMPROVEMENTS:
9+
* Module `modules/fortigate/fgt_asg_with_function`:
10+
* Data source `google_compute_default_service_account` will not be retrieved if the variable `service_account_email` is specified.
11+
* Added a new optional variable `bucket`. You can set "uniform_bucket_level_access = true" to the resource `google_storage_bucket` to enable uniform bucket-level access.
12+
* Added two new variables `cloud_function->service_config->ingress_settings` and `cloud_function->service_config->egress_settings`, to configure the ingress and egress traffic settings of the Cloud Function.
13+
* Added a new optional variable `cloud_function->build_service_account_email`. This account is used to build the Cloud Function and should have the role "roles/cloudbuild.builds.builder".
14+
* Added a new optional variable `cloud_function->trigger_service_account_email`. This account is used to trigger the Cloud Function and should have the role "roles/run.invoker".
15+
* Added a new variable `fmg_integration` to support FortiManager integration.
16+
* Example `examples/autoscale_fgt_as_hub`:
17+
* Supported everything changed in Module `fgt_asg_with_function`.
18+
* Example `examples/autoscale_fgt_lb_sandwich`:
19+
* Supported everything changed in Module `fgt_asg_with_function`.
20+
* Added variable `special_behavior`. Please only use this variable under the suggestion of the developer.
21+
* Document:
22+
* Added new file `/docs/guide_gcp_modules.md`.
23+
* Added new file `/docs/module_generic_vm_standalone.md`.
24+
25+
## 1.3.0 (Febuary, 25, 2025)
226

327
FEATURES:
428
* **New Module**: `modules/gcp/iam`. It helps you create a new service account with specified roles.

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@ Please click the following links for visual diagrams, requirements, example depl
2222
Utilize Autoscale FortiGate as a central hub to connect up to eight existing VPCs. FortiGates connect your VPCs and manage traffic between VPCs.
2323

2424
### Modules
25-
1. [Single FortiGate](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/fgt_single.md):
25+
1. [generic_vm_standalone](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/module_generic_vm_standalone.md)
26+
27+
This module can be used to deploy any Fortinet VM: FortiGate / FortiManager / FortiAnalyzer / FortiAIOPS / FortiGuest ...
28+
29+
30+
2. [Single FortiGate](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/fgt_single.md) (Deprecated, please use [generic_vm_standalone](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/module_generic_vm_standalone.md)):
2631

2732
You can use this module to quickly deploy one single FortiGate.
2833

34+
This module can also be used to create FortiManager and FortiAnalyzer if you change the `image_type` or `image_source` to the [target value](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/guide_image.md#image-list).
35+
36+
2937

3038
## How to Use Examples/Modules:
3139

@@ -53,6 +61,7 @@ module "your_module_name" {
5361
## FAQ
5462
- [How to Specify Image](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/guide_image.md)
5563
- [What is Cloud Function](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/guide_function.md)
64+
- [Useful GCP Modules](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/guide_gcp_modules.md)
5665

5766
## Request, Question or Issue
5867

docs/autoscale_fgt_as_hub.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,16 @@ zones = ["<YOUR-OWN-VALUE1>", # e.g., ["us-central1-b", "us-central1-c"].
5858
"<YOUR-OWN-VALUE2>"] # If zones is empty, GCP will select 3 zones for you.
5959
6060
# IAM variables (Optional)
61-
# service_account_email = "example@example.com " # The e-mail address of the service account.
62-
# This service account should already have "roles/datastore.user" and "roles/compute.viewer".
63-
# If not given, the default Google Compute Engine service account is used.
61+
# service_account_email = "example@<your-project-name>.iam.gserviceaccount.com"
62+
# The e-mail address of the service account. This service account will control the cloud function created by this project.
63+
# This service account should already have "roles/datastore.user", "roles/compute.viewer" and "roles/run.invoker".
64+
# If this variable is not specified, the default Google Compute Engine service account is used.
6465
```
6566
Modify these variables based on your needs.
6667

68+
`service_account_email` should comply with the least privilege principle.
69+
You can [create dedicated service account by using our GCP module](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/guide_gcp_modules.md#create-dedicated-service-account).
70+
6771
If you want to deploy more than one examples, please make sure the `prefix` of those examples are different.
6872

6973

@@ -183,14 +187,14 @@ cloud_function = {
183187
# "fortiflex" parameters is required if license_source is "fortiflex" or "file_fortiflex"
184188
# fortiflex = {
185189
# retrieve_mode = "use_active" # How to retrieve an existing fortiflex license (entitlement)
186-
# # "use_stopped" selects and reactivates a stopped entitlement where the description field is empty;
187-
# # "use_active" selects one active and unused entitlement where the description field is empty.
190+
# # "use_active": Retrieves "ACTIVE" or "PENDING" licenses. If the license is released, the license keeps "ACTIVE".
191+
# # "use_stopped" (default behavior): Retrieves "STOPPED", "EXPIRED" or "PENDING" licenses, and changes them to "ACTIVE". If the license is released, change the license to "STOPPED".
188192
# username = "<YOUR-OWN-VALUE>" # The username of your FortiFlex account.
189193
# password = "<YOUR-OWN-VALUE>" # The password of your FortiFlex account.
190194
# config = <YOUR-OWN-VALUE> # The config ID of your FortiFlex configuration.
191195
# }
192196
193-
# This parameter controls the instance that runs the cloud function.
197+
# This parameter controls the instance that runs the cloud function. For simplicity, it is recommended to use the default value.
194198
service_config = {
195199
max_instance_count = 1 # The limit on the maximum number of function instances that may coexist at a given time.
196200
max_instance_request_concurrency = 3 # Sets the maximum number of concurrent requests that one cloud function can handle at the same time.
@@ -200,6 +204,12 @@ cloud_function = {
200204
}
201205
202206
# additional_variables = {} # Additional Cloud Function Variables
207+
208+
# The following parameters are optional, and no need to be specified in most of cases
209+
# build_service_account_email = "your-name@example.com" # The email address of the service account used to build the cloud function. This account needs to have role "roles/cloudbuild.builds.builder".
210+
# The <PROJECT_NUMBER>@cloudbuild.gserviceaccount.com will be used if it is not specified.
211+
# trigger_service_account_email = "your-name@example.com" # The email address of the service account used to trigger the cloud function. This account needs to have role "roles/run.invoker".
212+
# The default service account will be used if it is not specified.
203213
}
204214
```
205215

@@ -356,6 +366,21 @@ In addition to the variable config_script, you can also save the configuration s
356366

357367
If you specify both config_script and config_file, this terraform project will upload both of them.
358368

369+
#### Others
370+
```
371+
# FortiManager integration
372+
fmg_integration = {
373+
ip = "<Your FMG IP>" # The public IP address of the FortiManager.
374+
sn = "<Your FMG Serial Number>" # The serial number of the FortiManager.
375+
ums = {
376+
autoscale_psksecret = "<RANDOM-STRING>" # The secret key used to synchronize information between FortiGates.
377+
fmg_reg_password = "fmg_reg_passwd>" # The password used to register the FortiGate to the FortiManager.
378+
sync_interface = "port1" # The interface used to synchronize information between FortiGates.
379+
api_key = "" # The API key used to register the FortiGate to the FortiManager. Only used when license type is BYOL.
380+
}
381+
}
382+
```
383+
359384

360385
## FortiGates Licenses
361386

docs/autoscale_fgt_lb_sandwich.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,16 @@ zones = ["<YOUR-OWN-VALUE1>", # e.g., ["us-central1-b", "us-central1-c"].
5757
"<YOUR-OWN-VALUE2>"] # If zones is empty, GCP will select 3 zones for you.
5858
5959
# IAM variables (Optional)
60-
# service_account_email = "example@example.com " # The e-mail address of the service account.
61-
# This service account should already have "roles/datastore.user" and "roles/compute.viewer".
62-
# If not given, the default Google Compute Engine service account is used.
60+
# service_account_email = "example@<your-project-name>.iam.gserviceaccount.com"
61+
# The e-mail address of the service account. This service account will control the cloud function created by this project.
62+
# This service account should already have "roles/datastore.user", "roles/compute.viewer" and "roles/run.invoker".
63+
# If this variable is not specified, the default Google Compute Engine service account is used.
6364
```
6465
Modify these variables based on your needs.
6566

67+
`service_account_email` should comply with the least privilege principle.
68+
You can [create dedicated service account by using our GCP module](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/guide_gcp_modules.md#create-dedicated-service-account).
69+
6670
If you want to deploy more than one examples, please make sure the `prefix` of those examples are different.
6771

6872
#### FortiGate Variables:
@@ -159,14 +163,14 @@ cloud_function = {
159163
# "fortiflex" parameters is required if license_source is "fortiflex" or "file_fortiflex"
160164
# fortiflex = {
161165
# retrieve_mode = "use_active" # How to retrieve an existing fortiflex license (entitlement)
162-
# # "use_stopped" selects and reactivates a stopped entitlement where the description field is empty;
163-
# # "use_active" selects one active and unused entitlement where the description field is empty.
166+
# # "use_active": Retrieves "ACTIVE" or "PENDING" licenses. If the license is released, the license keeps "ACTIVE".
167+
# # "use_stopped" (default behavior): Retrieves "STOPPED", "EXPIRED" or "PENDING" licenses, and changes them to "ACTIVE". If the license is released, change the license to "STOPPED".
164168
# username = "<YOUR-OWN-VALUE>" # The username of your FortiFlex account.
165169
# password = "<YOUR-OWN-VALUE>" # The password of your FortiFlex account.
166170
# config = <YOUR-OWN-VALUE> # The config ID of your FortiFlex configuration.
167171
# }
168172
169-
# This parameter controls the instance that runs the cloud function.
173+
# This parameter controls the instance that runs the cloud function. For simplicity, it is recommended to use the default value.
170174
service_config = {
171175
max_instance_count = 1 # The limit on the maximum number of function instances that may coexist at a given time.
172176
max_instance_request_concurrency = 3 # Sets the maximum number of concurrent requests that one cloud function can handle at the same time.
@@ -176,6 +180,12 @@ cloud_function = {
176180
}
177181
178182
# additional_variables = {} # Additional Cloud Function Variables
183+
184+
# The following parameters are optional, and no need to be specified in most of cases
185+
# build_service_account_email = "your-name@example.com" # The email address of the service account used to build the cloud function. This account needs to have role "roles/cloudbuild.builds.builder".
186+
# The <PROJECT_NUMBER>@cloudbuild.gserviceaccount.com will be used if it is not specified.
187+
# trigger_service_account_email = "your-name@example.com" # The email address of the service account used to trigger the cloud function. This account needs to have role "roles/run.invoker".
188+
# The default service account will be used if it is not specified.
179189
}
180190
```
181191
Cloud Function is used to manage FGT synchronization and inject license into FGT. For more information about the Cloud Function, please check [here](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/guide_function.md).

docs/fgt_single.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Module: Single FortiGate - fgt_single
22

3+
> This module is used to deploy one single FortiGate.
4+
To deploy any Forti products (e.g., FortiGate, FortiAnalyzer, FortiManager... ), please use the module: [generic_vm_standalone](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/module_generic_vm_standalone.md).
5+
36
Create a FortiGate and using existing VPCs.
47

58
## How To Deploy
@@ -8,11 +11,11 @@ You can use this module directly:
811

912
```
1013
module "single_fortigate" {
11-
source = "fortinetdev/cloud-modules/google//modules/fortigate/fgt_single"
14+
source = "fortinetdev/cloud-modules/google//modules/fortinet/fgt_single"
1215
1316
prefix = "single-fortigate" # The prefix name of all Google Cloud resources created by this module.
1417
hostname = "single-fortigate" # The name of your FortiGate. If not set, it will be <prefix>-instance.
15-
# password = "<Your admin password>" # Optional. If not set, it will be the GCP instance id.
18+
# password = "<Your admin password>" # Optional. If not set, it will be the GCP instance id. This variable only works for FortiGate (Not working for FortiAnalyzer and FortiManager).
1619
region = "us-central1" # Region to deploy FortiGate.
1720
zone = "us-central1-a" # Zone to deploy FortiGate.
1821
machine_type = "n1-standard-4" # The GCP Virtual Machine type to deploy FGT.
File renamed without changes.

docs/guide_gcp_modules.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Guide: GCP Modules
2+
3+
In order to use Google Cloud Terraform resources more conveniently, this Terraform project includes some GCP Modules (`/modules/gcp`).
4+
5+
Here are some useful modules you may need:
6+
7+
### Create dedicated service account
8+
9+
This script will create a dedicated service account: `<SERVICE-ACCOUNT-NAME>@<YOUR-PROJECT-NAME>.iam.gserviceaccount.com`.
10+
11+
This service account has roles ["roles/datastore.user", "roles/compute.viewer", "roles/run.invoker"].
12+
13+
```hcl
14+
module "dedicated_service_account" {
15+
source = "fortinetdev/cloud-modules/google//modules/gcp/iam"
16+
project = "<YOUR-PROJECT-NAME>"
17+
service_account_name = "<SERVICE-ACCOUNT-NAME>"
18+
roles = [
19+
"roles/datastore.user",
20+
"roles/compute.viewer",
21+
"roles/run.invoker",
22+
# Add any roles you want here
23+
]
24+
}
25+
26+
output "dedicated_service_account" {
27+
value = module.dedicated_service_account.service_account_email
28+
}
29+
```
30+
31+
32+
### Create a new VPC
33+
34+
You can use this script to create a new VPC with subnets and firewall rules.
35+
36+
```
37+
module "example_vpc" {
38+
source = "fortinetdev/cloud-modules/google//modules/gcp/vpc"
39+
40+
network_name = "example-network-name"
41+
42+
# You can specify a list of subnets in this VPC
43+
subnets = [
44+
{
45+
name = "example-subnet-name"
46+
region = "<YOUR-REGION>" # e.g., us-central1
47+
ip_cidr_range = "<YOUR-IP-RANGE>" # e.g., "10.0.0.0/24"
48+
}
49+
]
50+
51+
# You can specify a list of firewall rules
52+
firewall_rules = [
53+
{
54+
name = "example-network-firewall-1"
55+
source_ranges = ["0.0.0.0/0"]
56+
target_tags = ["example-access"]
57+
allow = [
58+
{
59+
protocol = "all"
60+
}
61+
]
62+
}
63+
]
64+
}
65+
66+
```

0 commit comments

Comments
 (0)