Skip to content

Commit

Permalink
feat: add ebs encryption resources and brownfield prompts (#47)
Browse files Browse the repository at this point in the history
* feat: add ebs encryption resources

* fix: change default ebs gp3

* refactor: add ebs vars to example templates

* chore: add ebs variables to tfvars

* feat: add ebs prompts to zsec

* feat: add zsec brownfield prompts
  • Loading branch information
jmolnar-zscaler authored Oct 6, 2023
1 parent 22c7067 commit 6cd03a1
Show file tree
Hide file tree
Showing 51 changed files with 882 additions and 148 deletions.
3 changes: 3 additions & 0 deletions examples/base_1cc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@ From base_1cc directory execute:
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | The AWS region. | `string` | `"us-west-2"` | no |
| <a name="input_az_count"></a> [az\_count](#input\_az\_count) | Default number of subnets to create based on availability zone | `number` | `1` | no |
| <a name="input_bastion_nsg_source_prefix"></a> [bastion\_nsg\_source\_prefix](#input\_bastion\_nsg\_source\_prefix) | CIDR blocks of trusted networks for bastion host ssh access | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
| <a name="input_byo_kms_key_alias"></a> [byo\_kms\_key\_alias](#input\_byo\_kms\_key\_alias) | Requires var.ebs\_encryption\_enabled to be true. Set to null by default which is the AWS default managed/master key. Set as 'alias/<key-alias>' to use a custom KMS key | `string` | `null` | no |
| <a name="input_cc_count"></a> [cc\_count](#input\_cc\_count) | Default number of Cloud Connector appliances to create | `number` | `1` | no |
| <a name="input_cc_instance_size"></a> [cc\_instance\_size](#input\_cc\_instance\_size) | Cloud Connector Instance size. Determined by and needs to match the Cloud Connector Portal provisioning template configuration | `string` | `"small"` | no |
| <a name="input_cc_subnets"></a> [cc\_subnets](#input\_cc\_subnets) | Cloud Connector Subnets to create in VPC. This is only required if you want to override the default subnets that this code creates via vpc\_cidr variable. | `list(string)` | `null` | no |
| <a name="input_cc_vm_prov_url"></a> [cc\_vm\_prov\_url](#input\_cc\_vm\_prov\_url) | Zscaler Cloud Connector Provisioning URL | `string` | n/a | yes |
| <a name="input_ccvm_instance_type"></a> [ccvm\_instance\_type](#input\_ccvm\_instance\_type) | Cloud Connector Instance Type | `string` | `"m6i.large"` | no |
| <a name="input_ebs_encryption_enabled"></a> [ebs\_encryption\_enabled](#input\_ebs\_encryption\_enabled) | true/false whether to enable EBS encryption on the root volume. Default is true | `bool` | `true` | no |
| <a name="input_ebs_volume_type"></a> [ebs\_volume\_type](#input\_ebs\_volume\_type) | (Optional) Type of volume. Valid values include standard, gp2, gp3, io1, io2, sc1, or st1. Defaults to gp3 | `string` | `"gp3"` | no |
| <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 GWLB Target Group | `number` | `50000` | no |
| <a name="input_mgmt_ssh_enabled"></a> [mgmt\_ssh\_enabled](#input\_mgmt\_ssh\_enabled) | Default is true which creates an ingress rule permitting SSH traffic from the local VPC to the CC management interface. If false, the rule is not created. Value ignored if not creating a security group | `bool` | `true` | no |
| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | The name prefix for all your resources | `string` | `"zscc"` | no |
Expand Down
4 changes: 4 additions & 0 deletions examples/base_1cc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ module "cc_vm" {
iam_instance_profile = module.cc_iam.iam_instance_profile_id
mgmt_security_group_id = module.cc_sg.mgmt_security_group_id
service_security_group_id = module.cc_sg.service_security_group_id
ebs_volume_type = var.ebs_volume_type
ebs_encryption_enabled = var.ebs_encryption_enabled
byo_kms_key_alias = var.byo_kms_key_alias


depends_on = [
local_file.user_data_file,
Expand Down
17 changes: 14 additions & 3 deletions examples/base_1cc/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
## Uncomment and change the below variables according to your specific environment

#####################################################################################################################
##### Variables 1-14 are populated automically if terraform is ran via ZSEC bash script. #####
##### Modifying the variables in this file will override any inputs from ZSEC #####
##### Variables are populated automically if terraform is ran via ZSEC bash script. #####
##### Modifying the variables in this file will override any inputs from ZSEC #####
#####################################################################################################################


#####################################################################################################################
##### Cloud Init Userdata Provisioning variables #####
#####################################################################################################################
Expand Down Expand Up @@ -128,3 +127,15 @@
## Leave this variable commented out unless you are absolutely certain why/that you need to set it and only temporarily.

#ami_id = ["ami-123456789"]

## 16. By default, terraform will configure Cloud Connector with EBS encryption enabled.
## Uncomment if you want to disable ebs encryption.

#ebs_encryption_enabled = false

## 17. By default, EBS encryptions is set to null which uses the AWS default managed/master key.
## Set as 'alias/<key-alias>' to use an existing customer KMS key"

## Note: this variable is only enforced if ebs_encryption_enabled is set to true

#byo_kms_key_alias = "alias/<customer key alias name>"
18 changes: 18 additions & 0 deletions examples/base_1cc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,21 @@ variable "all_ports_egress_enabled" {
default = true
description = "Default is true which creates an egress rule permitting the CC service interface to forward direct traffic on all ports and protocols. If false, the rule is not created. Value ignored if not creating a security group"
}

variable "ebs_volume_type" {
type = string
description = "(Optional) Type of volume. Valid values include standard, gp2, gp3, io1, io2, sc1, or st1. Defaults to gp3"
default = "gp3"
}

variable "ebs_encryption_enabled" {
type = bool
description = "true/false whether to enable EBS encryption on the root volume. Default is true"
default = true
}

variable "byo_kms_key_alias" {
type = string
description = "Requires var.ebs_encryption_enabled to be true. Set to null by default which is the AWS default managed/master key. Set as 'alias/<key-alias>' to use a custom KMS key"
default = null
}
3 changes: 3 additions & 0 deletions examples/base_1cc_zpa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,15 @@ From base_1cc_zpa directory execute:
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | The AWS region. | `string` | `"us-west-2"` | no |
| <a name="input_az_count"></a> [az\_count](#input\_az\_count) | Default number of subnets to create based on availability zone | `number` | `1` | no |
| <a name="input_bastion_nsg_source_prefix"></a> [bastion\_nsg\_source\_prefix](#input\_bastion\_nsg\_source\_prefix) | CIDR blocks of trusted networks for bastion host ssh access | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
| <a name="input_byo_kms_key_alias"></a> [byo\_kms\_key\_alias](#input\_byo\_kms\_key\_alias) | Requires var.ebs\_encryption\_enabled to be true. Set to null by default which is the AWS default managed/master key. Set as 'alias/<key-alias>' to use a custom KMS key | `string` | `null` | no |
| <a name="input_cc_count"></a> [cc\_count](#input\_cc\_count) | Default number of Cloud Connector appliances to create | `number` | `1` | no |
| <a name="input_cc_instance_size"></a> [cc\_instance\_size](#input\_cc\_instance\_size) | Cloud Connector Instance size. Determined by and needs to match the Cloud Connector Portal provisioning template configuration | `string` | `"small"` | no |
| <a name="input_cc_subnets"></a> [cc\_subnets](#input\_cc\_subnets) | Cloud Connector Subnets to create in VPC. This is only required if you want to override the default subnets that this code creates via vpc\_cidr variable. | `list(string)` | `null` | no |
| <a name="input_cc_vm_prov_url"></a> [cc\_vm\_prov\_url](#input\_cc\_vm\_prov\_url) | Zscaler Cloud Connector Provisioning URL | `string` | n/a | yes |
| <a name="input_ccvm_instance_type"></a> [ccvm\_instance\_type](#input\_ccvm\_instance\_type) | Cloud Connector Instance Type | `string` | `"m6i.large"` | no |
| <a name="input_domain_names"></a> [domain\_names](#input\_domain\_names) | Domain names fqdn/wildcard to have Route 53 redirect DNS requests to Cloud Connector for ZPA. Refer to terraform.tfvars ZPA/Route 53 specific variables | `map(any)` | n/a | yes |
| <a name="input_ebs_encryption_enabled"></a> [ebs\_encryption\_enabled](#input\_ebs\_encryption\_enabled) | true/false whether to enable EBS encryption on the root volume. Default is true | `bool` | `true` | no |
| <a name="input_ebs_volume_type"></a> [ebs\_volume\_type](#input\_ebs\_volume\_type) | (Optional) Type of volume. Valid values include standard, gp2, gp3, io1, io2, sc1, or st1. Defaults to gp3 | `string` | `"gp3"` | no |
| <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 GWLB Target Group | `number` | `50000` | no |
| <a name="input_mgmt_ssh_enabled"></a> [mgmt\_ssh\_enabled](#input\_mgmt\_ssh\_enabled) | Default is true which creates an ingress rule permitting SSH traffic from the local VPC to the CC management interface. If false, the rule is not created. Value ignored if not creating a security group | `bool` | `true` | no |
| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | The name prefix for all your resources | `string` | `"zscc"` | no |
Expand Down
3 changes: 3 additions & 0 deletions examples/base_1cc_zpa/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ module "cc_vm" {
iam_instance_profile = module.cc_iam.iam_instance_profile_id
mgmt_security_group_id = module.cc_sg.mgmt_security_group_id
service_security_group_id = module.cc_sg.service_security_group_id
ebs_volume_type = var.ebs_volume_type
ebs_encryption_enabled = var.ebs_encryption_enabled
byo_kms_key_alias = var.byo_kms_key_alias

depends_on = [
local_file.user_data_file,
Expand Down
46 changes: 28 additions & 18 deletions examples/base_1cc_zpa/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
## This is only a sample terraform.tfvars file.
## Uncomment and change the below variables according to your specific environment


#####################################################################################################################
##### ZPA/Route 53 specific variables #####
##### Variables are populated automically if terraform is ran via ZSEC bash script. #####
##### Modifying the variables in this file will override any inputs from ZSEC #####
#####################################################################################################################
## *** Provide the domain names you want Route53 to redirect to Cloud Connector for ZPA interception. Only applicable for base + zpa or zpa_enabled = true
## deployment types where Route53 subnets, Resolver Rules, and Outbound Endpoints are being created. Two example domains are populated to show the
## mapping structure and syntax. ZPA Module will read through each to create a resolver rule per domain_name entry. Ucomment domain_names variable and
## add any additional appsegXX mappings as needed.

#domain_names = {
# appseg1 = "app1.com"
# appseg2 = "app2.com"
#}


#####################################################################################################################
##### Variables 1-14 are populated automically if terraform is ran via ZSEC bash script. #####
##### Modifying the variables in this file will override any inputs from ZSEC #####
#####################################################################################################################


#####################################################################################################################
##### Cloud Init Userdata Provisioning variables #####
Expand Down Expand Up @@ -143,3 +127,29 @@
## Leave this variable commented out unless you are absolutely certain why/that you need to set it and only temporarily.

#ami_id = ["ami-123456789"]

## 16. By default, terraform will configure Cloud Connector with EBS encryption enabled.
## Uncomment if you want to disable ebs encryption.

#ebs_encryption_enabled = false

## 17. By default, EBS encryptions is set to null which uses the AWS default managed/master key.
## Set as 'alias/<key-alias>' to use an existing customer KMS key"

## Note: this variable is only enforced if ebs_encryption_enabled is set to true

#byo_kms_key_alias = "alias/<customer key alias name>"


#####################################################################################################################
##### ZPA/Route 53 specific variables #####
#####################################################################################################################
## 18. Provide the domain names you want Route53 to redirect to Cloud Connector for ZPA interception. Only applicable for base + zpa or zpa_enabled = true
## deployment types where Route53 subnets, Resolver Rules, and Outbound Endpoints are being created. Two example domains are populated to show the
## mapping structure and syntax. ZPA Module will read through each to create a resolver rule per domain_name entry. Ucomment domain_names variable and
## add any additional appsegXX mappings as needed.

#domain_names = {
# appseg1 = "app1.com"
# appseg2 = "app2.com"
#}
18 changes: 18 additions & 0 deletions examples/base_1cc_zpa/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,21 @@ variable "all_ports_egress_enabled" {
default = true
description = "Default is true which creates an egress rule permitting the CC service interface to forward direct traffic on all ports and protocols. If false, the rule is not created. Value ignored if not creating a security group"
}

variable "ebs_volume_type" {
type = string
description = "(Optional) Type of volume. Valid values include standard, gp2, gp3, io1, io2, sc1, or st1. Defaults to gp3"
default = "gp3"
}

variable "ebs_encryption_enabled" {
type = bool
description = "true/false whether to enable EBS encryption on the root volume. Default is true"
default = true
}

variable "byo_kms_key_alias" {
type = string
description = "Requires var.ebs_encryption_enabled to be true. Set to null by default which is the AWS default managed/master key. Set as 'alias/<key-alias>' to use a custom KMS key"
default = null
}
3 changes: 3 additions & 0 deletions examples/base_2cc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,14 @@ From base_2cc directory execute:
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | The AWS region. | `string` | `"us-west-2"` | no |
| <a name="input_az_count"></a> [az\_count](#input\_az\_count) | Default number of subnets to create based on availability zone | `number` | `2` | no |
| <a name="input_bastion_nsg_source_prefix"></a> [bastion\_nsg\_source\_prefix](#input\_bastion\_nsg\_source\_prefix) | CIDR blocks of trusted networks for bastion host ssh access | `list(string)` | <pre>[<br> "0.0.0.0/0"<br>]</pre> | no |
| <a name="input_byo_kms_key_alias"></a> [byo\_kms\_key\_alias](#input\_byo\_kms\_key\_alias) | Requires var.ebs\_encryption\_enabled to be true. Set to null by default which is the AWS default managed/master key. Set as 'alias/<key-alias>' to use a custom KMS key | `string` | `null` | no |
| <a name="input_cc_count"></a> [cc\_count](#input\_cc\_count) | Default number of Cloud Connector appliances to create | `number` | `2` | no |
| <a name="input_cc_instance_size"></a> [cc\_instance\_size](#input\_cc\_instance\_size) | Cloud Connector Instance size. Determined by and needs to match the Cloud Connector Portal provisioning template configuration | `string` | `"small"` | no |
| <a name="input_cc_subnets"></a> [cc\_subnets](#input\_cc\_subnets) | Cloud Connector Subnets to create in VPC. This is only required if you want to override the default subnets that this code creates via vpc\_cidr variable. | `list(string)` | `null` | no |
| <a name="input_cc_vm_prov_url"></a> [cc\_vm\_prov\_url](#input\_cc\_vm\_prov\_url) | Zscaler Cloud Connector Provisioning URL | `string` | n/a | yes |
| <a name="input_ccvm_instance_type"></a> [ccvm\_instance\_type](#input\_ccvm\_instance\_type) | Cloud Connector Instance Type | `string` | `"m6i.large"` | no |
| <a name="input_ebs_encryption_enabled"></a> [ebs\_encryption\_enabled](#input\_ebs\_encryption\_enabled) | true/false whether to enable EBS encryption on the root volume. Default is true | `bool` | `true` | no |
| <a name="input_ebs_volume_type"></a> [ebs\_volume\_type](#input\_ebs\_volume\_type) | (Optional) Type of volume. Valid values include standard, gp2, gp3, io1, io2, sc1, or st1. Defaults to gp3 | `string` | `"gp3"` | no |
| <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 GWLB Target Group | `number` | `50000` | no |
| <a name="input_mgmt_ssh_enabled"></a> [mgmt\_ssh\_enabled](#input\_mgmt\_ssh\_enabled) | Default is true which creates an ingress rule permitting SSH traffic from the local VPC to the CC management interface. If false, the rule is not created. Value ignored if not creating a security group | `bool` | `true` | no |
| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | The name prefix for all your resources | `string` | `"zscc"` | no |
Expand Down
3 changes: 3 additions & 0 deletions examples/base_2cc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ module "cc_vm" {
iam_instance_profile = module.cc_iam.iam_instance_profile_id
mgmt_security_group_id = module.cc_sg.mgmt_security_group_id
service_security_group_id = module.cc_sg.service_security_group_id
ebs_volume_type = var.ebs_volume_type
ebs_encryption_enabled = var.ebs_encryption_enabled
byo_kms_key_alias = var.byo_kms_key_alias

depends_on = [
local_file.user_data_file,
Expand Down
17 changes: 14 additions & 3 deletions examples/base_2cc/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
## Uncomment and change the below variables according to your specific environment

#####################################################################################################################
##### Variables 1-14 are populated automically if terraform is ran via ZSEC bash script. #####
##### Modifying the variables in this file will override any inputs from ZSEC #####
##### Variables are populated automically if terraform is ran via ZSEC bash script. #####
##### Modifying the variables in this file will override any inputs from ZSEC #####
#####################################################################################################################


#####################################################################################################################
##### Cloud Init Userdata Provisioning variables #####
#####################################################################################################################
Expand Down Expand Up @@ -110,3 +109,15 @@
## Leave this variable commented out unless you are absolutely certain why/that you need to set it and only temporarily.

#ami_id = ["ami-123456789"]

## 16. By default, terraform will configure Cloud Connector with EBS encryption enabled.
## Uncomment if you want to disable ebs encryption.

#ebs_encryption_enabled = false

## 17. By default, EBS encryptions is set to null which uses the AWS default managed/master key.
## Set as 'alias/<key-alias>' to use an existing customer KMS key"

## Note: this variable is only enforced if ebs_encryption_enabled is set to true

#byo_kms_key_alias = "alias/<customer key alias name>"
Loading

0 comments on commit 6cd03a1

Please sign in to comment.