Skip to content

Commit

Permalink
feat: add variable instance_template_name option
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolnar-zscaler committed Jan 11, 2024
1 parent 5cec09d commit cee638b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion modules/terraform-zscc-ccvm-gcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ No modules.
| <a name="input_ccvm_instance_type"></a> [ccvm\_instance\_type](#input\_ccvm\_instance\_type) | Cloud Connector Instance Type | `string` | `"n2-standard-2"` | no |
| <a name="input_image_name"></a> [image\_name](#input\_image\_name) | Custom image name to be used for deploying Cloud Connector appliances. Ideally all VMs should be on the same Image as templates always pull the latest from Google Marketplace. This variable is provided if a customer desires to override/retain an old ami for existing deployments rather than upgrading and forcing a replacement. It is also inputted as a list to facilitate if a customer desired to manually upgrade select CCs deployed based on the cc\_count index | `string` | `""` | no |
| <a name="input_instance_group_name"></a> [instance\_group\_name](#input\_instance\_group\_name) | The name of the Instance Group Manager. Must be 1-63 characters long and comply with RFC1035. Supported characters include lowercase letters, numbers, and hyphens | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| <a name="input_instance_template_name_prefix"></a> [instance\_template\_name\_prefix](#input\_instance\_template\_name\_prefix) | Creates a unique Instance Template name beginning with the specified prefix | `string` | `null` | no |
| <a name="input_instance_template_name"></a> [instance\_template\_name](#input\_instance\_template\_name) | The name of the instance template. Conflicts with variable instance\_template\_name\_prefix | `string` | `""` | no |
| <a name="input_instance_template_name_prefix"></a> [instance\_template\_name\_prefix](#input\_instance\_template\_name\_prefix) | Creates a unique Instance Template name beginning with the specified prefix. Conflicts with variable instance\_template\_name | `string` | `""` | no |
| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | A prefix to associate to all the Cloud Connector module resources | `string` | `null` | no |
| <a name="input_project"></a> [project](#input\_project) | Google Cloud project name | `string` | n/a | yes |
| <a name="input_region"></a> [region](#input\_region) | Google Cloud region | `string` | n/a | yes |
Expand Down
3 changes: 2 additions & 1 deletion modules/terraform-zscc-ccvm-gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Create Cloud Connector Instance Template
################################################################################
resource "google_compute_instance_template" "cc_instance_template" {
name_prefix = coalesce(var.instance_template_name_prefix, "${var.name_prefix}-cc-template-${var.resource_tag}-")
name_prefix = var.instance_template_name == "" ? coalesce(var.instance_template_name_prefix, "${var.name_prefix}-cc-template-${var.resource_tag}-") : null
name = var.instance_template_name != "" ? var.instance_template_name : null
project = var.project
region = var.region

Expand Down
10 changes: 8 additions & 2 deletions modules/terraform-zscc-ccvm-gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,14 @@ variable "update_max_unavailable_fixed" {

variable "instance_template_name_prefix" {
type = string
description = "Creates a unique Instance Template name beginning with the specified prefix"
default = null
description = "Creates a unique Instance Template name beginning with the specified prefix. Conflicts with variable instance_template_name"
default = ""
}

variable "instance_template_name" {
type = string
description = "The name of the instance template. Conflicts with variable instance_template_name_prefix"
default = ""
}

variable "instance_group_name" {
Expand Down

0 comments on commit cee638b

Please sign in to comment.