Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dependencies to application segment #1

Merged
merged 1 commit into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
max_line_length = 80
trim_trailing_whitespace = true

[*.{tf,tfvars}]
indent_size = 2
indent_style = space

[*.md]
max_line_length = 0
trim_trailing_whitespace = false

[Makefile]
tab_width = 2
indent_style = tab

[COMMIT_EDITMSG]
max_line_length = 0

[*.json]
indent_style = space
indent_size = 2

[*.{yaml,yml}]
indent_style = space
indent_size = 2

[shell]
indent_style = tab
indent_size = 4

[*.sh]
indent_style = tab
indent_size = 4
4 changes: 4 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
terraform 1.2.7
terraform-docs 0.16.0
pre-commit 2.20.0
vault 1.11.2
Binary file modified Images/consul-terraform-sync-arch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 11 additions & 4 deletions example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ terraform {
}
}

vault {}
provider "zpa" {
zpa_client_id = "{{ with secret \"zscaler/zpacloud\" }}{{ .Data.data.client_id }}{{ end }}"
zpa_client_id = "{{ with secret \"zscaler/zpacloud\" }}{{ .Data.data.client_id }}{{ end }}"
zpa_client_secret = "{{ with secret \"zscaler/zpacloud\" }}{{ .Data.data.client_secret }}{{ end }}"
zpa_customer_id = "{{ with secret \"zscaler/zpacloud\" }}{{ .Data.data.customer_id }}{{ end }}"
zpa_customer_id = "{{ with secret \"zscaler/zpacloud\" }}{{ .Data.data.customer_id }}{{ end }}"
}
# terraform_provider "zpa" {
# zpa_client_id = "zpa_client_id"
Expand All @@ -20,6 +19,14 @@ provider "zpa" {
# }

module "zpa-application-segment_module" {
source = "github.com/zscaler/terraform-zpa-application-segment-nia"
# source = "github.com/zscaler/terraform-zpa-application-segment-nia"
source = "../"
services = var.services

# Bring-Your-Own Variables
byo_segment_group = var.byo_segment_group
byo_segment_group_id = var.byo_segment_group_id
byo_server_group = var.byo_server_group
byo_server_group_id = var.byo_server_group_id
byo_app_connector_group = var.byo_app_connector_group
}
31 changes: 31 additions & 0 deletions example/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## This is a sample terraform.tfvars file.
## Uncomment and change the below variables according to your specific environment


################################################################################
# Custom Segment Group Variables
################################################################################
#byo_segment_group = false
#byo_segment_group_id = "216196257331307900"

################################################################################
# Custom Server Group Variables
################################################################################
#byo_server_group = false
#byo_server_group_id = "216196257331307901"

################################################################################
# Custom App Connector Group Variables Values
################################################################################
#byo_app_connector_group = false
#byo_app_connector_group_id = "216196257331307899"

# app_connector_group_latitude = "37.3382082"
# app_connector_group_longitude = "-121.8863286"
# app_connector_group_country_code = "US"
# app_connector_group_location = "San Jose, CA, USA"
# app_connector_group_upgrade_day = "SUNDAY"
# app_connector_group_upgrade_time_in_secs = "66600"
# app_connector_group_override_version_profile = true
# app_connector_group_version_profile_id = "2"
# app_connector_group_dns_query_type = "IPV4_IPV6"
142 changes: 135 additions & 7 deletions example/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ variable "services" {
)
}

