diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 2140a74..27f7b0a 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -20,7 +20,7 @@ jobs: - uses: actions/cache@v4 with: path: ~/go/pkg/mod - key: go1.20-${{ hashFiles('**/go.sum') }} + key: go1.21-${{ hashFiles('**/go.sum') }} - name: golangci-lint uses: golangci/golangci-lint-action@v4 with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b3f73e2..5eccab0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -17,14 +17,14 @@ jobs: test: strategy: matrix: - goVersion: [1.20] + goVersion: ["1.21"] os: [ubuntu-latest] runs-on: ${{ matrix.os }} steps: - name: install go uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.21" - name: checkout uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index d3ce6e4..95225f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 1.1.0 (March, 7 2024) + +### Notes + +- Release date: **(March, 7 2024)** +- Supported Terraform version: **v1.x.x** + +### Enhancements + +- [PR #176](https://github.com/zscaler/zscaler-terraformer/pull/176) Updated [support guide](/docs/guides/support.md) with new Zscaler support model. +- [PR #176](https://github.com/zscaler/zscaler-terraformer/pull/176) Introduced importing support for the following ZIA resource(s): + * ``zia_sandbox_behavioral_analysis`` +### Fixes +- [PR #176](https://github.com/zscaler/zscaler-terraformer/pull/176) Fixed importing issue with the following ZIA resources: + * ``zia_security_settings`` + * ``zia_url_categories`` + ## 1.0.3 (February, 29 2024) ### Notes diff --git a/README.md b/README.md index a302f57..eebae9a 100644 --- a/README.md +++ b/README.md @@ -271,7 +271,7 @@ Last updated February 29, 2024 Any resources not listed are currently not supported. -Last updated February 29, 2024 +Last updated March 7, 2024 | Resource | Resource Scope | Generate Supported | Import Supported | |----------|-----------|----------|----------| @@ -294,6 +294,7 @@ Last updated February 29, 2024 | [zia_url_filtering_rules](https://registry.terraform.io/providers/zscaler/zia/latest/docs/resources/zia_url_filtering_rules) | URL | ✅ | ✅ | | [zia_auth_settings_urls](https://registry.terraform.io/providers/zscaler/zia/latest/docs/resources/zia_auth_settings_urls) | URL | ✅ | ✅ | | [zia_security_policy_settings](https://registry.terraform.io/providers/zscaler/zia/latest/docs/resources/zia_security_policy_settings) | URL | ✅ | ✅ | +| [zia_sandbox_behavioral_analysis](https://https://registry.terraform.io/providers/zscaler/zia/latest/docs/resources/zia_sandbox_behavioral_analysis) | URL | ✅ | ✅ | | [zia_user_management](https://registry.terraform.io/providers/zscaler/zia/latest/docs/resources/zia_user_management) | User | ✅ | ✅ | | [zia_forwarding_control_rule](https://registry.terraform.io/providers/zscaler/zia/latest/docs/resources/zia_forwarding_control_rule) | Forward | ✅ | ✅ | | [zia_forwarding_control_zpa_gateway](https://registry.terraform.io/providers/zscaler/zia/latest/docs/resources/zia_forwarding_control_zpa_gateway) | Forward | ✅ | ✅ | diff --git a/docs/guides/support.md b/docs/guides/support.md index ca1460a..3299b98 100644 --- a/docs/guides/support.md +++ b/docs/guides/support.md @@ -4,22 +4,20 @@ page_title: "Support Guide" # General Support Statement -The Zscaler Terraformer Tool is supported and maintained by the Zscaler Technology Alliances team, and we welcome questions on how to use the tool. +The ZIA Terraform provider is supported and maintained by the Zscaler Technology Alliances team, and we welcome questions on how to use the provider. Please, refer to our [troubleshooting guide](troubleshooting.md) for guidance on typical problems. -All bug reports and feature requests must be submitted via [GitHub issues](https://github.com/zscaler/zscaler-terraformer/issues). When reporting bugs, please include a detailed description that demonstrates the bug and the command output. Stack traces will also be helpful. +## Support Ticket Severity -⚠️ **IMPORTANT:**:: Please ensure any sensitive information is redacted as Issues and Pull Requests are publicly viewable. +Support tickets related to the Terraform providers can be opened with [Zscaler Support](https://help.zscaler.com/login-tickets), however since the provider is just a client of the underlying product API, we will **NOT** be able to treat provider related support requests as a Severity-1 (Immediate time frame). -Notice that we will **NOT**, however, fix bugs upon customer demand, as we have to prioritize all pending bugs and features, as part of the product's backlog and release cycles. +When reporting bugs, please provide the Terraform script that demonstrates the bug and the command output. Stack traces will also be helpful. -## Support Ticket Severity - -Support tickets related to the Zscaler Terraformer tool can be opened with [Zscaler Support](https://help.zscaler.com/login-tickets), however since the tool is just a client of the underlying product API, we will **NOT** be able to treat related support requests as a Severity-1 (Immediate time frame). +Notice that we will **NOT**, however, fix bugs upon customer demand, as we have to prioritize all pending bugs and features, as part of the product's backlog and release cycles. -Urgent, production related issues associated with this tool can be resolved via direct interaction with the underlying API or UI. We will ask customers to resort to these methods to resolve downtime or urgent issues. If you have an urgent escalation, please contact your local Zscaler account team (RSM/SE/CSM/TAM) for assistance. +Urgent, production related Terraform issues can be resolved via direct interaction with the underlying API or UI. We will ask customers to resort to these methods to resolve downtime or urgent issues. If you have an urgent escalation, please contact your local Zscaler account team (RSM/SE/CSM/TAM) for assistance. ## Contact -For questions or requests that cannot be submitted via GitHub Issues, please contact zscaler-partner-labs@z-bd.com with "zscaler-terraformer" in the subject line. -We also provide a [private Slack channel](https://docs.google.com/forms/d/e/1FAIpQLSfkd3EMkLQdIWMNQ7QCr8TrH_xVSwSYcQshfBPDEZFOaF28qA/viewform?usp=sf_link) where you can submit your questions to the maintainers. Notice that this form will be reviewed and approved by Zscaler Technology Alliances team. +For questions or requests that cannot be submitted via GitHub Issues, please contact zscaler-partner-labs@z-bd.com with zia-terraform-provider" in the subject line. +We also provide a [private Slack channel](https://docs.google.com/forms/d/e/1FAIpQLSfkd3EMkLQdIWMNQ7QCr8TrH_xVSwSYcQshfBPDEZFOaF28qA/viewform?usp=sf_link) where you can submit your questions to the provider maintainers. Notice that this form will be reviewed and approved by Zscaler Technology Alliances team. diff --git a/go.mod b/go.mod index ada804e..a8a5bbc 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/zscaler/zscaler-terraformer -go 1.20 +go 1.21 + +toolchain go1.22.0 require ( github.com/dnaeon/go-vcr v1.2.0 diff --git a/go.sum b/go.sum index 0bb91e6..4bd9031 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,20 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/ProtonMail/go-crypto v1.1.0-alpha.1-proton h1:R+MMcIpg1nTjsYabIeFNR18j2V+3WT25xClrsrR0O6A= github.com/ProtonMail/go-crypto v1.1.0-alpha.1-proton/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3bSzwk= github.com/allegro/bigcache/v3 v3.1.0/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I= github.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU= +github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= +github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= @@ -18,18 +22,25 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8Yc github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= github.com/go-git/go-git/v5 v5.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4= +github.com/go-git/go-git/v5 v5.11.0/go.mod h1:6GFcX2P3NM7FPBfpePbpLd21XxsgdAt+lKqXmCUiUCY= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -58,6 +69,7 @@ github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2D github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= github.com/hashicorp/terraform-plugin-sdk v1.17.2 h1:V7DUR3yBWFrVB9z3ddpY7kiYVSsq4NYR67NiTs93NQo= +github.com/hashicorp/terraform-plugin-sdk v1.17.2/go.mod h1:wkvldbraEMkz23NxkkAsFS88A1R9eUiooiaUZyS6TLw= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= @@ -65,9 +77,13 @@ github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47 github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= +github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -89,19 +105,23 @@ github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3P github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= +github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= +github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/skeema/knownhosts v1.2.1 h1:SHWdIUa82uGZz+F+47k8SY4QhhI291cXCpopT1lK2AQ= +github.com/skeema/knownhosts v1.2.1/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= @@ -128,6 +148,7 @@ github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8 github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= +github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/zclconf/go-cty v1.14.3 h1:1JXy1XroaGrzZuG6X9dt7HL6s9AwbY+l4UNL8o5B6ho= github.com/zclconf/go-cty v1.14.3/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= github.com/zscaler/zscaler-sdk-go/v2 v2.3.11 h1:/acxn6Pp30f9zcwvdvOIj0vlTa2auub9vweB0045jro= @@ -141,6 +162,7 @@ golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -154,12 +176,15 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/internal/app/zscaler-terraformer/cmd/generate.go b/internal/app/zscaler-terraformer/cmd/generate.go index be14839..07ef55b 100644 --- a/internal/app/zscaler-terraformer/cmd/generate.go +++ b/internal/app/zscaler-terraformer/cmd/generate.go @@ -28,6 +28,7 @@ import ( "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkservices" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/forwarding_control_policy/forwarding_rules" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/forwarding_control_policy/zpa_gateways" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/sandbox/sandbox_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/security_policy_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/urlcategories" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/user_authentication_settings" @@ -86,6 +87,7 @@ var allGeneratableResources = []string{ "zia_user_management", "zia_rule_labels", "zia_auth_settings_urls", + "zia_sandbox_behavioral_analysis", "zia_security_settings", "zia_forwarding_control_zpa_gateway", "zia_forwarding_control_rule", @@ -135,29 +137,45 @@ func generateResources() func(cmd *cobra.Command, args []string) { } func buildResourceName(resourceType string, structData map[string]interface{}) string { - id := "" - resourceID := "" - if structData["id"] != nil { + // Define a variable for the short UUID. + var shortUUID string + + // For resources that typically lack a unique identifier, generate a short UUID. + resourcesRequiringShortID := []string{"zia_sandbox_behavioral_analysis", "zia_security_settings", "zia_auth_settings_urls"} + if isInList(resourceType, resourcesRequiringShortID) { + // Generate a UUID and use the first 8 characters. + shortUUID = uuid.New().String()[:8] + } + + // Construct the resource ID using only the short UUID for specific resources, or use the existing logic for others. + var resID string + if shortUUID != "" { + resID = fmt.Sprintf("resource_%s", shortUUID) + } else if structData["id"] != nil { + var resourceID string switch structData["id"].(type) { case float64: resourceID = fmt.Sprintf("%d", int64(structData["id"].(float64))) default: resourceID = structData["id"].(string) } - } - id = strings.ToLower(strip(id)) - if structData["name"] != nil { + resID = fmt.Sprintf("resource_%s_%s", resourceType, resourceID) + } else if structData["name"] != nil { name := structData["name"].(string) if name != "" { - id = strings.ReplaceAll(strings.ToLower(strip(name)), " ", "_") + id := strings.ReplaceAll(strings.ToLower(strip(name)), " ", "_") + resID = fmt.Sprintf("resource_%s_%s", resourceType, id) } } - resID := fmt.Sprintf("resource_%s_%s", id, resourceID) + + if resID == "" { + // Fallback to using the short UUID if no other identifier is available. + resID = fmt.Sprintf("resource_%s", shortUUID) + } + resID = strings.ReplaceAll(resID, `"`, "") resID = strings.ReplaceAll(resID, `'`, "") resID = strings.ReplaceAll(resID, "`", "") - - // Remove any double underscores resID = strings.ReplaceAll(resID, "__", "_") return resID @@ -780,6 +798,15 @@ func generate(cmd *cobra.Command, writer io.Writer, resourceType string) { resourceCount = len(jsonPayload) m, _ := json.Marshal(jsonPayload) _ = json.Unmarshal(m, &jsonStructData) + case "zia_sandbox_behavioral_analysis": + hashes, err := api.zia.sandbox_settings.Get() + if err != nil { + log.Fatal(err) + } + jsonPayload := []*sandbox_settings.BaAdvancedSettings{hashes} + resourceCount = len(jsonPayload) + m, _ := json.Marshal(jsonPayload) + _ = json.Unmarshal(m, &jsonStructData) case "zia_security_settings": urls, err := api.zia.security_policy_settings.GetListUrls() if err != nil { diff --git a/internal/app/zscaler-terraformer/cmd/generate_test.go b/internal/app/zscaler-terraformer/cmd/generate_test.go index 8b2159d..7592af8 100644 --- a/internal/app/zscaler-terraformer/cmd/generate_test.go +++ b/internal/app/zscaler-terraformer/cmd/generate_test.go @@ -29,6 +29,7 @@ import ( "github.com/zscaler/zscaler-sdk-go/v2/zia/services/location/locationgroups" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/location/locationmanagement" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/rule_labels" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/sandbox/sandbox_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/security_policy_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/greinternalipranges" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/gretunnelinfo" @@ -186,6 +187,7 @@ func TestResourceGeneration(t *testing.T) { "zia rule labels": {identiferType: "rule", resourceType: "zia_rule_labels", testdataFilename: "zia_rule_labels"}, "zia auth settings urls": {identiferType: "auth", resourceType: "zia_auth_settings_urls", testdataFilename: "zia_auth_settings_urls"}, "zia security settings": {identiferType: "security", resourceType: "zia_security_settings", testdataFilename: "zia_security_settings"}, + "zia sandbox settings": {identiferType: "sandbox", resourceType: "zia_sandbox_behavioral_analysis", testdataFilename: "zia_sandbox_behavioral_analysis"}, //"zia forward control rule": {identiferType: "forward", resourceType: "zia_forwarding_control_rule", testdataFilename: "zia_forwarding_control_rule"}, //"zia zpa gateway": {identiferType: "forward", resourceType: "zia_forwarding_control_zpa_gateway", testdataFilename: "zia_forwarding_control_zpa_gateway"}, } @@ -305,6 +307,7 @@ func createClientMock(r http.RoundTripper, resourceType, zpaClientID, zpaClientS dlp_web_rules: dlp_web_rules.New(ziaClient), rule_labels: rule_labels.New(ziaClient), security_policy_settings: security_policy_settings.New(ziaClient), + sandbox_settings: sandbox_settings.New(ziaClient), user_authentication_settings: user_authentication_settings.New(ziaClient), users: users.New(ziaClient), forwarding_rules: forwarding_rules.New(ziaClient), diff --git a/internal/app/zscaler-terraformer/cmd/import.go b/internal/app/zscaler-terraformer/cmd/import.go index 46f27e3..13858f9 100644 --- a/internal/app/zscaler-terraformer/cmd/import.go +++ b/internal/app/zscaler-terraformer/cmd/import.go @@ -20,6 +20,7 @@ import ( "github.com/zscaler/zscaler-sdk-go/v2/zia/services/firewallpolicies/networkservices" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/forwarding_control_policy/forwarding_rules" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/forwarding_control_policy/zpa_gateways" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/sandbox/sandbox_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/security_policy_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/urlcategories" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/user_authentication_settings" @@ -76,6 +77,7 @@ var resourceImportStringFormats = map[string]string{ "zia_rule_labels": ":id", "zia_auth_settings_urls": ":id", "zia_security_settings": ":id", + "zia_sandbox_behavioral_analysis": ":id", } func init() { @@ -669,6 +671,15 @@ func importResource(cmd *cobra.Command, writer io.Writer, resourceType string) { m, _ := json.Marshal(jsonPayload) resourceCount = len(jsonPayload) _ = json.Unmarshal(m, &jsonStructData) + case "zia_sandbox_behavioral_analysis": + hashes, err := api.zia.sandbox_settings.Get() + if err != nil { + log.Fatal(err) + } + jsonPayload := []*sandbox_settings.BaAdvancedSettings{hashes} + m, _ := json.Marshal(jsonPayload) + resourceCount = len(jsonPayload) + _ = json.Unmarshal(m, &jsonStructData) case "zia_security_settings": urls, err := api.zia.security_policy_settings.GetListUrls() if err != nil { diff --git a/internal/app/zscaler-terraformer/cmd/type.go b/internal/app/zscaler-terraformer/cmd/type.go index a2d54a4..a97c842 100644 --- a/internal/app/zscaler-terraformer/cmd/type.go +++ b/internal/app/zscaler-terraformer/cmd/type.go @@ -20,6 +20,7 @@ import ( "github.com/zscaler/zscaler-sdk-go/v2/zia/services/location/locationgroups" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/location/locationmanagement" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/rule_labels" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/sandbox/sandbox_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/security_policy_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/greinternalipranges" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/gretunnelinfo" @@ -128,6 +129,7 @@ type ZIAClient struct { dlp_web_rules *dlp_web_rules.Service rule_labels *rule_labels.Service security_policy_settings *security_policy_settings.Service + sandbox_settings *sandbox_settings.Service user_authentication_settings *user_authentication_settings.Service forwarding_rules *forwarding_rules.Service zpa_gateways *zpa_gateways.Service diff --git a/internal/app/zscaler-terraformer/cmd/util.go b/internal/app/zscaler-terraformer/cmd/util.go index a5f8872..4adb448 100644 --- a/internal/app/zscaler-terraformer/cmd/util.go +++ b/internal/app/zscaler-terraformer/cmd/util.go @@ -30,6 +30,7 @@ import ( "github.com/zscaler/zscaler-sdk-go/v2/zia/services/location/locationgroups" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/location/locationmanagement" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/rule_labels" + "github.com/zscaler/zscaler-sdk-go/v2/zia/services/sandbox/sandbox_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/security_policy_settings" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/greinternalipranges" "github.com/zscaler/zscaler-sdk-go/v2/zia/services/trafficforwarding/gretunnelinfo" @@ -235,6 +236,7 @@ func sharedPreRun(cmd *cobra.Command, args []string) { dlp_web_rules: dlp_web_rules.New(ziaClient), rule_labels: rule_labels.New(ziaClient), security_policy_settings: security_policy_settings.New(ziaClient), + sandbox_settings: sandbox_settings.New(ziaClient), user_authentication_settings: user_authentication_settings.New(ziaClient), forwarding_rules: forwarding_rules.New(ziaClient), zpa_gateways: zpa_gateways.New(ziaClient),