|
| 1 | +--- |
| 2 | +subcategory: "Workload Groups" |
| 3 | +layout: "zscaler" |
| 4 | +page_title: "ZIA: workload_groups" |
| 5 | +description: |- |
| 6 | + Official documentation https://help.zscaler.com/zia/about-workload-groups |
| 7 | + API documentation https://help.zscaler.com/zia/workload-groups#/workloadGroups-get |
| 8 | + Get information about Workload Groups. |
| 9 | +--- |
| 10 | + |
| 11 | +# zia_workload_groups (Resource) |
| 12 | + |
| 13 | +* [Official documentation](https://help.zscaler.com/zia/about-workload-groups) |
| 14 | +* [API documentation](https://help.zscaler.com/zia/workload-groups#/workloadGroups-get) |
| 15 | + |
| 16 | +Use the **zia_workload_groups** resource allows the creation and management of Workload Group objects in the Zscaler Internet Access. This resource can then be used as a criterion in ZIA policies such as, Firewall Filtering, URL Filtering, and Data Loss Prevention (DLP) to apply security policies to the workload traffic. |
| 17 | + |
| 18 | +## Example Usage |
| 19 | + |
| 20 | +```hcl |
| 21 | +resource "zia_workload_groups" "example" { |
| 22 | + name = "Test Group" |
| 23 | + description = "Test Group" |
| 24 | +
|
| 25 | + expression_json { |
| 26 | + expression_containers { |
| 27 | + tag_type = "ATTR" |
| 28 | + operator = "AND" |
| 29 | +
|
| 30 | + tag_container { |
| 31 | + operator = "AND" |
| 32 | +
|
| 33 | + tags { |
| 34 | + key = "GroupName" |
| 35 | + value = "example" |
| 36 | + } |
| 37 | + } |
| 38 | + } |
| 39 | +
|
| 40 | + expression_containers { |
| 41 | + tag_type = "ENI" |
| 42 | + operator = "AND" |
| 43 | +
|
| 44 | + tag_container { |
| 45 | + operator = "AND" |
| 46 | +
|
| 47 | + tags { |
| 48 | + key = "GroupId" |
| 49 | + value = "123456789" |
| 50 | + } |
| 51 | + } |
| 52 | + } |
| 53 | +
|
| 54 | + expression_containers { |
| 55 | + tag_type = "VPC" |
| 56 | + operator = "AND" |
| 57 | +
|
| 58 | + tag_container { |
| 59 | + operator = "AND" |
| 60 | +
|
| 61 | + tags { |
| 62 | + key = "Vpc-id" |
| 63 | + value = "vpcid12344" |
| 64 | + } |
| 65 | + } |
| 66 | + } |
| 67 | +
|
| 68 | + expression_containers { |
| 69 | + tag_type = "VM" |
| 70 | + operator = "AND" |
| 71 | +
|
| 72 | + tag_container { |
| 73 | + operator = "AND" |
| 74 | +
|
| 75 | + tags { |
| 76 | + key = "IamInstanceProfile-Arn" |
| 77 | + value = "test01" |
| 78 | + } |
| 79 | + } |
| 80 | + } |
| 81 | + } |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +## Argument Reference |
| 86 | + |
| 87 | +The following arguments are supported: |
| 88 | + |
| 89 | +### Required |
| 90 | + |
| 91 | +* `name` - (Required) The name of the workload group. |
| 92 | + |
| 93 | +### Optional |
| 94 | + |
| 95 | +* `description` - (Optional) The description of the workload group. |
| 96 | +* `expression_json` - (Optional) The workload group expression containing tag types, tags, and their relationships represented in a JSON format. |
| 97 | + * `expression_containers` - (Optional) Contains one or more tag types (and associated tags) combined using logical operators within a workload group. |
| 98 | + * `tag_type` - (Optional) The tag type selected from a predefined list. Supported values are: `ANY`, `VPC`, `SUBNET`, `VM`, `ENI`, `ATTR`. |
| 99 | + * `operator` - (Optional) The operator (either AND or OR) used to create logical relationships among tag types. Supported values are: `AND`, `OR`, `OPEN_PARENTHESES`, `CLOSE_PARENTHESES`. |
| 100 | + * `tag_container` - (Optional) Contains one or more tags and the logical operator used to combine the tags within a tag type. |
| 101 | + * `operator` - (Optional) The logical operator (either AND or OR) used to combine the tags within a tag type. Supported values are: `AND`, `OR`. |
| 102 | + * `tags` - (Optional) One or more tags, each consisting of a key-value pair, selected within a tag type. If multiple tags are present within a tag type, they are combined using a logical operator. Note: A maximum of 8 tags can be added to a workload group, irrespective of the number of tag types present. |
| 103 | + * `key` - (Optional) The key component present in the key-value pair contained in a tag. |
| 104 | + * `value` - (Optional) The value component present in the key-value pair contained in a tag. |
| 105 | + |
| 106 | +## Attribute Reference |
| 107 | + |
| 108 | +In addition to all arguments above, the following attributes are exported: |
| 109 | + |
| 110 | +* `id` - (String) A unique identifier assigned to the workload group. |
| 111 | +* `group_id` - (Number) A unique identifier assigned to the workload group. |
| 112 | +* `name` - (String) The name of the workload group. |
| 113 | +* `description` - (String) The description of the workload group. |
| 114 | +* `expression_json` - (List) The workload group expression containing tag types, tags, and their relationships represented in a JSON format. |
| 115 | + * `expression_containers` - (List) Contains one or more tag types (and associated tags) combined using logical operators within a workload group. |
| 116 | + * `tag_type` - (String) The tag type selected from a predefined list. Returned values are: `ANY`, `VPC`, `SUBNET`, `VM`, `ENI`, `ATTR`. |
| 117 | + * `operator` - (String) The operator (either AND or OR) used to create logical relationships among tag types. Returned values are: `AND`, `OR`, `OPEN_PARENTHESES`, `CLOSE_PARENTHESES`. |
| 118 | + * `tag_container` - (List) Contains one or more tags and the logical operator used to combine the tags within a tag type. |
| 119 | + * `operator` - (String) The logical operator (either AND or OR) used to combine the tags within a tag type. Returned values are: `AND`, `OR`. |
| 120 | + * `tags` - (List) One or more tags, each consisting of a key-value pair, selected within a tag type. If multiple tags are present within a tag type, they are combined using a logical operator. Note: A maximum of 8 tags can be added to a workload group, irrespective of the number of tag types present. |
| 121 | + * `key` - (String) The key component present in the key-value pair contained in a tag. |
| 122 | + * `value` - (String) The value component present in the key-value pair contained in a tag. |
| 123 | + |
| 124 | +## Import |
| 125 | + |
| 126 | +Zscaler offers a dedicated tool called Zscaler-Terraformer to allow the automated import of ZIA configurations into Terraform-compliant HashiCorp Configuration Language. |
| 127 | +[Visit](https://github.com/zscaler/zscaler-terraformer) |
| 128 | + |
| 129 | +**zia_workload_groups** can be imported by using `<GROUP_ID>` or `<GROUP_NAME>` as the import ID. |
| 130 | + |
| 131 | +For example: |
| 132 | + |
| 133 | +```shell |
| 134 | +terraform import zia_workload_groups.example <group_id> |
| 135 | +``` |
| 136 | + |
| 137 | +or |
| 138 | + |
| 139 | +```shell |
| 140 | +terraform import zia_workload_groups.example <group_name> |
| 141 | +``` |
0 commit comments