|
| 1 | +# Guide: Upgrading FortiGate AutoScale Group |
| 2 | + |
| 3 | +After deploying the examples `autoscale_fgt_as_hub`, `autoscale_fgt_lb_sandwich`, or the module `fortigate/fgt_asg_with_function`, you can upgrade the FortiGate (FGT) image version and the [Cloud Function](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/guide_function.md) code. |
| 4 | + |
| 5 | +### Upgrading the FortiGate Image Version |
| 6 | + |
| 7 | +The upgrade process depends on how the FGT image is specified in your Terraform configuration: |
| 8 | + |
| 9 | +- Using `image_type`: |
| 10 | + |
| 11 | + If you specify the image via the variable `image_type`, Terraform will automatically retrieve the latest available image. Simply run the command `terraform apply` and confirm the changes. |
| 12 | + |
| 13 | +- Using `image_type`: |
| 14 | + |
| 15 | + If the FGT image is set via the variable `image_source`, update this variable with the new image reference. Then, run the command `terraform apply` and confirm the changes. |
| 16 | + |
| 17 | +### Upgrading the Cloud Function (Available in version >= 1.4.1) |
| 18 | + |
| 19 | +The [Cloud Function](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/docs/guide_function.md) is continuously updated to support new features and improvements. To benefit from these updates, you can upgrade the Cloud Function code using one of the following methods: |
| 20 | + |
| 21 | +#### 1. If you are using a local copy of the project |
| 22 | + |
| 23 | +If you have cloned or downloaded the source code locally (using `terraform.tfvars` file to deploy), you can manually update the Cloud Function code: |
| 24 | + |
| 25 | +1. Download the latest [`cloud function code file`](https://github.com/fortinetdev/terraform-google-cloud-modules/blob/main/modules/fortigate/fgt_asg_with_function/cloud_function.zip) |
| 26 | +2. Replace the existing file at `/modules/fortigate/fgt_asg_with_function/cloud_function.zip`. |
| 27 | +3. Re-run `terraform apply` to deploy the updated function. |
| 28 | + |
| 29 | + |
| 30 | +#### 2. If you are using the project as a module (recommended for version ≥ 1.4.1) |
| 31 | + |
| 32 | +If you're using this project as a module, for example, by creating your own `main.tf` file and including the following block: |
| 33 | + |
| 34 | +**Example (initial use without version pinning):** |
| 35 | +``` |
| 36 | +module "autoscale_fgt_lb_sandwich" { |
| 37 | + source = "fortinetdev/cloud-modules/google//examples/autoscale_fgt_lb_sandwich" |
| 38 | +
|
| 39 | + # other parameters |
| 40 | +} |
| 41 | +``` |
| 42 | +Terraform will fetch the latest available version at the time of the first `terraform init`. However, this version is **locked** in your `.terraform.lock.hcl` file and will not automatically update, even if newer versions become available later. |
| 43 | + |
| 44 | +To ensure you're using a specific version, or to upgrade to a newer one, you should explicitly specify the version attribute in your module block. |
| 45 | + |
| 46 | +**To upgrade to a newer version:** |
| 47 | + |
| 48 | +Update the `version` field to the desired version number. For example: |
| 49 | + |
| 50 | +``` |
| 51 | +module "autoscale_fgt_lb_sandwich" { |
| 52 | + source = "fortinetdev/cloud-modules/google//examples/autoscale_fgt_lb_sandwich" |
| 53 | + version = "1.4.1" # <-- Update this to a new version |
| 54 | +
|
| 55 | + # other parameters |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +Then run the following commands to upgrade and apply the changes: |
| 60 | +``` |
| 61 | +terraform init -upgrade |
| 62 | +terraform apply |
| 63 | +``` |
0 commit comments