Skip to content

Commit

Permalink
refactor: template support for var.instance_template_name
Browse files Browse the repository at this point in the history
  • Loading branch information
jmolnar-zscaler committed Jan 12, 2024
1 parent 19b91ea commit fd67ab2
Show file tree
Hide file tree
Showing 19 changed files with 86 additions and 17 deletions.
3 changes: 2 additions & 1 deletion examples/base_1cc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ From base_1cc directory execute:
| <a name="input_http_probe_port"></a> [http\_probe\_port](#input\_http\_probe\_port) | Port number for Cloud Connector cloud init to enable listener port for HTTP probe from GCP LB | `number` | `50000` | 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) | The name prefix for all your resources | `string` | `"zscc"` | no |
| <a name="input_project"></a> [project](#input\_project) | Google Cloud project name | `string` | n/a | yes |
| <a name="input_project_host"></a> [project\_host](#input\_project\_host) | Google Cloud Host Project name. Defaults to null. This variable is intended for environments where different resources might exist in separate host and service projects | `string` | `null` | no |
Expand Down
3 changes: 2 additions & 1 deletion examples/base_1cc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ resource "google_compute_route" "route_to_cc_vm" {
dest_range = "0.0.0.0/0"
priority = 600
network = module.network.service_vpc_network
tags = [module.workload.workload_network_tag]
tags = module.workload.workload_network_tag
next_hop_instance = module.cc_vm.cc_instance[0]
}

Expand Down Expand Up @@ -156,6 +156,7 @@ module "cc_vm" {
service_account = module.iam_service_account.service_account

instance_template_name_prefix = var.instance_template_name_prefix
instance_template_name = var.instance_template_name
instance_group_name = var.instance_group_name
base_instance_name = var.base_instance_name

Expand Down
6 changes: 6 additions & 0 deletions examples/base_1cc/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@
## Custom CC VM/Instance Group module name variables

#instance_template_name_prefix = "template-name-prefix"

#### GCP Terraform provider recommends to use template name_prefix rather than name argument per: ####
#### https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance_template ####
#### Setting any value for instance_template_name will set name_prefix to empty/null ####
#instance_template_name = "template-name"

#instance_group_name = ["az-1-grp-name","az-2-grp-name"]
#base_instance_name = ["grp-1-base-name","grp-2-base-name"]

Expand Down
10 changes: 8 additions & 2 deletions examples/base_1cc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,14 @@ variable "service_account_display_name" {

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
3 changes: 2 additions & 1 deletion examples/base_1cc_zpa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ From base_1cc_zpa directory execute:
| <a name="input_http_probe_port"></a> [http\_probe\_port](#input\_http\_probe\_port) | Port number for Cloud Connector cloud init to enable listener port for HTTP probe from GCP LB | `number` | `50000` | 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) | The name prefix for all your resources | `string` | `"zscc"` | no |
| <a name="input_project"></a> [project](#input\_project) | Google Cloud project name | `string` | n/a | yes |
| <a name="input_project_host"></a> [project\_host](#input\_project\_host) | Google Cloud Host Project name. Defaults to null. This variable is intended for environments where different resources might exist in separate host and service projects | `string` | `null` | no |
Expand Down
3 changes: 2 additions & 1 deletion examples/base_1cc_zpa/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ resource "google_compute_route" "route_to_cc_vm" {
dest_range = "0.0.0.0/0"
priority = 600
network = module.network.service_vpc_network
tags = [module.workload.workload_network_tag]
tags = module.workload.workload_network_tag
next_hop_instance = module.cc_vm.cc_instance[0]
}

Expand Down Expand Up @@ -156,6 +156,7 @@ module "cc_vm" {
service_account = module.iam_service_account.service_account

instance_template_name_prefix = var.instance_template_name_prefix
instance_template_name = var.instance_template_name
instance_group_name = var.instance_group_name
base_instance_name = var.base_instance_name
}
Expand Down
6 changes: 6 additions & 0 deletions examples/base_1cc_zpa/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@
## Custom CC VM/Instance Group module name variables

#instance_template_name_prefix = "template-name-prefix"

#### GCP Terraform provider recommends to use template name_prefix rather than name argument per: ####
#### https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance_template ####
#### Setting any value for instance_template_name will set name_prefix to empty/null ####
#instance_template_name = "template-name"

#instance_group_name = ["az-1-grp-name","az-2-grp-name"]
#base_instance_name = ["grp-1-base-name","grp-2-base-name"]

Expand Down
10 changes: 8 additions & 2 deletions examples/base_1cc_zpa/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,14 @@ variable "service_account_display_name" {

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
3 changes: 2 additions & 1 deletion examples/base_cc_ilb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ From base_cc_ilb directory execute:
| <a name="input_ilb_health_check_name"></a> [ilb\_health\_check\_name](#input\_ilb\_health\_check\_name) | Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash | `string` | `null` | 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) | The name prefix for all your resources | `string` | `"zscc"` | no |
| <a name="input_project"></a> [project](#input\_project) | Google Cloud project name | `string` | n/a | yes |
| <a name="input_project_host"></a> [project\_host](#input\_project\_host) | Google Cloud Host Project name. Defaults to null. This variable is intended for environments where different resources might exist in separate host and service projects | `string` | `null` | no |
Expand Down
1 change: 1 addition & 0 deletions examples/base_cc_ilb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ module "cc_vm" {
service_account = module.iam_service_account.service_account

instance_template_name_prefix = var.instance_template_name_prefix
instance_template_name = var.instance_template_name
instance_group_name = var.instance_group_name
base_instance_name = var.base_instance_name
}
Expand Down
6 changes: 6 additions & 0 deletions examples/base_cc_ilb/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@
## Custom CC VM/Instance Group module name variables

#instance_template_name_prefix = "template-name-prefix"

#### GCP Terraform provider recommends to use template name_prefix rather than name argument per: ####
#### https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance_template ####
#### Setting any value for instance_template_name will set name_prefix to empty/null ####
#instance_template_name = "template-name"

#instance_group_name = ["az-1-grp-name","az-2-grp-name"]
#base_instance_name = ["grp-1-base-name","grp-2-base-name"]

Expand Down
10 changes: 8 additions & 2 deletions examples/base_cc_ilb/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,14 @@ variable "service_account_display_name" {

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
3 changes: 2 additions & 1 deletion examples/base_cc_ilb_zpa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ From base_cc_ilb_zpa directory execute:
| <a name="input_ilb_health_check_name"></a> [ilb\_health\_check\_name](#input\_ilb\_health\_check\_name) | Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash | `string` | `null` | 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) | The name prefix for all your resources | `string` | `"zscc"` | no |
| <a name="input_project"></a> [project](#input\_project) | Google Cloud project name | `string` | n/a | yes |
| <a name="input_project_host"></a> [project\_host](#input\_project\_host) | Google Cloud Host Project name. Defaults to null. This variable is intended for environments where different resources might exist in separate host and service projects | `string` | `null` | no |
Expand Down
3 changes: 2 additions & 1 deletion examples/base_cc_ilb_zpa/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ resource "google_compute_route" "route_to_cc_vm" {
dest_range = "0.0.0.0/0"
priority = 600
network = module.network.service_vpc_network
tags = [module.workload.workload_network_tag]
tags = module.workload.workload_network_tag
next_hop_ilb = module.ilb.next_hop_ilb_ip_address
}

Expand Down Expand Up @@ -156,6 +156,7 @@ module "cc_vm" {
service_account = module.iam_service_account.service_account

instance_template_name_prefix = var.instance_template_name_prefix
instance_template_name = var.instance_template_name
instance_group_name = var.instance_group_name
base_instance_name = var.base_instance_name
}
Expand Down
6 changes: 6 additions & 0 deletions examples/base_cc_ilb_zpa/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@
## Custom CC VM/Instance Group module name variables

#instance_template_name_prefix = "template-name-prefix"

#### GCP Terraform provider recommends to use template name_prefix rather than name argument per: ####
#### https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance_template ####
#### Setting any value for instance_template_name will set name_prefix to empty/null ####
#instance_template_name = "template-name"

#instance_group_name = ["az-1-grp-name","az-2-grp-name"]
#base_instance_name = ["grp-1-base-name","grp-2-base-name"]

Expand Down
10 changes: 8 additions & 2 deletions examples/base_cc_ilb_zpa/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,14 @@ variable "service_account_display_name" {

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
1 change: 1 addition & 0 deletions examples/cc_ilb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ module "cc_vm" {
service_account = module.iam_service_account.service_account

instance_template_name_prefix = var.instance_template_name_prefix
instance_template_name = var.instance_template_name
instance_group_name = var.instance_group_name
base_instance_name = var.base_instance_name
}
Expand Down
6 changes: 6 additions & 0 deletions examples/cc_ilb/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@
## Custom CC VM/Instance Group module name variables

#instance_template_name_prefix = "template-name-prefix"

#### GCP Terraform provider recommends to use template name_prefix rather than name argument per: ####
#### https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance_template ####
#### Setting any value for instance_template_name will set name_prefix to empty/null ####
#instance_template_name = "template-name"

#instance_group_name = ["az-1-grp-name","az-2-grp-name"]
#base_instance_name = ["grp-1-base-name","grp-2-base-name"]

Expand Down
10 changes: 8 additions & 2 deletions examples/cc_ilb/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,14 @@ variable "service_account_display_name" {

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 fd67ab2

Please sign in to comment.