Skip to content

Commit

Permalink
Fix: Fixed ZPA computed and nested attributes (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
willguibr authored May 19, 2024
1 parent b4d0422 commit 7696932
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 1.1.3 (May, 18 2024)

### Notes

- Release date: **(May, 18 2024)**
- Supported Terraform version: **v1.x.x**

### Fixes
- [PR #191](https://github.com/zscaler/zscaler-terraformer/pull/191) Fixed ZPA `provisioning_key` computed attribute. The attribute is now excluded from the HCL generation during the import process.

- [PR #191](https://github.com/zscaler/zscaler-terraformer/pull/191) Fixed ZPA `zpa_service_edge_group` to convert `is_public` attribute to expected bool format.

- [PR #191](https://github.com/zscaler/zscaler-terraformer/pull/191) Fixed ZPA `zpa_service_edge_group` to properly convert nested attribute blocks `service_edge` and `trusted_networks`

## 1.1.2 (May, 17 2024)

### Notes
Expand Down
16 changes: 15 additions & 1 deletion docs/guides/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,24 @@ Track all Zscaler Terraformer Tool releases. New resources, features, and bug fi

---

``Last updated: v1.1.2``
``Last updated: v1.1.3``

---

## 1.1.3 (May, 18 2024)

### Notes

- Release date: **(May, 18 2024)**
- Supported Terraform version: **v1.x.x**

### Fixes
- [PR #191](https://github.com/zscaler/zscaler-terraformer/pull/191) Fixed ZPA `provisioning_key` computed attribute. The attribute is now excluded from the HCL generation during the import process.

- [PR #191](https://github.com/zscaler/zscaler-terraformer/pull/191) Fixed ZPA `zpa_service_edge_group` to convert `is_public` attribute to expected bool format.

- [PR #191](https://github.com/zscaler/zscaler-terraformer/pull/191) Fixed ZPA `zpa_service_edge_group` to properly convert nested attribute blocks `service_edge` and `trusted_networks`

## 1.1.2 (May, 17 2024)

### Notes
Expand Down
12 changes: 12 additions & 0 deletions internal/app/zscaler-terraformer/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,18 @@ func generate(cmd *cobra.Command, writer io.Writer, resourceType string) {
value := structData[apiAttrName]
// Handle any string modifications here, if necessary.

if resourceType == "zpa_service_edge_group" && attrName == "is_public" {
if value == nil {
value = false
} else {
isPublicStr, ok := value.(string)
if ok {
isPublic, _ := strconv.ParseBool(isPublicStr)
value = isPublic
}
}
}

output += writeAttrLine(attrName, value, false)

case cty.Number:
Expand Down
6 changes: 6 additions & 0 deletions internal/app/zscaler-terraformer/cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,12 @@ func nestBlocks(resourceType string, schemaBlock *tfjson.SchemaBlock, structData
} else if isInList(resourceType, []string{"zpa_server_group", "zpa_policy_access_rule"}) && block == "app_connector_groups" {
output += listIdsStringBlock(block, structData["appConnectorGroups"])
continue
} else if isInList(resourceType, []string{"zpa_service_edge_group"}) && block == "service_edges" {
output += listIdsStringBlock(block, structData["serviceEdges"])
continue
} else if isInList(resourceType, []string{"zpa_service_edge_group"}) && block == "trusted_networks" {
output += listIdsStringBlock(block, structData["trustedNetworks"])
continue
} else if isInList(resourceType, []string{"zpa_server_group", "zpa_segment_group"}) && block == "applications" {
output += listIdsStringBlock(block, structData["applications"])
continue
Expand Down

0 comments on commit 7696932

Please sign in to comment.