Skip to content

Commit

Permalink
fix: Fixed ZPA Provisioning key computed attribute (#190)
Browse files Browse the repository at this point in the history
* fix: Fixed ZPA Provisioning key computed attribute
  • Loading branch information
willguibr authored May 18, 2024
1 parent 4ff90cf commit a02b4b8
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion internal/app/zscaler-terraformer/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -881,13 +881,14 @@ func generate(cmd *cobra.Command, writer io.Writer, resourceType string) {
for k := range r.Block.Attributes {
sortedBlockAttributes = append(sortedBlockAttributes, k)
}

sort.Strings(sortedBlockAttributes)
// Block attributes are for any attributes where assignment is involved.
for _, attrName := range sortedBlockAttributes {
apiAttrName := mapTfFieldNameToApi(resourceType, attrName)
// Don't bother outputting the ID for the resource as that is only for
// internal use (such as importing state).
if attrName == "id" {
if attrName == "id" || attrName == "provisioning_key" {
continue
}

Expand Down
1 change: 0 additions & 1 deletion testdata/terraform/zpa/zpa_policy_access_rule/test.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ resource "zpa_policy_access_rule" "terraform_managed_resource" {
id = ["216196257331301306"]
}
conditions {
negated = false
operator = "OR"
operands {
lhs = "id"
Expand Down
1 change: 0 additions & 1 deletion testdata/terraform/zpa/zpa_policy_inspection_rule/test.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ resource "zpa_policy_inspection_rule" "terraform_managed_resource" {
operator = "AND"
policy_type = "1"
conditions {
negated = false
operator = "OR"
operands {
lhs = "id"
Expand Down
1 change: 0 additions & 1 deletion testdata/terraform/zpa/zpa_policy_isolation_rule/test.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ resource "zpa_policy_isolation_rule" "terraform_managed_resource" {
policy_type = "5"

conditions {
negated = false
operator = "OR"
operands {
object_type = "CLIENT_TYPE"
Expand Down
2 changes: 1 addition & 1 deletion testdata/zpa/zpa_lss_config_controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ interactions:
Maharashtra, India","latitude":"19.0728","longitude":"72.8826","dnsQueryType":"IPV4_IPV6","cityCountry":"Mumbai,
IN","countryCode":"IN","connectors":[{"id":"216196257331307409","modifiedTime":"1656100806","creationTime":"1656100806","modifiedBy":"-2","name":"Zscaler
Deception-1656100806020","fingerprint":"TRdagD4/vmR47xjEJaGXWHTbS2nQx9EaGqdf3XozSoM=","issuedCertId":"1176378","enabled":true,"assistantVersion":{"id":"216196257331307409","modifiedTime":"1660654375","creationTime":"1656100811","modifiedBy":"72057594037928156","expectedVersion":"22.137.1","currentVersion":"22.184.4","systemStartTime":"1656100751","applicationStartTime":"1660335536","lastBrokerConnectTime":"1660504135692592","lastBrokerDisconnectTime":"1660653475685000","brokerId":"72057594037930604","restartTimeInSec":"1660674600","platform":"el7","upgradeStatus":"IN_PROGRESS","ctrlChannelStatus":"ZPN_STATUS_AUTHENTICATED","latitude":"19.0728","longitude":"72.8826","privateIp":"198.18.224.20","publicIp":"3.108.225.232","loneWarrior":true,"mtunnelId":"4RKEE72N5aAwtkE6H/Ig","previousVersion":"22.137.1","lastUpgradedTime":"1660335536","upgradeAttempt":"1","sargeVersion":"22.137.1","appConnectorGroupId":"216196257331301305"},"upgradeAttempt":"0","provisioningKeyId":"11110"}],"lssAppConnectorGroup":false}],"policyRule":{"id":"216196257331301315","modifiedTime":"1646791912","creationTime":"1646791912","modifiedBy":"216196257331301304","name":"SIEM
selection rule for Zscaler Deception Log Forwarder","ruleOrder":"1","priority":"1","policyType":"3","operator":"AND","actionId":"216196257331301309","conditions":[{"id":"1440538","modifiedTime":"1646791912","creationTime":"1646791912","modifiedBy":"216196257331301304","operator":"OR","negated":false,"operands":[{"id":"1440539","creationTime":"1646791912","modifiedBy":"216196257331301304","objectType":"APP_GROUP","lhs":"id","rhs":"216196257331301307","name":"test name"}]}],"action":"LOG","policySetId":"216196257331281966","defaultRule":false}}]}'
selection rule for Zscaler Deception Log Forwarder","ruleOrder":"1","priority":"1","policyType":"3","operator":"AND","actionId":"216196257331301309","conditions":[{"id":"1440538","modifiedTime":"1646791912","creationTime":"1646791912","modifiedBy":"216196257331301304","operator":"OR","operands":[{"id":"1440539","creationTime":"1646791912","modifiedBy":"216196257331301304","objectType":"APP_GROUP","lhs":"id","rhs":"216196257331301307","name":"test name"}]}],"action":"LOG","policySetId":"216196257331281966","defaultRule":false}}]}'
headers:
Cache-Control:
- no-store
Expand Down
2 changes: 1 addition & 1 deletion testdata/zpa/zpa_policy_access_rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ interactions:
method: GET
response:
body: '{"totalPages":"1","list":[{"id":"216196257331301308","modifiedTime":"1646791911","creationTime":"1646791911","modifiedBy":"216196257331301304","name":"test name","description":"Automatically created by Zscaler Deception API for
whiskeygolf","ruleOrder":"1","priority":"1","policyType":"1","operator":"AND","conditions":[{"id":"1440536","modifiedTime":"1646791911","creationTime":"1646791911","modifiedBy":"216196257331301304","operator":"OR","negated":false,"operands":[{"id":"1440537","creationTime":"1646791911","modifiedBy":"216196257331301304","objectType":"APP_GROUP","lhs":"id","rhs":"216196257331301307","name":"test name"}]}],"action":"ALLOW","appServerGroups":[{"id":"216196257331301306","creationTime":"1646791911","modifiedBy":"216196257331301304","name":"test name","enabled":true,"description":"Automatically created by Zscaler Deception
whiskeygolf","ruleOrder":"1","priority":"1","policyType":"1","operator":"AND","conditions":[{"id":"1440536","modifiedTime":"1646791911","creationTime":"1646791911","modifiedBy":"216196257331301304","operator":"OR","operands":[{"id":"1440537","creationTime":"1646791911","modifiedBy":"216196257331301304","objectType":"APP_GROUP","lhs":"id","rhs":"216196257331301307","name":"test name"}]}],"action":"ALLOW","appServerGroups":[{"id":"216196257331301306","creationTime":"1646791911","modifiedBy":"216196257331301304","name":"test name","enabled":true,"description":"Automatically created by Zscaler Deception
API for whiskeygolf","configSpace":"DEFAULT","dynamicDiscovery":true}],"defaultRule":false,"appConnectorGroups":[{"id":"216196257331301305","modifiedTime":"1646874488","creationTime":"1646791910","modifiedBy":"216196257331281958","name":"test name","enabled":true,"description":"Automatically created by Zscaler Deception
API for whiskeygolf","versionProfileId":"2","overrideVersionProfile":false,"location":"Mumbai,
Maharashtra, India","dnsQueryType":"IPV4_IPV6","cityCountry":"Mumbai, IN","countryCode":"IN","lssAppConnectorGroup":false}]}]}'
Expand Down
2 changes: 1 addition & 1 deletion testdata/zpa/zpa_policy_inspection_rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ interactions:
method: GET
response:
body: '{"totalPages":"1","list":[{"id":"216196257331301308","modifiedTime":"1646791911","creationTime":"1646791911","modifiedBy":"216196257331301304","name":"test name","description":"Automatically created by Zscaler Deception API for
whiskeygolf","ruleOrder":"1","priority":"1","policyType":"1","operator":"AND","conditions":[{"id":"1440536","modifiedTime":"1646791911","creationTime":"1646791911","modifiedBy":"216196257331301304","operator":"OR","negated":false,"operands":[{"id":"1440537","creationTime":"1646791911","modifiedBy":"216196257331301304","objectType":"APP_GROUP","lhs":"id","rhs":"216196257331301307","name":"test name"}]}],"action":"INSPECT","appServerGroups":[{"id":"216196257331301306","creationTime":"1646791911","modifiedBy":"216196257331301304","name":"test name","enabled":true,"description":"Automatically created by Zscaler Deception
whiskeygolf","ruleOrder":"1","priority":"1","policyType":"1","operator":"AND","conditions":[{"id":"1440536","modifiedTime":"1646791911","creationTime":"1646791911","modifiedBy":"216196257331301304","operator":"OR","operands":[{"id":"1440537","creationTime":"1646791911","modifiedBy":"216196257331301304","objectType":"APP_GROUP","lhs":"id","rhs":"216196257331301307","name":"test name"}]}],"action":"INSPECT","appServerGroups":[{"id":"216196257331301306","creationTime":"1646791911","modifiedBy":"216196257331301304","name":"test name","enabled":true,"description":"Automatically created by Zscaler Deception
API for whiskeygolf","configSpace":"DEFAULT","dynamicDiscovery":true}],"defaultRule":false,"appConnectorGroups":[{"id":"216196257331301305","modifiedTime":"1646874488","creationTime":"1646791910","modifiedBy":"216196257331281958","name":"test name","enabled":true,"description":"Automatically created by Zscaler Deception
API for whiskeygolf","versionProfileId":"2","overrideVersionProfile":false,"location":"Mumbai,
Maharashtra, India","dnsQueryType":"IPV4_IPV6","cityCountry":"Mumbai, IN","countryCode":"IN","lssAppConnectorGroup":false}]}]}'
Expand Down
2 changes: 1 addition & 1 deletion testdata/zpa/zpa_policy_isolation_rule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ interactions:
method: GET
response:
body: '{"totalPages":"1","totalCount":"0","list":[{"id":"216199618143212400","modifiedTime":"1705066939","creationTime":"1675812458","modifiedBy":"216199618143191053","name":"Default_Rule","description":"This
is the default Isolation Policy rule","ruleOrder":"1","priority":"1","policyType":"5","operator":"AND","conditions":[{"id":"3794594","modifiedTime":"1675812458","creationTime":"1675812458","modifiedBy":"72057594037930840","operator":"OR","negated":false,"operands":[{"id":"3794595","creationTime":"1675812458","modifiedBy":"72057594037930840","objectType":"CLIENT_TYPE","lhs":"id","rhs":"zpn_client_type_exporter","name":"zpn_client_type_exporter"}]}],"action":"BYPASS_ISOLATE","defaultRule":true,"defaultRuleName":"Default_Rule"}]}'
is the default Isolation Policy rule","ruleOrder":"1","priority":"1","policyType":"5","operator":"AND","conditions":[{"id":"3794594","modifiedTime":"1675812458","creationTime":"1675812458","modifiedBy":"72057594037930840","operator":"OR","operands":[{"id":"3794595","creationTime":"1675812458","modifiedBy":"72057594037930840","objectType":"CLIENT_TYPE","lhs":"id","rhs":"zpn_client_type_exporter","name":"zpn_client_type_exporter"}]}],"action":"BYPASS_ISOLATE","defaultRule":true,"defaultRuleName":"Default_Rule"}]}'
headers:
Cache-Control:
- no-store
Expand Down

0 comments on commit a02b4b8

Please sign in to comment.