################################################################################
# Optional Prefix
################################################################################
variable "appsegment_prefix" {
type = string
description = "(Optional) Prefix added to the dynamic application segment created by Consul"
Expand All @@ -34,7 +37,9 @@ variable "cts_prefix" {
default = "cts-"
}

################################################################################
# Application Segment Variables
################################################################################
variable "health_reporting" {
type = string
description = "Health reporting for the application segment created by Consul-Terraform-Sync. "
Expand Down Expand Up @@ -65,22 +70,36 @@ variable "bypass_type" {
default = "NEVER"
}

################################################################################
# Segment Group Variables
################################################################################
variable "byo_segment_group" {
type = bool
description = "Bring your own ZPA Segment Group"
default = false
}

variable "byo_segment_group_id" {
type = string
description = "User provided existing ZPA Segment Group"
default = null
}

variable "segment_group_name" {
type = string
description = "Segment Group Name"
description = "Name of the segment group."
default = "SegmentGroup"
}

variable "segment_group_description" {
type = string
description = "Segment Group Description"
description = "Description of the segment group."
default = "SegmentGroup"
}

variable "segment_group_enabled" {
type = bool
description = "Segment Group Status"
description = "Whether this segment group is enabled or not."
default = true
}

Expand All @@ -90,29 +109,138 @@ variable "tcp_keep_alive_enabled" {
default = "1"
}

################################################################################
# Server Group Variables
################################################################################
variable "byo_server_group" {
type = bool
description = "Bring your own Server Group"
default = false
}

variable "byo_server_group_id" {
type = string
description = "User provided existing Server Group ID"
default = null
}

variable "server_group_name" {
type = string
description = "Server Group Name"
description = "This field defines the name of the server group."
default = "ServerGroup"
}

variable "server_group_description" {
type = string
description = "Server Group Description"
description = "This field is the description of the server group."
default = "ServerGroup"
}

variable "server_group_enabled" {
type = bool
description = "Server Group Status"
description = "This field defines if the server group is enabled or disabled."
default = true
}

variable "server_group_dynamic_discovery" {
type = bool
description = "Server Group Dynamic Discovery Status"
description = "This field controls dynamic discovery of the servers."
default = true
}

################################################################################
# App Connector Group Variables
################################################################################
variable "byo_app_connector_group" {
type = bool
description = "Bring your own App Connector Group"
default = false
}

variable "byo_app_connector_group_id" {
type = string
description = "User provided existing App Connector Group ID"
default = null
}

variable "app_connector_group_name" {
type = string
description = "Name of the App Connector Group."
default = "AppConnector"
}

variable "app_connector_group_description" {
type = string
description = "Description of the App Connector Group."
default = "AppConnector"
}

/*
variable "app_connector_group_latitude" {
type = string
description = " Latitude of the App Connector Group."
validation {
condition = (
var.app_connector_group_latitude >= "-90" &&
var.app_connector_group_latitude >= "90"
)
error_message = "Latitude must be between -90 and 90."
}
default = "-121.8863286"
}

variable "app_connector_group_longitude" {
type = string
description = " Longitude of the App Connector Group."
validation {
condition = (
var.app_connector_group_longitude >= "-180" &&
var.app_connector_group_longitude >= "180"
)
error_message = "Longitude must be between -180 and 180."
}
default = "37.3382082"
}

variable "app_connector_group_country_code" {
type = string
description = "Code of the Country where the app connector is located i.e US or CA"
default = null
}

variable "app_connector_group_location" {
type = string
description = "Location of the App Connector Group."
default = null
}

variable "app_connector_group_upgrade_day" {
type = string
description = "App Connectors in this group will attempt to update to a newer version of the software during this specified day."
default = "SUNDAY"
}

variable "app_connector_group_upgrade_time_in_secs" {
type = string
description = "App Connectors in this group will attempt to update to a newer version of the software during this specified time."
default = "66600"
}

variable "app_connector_group_override_version_profile" {
type = bool
description = "Whether the default version profile of the App Connector Group is applied or overridden."
default = true
}

variable "app_connector_group_version_profile_id" {
type = string
description = "ID of the version profile"
default = "2"
}

variable "app_connector_group_dns_query_type" {
type = string
description = "Whether to enable IPv4 or IPv6, or both, for DNS resolution of all applications in the App Connector Group."
default = "IPV4_IPV6"
}
*/
5 changes: 3 additions & 2 deletions example/zpa-nia.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buffer_period {
max = "20s"
}

# Vault Config Options
# Vault Config Options (Optional)
vault {}

# Consul Config Options
Expand Down Expand Up @@ -38,12 +38,13 @@ terraform_provider "zpa" {
task {
name = "zpa_application_segment_update"
description = "Application Segment based on service definition"
module = "./"
module = "../"
# module = "github.com/zscaler/terraform-zpa-application-segment-nia"
# version = "0.0.1" # Optional
providers = ["zpa"]

condition "services" {
names = ["nginx","web","api"]
}
variable_files = "./terraform.tfvars"
}
8 changes: 0 additions & 8 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,4 @@ locals {
udp_port_ranges = {
for id, s in var.services : s.port => s... if s.status == "passing"
}
tcp_port_range = {
from = "80"
to = "80"
}
udp_port_range = {
from = "80"
to = "80"
}
}
Loading