### Running Terraform Example - ZIA Location Management - Bash Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_location_lite/README.md This snippet provides the standard Terraform commands to initialize the working directory, generate an execution plan, and apply the configuration to retrieve ZIA location management lite data. It ensures all necessary plugins are downloaded and the infrastructure is provisioned as defined. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Initializing Terraform Configuration Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/troubleshooting.md This standard Terraform command initializes a working directory containing Terraform configuration files. It downloads necessary providers and modules, and is often run after making changes to provider configurations or when starting a new project to ensure dependencies are met. ```sh terraform init ``` -------------------------------- ### Installing Zscaler Terraformer via Homebrew Tap (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/resource-importer.md This snippet provides the Homebrew commands to add the Zscaler tap and then install the `zscaler-terraformer` utility. This is the recommended installation method for macOS users. It ensures you get the official releases from the Zscaler Homebrew tap. ```bash brew tap zscaler/tap brew install zscaler/tap/zscaler-terraformer ``` -------------------------------- ### Running Terraform Commands Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_static_ips/README.md This snippet demonstrates the standard workflow for applying Terraform configurations. It initializes the working directory, generates an execution plan, and then applies the planned changes to create or update resources. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Running Terraform Example for ZIA IP Destination Groups Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_fw_filtering_ip_destination_groups/README.md These commands initialize the Terraform working directory, generate an execution plan, and then apply the planned changes to create IP destination groups in the ZIA portal. The 'terraform init' command downloads necessary providers, while 'terraform plan' shows what will be created, and 'terraform apply' executes the changes. ```Bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Example ZPA Configuration File (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/resource-importer.md This snippet shows an example `zscaler-terraformer.yaml` configuration file for ZPA, accessed via a `cat` command. It specifies authentication details like `zpaClientID`, `zpaClientSecret`, `zpaCustomerID`, and the `zpaCloud` to connect to. This method provides an alternative to environment variables for credential management. ```bash $ cat ~/.zscaler-terraformer.yaml zpaClientID: "Mrwefhoijhviihew" zpaClientSecret: "{HBRjowhdowqj" zpaCustomerID: "123456789" zpaCloud: "BETA" ``` -------------------------------- ### Initializing and Applying Terraform Configuration Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_fw_filtering_network_applications/README.md This snippet initializes the Terraform working directory, creates an execution plan, and applies the changes defined in the configuration. It's a standard workflow for deploying infrastructure with Terraform. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Installing Development Tools for ZIA Terraform Provider (sh) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/README.md This command installs all necessary development tools and dependencies required for building and working with the ZIA Terraform provider. It ensures the environment is properly configured for compilation and testing. ```sh $ make tools ``` -------------------------------- ### Retrieving DLP IDM Profile Example (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_dlp_idm_profiles.md This HCL snippet provides another example of retrieving a ZIA DLP IDM Profile. Although the accompanying comment suggests retrieval by ID, the code itself uses the `name` attribute set to "Example" to fetch the profile. This illustrates the common pattern of using the `name` argument for data source lookups. ```HCL data "zia_dlp_idm_profile" "example"{ name = "Example" } ``` -------------------------------- ### Installing Zscaler Terraformer via Homebrew Cask (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/resource-importer.md This snippet offers an alternative Homebrew installation method using `brew install --cask`. This command also adds the Zscaler tap and installs `zscaler-terraformer`, potentially installing it as an application or binary package. It's another option for macOS users. ```bash brew tap zscaler/tap brew install --cask zscaler/tap/zscaler-terraformer ``` -------------------------------- ### Building ZIA Activator CLI with Make (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/zia-activator-overview.md This command compiles the `ziaActivator` CLI binary using `make`. It first runs `build13` and then `ziaActivator`, potentially requiring `sudo` for installation into the system's PATH, typically `/usr/local/bin/`. ```bash $ make build13 && sudo make ziaActivator ``` -------------------------------- ### Applying Terraform Configuration for ZIA DLP Dictionary (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_dlp_dictionary/README.md This snippet initializes Terraform, generates an execution plan, and applies the configuration to create a custom DLP dictionary in the ZIA portal. It requires the ZIA provider to be configured as described in the documentation. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Defining ZIA Provider Requirements in Terraform Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/troubleshooting.md This HCL configuration block defines the required ZIA Terraform provider, specifying its source and a recommended version. It should be included in a `versions.tf` file within every module that uses the provider to resolve installation errors related to registry lookup. ```hcl # versions.tf terraform { required_providers { zpa = { source = "zscaler/zia" version = "2.6.2" } } } ``` -------------------------------- ### Initializing and Applying Terraform Configuration Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_gre_tunnel_info/README.md This snippet demonstrates the standard workflow for initializing a Terraform configuration, generating an execution plan, and applying the changes. `terraform init` prepares the working directory, `terraform plan` shows what actions will be performed, and `terraform apply` executes those actions. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Creating ZIA Local User Account with Group and Department (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_user_management.md This HCL example demonstrates how to create a local user account in ZIA, associating it with existing group and department resources. It uses data sources to retrieve the IDs of a 'Normal_Internet' group and an 'Engineering' department, then defines a `zia_user_management` resource with basic authentication. Note that passwords in the example are placeholders. ```HCL data "zia_group_management" "normal_internet" { name = "Normal_Internet" } data "zia_department_management" "engineering" { name = "Engineering" } # ZIA Local User Account ######### PASSWORDS IN THIS FILE ARE FAKE AND NOT USED IN PRODUCTION SYSTEMS ######### resource "zia_user_management" "john_ashcroft" { name = "John Ashcroft" email = "john.ashcroft@acme.com" password = "*********************" auth_methods = ["BASIC"] groups { id = data.zia_group_management.normal_internet.id } department { id = data.zia_department_management.engineering.id } } ``` -------------------------------- ### Creating VPN Credentials with IP Authentication (Terraform) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_traffic_forwarding_vpn_credentials.md This example illustrates the creation of ZIA VPN credentials using IP address authentication. It also includes the necessary `zia_traffic_forwarding_static_ip` resource, which must be created first, as indicated by the `depends_on` argument. This setup is used when the VPN is identified by a specific IP address. ```hcl # ZIA Traffic Forwarding - VPN Credentials (IP) ######### PASSWORDS IN THIS FILE ARE FAKE AND NOT USED IN PRODUCTION SYSTEMS ######### resource "zia_traffic_forwarding_vpn_credentials" "example"{ type = "IP" ip_address = zia_traffic_forwarding_static_ip.example.ip_address comments = "Example" pre_shared_key = "*********************" depends_on = [ zia_traffic_forwarding_static_ip.example ] } resource "zia_traffic_forwarding_static_ip" "example"{ ip_address = "1.1.1.1" routable_ip = true comment = "Example" geo_override = true latitude = -36.848461 longitude = 174.763336 } ``` -------------------------------- ### Querying ZIA Rule Labels (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_rule_labels.md This HCL example demonstrates how to use the `zia_rule_labels` data source to retrieve details about an existing rule label in Zscaler Internet Access. It queries for a label named 'Example'. This data source is essential for referencing rule labels in other ZIA configurations, such as firewall or URL filtering rules, by their name. ```HCL # ZIA Rule Labels Data Source data "zia_rule_labels" "example" { name = "Example" } ``` -------------------------------- ### Running Terraform Workflow Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_gre_tunnels_numbered/README.md This snippet outlines the standard Terraform workflow to initialize the working directory, generate an execution plan, and apply the changes to create the GRE Tunnel resource in the ZIA portal. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Running Terraform Commands for URL Filtering Policies - Bash Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_url_filtering_policies/README.md This snippet demonstrates the standard Terraform workflow to initialize the working directory, create an execution plan, and apply the configuration to create URL Filtering Policies in the ZIA portal. It ensures the provider is set up and the desired state is achieved. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Retrieving Workload Group Information (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_workload_groups.md This HCL snippet demonstrates how to use the `zia_workload_groups` data source to retrieve information about a specific Workload Group by its name. It sets the `name` argument to "Example" to fetch the workload group named 'Example', which can then be referenced in ZIA policies. ```hcl # ZIA Admin User Data Source data "zia_workload_groups" "ios"{ name = "Example" } ``` -------------------------------- ### Running Terraform Commands for VIP Retrieval Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_public_node_vips/README.md This snippet provides the standard Terraform commands to initialize the working directory, create an execution plan, and apply the configuration to retrieve the list of public VIPs. It ensures the necessary provider plugins are downloaded and the state is managed. ```Bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Applying Terraform Configuration for ZIA URL Categories (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_url_categories/README.md This snippet initializes Terraform, creates an execution plan, and applies the plan to provision custom URL categories in the ZIA portal. It ensures the necessary provider plugins are downloaded and the desired state is achieved. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Initializing and Applying Terraform Configuration for ZIA Firewall Rule (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_firewall_filtering_rule/README.md This snippet demonstrates the standard Terraform workflow to initialize the working directory, create an execution plan, and apply the changes to provision a ZIA firewall rule. It ensures all necessary plugins are downloaded and the desired state is achieved. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Destroying Terraform Resources for ZIA Time Windows (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_fw_filtering_time_windows/README.md This snippet destroys all resources managed by the Terraform configuration, effectively removing the ZIA Cloud Firewall Time Windows created by the example. It requires prior application of the configuration. ```bash terraform destroy ``` -------------------------------- ### Upgrading ZIA Provider Namespace in Terraform Files Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/troubleshooting.md This shell command executes a Python script to automatically update the ZIA Terraform provider namespace from `zscaler.com/zia/zia` to `zscaler/zia` across all `.tf` files. This is a crucial step for resolving provider installation issues after namespace changes. ```sh python3 -c "$(curl -Ls https://github.com/zscaler/terraform-provider-zia/scripts/upgrade-namespace.py)" ``` -------------------------------- ### Creating ZIA Firewall Network Service Groups with Terraform HCL Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_firewall_filtering_network_service_groups.md This HCL example demonstrates how to create a ZIA Cloud Firewall Network Service Group. It first retrieves existing network services (FTP, NETBIOS, DNS) using data sources and then defines a new `zia_firewall_filtering_network_service_groups` resource, associating these services by their IDs. The group is named 'example' with a corresponding description. ```HCL data "zia_firewall_filtering_network_service" "example1" { name = "FTP" } data "zia_firewall_filtering_network_service" "example2" { name = "NETBIOS" } data "zia_firewall_filtering_network_service" "example3" { name = "DNS" } # Add network services to a network services group resource "zia_firewall_filtering_network_service_groups" "example"{ name = "example" description = "example" services { id = [ data.zia_firewall_filtering_network_service.example1.id, data.zia_firewall_filtering_network_service.example2.id, data.zia_firewall_filtering_network_service.example3.id ] } } ``` -------------------------------- ### Destroying Terraform Resources Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_static_ips/README.md This snippet shows how to destroy all resources managed by the current Terraform configuration. This command prompts for confirmation before removing the infrastructure. ```bash terraform destroy ``` -------------------------------- ### Applying Terraform Configuration for ZIA Network Services - Bash Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_fw_filtering_network_services/README.md This snippet details the standard Terraform workflow for deploying ZIA custom network services. It initializes the working directory, generates an execution plan for review, and then applies the configuration to provision the resources in the ZIA portal. ```Bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Configuring ZIA Forwarding Control ZPA Gateway with HCL Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_forwarding_control_zpa_gateway.md This HCL example demonstrates how to define a `zia_forwarding_control_zpa_gateway` resource. It utilizes `zpa_server_group` and `zpa_application_segment` data sources to fetch existing ZPA entities, then creates a new ZPA gateway, linking it to these entities for IP Source Anchoring. This setup is crucial for integrating ZIA with ZPA. ```HCL # ZIA Forwarding Control - ZPA Gateway data "zpa_server_group" "this" { name = "Server_Group_IP_Source_Anchoring" } data "zpa_application_segment" "this1" { name = "App_Segment_IP_Source_Anchoring" } data "zpa_application_segment" "this2" { name = "App_Segment_IP_Source_Anchoring2" } resource "zia_forwarding_control_zpa_gateway" "this" { name = "ZPA_GW01" description = "ZPA_GW01" type = "ZPA" zpa_server_group { external_id = data.zpa_server_group.this.id name = data.zpa_server_group.this.id } zpa_app_segments { external_id = data.zpa_application_segment.this1.id name = data.zpa_application_segment.this1.name } zpa_app_segments { external_id = data.zpa_application_segment.this2.id name = data.zpa_application_segment.this2.name } } ``` -------------------------------- ### Applying Terraform Configuration for ZIA Time Windows (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_fw_filtering_time_windows/README.md This snippet initializes the Terraform working directory, generates an execution plan, and applies the planned changes to create or update ZIA Cloud Firewall Time Windows. It requires a configured ZIA provider. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Applying IPSec VPN Credentials with Terraform Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_vpn_credentials/README.md This snippet demonstrates the standard Terraform workflow to initialize the working directory, generate an execution plan, and apply the configuration to create IPSec VPN credentials in ZIA. It requires a configured ZIA provider. ```Bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Configuring Zscaler ZIA Terraform Provider (v2.0.3) in HCL Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/release-notes.md This HCL snippet demonstrates how to configure the Zscaler ZIA Terraform provider in a Terraform configuration file. It specifies the required provider `zia` from the `zscaler/zia` source and pins its version to `2.0.3`. This setup is necessary for administrators migrating from custom provider installations to the officially hosted version in the Terraform Registry. ```HCL terraform { required_providers { zia = { source = "zscaler/zia" version = "2.0.3" } } } provider "zia" {} ``` -------------------------------- ### Applying Terraform Configuration for ZIA Admin Account Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_admin_user/README.md This snippet outlines the standard workflow to apply a Terraform configuration. It initializes the working directory, generates an execution plan, and then applies that plan to create a local administrator account in the ZIA portal. A configured ZIA provider is a prerequisite. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Applying Terraform Configuration for ZIA Location Management (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_location_management/README.md This snippet initializes the Terraform working directory, generates an execution plan, and applies the planned changes to create or update ZIA location resources. It requires a properly configured ZIA provider and is used to deploy the defined infrastructure. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Running Terraform Commands for GRE VIPs Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_recommended_vips/README.md This snippet provides the standard Terraform workflow commands to initialize the working directory, generate an execution plan, and apply the configuration to retrieve recommended GRE tunnel VIPs. It ensures all necessary plugins are downloaded and the state is managed. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Retrieving Cloud App Control Policy by Name and Type (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_cloud_app_control_rule.md This HCL example demonstrates how to retrieve a ZIA Cloud Application Control Policy using the `zia_cloud_app_control_rule` data source. It requires specifying the `name` of the policy (e.g., 'Example') and its `type` (e.g., 'STREAMING_MEDIA') to fetch the policy details. ```HCL # Retrieve a Cloud App Control Policy by name data "zia_cloud_app_control_rule" "this"{ name = "Example" type = "STREAMING_MEDIA" } ``` -------------------------------- ### Applying Terraform Configuration for ZIA Network Application Groups Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_fw_filtering_network_applications_groups/README.md This snippet demonstrates the standard Terraform workflow to initialize the provider, create an execution plan, and apply the configuration to provision ZIA network application groups. It requires the ZIA provider to be configured. ```Bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Destroying Terraform Resources - ZIA Location Management - Bash Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_location_lite/README.md This command is used to destroy all resources provisioned by the Terraform configuration. It prompts for confirmation before de-provisioning the ZIA location management lite data and any other related resources. ```bash terraform destroy ``` -------------------------------- ### Destroying Terraform Resources Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_fw_filtering_network_applications/README.md This snippet destroys all resources managed by the current Terraform configuration. It's used to clean up infrastructure provisioned by Terraform. ```bash terraform destroy ``` -------------------------------- ### Destroying Terraform Configuration for ZIA IP Source Groups - Bash Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_fw_filtering_ip_source_groups/README.md This snippet provides the bash command to destroy all resources provisioned by the Terraform configuration, effectively removing the ZIA IP source groups created in the example. It's used for cleaning up the environment and reverting changes. ```bash terraform destroy ``` -------------------------------- ### Running Terraform Configuration for ZIA IP Source Groups - Bash Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_fw_filtering_ip_source_groups/README.md This snippet provides the bash commands to initialize the Terraform configuration, create an execution plan, and apply the changes to provision IP source groups in ZIA. It ensures the necessary provider plugins are downloaded and the infrastructure is deployed according to the defined configuration. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Applying Terraform Configuration for ZIA Network Service Groups (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_fw_filtering_network_services_groups/README.md This snippet initializes the Terraform working directory, creates an execution plan, and applies the plan to provision network service group resources in ZIA. It ensures all necessary plugins are downloaded and the configuration is validated before deployment. ```bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Creating ZIA Rule Label using Terraform HCL Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_rule_labels.md This Terraform HCL snippet defines a `zia_rule_labels` resource named 'example'. It configures a new rule label with a specified `name` and an optional `description`, which can be used to categorize and manage ZIA Firewall and URL filtering rules. ```HCL resource "zia_rule_labels" "example" { name = "Example" description = "Example" } ``` -------------------------------- ### Destroying Terraform-Managed ZIA Firewall Rule (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_firewall_filtering_rule/README.md This snippet shows how to use Terraform to destroy the infrastructure previously provisioned, specifically the ZIA firewall rule. It removes all resources managed by the current Terraform configuration. ```bash terraform destroy ``` -------------------------------- ### Importing All ZIA Configuration (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/resource-importer.md This command imports all ZIA configuration resources using the `zscaler-terraformer` utility. It provides a comprehensive way to export your entire ZIA setup into Terraform HCL files. The `--resources="zia"` flag ensures all ZIA-related resources are included. ```bash zscaler-terraformer import --resources="zia" ``` -------------------------------- ### Importing All ZPA Configuration (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/resource-importer.md This command imports all ZPA configuration resources using the `zscaler-terraformer` utility. It's a quick way to export your entire ZPA setup into Terraform HCL files. The `--resources="zpa"` flag specifies that all ZPA-related resources should be imported. ```bash zscaler-terraformer import --resources="zpa" ``` -------------------------------- ### Running Terraform Configuration for ZIA GRE Tunnel Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_gre_tunnels_unnumbered/README.md This snippet provides the standard Terraform commands to initialize the working directory, generate an execution plan, and apply the configuration to create an unnumbered GRE Tunnel in the ZIA portal. It ensures all necessary provider plugins are downloaded and the desired state is achieved. ```Bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Destroying Terraform Resources Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_gre_tunnel_info/README.md This snippet shows how to destroy all resources managed by the current Terraform configuration. The `terraform destroy` command will prompt for confirmation before deprovisioning the infrastructure defined in the configuration. ```bash terraform destroy ``` -------------------------------- ### Retrieving ZIA DLP IDM Profile Lite by Name (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_dlp_idm_profiles_lite.md This HCL snippet demonstrates how to retrieve a ZIA DLP IDM Profile Lite by its configured name. It uses the `zia_dlp_idm_profile_lite` data source and sets the `name` attribute to 'Example' to fetch the corresponding profile's details. ```hcl data "zia_dlp_idm_profile_lite" "example"{ name = "Example" } ``` -------------------------------- ### Collecting Debug Information for Terraform ZIA Provider Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/troubleshooting.md This shell command collects detailed debug logs for the ZIA Terraform provider by setting environment variables for verbose logging and piping the output of `terraform apply` to a file. It is essential for comprehensive troubleshooting and reporting issues. ```sh TF_LOG=DEBUG ZSCALER_SDK_VERBOSE=true ZSCALER_SDK_LOG=true terraform apply -no-color 2>&1 |tee tf-debug.log ``` -------------------------------- ### Destroying Terraform Resources for ZIA DLP Dictionary (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_dlp_dictionary/README.md This snippet destroys all resources managed by the Terraform configuration, effectively removing the custom DLP dictionary from the ZIA portal. Use with caution as it permanently deletes resources. ```bash terraform destroy ``` -------------------------------- ### Destroying Terraform Resources for ZIA Location Management (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_location_management/README.md This snippet destroys all resources managed by the current Terraform configuration, effectively removing the ZIA location resources created previously. It should be used with caution as it permanently deletes provisioned infrastructure. ```bash terraform destroy ``` -------------------------------- ### Obtaining Summarized Sandbox Report using Terraform HCL Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_sandbox_report.md This HCL snippet illustrates how to use the `zia_sandbox_report` data source to retrieve a summarized sandbox analysis report for a given MD5 hash. It requires the `md5_hash` of the file and sets the `details` parameter to `summary` to get a concise overview. ```HCL data "zia_sandbox_report" "this" { md5_hash = "F69CA01D65E6C8F9E3540029E5F6AB92" details = "summary" } ``` -------------------------------- ### Destroying Terraform Resources for ZIA Admin Account Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_admin_user/README.md This snippet executes the 'terraform destroy' command, which removes all resources previously provisioned by the Terraform configuration. It is used to clean up the local administrator account created in the ZIA portal. ```bash terraform destroy ``` -------------------------------- ### Generating ZIA Configuration to Custom Path (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/resource-importer.md This snippet demonstrates how to generate ZIA configuration for a specific resource type (`zia_firewall_filtering_rule`) and direct the output to a custom directory. The `ZSCALER_ZIA_TERRAFORM_INSTALL_PATH` environment variable is used to specify the desired installation path. ```bash $ export ZSCALER_ZIA_TERRAFORM_INSTALL_PATH="$HOME/Desktop/zia_configuration" $ zscaler-terraformer generate \ --resource-type "zia_firewall_filtering_rule" ``` -------------------------------- ### Destroying Terraform Resources for ZIA URL Categories (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_url_categories/README.md This snippet executes the Terraform destroy command to remove all resources previously provisioned by the Terraform configuration, effectively cleaning up the custom URL categories in the ZIA portal. ```bash terraform destroy ``` -------------------------------- ### Retrieving File Type Control Rule by Name (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_file_type_control_rules.md This HCL snippet demonstrates how to retrieve a ZIA File Type Control rule using its descriptive name. The `name` argument is set to 'Example' to fetch the rule with that specific identifier. ```hcl data "zia_file_type_control_rules" "this" { name = "Example" } ``` -------------------------------- ### Importing ZIA Advanced Threat Settings (Shell) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_atp_malware_settings.md This shell command provides an example of how to import an existing ZIA Advanced Threat Settings configuration into a Terraform state. It uses the `terraform import` command, specifying the target resource address `zia_advanced_threat_settings.this` and the import ID `"advanced_threat_settings"`. ```shell terraform import zia_advanced_threat_settings.this "advanced_threat_settings" ``` -------------------------------- ### Creating ZIA Location with IP VPN Credential and Static IP (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_location_management.md This example illustrates the creation of a ZIA location (`zia_location_management`) linked to an IP-based VPN credential and a static IP address. It configures a location with specific network settings and associates it with both `zia_traffic_forwarding_vpn_credentials` (type "IP") and `zia_traffic_forwarding_static_ip` resources. ```HCL # ZIA Location Management with IP VPN Credential resource "zia_location_management" "usa_sjc37"{ name = "USA_SJC_37" description = "Created with Terraform" country = "UNITED_STATES" tz = "UNITED_STATES_AMERICA_LOS_ANGELES" auth_required = true idle_time_in_minutes = 720 display_time_unit = "HOUR" surrogate_ip = true xff_forward_enabled = true ofw_enabled = true ips_control = true ip_addresses = [ zia_traffic_forwarding_static_ip.usa_sjc37.ip_address ] depends_on = [ zia_traffic_forwarding_static_ip.usa_sjc37, zia_traffic_forwarding_vpn_credentials.usa_sjc37 ] vpn_credentials { id = zia_traffic_forwarding_vpn_credentials.usa_sjc37.id type = zia_traffic_forwarding_vpn_credentials.usa_sjc37.type ip_address = zia_traffic_forwarding_static_ip.usa_sjc37.ip_address } } resource "zia_traffic_forwarding_vpn_credentials" "usa_sjc37"{ type = "IP" ip_address = zia_traffic_forwarding_static_ip.usa_sjc37.ip_address depends_on = [ zia_traffic_forwarding_static_ip.usa_sjc37 ] comments = "Created via Terraform" pre_shared_key = "******************" } resource "zia_traffic_forwarding_static_ip" "usa_sjc37"{ ip_address = "1.1.1.1" routable_ip = true comment = "SJC37 - Static IP" geo_override = false } ``` -------------------------------- ### Running Terraform Commands for ZIA GRE IP Ranges Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_gre_internal_ip_range/README.md This snippet provides the standard Terraform workflow commands to initialize the working directory, generate an execution plan, and apply the configuration to retrieve available GRE tunnel internal IP ranges from Zscaler. It requires the ZIA provider to be configured as described in the documentation. ```Bash terraform init terraform plan -out theplan terraform apply theplan ``` -------------------------------- ### Retrieving Advanced Settings using Terraform Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_advanced_settings.md This example demonstrates how to retrieve advanced settings configured in the ZIA Admin Portal using the `zia_advanced_settings` data source in Terraform. It fetches the current advanced settings without requiring any specific arguments, providing a simple way to access the configuration. ```hcl data "zia_advanced_settings" "this" {} ``` -------------------------------- ### Obtaining Full Sandbox Report using Terraform HCL Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_sandbox_report.md This HCL snippet demonstrates how to use the `zia_sandbox_report` data source to retrieve a complete (full) sandbox analysis report for a specified MD5 hash. It requires the `md5_hash` of the file and sets the `details` parameter to `full` to get comprehensive information. ```HCL data "zia_sandbox_report" "this" { md5_hash = "F69CA01D65E6C8F9E3540029E5F6AB92" details = "full" } ``` -------------------------------- ### Querying URL Category by Name in ZIA Terraform Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_url_categories.md This HCL snippet demonstrates how to query a ZIA URL category using its `configured_name`. It utilizes the `zia_url_categories` data source to retrieve information about a specific URL category named "Example". This is useful for referencing existing categories in other Terraform resources. ```HCL data "zia_url_categories" "this"{ configured_name = "Example" } ``` -------------------------------- ### Configuring ZPA API Credentials via Environment Variables (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/resource-importer.md This snippet provides an example of how to securely set ZPA API credentials as environment variables in a Bash shell. It includes `ZPA_CLIENT_ID`, `ZPA_CLIENT_SECRET`, `ZPA_CUSTOMER_ID`, and `ZPA_CLOUD`, which are used by `zscaler-terraformer` for authentication. Using environment variables is the recommended practice for managing sensitive API keys. ```Bash export ZPA_CLIENT_ID = "xxxxxxxxxxxxxxxx" export ZPA_CLIENT_SECRET = "xxxxxxxxxxxxxxxx" export ZPA_CUSTOMER_ID = "xxxxxxxxxxxxxxxx" export ZPA_CLOUD = "BETA" // Use "GOV" for ZPA Gov Cloud ``` -------------------------------- ### Querying ZIA Firewall Filtering Destination Groups (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_firewall_filtering_destination_groups.md This HCL code snippet demonstrates how to retrieve information about an existing IP destination group in Zscaler Internet Access (ZIA) using its name. It utilizes the `zia_firewall_filtering_destination_groups` data source to fetch details for a group named 'example', which can then be referenced in other Terraform resources or firewall rules. ```HCL # ZIA Destination Groups data "zia_firewall_filtering_destination_groups" "example" { name = "example" } ``` -------------------------------- ### Troubleshooting ZIA Provider Configuration Errors (Shell) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/troubleshooting.md This error occurs when ZIA API credentials are not properly configured via environment variables, hard-coded methods, or the 'credentials.json' file. The snippet shows a typical error message indicating a failure to open or parse the credentials file, listing the required keys. ```sh │ with provider["registry.terraform.io/zscaler/zia"], │ on zia_location_management.tf line 10, in provider "zia": │ 10: provider "zia" {} │ │ error:Could not open credentials file, needs to contain one json object with keys: zia_username, zia_password, zia_api_key, and │ zia_cloud. open /Users//.zia/credentials.json: no such file or directory ``` -------------------------------- ### Retrieving DLP IDM Profile by Name (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_dlp_idm_profiles.md This HCL snippet demonstrates how to retrieve a ZIA DLP IDM Profile using its `name` attribute. It defines a `data` block for `zia_dlp_idm_profile` and sets the `name` argument to "Example" to fetch the profile with that specific name. This allows referencing the profile's attributes elsewhere in the Terraform configuration. ```HCL data "zia_dlp_idm_profile" "example"{ name = "Example" } ``` -------------------------------- ### Creating Parent and Sub-DLP Web Rules (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_dlp_web_rules.md This example demonstrates the creation of a hierarchical structure for ZIA DLP Web Rules, defining a parent rule and a sub-rule. The sub-rule explicitly links to the parent rule using the `parent_rule` attribute, allowing for more granular policy management. Note that destroying a parent rule will also destroy all associated sub-rules. ```HCL resource "zia_dlp_web_rules" "parent_rule" { name = "ParentRule1" description = "ParentRule1" action = "ALLOW" state = "ENABLED" order = 1 rank = 0 protocols = ["FTP_RULE", "HTTPS_RULE", "HTTP_RULE"] cloud_applications = ["GOOGLE_WEBMAIL", "WINDOWS_LIVE_HOTMAIL"] without_content_inspection = false match_only = false min_size = 20 zscaler_incident_receiver = true } resource "zia_dlp_web_rules" "subrule1" { name = "SubRule1" description = "SubRule1" action = "ALLOW" state = "ENABLED" order = 1 rank = 0 protocols = ["FTP_RULE", "HTTPS_RULE", "HTTP_RULE"] cloud_applications = ["GOOGLE_WEBMAIL", "WINDOWS_LIVE_HOTMAIL"] without_content_inspection = false match_only = false parent_rule = zia_dlp_web_rules.parent_rule.id } ``` -------------------------------- ### Activating ZIA Configuration Changes (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_activation_status.md This HCL example demonstrates how to use the `zia_activation_status` resource to explicitly activate pending ZIA configurations. It includes both a data source block, which can be used to retrieve the current activation status, and a resource block that sets the `status` argument to `ACTIVE` to trigger the activation. This resource is being deprecated in newer provider versions as activation is now automatic. ```HCL data "zia_activation_status" "activation" {} resource "zia_activation_status" "activation" { status = "ACTIVE" } ``` -------------------------------- ### Destroying Terraform Resources Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_gre_tunnels_numbered/README.md This snippet shows the command to destroy all resources managed by the current Terraform configuration, effectively removing the numbered GRE Tunnel from the ZIA portal. ```bash terraform destroy ``` -------------------------------- ### Displaying Zscaler Terraformer CLI Usage and Commands (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/resource-importer.md This snippet shows the general usage syntax for the `zscaler-terraformer` command-line tool, listing its primary commands such as `generate` for fetching resources and `import` for creating `terraform import` compatible commands. It also details various flags for configuration, resource filtering, and specifying API credentials for ZIA and ZPA, providing a comprehensive overview of the tool's capabilities. ```Bash Usage: zscaler-terraformer [command] Available Commands: completion Generate the autocompletion script for the specified shell generate Fetch resources from the Cloudflare API and generate the respective Terraform stanzas help Help about any command import Output `terraform import` compatible commands in order to import resources into state version Print the version number of zscaler-terraformer Flags: -c, --config string Path to config file (default "/Users/username/.zscaler-terraformer.yaml") --exclude string Which resources you wish to exclude -h, --help help for zscaler-terraformer --resource-type string Which resource you wish to generate --resources string Which resources you wish to import --terraform-install-path string Path to the default Terraform installation (default ".") -v, --verbose Specify verbose output (same as setting log level to debug) --version Display the release version --zia-terraform-install-path string Path to the ZIA Terraform installation (default ".") --ziaApiKey string ZIA API Key --ziaCloud string ZIA Cloud (i.e zscalerthree) --ziaPassword string ZIA password --ziaUsername string ZIA username --zpa-terraform-install-path string Path to the ZPA Terraform installation (default ".") --zpaClientID string ZPA client ID --zpaClientSecret string ZPA client secret --zpaCloud string ZPA Cloud (BETA or PRODUCTION) --zpaCustomerID string ZPA Customer ID Use "zscaler-terraformer [command] --help" for more information about a command. ``` -------------------------------- ### Destroying IPSec VPN Credentials with Terraform Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_vpn_credentials/README.md This snippet shows how to destroy the IPSec VPN credentials previously created by Terraform. This command removes all resources managed by the current Terraform configuration. ```Bash terraform destroy ``` -------------------------------- ### Compiling the ZIA Terraform Provider (sh) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/README.md This snippet shows how to compile the ZIA Terraform provider using the `make build13` command. Upon successful compilation, the provider binary will be placed in the `$GOPATH/bin` directory, ready for execution. ```sh $ make build13 ... $ $GOPATH/bin/terraform-provider-zia ``` -------------------------------- ### Cloning the ZIA Terraform Provider Repository (sh) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/README.md This snippet demonstrates how to create a local directory structure and clone the `terraform-provider-zia` repository from GitHub. This is the initial step to set up the development environment for the provider. ```sh $ mkdir -p $HOME/development/terraform-providers/; cd $HOME/development/terraform-providers/ $ git clone git@github.com:zscaler/terraform-provider-zia.git ``` -------------------------------- ### Destroying Terraform Resources for ZIA Network Application Groups Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_fw_filtering_network_applications_groups/README.md This snippet shows how to destroy all resources provisioned by the Terraform configuration. It will remove the ZIA network application groups created in the previous step. ```Bash terraform destroy ``` -------------------------------- ### Running Unit Tests for ZIA Terraform Provider (sh) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/README.md This command executes the unit tests for the ZIA Terraform provider. Running `make test` verifies the core functionality of the provider's components without interacting with real Zscaler resources. ```sh $ make test ``` -------------------------------- ### Destroying Terraform Resources for ZIA GRE Tunnel Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_traffic_forwarding_gre_tunnels_unnumbered/README.md This command is used to destroy all resources managed by the current Terraform configuration, effectively removing the unnumbered GRE Tunnel from the ZIA portal. It prompts for confirmation before proceeding with the destruction. ```Bash terraform destroy ``` -------------------------------- ### Activating ZIA Configuration using Go SDK Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/zia_activator.md This Go program initializes a ZIA client by retrieving credentials from environment variables (ZIA_USERNAME, ZIA_PASSWORD, ZIA_API_KEY, ZIA_CLOUD). It then uses the Zscaler SDK to create an activation request, setting the status to 'active', and logs the outcome. Finally, it logs out of the ZIA session. ```Go package main import ( "fmt" "log" "os" "runtime" client "github.com/zscaler/zscaler-sdk-go/v2/zia" "github.com/zscaler/zscaler-sdk-go/v2/zia/services" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/activation" ) func getEnvVarOrFail(k string) string { if v := os.Getenv(k); v != "" { return v } log.Fatalf("[ERROR] Couldn't find environment variable %s\n", k) return "" } func main() { log.Printf("[INFO] Initializing ZIA client\n") // Here, rather than setting up the client configuration from the external library, // we'll simply gather the required details for initializing the client username := getEnvVarOrFail("ZIA_USERNAME") password := getEnvVarOrFail("ZIA_PASSWORD") apiKey := getEnvVarOrFail("ZIA_API_KEY") ziaCloud := getEnvVarOrFail("ZIA_CLOUD") userAgent := fmt.Sprintf("(%s %s) cli/ziaActivator", runtime.GOOS, runtime.GOARCH) // Now, we'll use the local SDK's NewClient method to get the client instance cli, err := client.NewClient(username, password, apiKey, ziaCloud, userAgent) if err != nil { log.Fatalf("[ERROR] Failed Initializing ZIA client: %v\n", err) } service := services.New(cli) resp, err := activation.CreateActivation(service, activation.Activation{ Status: "active", }) if err != nil { log.Printf("[ERROR] Activation Failed: %v\n", err) } else { log.Printf("[INFO] Activation succeeded: %#v\n", resp) } log.Printf("[INFO] Destroying session: %#v\n", resp) _ = cli.Logout() os.Exit(0) } ``` -------------------------------- ### Running Acceptance Tests for ZIA Terraform Provider (sh) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/README.md This command initiates the full suite of acceptance tests for the ZIA Terraform provider. It's important to note that these tests create and manage real resources within the Zscaler environment, requiring proper authentication and configuration. ```sh $ make testacc ``` -------------------------------- ### Retrieve DLP ICAP Server by Name (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_dlp_icap_servers.md This HCL example demonstrates how to use the `zia_dlp_icap_servers` data source to retrieve a specific DLP ICAP server by its configured `name`. This is useful for referencing existing servers within Terraform configurations. ```hcl data "zia_dlp_icap_servers" "example"{ name = "Example" } ``` -------------------------------- ### Importing ZIA Sandbox Behavioral Analysis Settings (Shell) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_sandbox_behavioral_analysis.md This shell command demonstrates how to import an existing ZIA Sandbox behavioral analysis configuration into a Terraform state. It uses `terraform import` with the resource address `zia_sandbox_behavioral_analysis.example` and the specific import ID `sandbox_settings`. ```shell terraform import zia_sandbox_behavioral_analysis.example sandbox_settings ``` -------------------------------- ### Resolving Invalid Country Name in ZIA Location Management (Shell) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/troubleshooting.md This error occurs when an invalid uppercase country name is supplied for the 'country' attribute within 'zia_location_management'. The message advises consulting ISO 3166-1 for a list of acceptable country names. ```sh │ Error: 'UNITED_STATE' is not a valid country name. Please refer to ISO 3166-1 for a list of valid country names ``` -------------------------------- ### Invoking ZIA Activator after Terraform Apply (Bash) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/zia-activator-overview.md This command sequence initializes Terraform, applies the configuration, and then invokes the `ziaActivator` CLI to perform the necessary post-Terraform activation steps. This ensures that ZIA configurations are fully applied and activated. ```bash $ terraform init && terraform apply && ziaActivator ``` -------------------------------- ### Importing ZIA Sandbox Rules by Name (Terraform CLI) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_sandbox_rules.md This command imports an existing ZIA Sandbox Rule into Terraform using its descriptive name. It associates the imported rule with the `zia_sandbox_rules.example` resource in the Terraform state, enabling Terraform to manage its configuration. ```Shell terraform import zia_sandbox_rules.example ``` -------------------------------- ### Importing Specific UFQDN VPN Credential (Shell) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_traffic_forwarding_vpn_credentials.md This shell command provides an example of importing a single ZIA VPN credential of type UFQDN, identified by its specific FQDN address, into Terraform. This is useful for bringing individual VPN configurations under Terraform management. ```shell $ terraform import zia_traffic_forwarding_vpn_credentials.example 'testvpn@example.com' ``` -------------------------------- ### Retrieve DLP ICAP Server by ID (HCL) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/data-sources/zia_dlp_icap_servers.md This HCL example illustrates how to use the `zia_dlp_icap_servers` data source to retrieve a specific DLP ICAP server by its unique `id`. This method is suitable when the exact ID of the server is known, providing a direct lookup. ```hcl data "zia_dlp_icap_servers" "example"{ id = 1234567890 } ``` -------------------------------- ### Handling Invalid Country Code in ZIA Firewall Filtering Rule (Shell) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/troubleshooting.md This error indicates that an invalid two-letter country code was provided for the 'dest_countries' attribute in a 'zia_firewall_filtering_rule'. The error message suggests referring to the ISO-3166 Alpha-2 standard for valid country codes. ```sh ╷ │ Error: 'AUC' is not a valid ISO-3166 Alpha-2 country code. Please visit the following site for reference: https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes ``` -------------------------------- ### Replacing ZIA Provider in Terraform State Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/troubleshooting.md This Terraform CLI command updates the provider namespace within the Terraform state file, replacing the old `zscaler.com/zia/zia` reference with the new `zscaler/zia`. This is necessary to align the state with updated provider configurations after a namespace change. ```sh terraform state replace-provider zscaler.com/zia/zia zscaler/zia ``` -------------------------------- ### Fixing DLP Dictionary Naming Errors in ZIA (Shell) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/guides/troubleshooting.md This error is typically returned when attempting to create a 'zia_dlp_dictionaries' resource with a name containing spaces. To avoid this, it is recommended to clone existing predefined DLP dictionaries and use names with underscores or dashes instead of spaces. ```sh │ Error: no dictionary found with name: Social Security Numbers (US) ``` -------------------------------- ### Importing ZIA Sandbox Rules by ID (Terraform CLI) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/resources/zia_sandbox_rules.md This command imports an existing ZIA Sandbox Rule into Terraform using its unique numerical ID. It associates the imported rule with the `zia_sandbox_rules.example` resource in the Terraform state, allowing Terraform to manage it. ```Shell terraform import zia_sandbox_rules.example ``` -------------------------------- ### Destroying Terraform Resources for URL Filtering Policies - Bash Source: https://github.com/zscaler/terraform-provider-zia/blob/master/examples/zia_url_filtering_policies/README.md This snippet shows how to destroy all resources managed by the Terraform configuration, effectively removing the URL Filtering Policies created in the ZIA portal. This command should be used with caution as it permanently deletes the provisioned infrastructure. ```bash terraform destroy ``` -------------------------------- ### Configuring Zscaler Beta Environment with Environment Variables (Shell) Source: https://github.com/zscaler/terraform-provider-zia/blob/master/docs/index.md This snippet demonstrates how to set environment variables (`ZSCALER_VANITY_DOMAIN` and `ZSCALER_CLOUD`) to authenticate the Zscaler Terraform provider to a specific alternative cloud environment, such as the `beta` cloud, using shell commands. This is part of the OneAPI authentication method. ```sh export ZSCALER_VANITY_DOMAIN="acme" export ZSCALER_CLOUD="beta" ```