-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added New DLP Engine Resource (#258)
* feat: Added New DLP Engine Resource * (doc): Added new zia_dlp_engine resource doc * fix: url filtering rule test * Fix: Disable Firewall rule test
- Loading branch information
Showing
18 changed files
with
431 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
subcategory: "Data Loss Prevention" | ||
layout: "zscaler" | ||
page_title: "ZIA: dlp_engines" | ||
description: |- | ||
Get information about ZIA DLP Engines. | ||
--- | ||
|
||
# Data Source: zia_dlp_engines | ||
|
||
Use the **zia_dlp_engines** resource allows the creation and management of ZIA DLP Engines in the Zscaler Internet Access cloud or via the API. | ||
|
||
⚠️ **WARNING:** "Before using the new ``zia_dlp_engines`` resource contact [Zscaler Support](https://help.zscaler.com/login-tickets)." and request the following API methods ``POST``, ``PUT``, and ``DELETE`` to be enabled for your organization. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
# Retrieve a DLP Engine by name | ||
resource "zia_dlp_engines" "this" { | ||
name = "Example" | ||
description = "Example" | ||
engine_expression = "((D63.S > 1))" | ||
custom_dlp_engine = true | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
### Required | ||
|
||
* `name` - (Required) The DLP engine name as configured by the admin. This attribute is required in POST and PUT requests for custom DLP engines. | ||
* `predefined_engine_name` - (String) The name of the predefined DLP engine. | ||
* `engine_expression` - (String) The boolean logical operator in which various DLP dictionaries are combined within a DLP engine's expression. | ||
* `custom_dlp_engine` - (Bool) Indicates whether this is a custom DLP engine. If this value is set to true, the engine is custom. | ||
|
||
### Optional | ||
|
||
* `description` - (String) The DLP engine's description. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "zia_dlp_engines" "this" { | ||
name = "Custom_DLP_Engine" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
data "zia_dlp_engines" "this" { | ||
name = "Custom_DLP_Engine" | ||
resource "zia_dlp_engines" "this" { | ||
name = "Example1000" | ||
description = "Example1000" | ||
engine_expression = "((D63.S > 1))" | ||
custom_dlp_engine = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,32 @@ | ||
package zia | ||
|
||
import ( | ||
"strconv" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
"github.com/zscaler/terraform-provider-zia/v2/zia/common/resourcetype" | ||
"github.com/zscaler/terraform-provider-zia/v2/zia/common/testing/method" | ||
"github.com/zscaler/terraform-provider-zia/v2/zia/common/testing/variable" | ||
) | ||
|
||
func TestAccDataSourceDLPEngines_Basic(t *testing.T) { | ||
resourceTypeAndName, dataSourceTypeAndName, generatedName := method.GenerateRandomSourcesTypeAndName(resourcetype.DLPEngines) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckDLPEnginesDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCheckDataSourceDLPEnginesConfig_basic, | ||
Config: testAccCheckDLPEnginesConfigure(resourceTypeAndName, generatedName, generatedName, variable.DLPCustomEngine), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccDataSourceDLPEnginesCheck("data.zia_dlp_engines.credit_cards"), | ||
testAccDataSourceDLPEnginesCheck("data.zia_dlp_engines.canada_ssn"), | ||
testAccDataSourceDLPEnginesCheck("data.zia_dlp_engines.us_ssn"), | ||
testAccDataSourceDLPEnginesCheck("data.zia_dlp_engines.glba"), | ||
testAccDataSourceDLPEnginesCheck("data.zia_dlp_engines.hipaa"), | ||
testAccDataSourceDLPEnginesCheck("data.zia_dlp_engines.pci"), | ||
resource.TestCheckResourceAttrPair(dataSourceTypeAndName, "id", resourceTypeAndName, "id"), | ||
resource.TestCheckResourceAttrPair(dataSourceTypeAndName, "name", resourceTypeAndName, "name"), | ||
resource.TestCheckResourceAttrPair(dataSourceTypeAndName, "description", resourceTypeAndName, "description"), | ||
resource.TestCheckResourceAttr(resourceTypeAndName, "custom_dlp_engine", strconv.FormatBool(variable.DLPCustomEngine)), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDataSourceDLPEnginesCheck(name string) resource.TestCheckFunc { | ||
return resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet(name, "name"), | ||
) | ||
} | ||
|
||
var testAccCheckDataSourceDLPEnginesConfig_basic = ` | ||
data "zia_dlp_engines" "credit_cards"{ | ||
name = "Credit Cards" | ||
} | ||
data "zia_dlp_engines" "canada_ssn"{ | ||
name = "Canada-SSN" | ||
} | ||
data "zia_dlp_engines" "us_ssn"{ | ||
name = "Social Security Numbers" | ||
} | ||
data "zia_dlp_engines" "glba"{ | ||
name = "GLBA" | ||
} | ||
data "zia_dlp_engines" "hipaa"{ | ||
name = "HIPAA" | ||
} | ||
data "zia_dlp_engines" "pci"{ | ||
name = "PCI" | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.