[
  {
    "path": ".github/dependabot.yml",
    "content": "# To get started with Dependabot version updates, you'll need to specify which\n# package ecosystems to update and where the package manifests are located.\n# Please see the documentation for all configuration options:\n# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates\n\nversion: 2\nupdates:\n  - package-ecosystem: \"gomod\"\n    directory: \"/\"\n    schedule:\n      interval: \"weekly\"\n\n  # Maintain dependencies for GitHub Actions\n  - package-ecosystem: \"github-actions\"\n    directory: \"/\"\n    schedule:\n      interval: \"weekly\"\n"
  },
  {
    "path": ".github/workflows/linter.yml",
    "content": "name: linter\n\non:\n  push:\n    branches:\n    - master\n  pull_request:\n    branches:\n    - master\n\njobs:\n  linter:\n    name: golangci-lint\n    runs-on: ubuntu-latest\n    steps:\n    - name: Check out code into the Go module directory\n      uses: actions/checkout@v4\n    - name: golangci-lint\n      uses: reviewdog/action-golangci-lint@v2\n      with:\n        go_version_file: go.mod\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n        tool_name: golangci-lint\n"
  },
  {
    "path": ".github/workflows/release.yaml",
    "content": "name: \"tagged-release\"\non:\n  workflow_dispatch:\n    inputs:\n      version:\n        description: Bump Version\n        required: true\njobs:\n  tagged-release:\n    name: \"Tagged Release\"\n    runs-on: \"ubuntu-latest\"\n\n    steps:\n      - uses: actions/checkout@v4\n      - name: Install Go\n        uses: actions/setup-go@v5\n        with:\n          go-version-file: go.mod\n          cache: true\n      - name: Test\n        run: go build -v && go test ./...\n      - name: Build for linux/amd64\n        run: go build -o terraformer-all-linux-amd64\n      - name: Build for linux/arm64\n        run: GOOS=linux GOARCH=arm64 go build -o terraformer-all-linux-arm64\n      - name: Build for mac\n        run: GOOS=darwin go build -o terraformer-all-darwin-amd64\n      - name: Build for mac Apple Silicon\n        run: GOOS=darwin GOARCH=arm64 go build -o terraformer-all-darwin-arm64\n      - name: Build for all providers\n        run: go run build/multi-build/main.go\n\n      - uses: \"marvinpinto/action-automatic-releases@latest\"\n        with:\n          repo_token: \"${{ secrets.GITHUB_TOKEN }}\"\n          automatic_release_tag: ${{ github.event.inputs.version }}\n          prerelease: false\n          files: |\n            terraformer-*\n"
  },
  {
    "path": ".github/workflows/stale.yaml",
    "content": "name: 'Close stale issues and PRs'\non:\n  schedule:\n    - cron: '30 1 * * *'\n\njobs:\n  stale:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/stale@v9\n        with:\n          repo-token: ${{ secrets.GITHUB_TOKEN }}\n          stale-issue-message: 'This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.'\n          close-issue-message: 'This issue was closed because it has been stalled for 7 days with no activity.'\n          days-before-issue-stale: 60\n          days-before-issue-close: 7\n          days-before-pr-close: -1"
  },
  {
    "path": ".github/workflows/test.yml",
    "content": "name: tests\n\non:\n  push:\n    branches:\n    - master\n  pull_request:\n    branches:\n    - master\n\njobs:\n  test:\n    strategy:\n      matrix:\n        platform: [ubuntu-latest, macos-latest]\n    runs-on: ${{ matrix.platform }}\n    steps:\n    - uses: actions/checkout@v4\n    - name: Install Go\n      uses: actions/setup-go@v5\n      with:\n        go-version-file: go.mod\n        cache: true\n    - name: Go Mod Tidy\n      run: go mod tidy\n    - name: Test\n      run: go build -v && go test ./...\n"
  },
  {
    "path": ".gitignore",
    "content": ".idea\ngenerated\nterraformer*\ncmd/tmp\n.DS_Store\n.terraform\n.vscode\nterraform.tfstate\nterraform.tfstate.backup\ninit.tf\nvendor/"
  },
  {
    "path": ".golangci.json",
    "content": "{\n  \"formatters\": {\n    \"enable\": [\n      \"gofmt\",\n      \"goimports\"\n    ],\n    \"exclusions\": {\n      \"generated\": \"lax\",\n      \"paths\": [\n        \"third_party$\",\n        \"builtin$\",\n        \"examples$\"\n      ]\n    }\n  },\n  \"issues\": {\n    \"max-issues-per-linter\": 0,\n    \"max-same-issues\": 0\n  },\n  \"linters\": {\n    \"enable\": [\n      \"gocritic\",\n      \"revive\",\n      \"unconvert\",\n      \"unparam\"\n    ],\n    \"exclusions\": {\n      \"generated\": \"lax\",\n      \"paths\": [\n        \"third_party$\",\n        \"builtin$\",\n        \"examples$\"\n      ],\n      \"presets\": [\n        \"comments\",\n        \"common-false-positives\",\n        \"legacy\",\n        \"std-error-handling\"\n      ]\n    }\n  },\n  \"run\": {\n    \"concurrency\": 8,\n    \"issues-exit-code\": 1,\n    \"modules-download-mode\": \"readonly\"\n  },\n  \"version\": \"2\"\n}\n"
  },
  {
    "path": "AUTHORS",
    "content": "# This is the list of Terraformer authors for copyright purposes.\n#\n# This does not necessarily list everyone who has contributed code, since in\n# some cases, their employer may be the copyright holder.  To see the full list\n# of contributors, see the revision history in source control.\nSergey Lanzman"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.\n\n## Our Standards\n\nExamples of behavior that contributes to creating a positive environment include:\n\n* Using welcoming and inclusive language\n* Being respectful of differing viewpoints and experiences\n* Gracefully accepting constructive criticism\n* Focusing on what is best for the community\n* Showing empathy towards other community members\n\nExamples of unacceptable behavior by participants include:\n\n* The use of sexualized language or imagery and unwelcome sexual attention or advances\n* Trolling, insulting/derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or electronic address, without explicit permission\n* Other conduct which could reasonably be considered inappropriate in a professional setting\n\n## Our Responsibilities\n\nProject maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.\n\nProject maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.\n\n## Scope\n\nThis Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at jaq@google.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.\n\nProject maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]\n\n[homepage]: http://contributor-covenant.org\n[version]: http://contributor-covenant.org/version/1/4/"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# How to Contribute\n\nWe'd love to accept your patches and contributions to this project. There are\njust a few small guidelines you need to follow.\n\n## Contributor License Agreement\n\nContributions to this project must be accompanied by a Contributor License\nAgreement. You (or your employer) retain the copyright to your contribution;\nthis simply gives us permission to use and redistribute your contributions as\npart of the project. Head over to <https://cla.developers.google.com/> to see\nyour current agreements on file or to sign a new one.\n\nYou generally only need to submit a CLA once, so if you've already submitted one\n(even if it was for a different project), you probably don't need to do it\nagain.\n\n## Code reviews\n\nAll submissions, including submissions by project members, require review. We\nuse GitHub pull requests for this purpose. Consult\n[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more\ninformation on using pull requests.\n\n## Community Guidelines\n\nThis project follows\n[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/)."
  },
  {
    "path": "LICENSE",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License."
  },
  {
    "path": "README.md",
    "content": "# Terraformer\n\n[![tests](https://github.com/GoogleCloudPlatform/terraformer/actions/workflows/test.yml/badge.svg)](https://github.com/GoogleCloudPlatform/terraformer/actions/workflows/test.yml)\n[![linter](https://github.com/GoogleCloudPlatform/terraformer/actions/workflows/linter.yml/badge.svg)](https://github.com/GoogleCloudPlatform/terraformer/actions/workflows/linter.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/GoogleCloudPlatform/terraformer)](https://goreportcard.com/report/github.com/GoogleCloudPlatform/terraformer)\n[![AUR package](https://img.shields.io/aur/version/terraformer)](https://aur.archlinux.org/packages/terraformer/)\n[![Homebrew](https://img.shields.io/badge/dynamic/json.svg?url=https://formulae.brew.sh/api/formula/terraformer.json&query=$.versions.stable&label=homebrew)](https://formulae.brew.sh/formula/terraformer)\n\n**This project is no longer maintained and is deprecated.**\n\nAs of March 16, 2026, this repository has been archived. It is now read-only, and no further updates, security patches, or support will be provided.\n\nA CLI tool that generates `tf`/`json` and `tfstate` files based on existing infrastructure\n(reverse Terraform).\n\n*   Disclaimer: This is not an official Google product\n*   Created by: Waze SRE\n\n![Waze SRE logo](assets/waze-sre-logo.png)\n\n# Table of Contents\n- [Demo GCP](#demo-gcp)\n- [Capabilities](#capabilities)\n- [Installation](#installation)\n- [Supported Providers](/docs)\n    * Major Cloud\n        * [Google Cloud](/docs/gcp.md)\n        * [AWS](/docs/aws.md)\n        * [Azure](/docs/azure.md)\n        * [AliCloud](/docs/alicloud.md)\n        * [IBM Cloud](/docs/ibmcloud.md)\n    * Cloud\n        * [DigitalOcean](/docs/digitalocean.md)\n        * [Equinix Metal](/docs/equinixmetal.md)\n        * [Fastly](/docs/fastly.md)\n        * [Heroku](/docs/heroku.md)\n        * [LaunchDarkly](/docs/launchdarkly.md)\n        * [Linode](/docs/linode.md)\n        * [NS1](/docs/ns1.md)\n        * [OpenStack](/docs/openstack.md)\n        * [TencentCloud](/docs/tencentcloud.md)\n        * [Vultr](/docs/vultr.md)\n        * [Yandex Cloud](/docs/yandex.md)\n        * [Ionos Cloud](/docs/ionoscloud.md)\n    * Infrastructure Software\n        * [Kubernetes](/docs/kubernetes.md)\n        * [OctopusDeploy](/docs/octopus.md)\n        * [RabbitMQ](/docs/rabbitmq.md)\n    * Network\n        * [Cloudflare](/docs/cloudflare.md) (broken, see #1761)\n        * [Myrasec](/docs/myrasec.md)\n        * [PAN-OS](/docs/panos.md)\n    * VCS\n        * [Azure DevOps](/docs/azuredevops.md)\n        * [GitHub](/docs/github.md)\n        * [Gitlab](/docs/gitlab.md)\n    * Monitoring & System Management\n        * [Datadog](/docs/datadog.md)\n        * [New Relic](/docs/relic.md)\n        * [Mackerel](/docs/mackerel.md)\n        * [PagerDuty](/docs/pagerduty.md)\n        * [Opsgenie](/docs/opsgenie.md)\n        * [Honeycomb.io](/docs/honeycombio.md)\n        * [Opal](/docs/opal.md)\n    * Community\n        * [Keycloak](/docs/keycloak.md)\n        * [Logz.io](/docs/logz.md)\n        * [Commercetools](/docs/commercetools.md)\n        * [Mikrotik](/docs/mikrotik.md)\n        * [Xen Orchestra](/docs/xen.md)\n        * [GmailFilter](/docs/gmailfilter.md)\n        * [Grafana](/docs/grafana.md)\n        * [Vault](/docs/vault.md)\n    * Identity\n        * [Okta](/docs/okta.md)\n        * [Auth0](/docs/auth0.md)\n        * [AzureAD](/docs/azuread.md)\n- [Contributing](#contributing)\n- [Developing](#developing)\n- [Infrastructure](#infrastructure)\n- [Stargazers over time](#stargazers-over-time)\n\n## Demo GCP\n[![asciicast](https://asciinema.org/a/243961.svg)](https://asciinema.org/a/243961)\n\n## Capabilities\n\n1.  Generate `tf`/`json` + `tfstate` files from existing infrastructure for all\n    supported objects by resource.\n2.  Remote state can be uploaded to a GCS bucket.\n3.  Connect between resources with `terraform_remote_state` (local and bucket).\n4.  Save `tf`/`json` files using a custom folder tree pattern.\n5.  Import by resource name and type.\n6.  Support terraform 0.13 (for terraform 0.11 use v0.7.9).\n\nTerraformer uses Terraform providers and is designed to easily support newly added resources.\nTo upgrade resources with new fields, all you need to do is upgrade the relevant Terraform providers.\n```\nImport current state to Terraform configuration from a provider\n\nUsage:\n   import [provider] [flags]\n   import [provider] [command]\n\nAvailable Commands:\n  list        List supported resources for a provider\n\nFlags:\n  -b, --bucket string         gs://terraform-state\n  -c, --connect                (default true)\n  -С, --compact                (default false)\n  -x, --excludes strings      firewalls,networks\n  -f, --filter strings        compute_firewall=id1:id2:id4\n  -h, --help                  help for google\n  -O, --output string         output format hcl or json (default \"hcl\")\n  -o, --path-output string     (default \"generated\")\n  -p, --path-pattern string   {output}/{provider}/ (default \"{output}/{provider}/{service}/\")\n      --projects strings\n  -z, --regions strings       europe-west1, (default [global])\n  -r, --resources strings     firewall,networks or * for all services\n  -s, --state string          local or bucket (default \"local\")\n  -v, --verbose               verbose mode\n  -n, --retry-number          number of retries to perform if refresh fails\n  -m, --retry-sleep-ms        time in ms to sleep between retries\n\nUse \" import [provider] [command] --help\" for more information about a command.\n```\n#### Permissions\n\nThe tool requires read-only permissions to list service resources.\n\n#### Resources\n\nYou can use `--resources` parameter to tell resources from what service you want to import.\n\nTo import resources from all services, use `--resources=\"*\"` . If you want to exclude certain services, you can combine the parameter with `--excludes` to exclude resources from services you don't want to import e.g. `--resources=\"*\" --excludes=\"iam\"`.\n\n#### Filtering\n\nFilters are a way to choose which resources `terraformer` imports. It's possible to filter resources by its identifiers or attributes. Multiple filtering values are separated by `:`. If an identifier contains this symbol, value should be wrapped in `'` e.g. `--filter=resource=id1:'project:dataset_id'`. Identifier based filters will be executed before Terraformer will try to refresh remote state.\n\nUse `Type` when you need to filter only one of several types of resources. Multiple filters can be combined when importing different resource types. An example would be importing all AWS security groups from a specific AWS VPC:\n```\nterraformer import aws -r sg,vpc --filter Type=sg;Name=vpc_id;Value=VPC_ID --filter Type=vpc;Name=id;Value=VPC_ID\n```\nNotice how the `Name` is different for `sg` than it is for `vpc`.\n\n##### Migration state version\nFor terraform >= 0.13, you can use `replace-provider` to migrate state from previous versions.\n\nExample usage:\n```\nterraform state replace-provider -auto-approve \"registry.terraform.io/-/aws\" \"hashicorp/aws\"\n```\n\n##### Resource ID\n\nFiltering is based on Terraform resource ID patterns. To find valid ID patterns for your resource, check the import part of the [Terraform documentation][terraform-providers].\n\n[terraform-providers]: https://www.terraform.io/docs/providers/\n\nExample usage:\n\n```\nterraformer import aws --resources=vpc,subnet --filter=vpc=myvpcid --regions=eu-west-1\n```\nWill only import the vpc with id `myvpcid`. This form of filters can help when it's necessary to select resources by its identifiers.\n\n##### Field name only\n\nIt is possible to filter by specific field name only. It can be used e.g. when you want to retrieve resources only with a specific tag key.\n\nExample usage:\n\n```\nterraformer import aws --resources=s3 --filter=\"Name=tags.Abc\" --regions=eu-west-1\n```\nWill only import the s3 resources that have tag `Abc`. This form of filters can help when the field values are not important from filtering perspective.\n\n##### Field with dots\n\nIt is possible to filter by a field that contains a dot.\n\nExample usage:\n\n```\nterraformer import aws --resources=s3 --filter=\"Name=tags.Abc.def\" --regions=eu-west-1\n```\nWill only import the s3 resources that have tag `Abc.def`.\n\n#### Planning\n\nThe `plan` command generates a planfile that contains all the resources set to be imported. By modifying the planfile before running the `import` command, you can rename or filter the resources you'd like to import.\n\nThe rest of subcommands and parameters are identical to the `import` command.\n\n```\n$ terraformer plan google --resources=networks,firewall --projects=my-project --regions=europe-west1-d\n(snip)\n\nSaving planfile to generated/google/my-project/terraformer/plan.json\n```\n\nAfter reviewing/customizing the planfile, begin the import by running `import plan`.\n\n```\n$ terraformer import plan generated/google/my-project/terraformer/plan.json\n```\n\n### Resource structure\n\nTerraformer by default separates each resource into a file, which is put into a given service directory.\n\nThe default path for resource files is `{output}/{provider}/{service}/{resource}.tf` and can vary for each provider.\n\nIt's possible to adjust the generated structure by:\n1. Using `--compact` parameter to group resource files within a single service into one `resources.tf` file\n2. Adjusting the `--path-pattern` parameter and passing e.g. `--path-pattern {output}/{provider}/` to generate resources for all services in one directory\n\nIt's possible to combine `--compact` `--path-pattern` parameters together.\n\n### Installation\n\nBoth Terraformer and a Terraform provider plugin need to be installed.\n\n#### Terraformer\n\n**From a package manager**\n- [Homebrew](https://brew.sh/) users can use `brew install terraformer`.\n- [MacPorts](https://www.macports.org/) users can use `sudo port install terraformer`.\n- [Chocolatey](https://chocolatey.org/) users can use `choco install terraformer`.\n\n**From releases**\nThis installs all providers, set `PROVIDER` to one of `google`, `aws` or `kubernetes` if you only need one.\n\n* Linux\n```\nexport PROVIDER=all\ncurl -LO \"https://github.com/GoogleCloudPlatform/terraformer/releases/download/$(curl -s https://api.github.com/repos/GoogleCloudPlatform/terraformer/releases/latest | grep tag_name | cut -d '\"' -f 4)/terraformer-${PROVIDER}-linux-amd64\"\nchmod +x terraformer-${PROVIDER}-linux-amd64\nsudo mv terraformer-${PROVIDER}-linux-amd64 /usr/local/bin/terraformer\n```\n* MacOS\n```\nexport PROVIDER=all\ncurl -LO \"https://github.com/GoogleCloudPlatform/terraformer/releases/download/$(curl -s https://api.github.com/repos/GoogleCloudPlatform/terraformer/releases/latest | grep tag_name | cut -d '\"' -f 4)/terraformer-${PROVIDER}-darwin-amd64\"\nchmod +x terraformer-${PROVIDER}-darwin-amd64\nsudo mv terraformer-${PROVIDER}-darwin-amd64 /usr/local/bin/terraformer\n```\n* Windows\n1. Install Terraform - https://www.terraform.io/downloads\n2. Download exe file for required provider from here - https://github.com/GoogleCloudPlatform/terraformer/releases\n3. Add the exe file path to path variable\n\n**From source**\n1.  Run `git clone <terraformer repo> && cd terraformer/`\n2.  Run `go mod download`\n3.  Run `go build -v` for all providers OR build with one provider\n`go run build/main.go {google,aws,azure,kubernetes,etc}`\n\n#### Terraform Providers\n\nCreate a working folder and initialize the Terraform provider plugin.  This folder will be where you run Terraformer commands.\n\nRun ```terraform init``` against a ```versions.tf``` file to install the plugins required for your platform. For example, if you need plugins for the google provider, ```versions.tf``` should contain:\n```\nterraform {\n  required_providers {\n    google = {\n      source = \"hashicorp/google\"\n    }\n  }\n  required_version = \">= 0.13\"\n}\n```\n\nOr, copy your Terraform provider's plugin(s) from the list below to folder `~/.terraform.d/plugins/`, as appropriate.\n\nLinks to download Terraform provider plugins:\n* Major Cloud\n    * Google Cloud provider >2.11.0 - [here](https://releases.hashicorp.com/terraform-provider-google/)\n    * AWS provider >2.25.0 - [here](https://releases.hashicorp.com/terraform-provider-aws/)\n    * Azure provider >1.35.0 - [here](https://releases.hashicorp.com/terraform-provider-azurerm/)\n    * Alicloud provider >1.57.1 - [here](https://releases.hashicorp.com/terraform-provider-alicloud/)\n* Cloud\n    * DigitalOcean provider >1.9.1 - [here](https://releases.hashicorp.com/terraform-provider-digitalocean/)\n    * Heroku provider >2.2.1 - [here](https://releases.hashicorp.com/terraform-provider-heroku/)\n    * LaunchDarkly provider >=2.1.1 - [here](https://releases.hashicorp.com/terraform-provider-launchdarkly/)\n    * Linode provider >1.8.0 - [here](https://releases.hashicorp.com/terraform-provider-linode/)\n    * OpenStack provider >1.21.1 - [here](https://releases.hashicorp.com/terraform-provider-openstack/)\n    * TencentCloud provider >1.50.0 - [here](https://releases.hashicorp.com/terraform-provider-tencentcloud/)\n    * Vultr provider >1.0.5 - [here](https://releases.hashicorp.com/terraform-provider-vultr/)\n    * Yandex provider >0.42.0 - [here](https://releases.hashicorp.com/terraform-provider-yandex/)\n    * Ionoscloud provider >6.3.3 - [here](https://github.com/ionos-cloud/terraform-provider-ionoscloud/releases)\n* Infrastructure Software\n    * Kubernetes provider >=1.9.0 - [here](https://releases.hashicorp.com/terraform-provider-kubernetes/)\n    * RabbitMQ provider >=1.1.0 - [here](https://releases.hashicorp.com/terraform-provider-rabbitmq/)\n* Network\n    * Myrasec provider >1.44 - [here](https://github.com/Myra-Security-GmbH/terraform-provider-myrasec)\n    * Cloudflare provider >1.16 - [here](https://releases.hashicorp.com/terraform-provider-cloudflare/)\n    * Fastly provider >0.16.1 - [here](https://releases.hashicorp.com/terraform-provider-fastly/)\n    * NS1 provider >1.8.3 - [here](https://releases.hashicorp.com/terraform-provider-ns1/)\n    * PAN-OS provider >= 1.8.3 - [here](https://github.com/PaloAltoNetworks/terraform-provider-panos)\n* VCS\n    * GitHub provider >=2.2.1 - [here](https://releases.hashicorp.com/terraform-provider-github/)\n* Monitoring & System Management\n    * Datadog provider >2.1.0 - [here](https://releases.hashicorp.com/terraform-provider-datadog/)\n    * New Relic provider >2.0.0 - [here](https://releases.hashicorp.com/terraform-provider-newrelic/)\n    * Mackerel provider > 0.0.6 - [here](https://github.com/mackerelio-labs/terraform-provider-mackerel)\n    * Pagerduty >=1.9 - [here](https://releases.hashicorp.com/terraform-provider-pagerduty/)\n    * Opsgenie >= 0.6.0 [here](https://releases.hashicorp.com/terraform-provider-opsgenie/)\n    * Honeycomb.io >= 0.10.0 - [here](https://github.com/honeycombio/terraform-provider-honeycombio/releases)\n    * Opal >= 0.0.2 - [here](https://github.com/opalsecurity/terraform-provider-opal/releases)\n* Community\n    * Keycloak provider >=1.19.0 - [here](https://github.com/mrparkers/terraform-provider-keycloak/)\n    * Logz.io provider >=1.1.1 - [here](https://github.com/jonboydell/logzio_terraform_provider/)\n    * Commercetools provider >= 0.21.0 - [here](https://github.com/labd/terraform-provider-commercetools)\n    * Mikrotik provider >= 0.2.2 - [here](https://github.com/ddelnano/terraform-provider-mikrotik)\n    * Xen Orchestra provider >= 0.18.0 - [here](https://github.com/ddelnano/terraform-provider-xenorchestra)\n    * GmailFilter provider >= 1.0.1 - [here](https://github.com/yamamoto-febc/terraform-provider-gmailfilter)\n    * Vault provider - [here](https://github.com/hashicorp/terraform-provider-vault)\n    * Auth0 provider - [here](https://github.com/alexkappa/terraform-provider-auth0)\n    * AzureAD provider - [here](https://github.com/hashicorp/terraform-provider-azuread)\n\nInformation on provider plugins:\nhttps://www.terraform.io/docs/configuration/providers.html\n\n\n## High-Level steps to add new provider\n * Initialize provider details in cmd/root.go and create a provider initialization file in the terraformer/cmd folder\n * Create a folder under terraformer/providers/ for your provider\n * Create two files under this folder\n   * <provide_name>_provider.go\n   * <provide_name>_service.go\n* Initialize all provider's supported services in <provide_name>_provider.go file\n* Create script for each supported service in same folder\n\n## Contributing\n\nIf you have improvements or fixes, we would love to have your contributions.\nPlease read [CONTRIBUTING.md](./CONTRIBUTING.md) for more information on the process we would like\ncontributors to follow.\n\n## Developing\n\nTerraformer was built so you can easily add new providers of any kind.\n\nProcess for generating `tf`/`json` + `tfstate` files:\n\n1.  Call GCP/AWS/other api and get list of resources.\n2.  Iterate over resources and take only the ID (we don't need mapping fields!).\n3.  Call to provider for readonly fields.\n4.  Call to infrastructure and take tf + tfstate.\n\n## Infrastructure\n\n1.  Call to provider using the refresh method and get all data.\n2.  Convert refresh data to go struct.\n3.  Generate HCL file - `tf`/`json` files.\n4.  Generate `tfstate` files.\n\nAll mapping of resource is made by providers and Terraform. Upgrades are needed only\nfor providers.\n\n##### GCP compute resources\n\nFor GCP compute resources, use generated code from\n`providers/gcp/gcp_compute_code_generator`.\n\nTo regenerate code:\n\n```\ngo run providers/gcp/gcp_compute_code_generator/*.go\n```\n\n### Similar projects\n\n#### [terraforming](https://github.com/dtan4/terraforming)\n\n##### Terraformer Benefits\n\n* Simpler to add new providers and resources - already supports AWS, GCP, GitHub, Kubernetes, and Openstack. Terraforming supports only AWS.\n* Better support for HCL + tfstate, including updates for Terraform 0.12.\n* If a provider adds new attributes to a resource, there is no need change Terraformer code - just update the Terraform provider on your laptop.\n* Automatically supports connections between resources in HCL files.\n\n##### Comparison\n\nTerraforming gets all attributes from cloud APIs and creates HCL and tfstate files with templating. Each attribute in the API needs to map to attribute in Terraform. Generated files from templating can be broken with illegal syntax. When a provider adds new attributes the terraforming code needs to be updated.\n\nTerraformer instead uses Terraform provider files for mapping attributes, HCL library from Hashicorp, and Terraform code.\n\nLook for S3 support in terraforming here and official S3 support\nTerraforming lacks full coverage for resources - as an example you can see that 70% of S3 options are not supported:\n\n* terraforming - https://github.com/dtan4/terraforming/blob/master/lib/terraforming/template/tf/s3.erb\n* official S3 support - https://www.terraform.io/docs/providers/aws/r/s3_bucket\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/GoogleCloudPlatform/terraformer.svg)](https://starchart.cc/GoogleCloudPlatform/terraformer)\n"
  },
  {
    "path": "SECURITY.md",
    "content": "To report a security issue, please use http://g.co/vulnz. We use\nhttp://g.co/vulnz for our intake, and do coordination and disclosure here on\nGitHub (including using GitHub Security Advisory). The Google Security Team will\nrespond within 5 working days of your report on g.co/vulnz.\n"
  },
  {
    "path": "build/main.go",
    "content": "package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n)\n\nconst filePrefix = \"provider_cmd_\"\nconst fileSuffix = \".go\"\nconst packageCmdPath = \"cmd\"\n\nfunc main() {\n\tprovider := os.Args[1]\n\tlog.Println(\"Build terraformer with \" + provider + \" provider...\")\n\tfiles, err := os.ReadDir(packageCmdPath)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tdeletedProvider := []string{}\n\tfor _, f := range files {\n\t\tif strings.HasPrefix(f.Name(), filePrefix) {\n\t\t\tif !strings.HasPrefix(f.Name(), filePrefix+provider+fileSuffix) {\n\t\t\t\tproviderName := strings.ReplaceAll(f.Name(), filePrefix, \"\")\n\t\t\t\tproviderName = strings.ReplaceAll(providerName, fileSuffix, \"\")\n\t\t\t\tdeletedProvider = append(deletedProvider, providerName)\n\t\t\t}\n\t\t}\n\t}\n\t// move files for deleted providers\n\terr = os.MkdirAll(packageCmdPath+\"/tmp\", os.ModePerm)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tfor _, provider := range deletedProvider {\n\t\terr := os.Rename(packageCmdPath+\"/\"+filePrefix+provider+fileSuffix, packageCmdPath+\"/tmp/\"+filePrefix+provider+fileSuffix)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n\n\t// comment deleted providers in code\n\trootCode, err := os.ReadFile(packageCmdPath + \"/root.go\")\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tlines := strings.Split(string(rootCode), \"\\n\")\n\tnewRootCodeLines := make([]string, len(lines))\n\tfor i, line := range lines {\n\t\tfor _, provider := range deletedProvider {\n\t\t\tif strings.Contains(strings.ToLower(line), \"newcmd\"+provider+\"importer\") {\n\t\t\t\tline = \"// \" + line\n\t\t\t}\n\t\t\tif strings.Contains(strings.ToLower(line), \"new\"+provider+\"provider\") {\n\t\t\t\tline = \"// \" + line\n\t\t\t}\n\t\t}\n\t\tnewRootCodeLines[i] = line\n\t}\n\tnewRootCode := strings.Join(newRootCodeLines, \"\\n\")\n\terr = os.WriteFile(packageCmdPath+\"/root.go\", []byte(newRootCode), os.ModePerm)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\t// build....\n\tcmd := exec.Command(\"go\", \"build\", \"-o\", \"terraformer-\"+provider)\n\tvar outb, errb bytes.Buffer\n\tcmd.Stdout = &outb\n\tcmd.Stderr = &errb\n\terr = cmd.Run()\n\tif err != nil {\n\t\tlog.Fatal(\"err:\", errb.String())\n\t}\n\tfmt.Println(outb.String())\n\n\t// revert code and files\n\terr = os.WriteFile(packageCmdPath+\"/root.go\", rootCode, os.ModePerm)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tfor _, provider := range deletedProvider {\n\t\terr := os.Rename(packageCmdPath+\"/tmp/\"+filePrefix+provider+fileSuffix, \"cmd/\"+filePrefix+provider+fileSuffix)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "build/multi-build/main.go",
    "content": "package main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"os/exec\"\n\t\"strings\"\n)\n\nconst filePrefix = \"provider_cmd_\"\nconst fileSuffix = \".go\"\nconst packageCmdPath = \"cmd\"\n\nfunc main() {\n\t// provider := os.Args[1]\n\tallProviders := []string{}\n\tfiles, err := os.ReadDir(packageCmdPath)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tfor _, f := range files {\n\t\tif strings.HasPrefix(f.Name(), filePrefix) {\n\t\t\tproviderName := strings.ReplaceAll(f.Name(), filePrefix, \"\")\n\t\t\tproviderName = strings.ReplaceAll(providerName, fileSuffix, \"\")\n\t\t\tallProviders = append(allProviders, providerName)\n\t\t}\n\t}\n\tfor _, arch := range []string{\"amd64\", \"arm64\"} {\n\t\tfor _, OS := range []string{\"linux\", \"windows\", \"mac\"} {\n\t\t\tfor _, provider := range allProviders {\n\t\t\t\tGOOS := \"\"\n\t\t\t\tbinaryName := \"\"\n\t\t\t\tswitch OS {\n\t\t\t\tcase \"linux\":\n\t\t\t\t\tGOOS = \"linux\"\n\t\t\t\t\tbinaryName = \"terraformer-\" + provider + \"-linux-\" + arch\n\t\t\t\tcase \"windows\":\n\t\t\t\t\tGOOS = \"windows\"\n\t\t\t\t\tbinaryName = \"terraformer-\" + provider + \"-windows-\" + arch + \".exe\"\n\t\t\t\tcase \"mac\":\n\t\t\t\t\tGOOS = \"darwin\"\n\t\t\t\t\tbinaryName = \"terraformer-\" + provider + \"-darwin-\" + arch\n\t\t\t\t}\n\t\t\t\tlog.Println(\"Build terraformer with \"+provider+\" provider...\", \"GOOS=\", GOOS, \" for GOARCH=\", arch)\n\t\t\t\tdeletedProvider := []string{}\n\t\t\t\tfor _, f := range files {\n\t\t\t\t\tif strings.HasPrefix(f.Name(), filePrefix) {\n\t\t\t\t\t\tif !strings.HasPrefix(f.Name(), filePrefix+provider+fileSuffix) {\n\t\t\t\t\t\t\tproviderName := strings.ReplaceAll(f.Name(), filePrefix, \"\")\n\t\t\t\t\t\t\tproviderName = strings.ReplaceAll(providerName, fileSuffix, \"\")\n\t\t\t\t\t\t\tdeletedProvider = append(deletedProvider, providerName)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// move files for deleted providers\n\t\t\t\terr := os.MkdirAll(packageCmdPath+\"/tmp\", os.ModePerm)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(\"err:\", err)\n\t\t\t\t}\n\t\t\t\tfor _, provider := range deletedProvider {\n\t\t\t\t\terr := os.Rename(packageCmdPath+\"/\"+filePrefix+provider+fileSuffix, packageCmdPath+\"/tmp/\"+filePrefix+provider+fileSuffix)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Println(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// comment deleted providers in code\n\t\t\t\trootCode, err := os.ReadFile(packageCmdPath + \"/root.go\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(\"err:\", err)\n\t\t\t\t}\n\t\t\t\tlines := strings.Split(string(rootCode), \"\\n\")\n\t\t\t\tnewRootCodeLines := make([]string, len(lines))\n\t\t\t\tfor i, line := range lines {\n\t\t\t\t\tfor _, provider := range deletedProvider {\n\t\t\t\t\t\tif strings.Contains(strings.ToLower(line), \"newcmd\"+provider+\"importer\") {\n\t\t\t\t\t\t\tline = \"// \" + line\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif strings.Contains(strings.ToLower(line), \"new\"+provider+\"provider\") {\n\t\t\t\t\t\t\tline = \"// \" + line\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tnewRootCodeLines[i] = line\n\t\t\t\t}\n\t\t\t\tnewRootCode := strings.Join(newRootCodeLines, \"\\n\")\n\t\t\t\terr = os.WriteFile(packageCmdPath+\"/root.go\", []byte(newRootCode), os.ModePerm)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(\"err:\", err)\n\t\t\t\t}\n\n\t\t\t\t// build....\n\t\t\t\tcmd := exec.Command(\"go\", \"build\", \"-v\", \"-o\", binaryName)\n\t\t\t\tcmd.Env = os.Environ()\n\t\t\t\tcmd.Env = append(cmd.Env, \"GOOS=\"+GOOS)\n\t\t\t\tcmd.Env = append(cmd.Env, \"GOARCH=\"+arch)\n\t\t\t\tvar outb, errb bytes.Buffer\n\t\t\t\tcmd.Stdout = &outb\n\t\t\t\tcmd.Stderr = &errb\n\t\t\t\terr = cmd.Run()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(\"err:\", errb.String())\n\t\t\t\t}\n\t\t\t\tfmt.Println(outb.String())\n\n\t\t\t\t// revert code and files\n\t\t\t\terr = os.WriteFile(packageCmdPath+\"/root.go\", rootCode, os.ModePerm)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(\"err:\", err)\n\t\t\t\t}\n\t\t\t\tfor _, provider := range deletedProvider {\n\t\t\t\t\terr := os.Rename(packageCmdPath+\"/tmp/\"+filePrefix+provider+fileSuffix, \"cmd/\"+filePrefix+provider+fileSuffix)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Println(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "cmd/import.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//\thttp://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"sort\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/terraformerstring\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/providerwrapper\"\n\n\t\"github.com/spf13/pflag\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/terraformoutput\"\n\n\t\"github.com/spf13/cobra\"\n)\n\ntype ImportOptions struct {\n\tResources     []string\n\tExcludes      []string\n\tPathPattern   string\n\tPathOutput    string\n\tState         string\n\tBucket        string\n\tProfile       string\n\tVerbose       bool\n\tZone          string\n\tRegions       []string\n\tProjects      []string\n\tResourceGroup string\n\tConnect       bool\n\tCompact       bool\n\tFilter        []string\n\tPlan          bool `json:\"-\"`\n\tOutput        string\n\tNoSort        bool\n\tRetryCount    int\n\tRetrySleepMs  int\n}\n\nconst DefaultPathPattern = \"{output}/{provider}/{service}/\"\nconst DefaultPathOutput = \"generated\"\nconst DefaultState = \"local\"\n\nfunc newImportCmd() *cobra.Command {\n\toptions := ImportOptions{}\n\tcmd := &cobra.Command{\n\t\tUse:           \"import\",\n\t\tShort:         \"Import current state to Terraform configuration\",\n\t\tLong:          \"Import current state to Terraform configuration\",\n\t\tSilenceUsage:  true,\n\t\tSilenceErrors: false,\n\t\t//Version:       version.String(),\n\t}\n\n\tcmd.AddCommand(newCmdPlanImporter(options))\n\tcmd.AddCommand(&cobra.Command{\n\t\tUse:   \"no-sort\",\n\t\tShort: \"Don't sort resources\",\n\t\tLong:  \"Don't sort resources\",\n\t})\n\tfor _, subcommand := range providerImporterSubcommands() {\n\t\tproviderCommand := subcommand(options)\n\t\t_ = providerCommand.MarkPersistentFlagRequired(\"resources\")\n\t\tcmd.AddCommand(providerCommand)\n\t}\n\treturn cmd\n}\n\nfunc Import(provider terraformutils.ProviderGenerator, options ImportOptions, args []string) error {\n\n\tproviderWrapper, options, err := initOptionsAndWrapper(provider, options, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer providerWrapper.Kill()\n\tproviderMapping := terraformutils.NewProvidersMapping(provider)\n\n\terr = initAllServicesResources(providerMapping, options, args, providerWrapper)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = terraformutils.RefreshResourcesByProvider(providerMapping, providerWrapper)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tproviderMapping.ConvertTFStates(providerWrapper)\n\t// change structs with additional data for each resource\n\tproviderMapping.CleanupProviders()\n\n\terr = importFromPlan(providerMapping, options, args)\n\n\treturn err\n}\n\nfunc initOptionsAndWrapper(provider terraformutils.ProviderGenerator, options ImportOptions, args []string) (*providerwrapper.ProviderWrapper, ImportOptions, error) {\n\terr := provider.Init(args)\n\tif err != nil {\n\t\treturn nil, options, err\n\t}\n\n\tif terraformerstring.ContainsString(options.Resources, \"*\") {\n\t\tlog.Println(\"Attempting an import of ALL resources in \" + provider.GetName())\n\t\toptions.Resources = providerServices(provider)\n\t}\n\n\tif len(options.Excludes) > 0 {\n\t\tlocalSlice := []string{}\n\t\tfor _, r := range options.Resources {\n\t\t\tremove := false\n\t\t\tfor _, e := range options.Excludes {\n\t\t\t\tif r == e {\n\t\t\t\t\tremove = true\n\t\t\t\t\tlog.Println(\"Excluding resource \" + e)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !remove {\n\t\t\t\tlocalSlice = append(localSlice, r)\n\t\t\t}\n\t\t}\n\t\toptions.Resources = localSlice\n\t}\n\n\tproviderWrapper, err := providerwrapper.NewProviderWrapper(provider.GetName(), provider.GetConfig(), options.Verbose, map[string]int{\"retryCount\": options.RetryCount, \"retrySleepMs\": options.RetrySleepMs})\n\tif err != nil {\n\t\treturn nil, options, err\n\t}\n\n\treturn providerWrapper, options, nil\n}\n\nfunc initAllServicesResources(providersMapping *terraformutils.ProvidersMapping, options ImportOptions, args []string, providerWrapper *providerwrapper.ProviderWrapper) error {\n\tnumOfResources := len(options.Resources)\n\tvar wg sync.WaitGroup\n\twg.Add(numOfResources)\n\n\tvar failedServices []string\n\n\tfor _, service := range options.Resources {\n\t\tserviceProvider := providersMapping.AddServiceToProvider(service)\n\t\terr := serviceProvider.Init(args)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = initServiceResources(service, serviceProvider, options, providerWrapper)\n\t\tif err != nil {\n\t\t\tfailedServices = append(failedServices, service)\n\t\t}\n\t}\n\n\t// remove providers that failed to init their service\n\tprovidersMapping.RemoveServices(failedServices)\n\tprovidersMapping.ProcessResources(false)\n\n\treturn nil\n}\n\nfunc importFromPlan(providerMapping *terraformutils.ProvidersMapping, options ImportOptions, args []string) error {\n\tplan := &ImportPlan{\n\t\tProvider:         providerMapping.GetBaseProvider().GetName(),\n\t\tOptions:          options,\n\t\tArgs:             args,\n\t\tImportedResource: map[string][]terraformutils.Resource{},\n\t}\n\n\tresourcesByService := providerMapping.GetResourcesByService()\n\tfor service := range resourcesByService {\n\t\tplan.ImportedResource[service] = append(plan.ImportedResource[service], resourcesByService[service]...)\n\t}\n\n\tif options.Plan {\n\t\tpath := Path(options.PathPattern, providerMapping.GetBaseProvider().GetName(), \"terraformer\", options.PathOutput)\n\t\treturn ExportPlanFile(plan, path, \"plan.json\")\n\t}\n\n\treturn ImportFromPlan(providerMapping.GetBaseProvider(), plan)\n}\n\nfunc initServiceResources(service string, provider terraformutils.ProviderGenerator,\n\toptions ImportOptions, providerWrapper *providerwrapper.ProviderWrapper) error {\n\tlog.Println(provider.GetName() + \" importing... \" + service)\n\terr := provider.InitService(service, options.Verbose)\n\tif err != nil {\n\t\tlog.Printf(\"%s error importing %s, err: %s\\n\", provider.GetName(), service, err)\n\t\treturn err\n\t}\n\tprovider.GetService().ParseFilters(options.Filter)\n\terr = provider.GetService().InitResources()\n\tif err != nil {\n\t\tlog.Printf(\"%s error initializing resources in service %s, err: %s\\n\", provider.GetName(), service, err)\n\t\treturn err\n\t}\n\n\tprovider.GetService().PopulateIgnoreKeys(providerWrapper)\n\tprovider.GetService().InitialCleanup()\n\tlog.Println(provider.GetName() + \" done importing \" + service)\n\n\treturn nil\n}\n\nfunc ImportFromPlan(provider terraformutils.ProviderGenerator, plan *ImportPlan) error {\n\toptions := plan.Options\n\timportedResource := plan.ImportedResource\n\tisServicePath := strings.Contains(options.PathPattern, \"{service}\")\n\n\tif options.Connect {\n\t\tlog.Println(provider.GetName() + \" Connecting.... \")\n\t\timportedResource = terraformutils.ConnectServices(importedResource, isServicePath, provider.GetResourceConnections())\n\t}\n\n\tif !isServicePath {\n\t\tvar compactedResources []terraformutils.Resource\n\t\tfor _, resources := range importedResource {\n\t\t\tcompactedResources = append(compactedResources, resources...)\n\t\t}\n\t\te := printService(provider, \"\", options, compactedResources, importedResource)\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t} else {\n\t\tfor serviceName, resources := range importedResource {\n\t\t\te := printService(provider, serviceName, options, resources, importedResource)\n\t\t\tif e != nil {\n\t\t\t\treturn e\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc printService(provider terraformutils.ProviderGenerator, serviceName string, options ImportOptions, resources []terraformutils.Resource, importedResource map[string][]terraformutils.Resource) error {\n\tlog.Println(provider.GetName() + \" save \" + serviceName)\n\t// Print HCL files for Resources\n\tpath := Path(options.PathPattern, provider.GetName(), serviceName, options.PathOutput)\n\terr := terraformoutput.OutputHclFiles(resources, provider, path, serviceName, options.Compact, options.Output, !options.NoSort)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttfStateFile, err := terraformutils.PrintTfState(resources)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// print or upload State file\n\tif options.State == \"bucket\" {\n\t\tlog.Println(provider.GetName() + \" upload tfstate to  bucket \" + options.Bucket)\n\t\tbucket := terraformoutput.BucketState{\n\t\t\tName: options.Bucket,\n\t\t}\n\t\tif err := bucket.BucketUpload(path, tfStateFile); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// create Bucket file\n\t\tif bucketStateDataFile, err := terraformutils.Print(bucket.BucketGetTfData(path), map[string]struct{}{}, options.Output, !options.NoSort); err == nil {\n\t\t\tterraformoutput.PrintFile(path+\"/bucket.tf\", bucketStateDataFile)\n\t\t}\n\t} else {\n\t\tif serviceName == \"\" {\n\t\t\tlog.Println(provider.GetName() + \" save tfstate\")\n\t\t} else {\n\t\t\tlog.Println(provider.GetName() + \" save tfstate for \" + serviceName)\n\t\t}\n\t\tif err := os.WriteFile(path+\"/terraform.tfstate\", tfStateFile, os.ModePerm); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Print hcl variables.tf\n\tif serviceName != \"\" {\n\t\tif options.Connect && len(provider.GetResourceConnections()[serviceName]) > 0 {\n\t\t\tvariables := map[string]map[string]map[string]interface{}{}\n\t\t\tvariables[\"data\"] = map[string]map[string]interface{}{}\n\t\t\tvariables[\"data\"][\"terraform_remote_state\"] = map[string]interface{}{}\n\t\t\tif options.State == \"bucket\" {\n\t\t\t\tbucket := terraformoutput.BucketState{\n\t\t\t\t\tName: options.Bucket,\n\t\t\t\t}\n\t\t\t\tfor k := range provider.GetResourceConnections()[serviceName] {\n\t\t\t\t\tif _, exist := importedResource[k]; !exist {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tvariables[\"data\"][\"terraform_remote_state\"][k] = map[string]interface{}{\n\t\t\t\t\t\t\"backend\": \"gcs\",\n\t\t\t\t\t\t\"config\":  bucket.BucketGetTfData(strings.ReplaceAll(path, serviceName, k)),\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor k := range provider.GetResourceConnections()[serviceName] {\n\t\t\t\t\tif _, exist := importedResource[k]; !exist {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tvariables[\"data\"][\"terraform_remote_state\"][k] = map[string]interface{}{\n\t\t\t\t\t\t\"backend\": \"local\",\n\t\t\t\t\t\t\"config\": map[string]interface{}{\n\t\t\t\t\t\t\t\"path\": strings.Repeat(\"../\", strings.Count(path, \"/\")) + strings.ReplaceAll(path, serviceName, k) + \"terraform.tfstate\",\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// create variables file\n\t\t\tif len(provider.GetResourceConnections()[serviceName]) > 0 && options.Connect && len(variables[\"data\"][\"terraform_remote_state\"]) > 0 {\n\t\t\t\tvariablesFile, err := terraformutils.Print(variables, map[string]struct{}{\"config\": {}}, options.Output, !options.NoSort)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tterraformoutput.PrintFile(path+\"/variables.\"+terraformoutput.GetFileExtension(options.Output), variablesFile)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif options.Connect {\n\t\t\tvariables := map[string]map[string]map[string]interface{}{}\n\t\t\tvariables[\"data\"] = map[string]map[string]interface{}{}\n\t\t\tvariables[\"data\"][\"terraform_remote_state\"] = map[string]interface{}{}\n\t\t\tif options.State == \"bucket\" {\n\t\t\t\tbucket := terraformoutput.BucketState{\n\t\t\t\t\tName: options.Bucket,\n\t\t\t\t}\n\t\t\t\tvariables[\"data\"][\"terraform_remote_state\"][\"local\"] = map[string]interface{}{\n\t\t\t\t\t\"backend\": \"gcs\",\n\t\t\t\t\t\"config\":  bucket.BucketGetTfData(path),\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvariables[\"data\"][\"terraform_remote_state\"][\"local\"] = map[string]interface{}{\n\t\t\t\t\t\"backend\": \"local\",\n\t\t\t\t\t\"config\": map[string]interface{}{\n\t\t\t\t\t\t\"path\": \"terraform.tfstate\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}\n\t\t\t// create variables file\n\t\t\tif options.Connect {\n\t\t\t\tvariablesFile, err := terraformutils.Print(variables, map[string]struct{}{\"config\": {}}, options.Output, !options.NoSort)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tterraformoutput.PrintFile(path+\"/variables.\"+terraformoutput.GetFileExtension(options.Output), variablesFile)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc Path(pathPattern, providerName, serviceName, output string) string {\n\treturn strings.NewReplacer(\n\t\t\"{provider}\", providerName,\n\t\t\"{service}\", serviceName,\n\t\t\"{output}\", output,\n\t).Replace(pathPattern)\n}\n\nfunc listCmd(provider terraformutils.ProviderGenerator) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"list\",\n\t\tShort: \"List supported resources for \" + provider.GetName() + \" provider\",\n\t\tLong:  \"List supported resources for \" + provider.GetName() + \" provider\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tservices := providerServices(provider)\n\t\t\tfor _, k := range services {\n\t\t\t\tfmt.Println(k)\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.Flags().AddFlag(&pflag.Flag{Name: \"resources\"})\n\treturn cmd\n}\n\nfunc providerServices(provider terraformutils.ProviderGenerator) []string {\n\tvar services []string\n\tfor k := range provider.GetSupportedService() {\n\t\tservices = append(services, k)\n\t}\n\tsort.Strings(services)\n\treturn services\n}\n\nfunc baseProviderFlags(flag *pflag.FlagSet, options *ImportOptions, sampleRes, sampleFilters string) {\n\tflag.BoolVarP(&options.Connect, \"connect\", \"c\", true, \"\")\n\tflag.BoolVarP(&options.Compact, \"compact\", \"C\", false, \"\")\n\tflag.StringSliceVarP(&options.Resources, \"resources\", \"r\", []string{}, sampleRes)\n\tflag.StringSliceVarP(&options.Excludes, \"excludes\", \"x\", []string{}, sampleRes)\n\tflag.StringVarP(&options.PathPattern, \"path-pattern\", \"p\", DefaultPathPattern, \"{output}/{provider}/\")\n\tflag.StringVarP(&options.PathOutput, \"path-output\", \"o\", DefaultPathOutput, \"\")\n\tflag.StringVarP(&options.State, \"state\", \"s\", DefaultState, \"local or bucket\")\n\tflag.StringVarP(&options.Bucket, \"bucket\", \"b\", \"\", \"gs://terraform-state\")\n\tflag.StringSliceVarP(&options.Filter, \"filter\", \"f\", []string{}, sampleFilters)\n\tflag.BoolVarP(&options.Verbose, \"verbose\", \"v\", false, \"\")\n\tflag.BoolVarP(&options.NoSort, \"no-sort\", \"S\", false, \"set to disable sorting of HCL\")\n\tflag.StringVarP(&options.Output, \"output\", \"O\", \"hcl\", \"output format hcl or json\")\n\tflag.IntVarP(&options.RetryCount, \"retry-number\", \"n\", 5, \"number of retries to perform when refresh fails\")\n\tflag.IntVarP(&options.RetrySleepMs, \"retry-sleep-ms\", \"m\", 300, \"time in ms to sleep between retries\")\n}\n"
  },
  {
    "path": "cmd/plan.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"path/filepath\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\ntype ImportPlan struct {\n\tVersion          string\n\tProvider         string\n\tOptions          ImportOptions\n\tArgs             []string\n\tImportedResource map[string][]terraformutils.Resource\n}\n\nfunc newPlanCmd() *cobra.Command {\n\toptions := ImportOptions{\n\t\tPlan: true,\n\t}\n\tcmd := &cobra.Command{\n\t\tUse:           \"plan\",\n\t\tShort:         \"Plan to import current state to Terraform configuration\",\n\t\tLong:          \"Plan to import current state to Terraform configuration\",\n\t\tSilenceUsage:  true,\n\t\tSilenceErrors: false,\n\t\t//Version:       version.String(),\n\t}\n\n\tfor _, subcommand := range providerImporterSubcommands() {\n\t\tcmd.AddCommand(subcommand(options))\n\t}\n\treturn cmd\n}\n\nfunc newCmdPlanImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"plan\",\n\t\tShort: \"Import planned state to Terraform configuration\",\n\t\tLong:  \"Import planned state to Terraform configuration\",\n\t\tArgs:  cobra.ExactArgs(1),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tplan, err := LoadPlanfile(args[0])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar provider terraformutils.ProviderGenerator\n\t\t\tif providerGen, ok := providerGenerators()[plan.Provider]; ok {\n\t\t\t\tprovider = providerGen()\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"unsupported provider: %s\", plan.Provider)\n\t\t\t}\n\n\t\t\tif err = provider.Init(plan.Args); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, service := range plan.Options.Resources {\n\t\t\t\tif err = provider.InitService(service, options.Verbose); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn ImportFromPlan(provider, plan)\n\t\t},\n\t}\n\treturn cmd\n}\n\nfunc LoadPlanfile(path string) (*ImportPlan, error) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\tplan := &ImportPlan{}\n\tdec := json.NewDecoder(f)\n\tdec.DisallowUnknownFields()\n\tif err := dec.Decode(plan); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif plan.Version != version {\n\t\treturn nil, fmt.Errorf(\"planfile version did not match. expected: %s, actual: %s\", version, plan.Version)\n\t}\n\n\treturn plan, nil\n}\n\nfunc ExportPlanFile(plan *ImportPlan, path, filename string) error {\n\tplan.Version = version\n\n\tplanfilePath := filepath.Join(path, filename)\n\tlog.Println(\"Saving planfile to\", planfilePath)\n\n\tif err := os.MkdirAll(path, os.ModePerm); err != nil {\n\t\treturn err\n\t}\n\n\tf, err := os.OpenFile(planfilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, os.ModePerm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tenc := json.NewEncoder(f)\n\tenc.SetIndent(\"\", \"\\t\")\n\treturn enc.Encode(plan)\n}\n"
  },
  {
    "path": "cmd/provider_cmd_alicloud.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"log\"\n\n\talicloud_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/alicloud\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdAliCloudImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"alicloud\",\n\t\tShort: \"Import current State to terraform configuration from alicloud\",\n\t\tLong:  \"Import current State to terraform configuration from alicloud\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\toriginalPathPattern := options.PathPattern\n\t\t\tfor _, region := range options.Regions {\n\t\t\t\tprovider := newAliCloudProvider()\n\t\t\t\toptions.PathPattern = originalPathPattern\n\t\t\t\toptions.PathPattern += region + \"/\"\n\t\t\t\tlog.Println(provider.GetName() + \" importing region \" + region)\n\t\t\t\tprofile := options.Profile\n\t\t\t\terr := Import(provider, options, []string{region, profile})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newAliCloudProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"vpc,subnet,nacl\", \"slb=id1:id2:id4\")\n\tcmd.PersistentFlags().StringVar(&options.Profile, \"profile\", \"default\", \"prod\")\n\tcmd.PersistentFlags().StringSliceVarP(&options.Regions, \"regions\", \"\", []string{}, \"cn-hangzhou\")\n\treturn cmd\n}\n\nfunc newAliCloudProvider() terraformutils.ProviderGenerator {\n\treturn &alicloud_terraforming.AliCloudProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_auth0.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\tauth0_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/auth0\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdAuth0Importer(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"auth0\",\n\t\tShort: \"Import current state to Terraform configuration from Auth0\",\n\t\tLong:  \"Import current state to Terraform configuration from Auth0\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tdomain := os.Getenv(\"AUTH0_DOMAIN\")\n\t\t\tif len(domain) == 0 {\n\t\t\t\treturn errors.New(\"Domain for Auth0 must be set through `AUTH0_DOMAIN` env var\")\n\t\t\t}\n\t\t\tclientID := os.Getenv(\"AUTH0_CLIENT_ID\")\n\t\t\tif len(clientID) == 0 {\n\t\t\t\treturn errors.New(\"Client ID for Auht0 must be set through `AUTH0_CLIENT_ID` env var\")\n\t\t\t}\n\t\t\tclientSecret := os.Getenv(\"AUTH0_CLIENT_SECRET\")\n\t\t\tif len(clientSecret) == 0 {\n\t\t\t\treturn errors.New(\"Clien Secret for Auth0 must be set through `AUTH0_CLIENT_SECRET` env var\")\n\t\t\t}\n\n\t\t\tprovider := newAuth0Provider()\n\t\t\terr := Import(provider, options, []string{domain, clientID, clientSecret})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newAuth0Provider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"action\", \"action=name1:name2:name3\")\n\treturn cmd\n}\n\nfunc newAuth0Provider() terraformutils.ProviderGenerator {\n\treturn &auth0_terraforming.Auth0Provider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_aws.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"log\"\n\n\tawsterraformer \"github.com/GoogleCloudPlatform/terraformer/providers/aws\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdAwsImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"aws\",\n\t\tShort: \"Import current state to Terraform configuration from AWS\",\n\t\tLong:  \"Import current state to Terraform configuration from AWS\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\toriginalResources := options.Resources\n\t\t\toriginalRegions := options.Regions\n\t\t\toriginalPathPattern := options.PathPattern\n\n\t\t\tif len(options.Regions) > 0 {\n\t\t\t\tshouldSpecifyPathRegion := len(options.Regions) > 1\n\t\t\t\tglobalResources, eastOnlyResources, regionalResources := parseAndGroupResources(originalResources)\n\t\t\t\toptions.Resources = globalResources\n\t\t\t\toptions.Regions = []string{awsterraformer.GlobalRegion}\n\t\t\t\te := importGlobalResources(options)\n\t\t\t\tif e != nil {\n\t\t\t\t\treturn e\n\t\t\t\t}\n\n\t\t\t\toptions.Resources = eastOnlyResources\n\t\t\t\toptions.Regions = []string{awsterraformer.MainRegionPublicPartition}\n\t\t\t\te = importEastOnlyResources(options)\n\t\t\t\tif e != nil {\n\t\t\t\t\treturn e\n\t\t\t\t}\n\n\t\t\t\toptions.Resources = regionalResources\n\t\t\t\toptions.Regions = originalRegions\n\t\t\t\tif len(options.Resources) > 0 { // don't import anything and potentially override global resources\n\t\t\t\t\tif len(globalResources) > 0 {\n\t\t\t\t\t\tshouldSpecifyPathRegion = true // we should keep global resources away from regional\n\t\t\t\t\t}\n\t\t\t\t\tfor _, region := range originalRegions {\n\t\t\t\t\t\te := importRegionResources(options, originalPathPattern, region, shouldSpecifyPathRegion)\n\t\t\t\t\t\tif e != nil {\n\t\t\t\t\t\t\treturn e\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\terr := importRegionResources(options, options.PathPattern, awsterraformer.NoRegion, false)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newAWSProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"vpc,subnet,nacl\", \"elb=id1:id2:id4\")\n\n\tcmd.PersistentFlags().StringVarP(&options.Profile, \"profile\", \"\", \"default\", \"prod\")\n\tcmd.PersistentFlags().StringSliceVarP(&options.Regions, \"regions\", \"\", []string{}, \"eu-west-1,eu-west-2,us-east-1\")\n\treturn cmd\n}\n\n// returns global, east-only, regional resources\nfunc parseAndGroupResources(allResources []string) ([]string, []string, []string) {\n\tvar globalResources, eastOnlyResources, regionalResources []string\n\tfor _, resourceName := range allResources {\n\t\tif contains(awsterraformer.SupportedGlobalResources, resourceName) {\n\t\t\tglobalResources = append(globalResources, resourceName)\n\t\t} else if contains(awsterraformer.SupportedEastOnlyResources, resourceName) {\n\t\t\teastOnlyResources = append(eastOnlyResources, resourceName)\n\t\t} else {\n\t\t\tregionalResources = append(regionalResources, resourceName)\n\t\t}\n\t}\n\treturn globalResources, eastOnlyResources, regionalResources\n}\n\nfunc importGlobalResources(options ImportOptions) error {\n\tif len(options.Resources) > 0 {\n\t\treturn importRegionResources(options, options.PathPattern, awsterraformer.GlobalRegion, false)\n\t}\n\treturn nil\n}\n\nfunc importEastOnlyResources(options ImportOptions) error {\n\tif len(options.Resources) > 0 {\n\t\treturn importRegionResources(options, options.PathPattern, awsterraformer.MainRegionPublicPartition, false)\n\t}\n\treturn nil\n}\n\nfunc importRegionResources(options ImportOptions, originalPathPattern string, region string, shouldSpecifyPathRegion bool) error {\n\tprovider := newAWSProvider()\n\toptions.PathPattern = originalPathPattern\n\tif region != awsterraformer.GlobalRegion && region != awsterraformer.NoRegion {\n\t\tif shouldSpecifyPathRegion {\n\t\t\toptions.PathPattern += region + \"/\"\n\t\t}\n\t\tlog.Println(provider.GetName() + \" importing region \" + region)\n\t} else {\n\t\tlog.Println(provider.GetName() + \" importing default region\")\n\t}\n\terr := Import(provider, options, []string{region, options.Profile})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc newAWSProvider() terraformutils.ProviderGenerator {\n\treturn &awsterraformer.AWSProvider{}\n}\n\nfunc contains(s []string, e string) bool {\n\tfor _, a := range s {\n\t\tif a == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n"
  },
  {
    "path": "cmd/provider_cmd_azure.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tazure_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/azure\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdAzureImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"azure\",\n\t\tShort: \"Import current state to Terraform configuration from Azure\",\n\t\tLong:  \"Import current state to Terraform configuration from Azure\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newAzureProvider()\n\t\t\terr := Import(provider, options, []string{options.ResourceGroup})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newAzureProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"resource_group\", \"resource_group=name1:name2:name3\")\n\tcmd.PersistentFlags().StringVarP(&options.ResourceGroup, \"resource-group\", \"R\", \"\", \"\")\n\treturn cmd\n}\n\nfunc newAzureProvider() terraformutils.ProviderGenerator {\n\treturn &azure_terraforming.AzureProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_azuread.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tazuread \"github.com/GoogleCloudPlatform/terraformer/providers/azuread\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdAzureADImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"azuread\",\n\t\tShort: \"Import current state to Terraform configuration from Azure Active Directory\",\n\t\tLong:  \"Import current state to Terraform configuration from Azure Active Directory\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newAzureADProvider()\n\t\t\terr := Import(provider, options, []string{options.ResourceGroup})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newAzureADProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"resource_group\", \"resource_group=name1:name2:name3\")\n\tcmd.PersistentFlags().StringVarP(&options.ResourceGroup, \"resource-group\", \"R\", \"\", \"\")\n\treturn cmd\n}\n\nfunc newAzureADProvider() terraformutils.ProviderGenerator {\n\treturn &azuread.AzureADProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_azuredevops.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tazuredevops \"github.com/GoogleCloudPlatform/terraformer/providers/azuredevops\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdAzureDevOpsImporter(options ImportOptions) *cobra.Command {\n\n\tcmd := &cobra.Command{\n\t\tUse:   \"azuredevops\",\n\t\tShort: \"Import current state to Terraform configuration from Azure DevOps\",\n\t\tLong:  \"Import current state to Terraform configuration from Azure DevOps\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newAzureDevOpsProvider()\n\t\t\terr := Import(provider, options, []string{options.ResourceGroup})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newAzureDevOpsProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"project,team,git\", \"project=name1:name2:name3\")\n\treturn cmd\n}\n\nfunc newAzureDevOpsProvider() terraformutils.ProviderGenerator {\n\treturn &azuredevops.AzureDevOpsProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_cloudflare.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tcloudflare_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/cloudflare\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdCloudflareImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"cloudflare\",\n\t\tShort: \"Import current state to Terraform configuration from Cloudflare\",\n\t\tLong:  \"Import current state to Terraform configuration from Cloudflare\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newCloudflareProvider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newCloudflareProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"zone\", \"access_application=id1:id2:id4\")\n\treturn cmd\n}\n\nfunc newCloudflareProvider() terraformutils.ProviderGenerator {\n\treturn &cloudflare_terraforming.CloudflareProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_commercetools.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\tcommercetools_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/commercetools\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nconst (\n\tdefaultCommercetoolsBaseURL  = \"https://api.sphere.io\"\n\tdefaultCommercetoolsTokenURL = \"https://auth.sphere.io\"\n)\n\nfunc newCmdCommercetoolsImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"commercetools\",\n\t\tShort: \"Import current state to Terraform configuration from Commercetools\",\n\t\tLong:  \"Import current state to Terraform configuration from Commercetools\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tclientID := os.Getenv(\"CTP_CLIENT_ID\")\n\t\t\tif len(clientID) == 0 {\n\t\t\t\treturn errors.New(\"API client ID for commercetools must be set through `CTP_CLIENT_ID` env var\")\n\t\t\t}\n\t\t\tclientScope := os.Getenv(\"CTP_CLIENT_SCOPE\")\n\t\t\tif len(clientScope) == 0 {\n\t\t\t\treturn errors.New(\"API client scope for comercetools must be set through `CTP_CLIENT_SCOPE` env var\")\n\t\t\t}\n\t\t\tclientSecret := os.Getenv(\"CTP_CLIENT_SECRET\")\n\t\t\tif len(clientSecret) == 0 {\n\t\t\t\treturn errors.New(\"API client secret for comercetools must be set through `CTP_CLIENT_SECRET` env var\")\n\t\t\t}\n\t\t\tprojectKey := os.Getenv(\"CTP_PROJECT_KEY\")\n\t\t\tif len(projectKey) == 0 {\n\t\t\t\treturn errors.New(\"API project key for comercetools must be set through `CTP_PROJECT_KEY` env var\")\n\t\t\t}\n\t\t\tbaseURL := os.Getenv(\"CTP_BASE_URL\")\n\t\t\tif len(baseURL) == 0 {\n\t\t\t\tbaseURL = defaultCommercetoolsBaseURL\n\t\t\t}\n\t\t\ttokenURL := os.Getenv(\"CTP_TOKEN_URL\")\n\t\t\tif len(tokenURL) == 0 {\n\t\t\t\ttokenURL = defaultCommercetoolsTokenURL\n\t\t\t}\n\t\t\tprovider := newCommercetoolsProvider()\n\t\t\terr := Import(provider, options, []string{clientID, clientScope, clientSecret, projectKey, baseURL, tokenURL})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newCommercetoolsProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"types\", \"type=id1:id2:id4\")\n\treturn cmd\n}\n\nfunc newCommercetoolsProvider() terraformutils.ProviderGenerator {\n\treturn &commercetools_terraforming.CommercetoolsProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_datadog.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tdatadog_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/datadog\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdDatadogImporter(options ImportOptions) *cobra.Command {\n\tvar apiKey, appKey, apiURL, validate string\n\tcmd := &cobra.Command{\n\t\tUse:   \"datadog\",\n\t\tShort: \"Import current state to Terraform configuration from Datadog\",\n\t\tLong:  \"Import current state to Terraform configuration from Datadog\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newDataDogProvider()\n\t\t\terr := Import(provider, options, []string{apiKey, appKey, apiURL, validate})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newDataDogProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"monitors,users\", \"monitor=id1:id2:id4\")\n\tcmd.PersistentFlags().StringVarP(&apiKey, \"api-key\", \"\", \"\", \"YOUR_DATADOG_API_KEY or env param DATADOG_API_KEY\")\n\tcmd.PersistentFlags().StringVarP(&appKey, \"app-key\", \"\", \"\", \"YOUR_DATADOG_APP_KEY or env param DATADOG_APP_KEY\")\n\tcmd.PersistentFlags().StringVarP(&apiURL, \"api-url\", \"\", \"\", \"YOUR_DATADOG_API_URL or env param DATADOG_HOST\")\n\tcmd.PersistentFlags().StringVar(&validate, \"validate\", \"\", \"bool-parsable values only or env param DATADOG_VALIDATE. Enables validation of the provided API and APP keys during provider initialization. Default is true. When false, api_key and app_key won't be checked\")\n\treturn cmd\n}\n\nfunc newDataDogProvider() terraformutils.ProviderGenerator {\n\treturn &datadog_terraforming.DatadogProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_digitalocean.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tdigitalocean_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/digitalocean\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdDigitalOceanImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"digitalocean\",\n\t\tShort: \"Import current state to Terraform configuration from DigitalOcean\",\n\t\tLong:  \"Import current state to Terraform configuration from DigitalOcean\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newDigitalOceanProvider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newDigitalOceanProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"project,droplet\", \"project=name1:name2:name3\")\n\n\treturn cmd\n}\n\nfunc newDigitalOceanProvider() terraformutils.ProviderGenerator {\n\treturn &digitalocean_terraforming.DigitalOceanProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_equinixmetal.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tequinixmetal_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/equinixmetal\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdEquinixMetalImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"metal\",\n\t\tShort: \"Import current state to Terraform configuration from Equinix Metal\",\n\t\tLong:  \"Import current state to Terraform configuration from Equinix Metal\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newEquinixMetalProvider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newEquinixMetalProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"project,device\", \"project=name1:name2:name3\")\n\n\treturn cmd\n}\n\nfunc newEquinixMetalProvider() terraformutils.ProviderGenerator {\n\treturn &equinixmetal_terraforming.EquinixMetalProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_fastly.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tfastly_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/fastly\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdFastlyImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"fastly\",\n\t\tShort: \"Import current state to Terraform configuration from Fastly\",\n\t\tLong:  \"Import current state to Terraform configuration from Fastly\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newFastlyProvider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newFastlyProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"service_v1\", \"service_v1=id1:id2:id3\")\n\treturn cmd\n}\n\nfunc newFastlyProvider() terraformutils.ProviderGenerator {\n\treturn &fastly_terraforming.FastlyProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_github.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"log\"\n\t\"strings\"\n\n\tgithub_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/github\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdGithubImporter(options ImportOptions) *cobra.Command {\n\ttoken := \"\"\n\tbaseURL := \"\"\n\towner := []string{}\n\tcmd := &cobra.Command{\n\t\tUse:   \"github\",\n\t\tShort: \"Import current state to Terraform configuration from GitHub\",\n\t\tLong:  \"Import current state to Terraform configuration from GitHub\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\toriginalPathPattern := options.PathPattern\n\t\t\tfor _, organization := range owner {\n\t\t\t\tprovider := newGitHubProvider()\n\t\t\t\toptions.PathPattern = originalPathPattern\n\t\t\t\toptions.PathPattern = strings.ReplaceAll(options.PathPattern, \"{provider}\", \"{provider}/\"+organization)\n\t\t\t\tlog.Println(provider.GetName() + \" importing organization \" + organization)\n\t\t\t\terr := Import(provider, options, []string{organization, token, baseURL})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newGitHubProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"repository\", \"repository=id1:id2:id4\")\n\tcmd.PersistentFlags().StringVarP(&token, \"token\", \"t\", \"\", \"YOUR_GITHUB_TOKEN or env param GITHUB_TOKEN\")\n\tcmd.PersistentFlags().StringSliceVarP(&owner, \"owner\", \"\", []string{}, \"\")\n\tcmd.PersistentFlags().StringVarP(&baseURL, \"base-url\", \"\", \"\", \"\")\n\treturn cmd\n}\n\nfunc newGitHubProvider() terraformutils.ProviderGenerator {\n\treturn &github_terraforming.GithubProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_gitlab.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"log\"\n\t\"strings\"\n\n\tgitLab_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/gitlab\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdGitLabImporter(options ImportOptions) *cobra.Command {\n\ttoken := \"\"\n\tbaseURL := \"\"\n\tgroups := []string{}\n\tcmd := &cobra.Command{\n\t\tUse:   \"gitlab\",\n\t\tShort: \"Import current state to Terraform configuration from GitLab\",\n\t\tLong:  \"Import current state to Terraform configuration from GitLab\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\toriginalPathPattern := options.PathPattern\n\t\t\tfor _, group := range groups {\n\t\t\t\tprovider := newGitLabProvider()\n\t\t\t\toptions.PathPattern = originalPathPattern\n\t\t\t\toptions.PathPattern = strings.ReplaceAll(options.PathPattern, \"{provider}\", \"{provider}/\"+group)\n\t\t\t\tlog.Println(provider.GetName() + \" importing group \" + group)\n\t\t\t\terr := Import(provider, options, []string{group, token, baseURL})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newGitLabProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"repository\", \"repository=id1:id2:id4\")\n\tcmd.PersistentFlags().StringVarP(&token, \"token\", \"t\", \"\", \"YOUR_GITLAB_TOKEN or env param GITLAB_TOKEN\")\n\tcmd.PersistentFlags().StringSliceVarP(&groups, \"group\", \"\", []string{}, \"paths to groups\")\n\tcmd.PersistentFlags().StringVarP(&baseURL, \"base-url\", \"\", \"\", \"\")\n\treturn cmd\n}\n\nfunc newGitLabProvider() terraformutils.ProviderGenerator {\n\treturn &gitLab_terraforming.GitLabProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_gmailfilter.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cmd\n\nimport (\n\tgmailfilter_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/gmailfilter\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdGmailfilterImporter(options ImportOptions) *cobra.Command {\n\tvar creds, impersonatedUserEmail string\n\tcmd := &cobra.Command{\n\t\tUse:   \"gmailfilter\",\n\t\tShort: \"Import current state to Terraform configuration from Gmail\",\n\t\tLong:  \"Import current state to Terraform configuration from Gmail\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newGmailfilterProvider()\n\t\t\terr := Import(provider, options, []string{\n\t\t\t\tcreds,\n\t\t\t\timpersonatedUserEmail,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newGmailfilterProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"label,filter\", \"label=name1:name2\")\n\tcmd.PersistentFlags().StringVarP(&creds, \"credentials\", \"\", \"\", \"/path/to/client_secret.json\")\n\tcmd.PersistentFlags().StringVarP(&impersonatedUserEmail, \"email\", \"\", \"\", \"foobar@example.com\")\n\treturn cmd\n}\n\nfunc newGmailfilterProvider() terraformutils.ProviderGenerator {\n\treturn &gmailfilter_terraforming.GmailfilterProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_google.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"log\"\n\t\"strings\"\n\n\tgcp_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/gcp\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdGoogleImporter(options ImportOptions) *cobra.Command {\n\tproviderType := \"\"\n\tcmd := &cobra.Command{\n\t\tUse:   \"google\",\n\t\tShort: \"Import current state to Terraform configuration from Google Cloud\",\n\t\tLong:  \"Import current state to Terraform configuration from Google Cloud\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\toriginalPathPattern := options.PathPattern\n\t\t\tfor _, project := range options.Projects {\n\t\t\t\tfor _, region := range options.Regions {\n\t\t\t\t\tprovider := newGoogleProvider()\n\t\t\t\t\toptions.PathPattern = originalPathPattern\n\t\t\t\t\toptions.PathPattern = strings.ReplaceAll(options.PathPattern, \"{provider}/{service}\", \"{provider}/\"+project+\"/{service}/\"+region)\n\t\t\t\t\tlog.Println(provider.GetName() + \" importing project \" + project + \" region \" + region)\n\t\t\t\t\terr := Import(provider, options, []string{region, project, providerType})\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newGoogleProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"firewalls,networks\", \"compute_firewall=id1:id2:id4\")\n\tcmd.PersistentFlags().StringSliceVarP(&options.Regions, \"regions\", \"z\", []string{\"global\"}, \"europe-west1,\")\n\tcmd.PersistentFlags().StringSliceVarP(&options.Projects, \"projects\", \"\", []string{}, \"\")\n\tcmd.PersistentFlags().StringVarP(&providerType, \"provider-type\", \"\", \"\", \"beta\")\n\t_ = cmd.MarkPersistentFlagRequired(\"projects\")\n\treturn cmd\n}\n\nfunc newGoogleProvider() terraformutils.ProviderGenerator {\n\treturn &gcp_terraforming.GCPProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_grafana.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/grafana\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdGrafanaImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"grafana\",\n\t\tShort: \"Import current state to Terraform configuration from Grafana\",\n\t\tLong:  \"Import current state to Terraform configuration from Grafana\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newGrafanaProvider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newGrafanaProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"grafana_dashboard\", \"dashboard=slug1\")\n\treturn cmd\n}\n\nfunc newGrafanaProvider() terraformutils.ProviderGenerator {\n\treturn &grafana.GrafanaProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_heroku.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\theroku_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/heroku\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdHerokuImporter(options ImportOptions) *cobra.Command {\n\tvar apiKey, team string\n\n\tcmd := &cobra.Command{\n\t\tUse:   \"heroku\",\n\t\tShort: \"Import current state to Terraform configuration from Heroku\",\n\t\tLong:  \"Import current state to Terraform configuration from Heroku\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif apiKey = os.Getenv(\"HEROKU_API_KEY\"); apiKey == \"\" {\n\t\t\t\treturn errors.New(\"Requires HEROKU_API_KEY env var\")\n\t\t\t}\n\t\t\tprovider := newHerokuProvider()\n\t\t\terr := Import(provider, options, []string{apiKey, team})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newHerokuProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"app,addon\", \"app=ID\")\n\tcmd.PersistentFlags().StringVarP(&team, \"team\", \"\", \"\", \"\")\n\treturn cmd\n}\n\nfunc newHerokuProvider() terraformutils.ProviderGenerator {\n\treturn &heroku_terraforming.HerokuProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_honeycombio.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//\thttp://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\thoneycombio_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/honeycombio\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdHoneycombioImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"honeycombio\",\n\t\tShort: \"Import current state to Terraform configuration from Honeycomb.io\",\n\t\tLong:  \"Import current state to Terraform configuration from Honeycomb.io\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newHoneycombioProvider()\n\t\t\terr := Import(provider, options, options.Projects)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newHoneycombioProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"derived_column,board\", \"board=id1,id2\")\n\tcmd.PersistentFlags().StringSliceVarP(&options.Projects, \"datasets\", \"\", []string{}, \"hello-service,goodbye-service\")\n\n\treturn cmd\n}\n\nfunc newHoneycombioProvider() terraformutils.ProviderGenerator {\n\treturn &honeycombio_terraforming.HoneycombProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_ibm.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tibm_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/ibm\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdIbmImporter(options ImportOptions) *cobra.Command {\n\tvar resourceGroup string\n\tvar region string\n\tvar cis string\n\tvar vpc string\n\tcmd := &cobra.Command{\n\t\tUse:   \"ibm\",\n\t\tShort: \"Import current state to Terraform configuration from ibm\",\n\t\tLong:  \"Import current state to Terraform configuration from ibm\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newIbmProvider()\n\t\t\terr := Import(provider, options, []string{resourceGroup, region, cis, vpc})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newIbmProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"server\", \"ibm_server=name1:name2:name3\")\n\tcmd.PersistentFlags().StringVarP(&resourceGroup, \"resource_group\", \"\", \"\", \"resource_group=default\")\n\tcmd.PersistentFlags().StringVarP(&region, \"region\", \"R\", \"\", \"region=us-south\")\n\tcmd.PersistentFlags().StringVarP(&cis, \"cis\", \"\", \"\", \"cis=TestCIS\")\n\tcmd.PersistentFlags().StringVarP(&vpc, \"vpc\", \"\", \"\", \"vpc=vpc01\")\n\treturn cmd\n}\n\nfunc newIbmProvider() terraformutils.ProviderGenerator {\n\treturn &ibm_terraforming.IBMProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_ionoscloud.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//\thttp://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tionoscloud_terraformer \"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdIonosCloudImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"ionoscloud\",\n\t\tShort: \"Import current state to Terraform configuration from IONOS Cloud\",\n\t\tLong:  \"Import current state to Terraform configuration from IONOS Cloud\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newIonosCloudProvider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newIonosCloudProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"app,addon\", \"app=name1:name2:name3\")\n\treturn cmd\n}\n\nfunc newIonosCloudProvider() terraformutils.ProviderGenerator {\n\treturn &ionoscloud_terraformer.IonosCloudProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_keycloak.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cmd\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"strconv\"\n\t\"strings\"\n\n\tkeycloak_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/keycloak\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nconst (\n\tdefaultKeycloakEndpoint              = \"https://localhost:8443\"\n\tdefaultKeycloakBasePath              = \"\" // Override with `export KEYCLOAK_BASE_PATH=/auth` for the legacy version of Keycloak.\n\tdefaultKeycloakRealm                 = \"master\"\n\tdefaultKeycloakClientTimeout         = int64(30)\n\tdefaultKeycloakTLSInsecureSkipVerify = false\n\tdefaultRedHatSSO                     = false\n)\n\nfunc newCmdKeycloakImporter(options ImportOptions) *cobra.Command {\n\ttargets := []string{}\n\tcmd := &cobra.Command{\n\t\tUse:   \"keycloak\",\n\t\tShort: \"Import current state to Terraform configuration from Keycloak\",\n\t\tLong:  \"Import current state to Terraform configuration from Keycloak\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\turl := os.Getenv(\"KEYCLOAK_URL\")\n\t\t\tif len(url) == 0 {\n\t\t\t\turl = defaultKeycloakEndpoint\n\t\t\t}\n\t\t\tbasePath, ok := os.LookupEnv(\"KEYCLOAK_BASE_PATH\")\n\t\t\tif !ok {\n\t\t\t\tbasePath = defaultKeycloakBasePath\n\t\t\t}\n\t\t\tredHatSSO, err := strconv.ParseBool(os.Getenv(\"RED_HAT_SSO\"))\n\t\t\tif err != nil {\n\t\t\t\tredHatSSO = defaultRedHatSSO\n\t\t\t}\n\t\t\tclientID := os.Getenv(\"KEYCLOAK_CLIENT_ID\")\n\t\t\tclientSecret := os.Getenv(\"KEYCLOAK_CLIENT_SECRET\")\n\t\t\trealm := os.Getenv(\"KEYCLOAK_REALM\")\n\t\t\tif len(realm) == 0 {\n\t\t\t\trealm = defaultKeycloakRealm\n\t\t\t}\n\t\t\tclientTimeout, err := strconv.ParseInt(os.Getenv(\"KEYCLOAK_CLIENT_TIMEOUT\"), 10, 64)\n\t\t\tif err != nil {\n\t\t\t\tclientTimeout = defaultKeycloakClientTimeout\n\t\t\t}\n\t\t\ttlsInsecureSkipVerify, err := strconv.ParseBool(os.Getenv(\"KEYCLOAK_TLS_INSECURE_SKIP_VERIFY\"))\n\t\t\tif err != nil {\n\t\t\t\ttlsInsecureSkipVerify = defaultKeycloakTLSInsecureSkipVerify\n\t\t\t}\n\t\t\tcaCert := os.Getenv(\"KEYCLOAK_CACERT\")\n\t\t\tif len(caCert) == 0 {\n\t\t\t\tcaCert = \"-\"\n\t\t\t}\n\t\t\tif len(targets) > 0 {\n\t\t\t\toriginalPathPattern := options.PathPattern\n\t\t\t\tfor _, target := range targets {\n\t\t\t\t\tprovider := newKeycloakProvider()\n\t\t\t\t\tlog.Println(provider.GetName() + \" importing realm \" + target)\n\t\t\t\t\toptions.PathPattern = originalPathPattern\n\t\t\t\t\toptions.PathPattern = strings.ReplaceAll(options.PathPattern, \"{provider}\", \"{provider}/\"+target)\n\t\t\t\t\terr := Import(provider, options, []string{url, basePath, clientID, clientSecret, realm, strconv.FormatInt(clientTimeout, 10), caCert, strconv.FormatBool(tlsInsecureSkipVerify), strconv.FormatBool(redHatSSO), target})\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tprovider := newKeycloakProvider()\n\t\t\t\tlog.Println(provider.GetName() + \" importing all realms\")\n\t\t\t\terr := Import(provider, options, []string{url, basePath, clientID, clientSecret, realm, strconv.FormatInt(clientTimeout, 10), caCert, strconv.FormatBool(tlsInsecureSkipVerify), strconv.FormatBool(redHatSSO), \"-\"})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newKeycloakProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"realms\", \"type=id1:id2:id4\")\n\tcmd.PersistentFlags().StringSliceVarP(&targets, \"targets\", \"\", []string{}, \"\")\n\treturn cmd\n}\n\nfunc newKeycloakProvider() terraformutils.ProviderGenerator {\n\treturn &keycloak_terraforming.KeycloakProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_kubernetes.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"strconv\"\n\n\tkubernetes_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/kubernetes\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdKubernetesImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"kubernetes\",\n\t\tShort: \"Import current state to Terraform configuration from Kubernetes\",\n\t\tLong:  \"Import current state to Terraform configuration from Kubernetes\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newKubernetesProvider()\n\t\t\terr := Import(provider, options, []string{strconv.FormatBool(options.Verbose)})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newKubernetesProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"configmaps,deployments,services\", \"deployment=name1:name2:name3\")\n\treturn cmd\n}\n\nfunc newKubernetesProvider() terraformutils.ProviderGenerator {\n\treturn &kubernetes_terraforming.KubernetesProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_launchdarkly.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tlaunchdarkly_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/launchdarkly\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdLaunchDarklyImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"launchdarkly\",\n\t\tShort: \"Import current state to Terraform configuration from LaunchDarkly\",\n\t\tLong:  \"Import current state to Terraform configuration from LaunchDarkly\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newLaunchDarklyProvider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newLaunchDarklyProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"project\", \"launchdarkly_project=id1:id2:id3\")\n\treturn cmd\n}\n\nfunc newLaunchDarklyProvider() terraformutils.ProviderGenerator {\n\treturn &launchdarkly_terraforming.LaunchDarklyProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_linode.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tlinode_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/linode\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdLinodeImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"linode\",\n\t\tShort: \"Import current state to Terraform configuration from Linode\",\n\t\tLong:  \"Import current state to Terraform configuration from Linode\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newLinodeProvider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newLinodeProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"instance\", \"instance=name1:name2:name3\")\n\treturn cmd\n}\n\nfunc newLinodeProvider() terraformutils.ProviderGenerator {\n\treturn &linode_terraforming.LinodeProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_logzio.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\tlogzio_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/logzio\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nconst (\n\tdefaultBaseURL = \"https://api.logz.io\"\n)\n\nfunc newCmdLogzioImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"logzio\",\n\t\tShort: \"Import current state to Terraform configuration from Logz.io\",\n\t\tLong:  \"Import current state to Terraform configuration from Logz.io\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\ttoken := os.Getenv(\"LOGZIO_API_TOKEN\")\n\t\t\tif len(token) == 0 {\n\t\t\t\treturn errors.New(\"API Token for Logz.io must be set through `LOGZIO_API_TOKEN` env var\")\n\t\t\t}\n\t\t\tbaseURL := os.Getenv(\"LOGZIO_BASE_URL\")\n\t\t\tif len(baseURL) == 0 {\n\t\t\t\tbaseURL = defaultBaseURL\n\t\t\t}\n\n\t\t\tprovider := newLogzioProvider()\n\t\t\terr := Import(provider, options, []string{token, baseURL})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newLogzioProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"repository\", \"alert=id1:id2:id4\")\n\treturn cmd\n}\n\nfunc newLogzioProvider() terraformutils.ProviderGenerator {\n\treturn &logzio_terraforming.LogzioProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_mackerel.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cmd\n\nimport (\n\tmackerel_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/mackerel\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdMackerelImporter(options ImportOptions) *cobra.Command {\n\tvar apiKey string\n\tcmd := &cobra.Command{\n\t\tUse:   \"mackerel\",\n\t\tShort: \"Import current state to Terraform configuration from Mackerel\",\n\t\tLong:  \"Import current state to Terraform configuration from Mackerel\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newMackerelProvider()\n\t\t\terr := Import(provider, options, []string{apiKey})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newMackerelProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"service,role,aws_integration\", \"aws_integration=id1:id2:id4\")\n\tcmd.PersistentFlags().StringVarP(&apiKey, \"api-key\", \"\", \"\", \"YOUR_MACKEREL_API_KEY or env param MACKEREL_API_KEY\")\n\treturn cmd\n}\n\nfunc newMackerelProvider() terraformutils.ProviderGenerator {\n\treturn &mackerel_terraforming.MackerelProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_mikrotik.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tmikrotik_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/mikrotik\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdMikrotikImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"mikrotik\",\n\t\tShort: \"Import current state to Terraform configuration from RouterOS\",\n\t\tLong:  \"Import current state to Terraform configuration from RouterOS\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newMikrotikProvider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newMikrotikProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"instance\", \"dhcp_lease=name1:name2:name3\")\n\treturn cmd\n}\n\nfunc newMikrotikProvider() terraformutils.ProviderGenerator {\n\treturn &mikrotik_terraforming.MikrotikProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_myrasec.go",
    "content": "package cmd\n\nimport (\n\tmyrasec_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/myrasec\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\n//\n// newCmdMyrasecImporter\n//\nfunc newCmdMyrasecImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"myrasec\",\n\t\tShort: \"Import current state to Terraform configuration from Myra Security\",\n\t\tLong:  \"Import current state to Terraform configuration from Myra Security\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newMyrasecProvider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newMyrasecProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"domain\", \"\")\n\treturn cmd\n}\n\n//\n// newMyrasecProvider\n//\nfunc newMyrasecProvider() terraformutils.ProviderGenerator {\n\treturn &myrasec_terraforming.MyrasecProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_newrelic.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tnewrelic_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/newrelic\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdNewRelicImporter(options ImportOptions) *cobra.Command {\n\tapiKey := \"\"\n\taccountID := \"\"\n\tregion := \"\"\n\tcmd := &cobra.Command{\n\t\tUse:   \"newrelic\",\n\t\tShort: \"Import current state to Terraform configuration from New Relic\",\n\t\tLong:  \"Import current state to Terraform configuration from New Relic\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newNewRelicProvider()\n\t\t\terr := Import(provider, options, []string{apiKey, accountID, region})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newNewRelicProvider()))\n\tcmd.PersistentFlags().StringVar(&apiKey, \"api-key\", \"\", \"Your Personal API Key\")\n\tcmd.PersistentFlags().StringVar(&accountID, \"account-id\", \"\", \"Your Account ID\")\n\tcmd.PersistentFlags().StringVar(&region, \"region\", \"US\", \"\")\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"alert\", \"dashboard=id1:id2:id4\")\n\treturn cmd\n}\n\nfunc newNewRelicProvider() terraformutils.ProviderGenerator {\n\treturn &newrelic_terraforming.NewRelicProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_ns1.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tns1_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/ns1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdNs1Importer(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"ns1\",\n\t\tShort: \"Import current state to Terraform configuration from NS1\",\n\t\tLong:  \"Import current state to Terraform configuration from NS1\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newNs1Provider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newNs1Provider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"zone\", \"zone=id1:id2:id4\")\n\treturn cmd\n}\n\nfunc newNs1Provider() terraformutils.ProviderGenerator {\n\treturn &ns1_terraforming.Ns1Provider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_octopusdeploy.go",
    "content": "package cmd\n\nimport (\n\toctopusdeploy_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/octopusdeploy\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdOctopusDeployImporter(options ImportOptions) *cobra.Command {\n\tvar server, apiKey string\n\tcmd := &cobra.Command{\n\t\tUse:   \"octopusdeploy\",\n\t\tShort: \"Import current state to Terraform configuration from Octopus Deploy\",\n\t\tLong:  \"Import current state to Terraform configuration from Octopus Deploy\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newOctopusDeployProvider()\n\t\t\toptions.PathPattern = \"{output}/{provider}/\"\n\t\t\terr := Import(provider, options, []string{server, apiKey})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newOctopusDeployProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"octopusdeploy\", \"tagset\")\n\tcmd.PersistentFlags().StringVar(&server, \"server\", \"\", \"Octopus Server's API endpoint or env param OCTOPUS_CLI_SERVER\")\n\tcmd.PersistentFlags().StringVar(&apiKey, \"apikey\", \"\", \"Octopus API key or env param OCTOPUS_CLI_API_KEY\")\n\treturn cmd\n}\n\nfunc newOctopusDeployProvider() terraformutils.ProviderGenerator {\n\treturn &octopusdeploy_terraforming.OctopusDeployProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_okta.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\tokta_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/okta\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdOktaImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"okta\",\n\t\tShort: \"Import current State to terraform configuration from okta\",\n\t\tLong:  \"Import current State to terraform configuration from okta\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\ttoken := os.Getenv(\"OKTA_API_TOKEN\")\n\t\t\tif len(token) == 0 {\n\t\t\t\treturn errors.New(\"API Token for Okta must be set through `OKTA_API_TOKEN` env var\")\n\t\t\t}\n\t\t\tbaseURL := os.Getenv(\"OKTA_BASE_URL\")\n\t\t\tif len(baseURL) == 0 {\n\t\t\t\treturn errors.New(\"Base URL for Okta must be set through `OKTA_BASE_URL` env var\")\n\t\t\t}\n\t\t\torgName := os.Getenv(\"OKTA_ORG_NAME\")\n\t\t\tif len(orgName) == 0 {\n\t\t\t\treturn errors.New(\"Org Name for Okta must be set through `OKTA_ORG_NAME` env var\")\n\t\t\t}\n\n\t\t\tprovider := newOktaProvider()\n\t\t\terr := Import(provider, options, []string{orgName, token, baseURL})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newOktaProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"user\", \"okta_user=user1:user2:user3\")\n\treturn cmd\n}\n\nfunc newOktaProvider() terraformutils.ProviderGenerator {\n\treturn &okta_terraforming.OktaProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_opal.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//\thttp://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\topal_terraformer \"github.com/GoogleCloudPlatform/terraformer/providers/opal\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdOpalImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"opal\",\n\t\tShort: \"Import current state to Terraform configuration from opal.dev\",\n\t\tLong:  \"Import current state to Terraform configuration from opal.dev\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newOpalProvider()\n\t\t\terr := Import(provider, options, options.Projects)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newOpalProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"\", \"\")\n\n\treturn cmd\n}\n\nfunc newOpalProvider() terraformutils.ProviderGenerator {\n\treturn &opal_terraformer.OpalProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_openstack.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\t\"log\"\n\n\topenstack_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/openstack\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdOpenStackImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"openstack\",\n\t\tShort: \"Import current state to Terraform configuration from OpenStack\",\n\t\tLong:  \"Import current state to Terraform configuration from OpenStack\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\toriginalPathPattern := options.PathPattern\n\t\t\tfor _, region := range options.Regions {\n\t\t\t\tprovider := newOpenStackProvider()\n\t\t\t\toptions.PathPattern = originalPathPattern\n\t\t\t\toptions.PathPattern += region + \"/\"\n\t\t\t\tlog.Println(provider.GetName() + \" importing region \" + region)\n\t\t\t\terr := Import(provider, options, []string{region})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newOpenStackProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"compute,networking\", \"compute_instance_v2=id1:id2:id4\")\n\tcmd.PersistentFlags().StringSliceVarP(&options.Regions, \"regions\", \"\", []string{}, \"RegionOne\")\n\treturn cmd\n}\n\nfunc newOpenStackProvider() terraformutils.ProviderGenerator {\n\treturn &openstack_terraforming.OpenStackProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_opsgenie.go",
    "content": "package cmd\n\nimport (\n\t\"github.com/spf13/cobra\"\n\n\topsgenie_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/opsgenie\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nfunc newCmdOpsgenieImporter(options ImportOptions) *cobra.Command {\n\tvar apiKey string\n\tcmd := &cobra.Command{\n\t\tUse:   \"opsgenie\",\n\t\tShort: \"Import current state to Terraform configuration from Opsgenie\",\n\t\tLong:  \"Import current state to Terraform configuration from Opsgenie\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newOpsgenieProvider()\n\t\t\terr := Import(provider, options, []string{apiKey})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newOpsgenieProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"user,team\", \"\")\n\tcmd.PersistentFlags().StringVarP(&apiKey, \"api-key\", \"\", \"\", \"YOUR_OPSGENIE_API_KEY or env param OPSGENIE_API_KEY\")\n\treturn cmd\n}\n\nfunc newOpsgenieProvider() terraformutils.ProviderGenerator {\n\treturn &opsgenie_terraforming.OpsgenieProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_pagerduty.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tpagerduty_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/pagerduty\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdPagerDutyImporter(options ImportOptions) *cobra.Command {\n\ttoken := \"\"\n\tcmd := &cobra.Command{\n\t\tUse:   \"pagerduty\",\n\t\tShort: \"Import current state to Terraform configuration from PagerDuty\",\n\t\tLong:  \"Import current state to Terraform configuration from PagerDuty\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newPagerDutyProvider()\n\t\t\terr := Import(provider, options, []string{token})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newPagerDutyProvider()))\n\tcmd.PersistentFlags().StringVarP(&token, \"token\", \"t\", \"\", \"env param PAGERDUTY_TOKEN\")\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"user\", \"user=id1:id2:id4\")\n\treturn cmd\n}\n\nfunc newPagerDutyProvider() terraformutils.ProviderGenerator {\n\treturn &pagerduty_terraforming.PagerDutyProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_panos.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cmd\n\nimport (\n\t\"log\"\n\t\"reflect\"\n\t\"strings\"\n\n\tpanos_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/panos\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdPanosImporter(options ImportOptions) *cobra.Command {\n\tvsys := []string{}\n\tcmd := &cobra.Command{\n\t\tUse:   \"panos\",\n\t\tShort: \"Import current state to Terraform configuration from a PAN-OS\",\n\t\tLong:  \"Import current state to Terraform configuration from a PAN-OS\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tvar t interface{}\n\n\t\t\tif len(vsys) == 0 {\n\t\t\t\tvar err error\n\n\t\t\t\tvsys, t, err = panos_terraforming.GetVsysList()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tc, err := panos_terraforming.Initialize()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tt = reflect.TypeOf(c)\n\t\t\t}\n\n\t\t\tresources := panos_terraforming.FilterCallableResources(t, options.Resources)\n\t\t\toptions.Resources = resources\n\n\t\t\toriginalPathPattern := options.PathPattern\n\t\t\tfor _, v := range vsys {\n\t\t\t\tprovider := newPanosProvider()\n\t\t\t\tlog.Println(provider.GetName() + \" importing VSYS \" + v)\n\t\t\t\toptions.PathPattern = originalPathPattern\n\t\t\t\toptions.PathPattern = strings.ReplaceAll(options.PathPattern, \"{provider}\", \"{provider}/\"+v)\n\n\t\t\t\terr := Import(provider, options, []string{v})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newPanosProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"firewall_device_config,firewall_networking,firewall_objects,firewall_policy\", \"\")\n\tcmd.PersistentFlags().StringSliceVarP(&vsys, \"vsys\", \"\", []string{}, \"\")\n\n\treturn cmd\n}\n\nfunc newPanosProvider() terraformutils.ProviderGenerator {\n\n\treturn &panos_terraforming.PanosProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_rabbitmq.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cmd\n\nimport (\n\t\"os\"\n\n\trabbitmq_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/rabbitmq\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nconst (\n\tdefaultRabbitMQEndpoint = \"http://localhost:15672\"\n)\n\nfunc newCmdRabbitMQImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"rabbitmq\",\n\t\tShort: \"Import current state to Terraform configuration from RabbitMQ\",\n\t\tLong:  \"Import current state to Terraform configuration from RabbitMQ\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tendpoint := os.Getenv(\"RABBITMQ_SERVER_URL\")\n\t\t\tif len(endpoint) == 0 {\n\t\t\t\tendpoint = defaultRabbitMQEndpoint\n\t\t\t}\n\t\t\tusername := os.Getenv(\"RABBITMQ_USERNAME\")\n\t\t\tpassword := os.Getenv(\"RABBITMQ_PASSWORD\")\n\t\t\tprovider := newRabbitMQProvider()\n\t\t\terr := Import(provider, options, []string{endpoint, username, password})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newRabbitMQProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"vhosts\", \"type=id1:id2:id4\")\n\treturn cmd\n}\n\nfunc newRabbitMQProvider() terraformutils.ProviderGenerator {\n\treturn &rabbitmq_terraforming.RBTProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_tencentcloud.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cmd\n\nimport (\n\t\"log\"\n\n\ttencentcloud_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/tencentcloud\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdTencentCloudImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"tencentcloud\",\n\t\tShort: \"Import current state to Terraform configuration from Tencent Cloud\",\n\t\tLong:  \"Import current state to Terraform configuration from Tencent Cloud\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\toriginalPathPattern := options.PathPattern\n\t\t\tfor _, region := range options.Regions {\n\t\t\t\tprovider := newTencentCloudProvider()\n\t\t\t\toptions.PathPattern = originalPathPattern\n\t\t\t\toptions.PathPattern += region + \"/\"\n\t\t\t\tlog.Println(provider.GetName() + \" importing region \" + region)\n\t\t\t\terr := Import(provider, options, []string{region})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\tcmd.AddCommand(listCmd(newTencentCloudProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"cvm,vpc,cdn\", \"tencentcloud_vpc=id1:id2:id3\")\n\tcmd.PersistentFlags().StringSliceVarP(&options.Regions, \"regions\", \"\", []string{}, \"ap-guangzhou\")\n\treturn cmd\n}\n\nfunc newTencentCloudProvider() terraformutils.ProviderGenerator {\n\treturn &tencentcloud_terraforming.TencentCloudProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_vault.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tvault_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/vault\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdVaultImporter(options ImportOptions) *cobra.Command {\n\tvar token, address string\n\tcmd := &cobra.Command{\n\t\tUse:   \"vault\",\n\t\tShort: \"Import current state to Terraform configuration from Vault\",\n\t\tLong:  \"Import current state to Terraform configuration from Vault\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newVaultProvider()\n\t\t\terr := Import(provider, options, []string{address, token})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newVaultProvider()))\n\tcmd.PersistentFlags().StringVarP(&address, \"address\", \"a\", \"\", \"env param VAULT_ADDR\")\n\tcmd.PersistentFlags().StringVarP(&token, \"token\", \"t\", \"\", \"env param VAULT_TOKEN\")\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"\", \"\")\n\treturn cmd\n}\n\nfunc newVaultProvider() terraformutils.ProviderGenerator {\n\treturn &vault_terraforming.Provider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_vultr.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\tvultr_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/vultr\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdVultrImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"vultr\",\n\t\tShort: \"Import current state to Terraform configuration from Vultr\",\n\t\tLong:  \"Import current state to Terraform configuration from Vultr\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newVultrProvider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newVultrProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"server\", \"server=name1:name2:name3\")\n\treturn cmd\n}\n\nfunc newVultrProvider() terraformutils.ProviderGenerator {\n\treturn &vultr_terraforming.VultrProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_xenorchestra.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage cmd\n\nimport (\n\txenorchestra_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/xenorchestra\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdXenorchestraImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"xenorchestra\",\n\t\tShort: \"Import current state to Terraform configuration from Xen Orchestra\",\n\t\tLong:  \"Import current state to Terraform configuration from Xen Orchestra\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tprovider := newXenorchestraProvider()\n\t\t\terr := Import(provider, options, []string{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newXenorchestraProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"instance\", \"acl=name1:name2:name3\")\n\treturn cmd\n}\n\nfunc newXenorchestraProvider() terraformutils.ProviderGenerator {\n\treturn &xenorchestra_terraforming.XenorchestraProvider{}\n}\n"
  },
  {
    "path": "cmd/provider_cmd_yandex.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cmd\n\nimport (\n\t\"log\"\n\t\"strings\"\n\n\tyandex_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/yandex\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc newCmdYandexImporter(options ImportOptions) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse:   \"yandex\",\n\t\tShort: \"Import current state to Terraform configuration from Yandex Cloud\",\n\t\tLong:  \"Import current state to Terraform configuration from Yandex Cloud\",\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\n\t\t\toriginalPathPattern := options.PathPattern\n\t\t\t// iterate over provided folder_ids\n\t\t\tfor _, folderID := range options.Projects {\n\t\t\t\tprovider := newYandexProvider()\n\t\t\t\toptions.PathPattern = originalPathPattern\n\t\t\t\toptions.PathPattern = strings.ReplaceAll(options.PathPattern, \"{provider}/{service}\", \"{provider}/\"+folderID+\"/{service}\")\n\t\t\t\tlog.Println(provider.GetName() + \" importing folder id \" + folderID)\n\t\t\t\terr := Import(provider, options, []string{folderID})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.AddCommand(listCmd(newYandexProvider()))\n\tbaseProviderFlags(cmd.PersistentFlags(), &options, \"instance,disk\", \"\")\n\tcmd.Flags().StringSliceVarP(&options.Projects, \"folder_ids\", \"\", []string{}, \"folder_id_1,folder_id_2\")\n\t_ = cmd.MarkFlagRequired(\"folder_ids\")\n\treturn cmd\n}\n\nfunc newYandexProvider() terraformutils.ProviderGenerator {\n\treturn &yandex_terraforming.YandexProvider{}\n}\n"
  },
  {
    "path": "cmd/root.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cmd\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/spf13/cobra\"\n)\n\nfunc NewCmdRoot() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tSilenceUsage:  true,\n\t\tSilenceErrors: true,\n\t\tVersion:       version,\n\t}\n\tcmd.AddCommand(newImportCmd())\n\tcmd.AddCommand(newPlanCmd())\n\tcmd.AddCommand(versionCmd)\n\treturn cmd\n}\n\nfunc Execute() error {\n\tcmd := NewCmdRoot()\n\treturn cmd.Execute()\n}\n\nfunc providerImporterSubcommands() []func(options ImportOptions) *cobra.Command {\n\treturn []func(options ImportOptions) *cobra.Command{\n\t\t// Major Cloud\n\t\tnewCmdGoogleImporter,\n\t\tnewCmdAwsImporter,\n\t\tnewCmdAzureImporter,\n\t\tnewCmdAliCloudImporter,\n\t\tnewCmdIbmImporter,\n\t\t// Cloud\n\t\tnewCmdDigitalOceanImporter,\n\t\tnewCmdEquinixMetalImporter,\n\t\tnewCmdHerokuImporter,\n\t\tnewCmdLaunchDarklyImporter,\n\t\tnewCmdLinodeImporter,\n\t\tnewCmdOpenStackImporter,\n\t\tnewCmdTencentCloudImporter,\n\t\tnewCmdVultrImporter,\n\t\tnewCmdYandexImporter,\n\t\tnewCmdIonosCloudImporter,\n\t\t// Infrastructure Software\n\t\tnewCmdKubernetesImporter,\n\t\tnewCmdOctopusDeployImporter,\n\t\tnewCmdRabbitMQImporter,\n\t\t// Network\n\t\tnewCmdMyrasecImporter,\n\t\tnewCmdCloudflareImporter,\n\t\tnewCmdFastlyImporter,\n\t\tnewCmdNs1Importer,\n\t\tnewCmdPanosImporter,\n\t\t// VCS\n\t\tnewCmdAzureDevOpsImporter,\n\t\tnewCmdAzureADImporter,\n\t\tnewCmdGithubImporter,\n\t\tnewCmdGitLabImporter,\n\t\t// Monitoring & System Management\n\t\tnewCmdDatadogImporter,\n\t\tnewCmdNewRelicImporter,\n\t\tnewCmdMackerelImporter,\n\t\tnewCmdGrafanaImporter,\n\t\tnewCmdPagerDutyImporter,\n\t\tnewCmdOpsgenieImporter,\n\t\tnewCmdHoneycombioImporter,\n\t\tnewCmdOpalImporter,\n\t\t// Community\n\t\tnewCmdKeycloakImporter,\n\t\tnewCmdLogzioImporter,\n\t\tnewCmdCommercetoolsImporter,\n\t\tnewCmdMikrotikImporter,\n\t\tnewCmdXenorchestraImporter,\n\t\tnewCmdGmailfilterImporter,\n\t\tnewCmdVaultImporter,\n\t\tnewCmdOktaImporter,\n\t\tnewCmdAuth0Importer,\n\t}\n}\n\nfunc providerGenerators() map[string]func() terraformutils.ProviderGenerator {\n\tlist := make(map[string]func() terraformutils.ProviderGenerator)\n\tfor _, providerGen := range []func() terraformutils.ProviderGenerator{\n\t\t// Major Cloud\n\t\tnewGoogleProvider,\n\t\tnewAWSProvider,\n\t\tnewAzureProvider,\n\t\tnewAliCloudProvider,\n\t\tnewIbmProvider,\n\t\t// Cloud\n\t\tnewDigitalOceanProvider,\n\t\tnewEquinixMetalProvider,\n\t\tnewFastlyProvider,\n\t\tnewHerokuProvider,\n\t\tnewLaunchDarklyProvider,\n\t\tnewLinodeProvider,\n\t\tnewNs1Provider,\n\t\tnewOpenStackProvider,\n\t\tnewTencentCloudProvider,\n\t\tnewVultrProvider,\n\t\t// Infrastructure Software\n\t\tnewKubernetesProvider,\n\t\tnewOctopusDeployProvider,\n\t\tnewRabbitMQProvider,\n\t\t// Network\n\t\tnewMyrasecProvider,\n\t\tnewCloudflareProvider,\n\t\t// VCS\n\t\tnewAzureDevOpsProvider,\n\t\tnewAzureADProvider,\n\t\tnewGitHubProvider,\n\t\tnewGitLabProvider,\n\t\t// Monitoring & System Management\n\t\tnewDataDogProvider,\n\t\tnewNewRelicProvider,\n\t\tnewPagerDutyProvider,\n\t\tnewHoneycombioProvider,\n\t\tnewOpalProvider,\n\t\t// Community\n\t\tnewKeycloakProvider,\n\t\tnewLogzioProvider,\n\t\tnewCommercetoolsProvider,\n\t\tnewMikrotikProvider,\n\t\tnewXenorchestraProvider,\n\t\tnewGmailfilterProvider,\n\t\tnewVaultProvider,\n\t\tnewOktaProvider,\n\t\tnewAuth0Provider,\n\t} {\n\t\tlist[providerGen().GetName()] = providerGen\n\t}\n\treturn list\n}\n"
  },
  {
    "path": "cmd/version.go",
    "content": "package cmd\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/spf13/cobra\"\n)\n\nconst version = \"v0.8.30\"\n\nvar versionCmd = &cobra.Command{\n\tUse:   \"version\",\n\tShort: \"Print the version number of Terraformer\",\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\tfmt.Println(\"Terraformer \" + version)\n\t},\n}\n"
  },
  {
    "path": "docs/alicloud.md",
    "content": "\n### Use with AliCloud\n\nYou can either edit your alicloud config directly, (usually it is `~/.aliyun/config.json`)\nor run `aliyun configure` and enter the credentials when prompted.\n\nExample:\n\n```json\n{\n\t\"current\": \"default\",\n\t\"profiles\": [\n\t\t{\n\t\t\t\"name\": \"default\",\n\t\t\t\"mode\": \"AK\",\n\t\t\t\"access_key_id\": \"LTA***\",\n\t\t\t\"access_key_secret\": \"mrZ***\",\n\t\t\t\"region_id\": \"cn-hangzhou\",\n\t\t\t\"output_format\": \"json\",\n\t\t\t\"language\": \"en\"\n\t\t}\n\t],\n\t\"meta_path\": \"\"\n}\n```\n\nTerraformer will pick up the profile name specified in the `--profile` parameter.\nIt defaults to the first config in the config array.\n\n```sh\nterraformer import alicloud --resources=ecs --regions=ap-southeast-3 --profile=default\n```\n\nList of supported AliCloud resources:\n\n* `dns`\n  * `alicloud_dns`\n  * `alicloud_dns_record`\n* `ecs`\n  * `alicloud_instance`\n* `keypair`\n  * `alicloud_key_pair`\n* `nat`\n  * `alicloud_nat_gateway`\n* `pvtz`\n  * `alicloud_pvtz_zone`\n  * `alicloud_pvtz_zone_attachment`\n  * `alicloud_pvtz_zone_record`\n* `ram`\n  * `alicloud_ram_role`\n  * `alicloud_ram_role_policy_attachment`\n* `rds`\n  * `alicloud_db_instance`\n* `sg`\n  * `alicloud_security_group`\n  * `alicloud_security_group_rule`\n* `slb`\n  * `alicloud_slb`\n  * `alicloud_slb_server_group`\n  * `alicloud_slb_listener`\n* `vpc`\n  * `alicloud_vpc`\n* `vswitch`\n  * `alicloud_vswitch`\n"
  },
  {
    "path": "docs/auth0.md",
    "content": "### Use with Auth0\n\nExample:\n\n```\n$ export AUTH0_DOMAIN=<DOMAIN>\n$ export AUTH0_CLIENT_ID=<CLIENT_ID>\n$ export AUTH0_CLIENT_SECRET=<CLIENT_SECRET>\n$ terraformer import auth0 --resources=auth0_rule,auth0_user\n```\n\nList of supported Auth0 services:\n\n* `auth0_action`\n* `auth0_branding`\n* `auth0_client`\n* `auth0_client_grant`\n* `auth0_custom_domain`\n* `auth0_email`\n* `auth0_hook`\n* `auth0_log_stream`\n* `auth0_prompt`\n* `auth0_resource_server`\n* `auth0_role`\n* `auth0_rule`\n* `auth0_rule_config`\n* `auth0_tenant`\n* `auth0_trigger_binding`\n* `auth0_user`\n"
  },
  {
    "path": "docs/aws.md",
    "content": "\n### Use with AWS\n\nExample:\n\n```\n terraformer import aws --resources=vpc,subnet --connect=true --regions=eu-west-1 --profile=prod\n terraformer import aws --resources=vpc,subnet --filter=vpc=vpc_id1:vpc_id2:vpc_id3 --regions=eu-west-1\n```\n\n#### Profiles support\n\nAWS configuration including environmental variables, shared credentials file (\\~/.aws/credentials), and shared config file (\\~/.aws/config) will be loaded by the tool by default. To use a specific profile, you can use the following command:\n\n```\nterraformer import aws --resources=vpc,subnet --regions=eu-west-1 --profile=prod\n```\n\nYou can also provide no regions when importing resources:\n```\nterraformer import aws --resources=cloudfront --profile=prod\n```\nIn that case terraformer will not know with which region resources are associated with and will not assume any region. That scenario is useful in case of global resources (e.g. CloudFront distributions or Route 53 records) and when region is passed implicitly through environmental variables or metadata service.\n\nExamples to import other resources-\n\n * Security Group-\n```\nterraformer import aws --resources=sg --regions=us-east-1\n```\n\n\n\n#### Supported services\n\n*   `accessanalyzer`\n    * `aws_accessanalyzer_analyzer`\n*   `acm`\n    * `aws_acm_certificate`\n*   `alb` (supports ALB and NLB)\n    * `aws_lb`\n    * `aws_lb_listener`\n    * `aws_lb_listener_rule`\n    * `aws_lb_listener_certificate`\n    * `aws_lb_target_group`\n    * `aws_lb_target_group_attachment`\n*   `api_gateway`\n    * `aws_api_gateway_authorizer`\n    * `aws_api_gateway_api_key`\n    * `aws_api_gateway_documentation_part`\n    * `aws_api_gateway_gateway_response`\n    * `aws_api_gateway_integration`\n    * `aws_api_gateway_integration_response`\n    * `aws_api_gateway_method`\n    * `aws_api_gateway_method_response`\n    * `aws_api_gateway_model`\n    * `aws_api_gateway_resource`\n    * `aws_api_gateway_rest_api`\n    * `aws_api_gateway_stage`\n    * `aws_api_gateway_usage_plan`\n    * `aws_api_gateway_vpc_link`\n*   `appsync`\n    * `aws_appsync_graphql_api`\n*   `auto_scaling`\n    * `aws_autoscaling_group`\n    * `aws_launch_configuration`\n    * `aws_launch_template`\n*   `batch`\n    * `aws_batch_compute_environment`\n    * `aws_batch_job_definition`\n    * `aws_batch_job_queue`\n*   `budgets`\n    * `aws_budgets_budget`\n*   `cloud9`\n    * `aws_cloud9_environment_ec2`\n*   `cloudformation`\n    * `aws_cloudformation_stack`\n    * `aws_cloudformation_stack_set`\n    * `aws_cloudformation_stack_set_instance`\n*   `cloudfront`\n    * `aws_cloudfront_distribution`\n    * `aws_cloudfront_cache_policy`\n*   `cloudhsm`\n    * `aws_cloudhsm_v2_cluster`\n    * `aws_cloudhsm_v2_hsm`\n*   `cloudtrail`\n    * `aws_cloudtrail`\n*   `cloudwatch`\n    * `aws_cloudwatch_dashboard`\n    * `aws_cloudwatch_event_rule`\n    * `aws_cloudwatch_event_target`\n    * `aws_cloudwatch_metric_alarm`\n*   `codebuild`\n    * `aws_codebuild_project`\n*   `codecommit`\n    * `aws_codecommit_repository`\n*   `codedeploy`\n    * `aws_codedeploy_app`\n*   `codepipeline`\n    * `aws_codepipeline`\n    * `aws_codepipeline_webhook`\n*   `cognito`\n    * `aws_cognito_identity_pool`\n    * `aws_cognito_user_pool`\n*   `config`\n    * `aws_config_config_rule`\n    * `aws_config_configuration_recorder`\n    * `aws_config_delivery_channel`\n*   `customer_gateway`\n    * `aws_customer_gateway`\n*   `datapipeline`\n    * `aws_datapipeline_pipeline`\n*   `devicefarm`\n    * `aws_devicefarm_project`\n*   `docdb`\n    * `aws_docdb_cluster`\n    * `aws_docdb_cluster_instance`\n    * `aws_docdb_cluster_parameter_group`\n    * `aws_docdb_subnet_group`\n*   `dynamodb`\n    * `aws_dynamodb_table`\n*   `ebs`\n    * `aws_ebs_volume`\n    * `aws_volume_attachment`\n*   `ec2_instance`\n    * `aws_instance`\n*   `ecr`\n    * `aws_ecr_lifecycle_policy`\n    * `aws_ecr_repository`\n    * `aws_ecr_repository_policy`\n*   `ecrpublic`\n    * `aws_ecrpublic_repository`\n*   `ecs`\n    * `aws_ecs_cluster`\n    * `aws_ecs_service`\n    * `aws_ecs_task_definition`\n*   `efs`\n    * `aws_efs_access_point`\n    * `aws_efs_file_system`\n    * `aws_efs_file_system_policy`\n    * `aws_efs_mount_target`\n*   `eip`\n    * `aws_eip`\n*   `eks`\n    * `aws_eks_cluster`\n    * `aws_eks_node_group`\n*   `elasticache`\n    * `aws_elasticache_cluster`\n    * `aws_elasticache_parameter_group`\n    * `aws_elasticache_subnet_group`\n    * `aws_elasticache_replication_group`\n*   `elastic_beanstalk`\n    * `aws_elastic_beanstalk_application`\n    * `aws_elastic_beanstalk_environment`\n*   `elb`\n    * `aws_elb`\n*   `emr`\n    * `aws_emr_cluster`\n    * `aws_emr_security_configuration`\n*   `eni`\n    * `aws_network_interface`\n*   `es`\n    * `aws_elasticsearch_domain`\n*   `firehose`\n    * `aws_kinesis_firehose_delivery_stream`\n*   `glue`\n    * `aws_glue_crawler`\n    * `aws_glue_catalog_database`\n    * `aws_glue_catalog_table`\n    * `aws_glue_job`\n    * `aws_glue_trigger`\n*   `iam`\n    * `aws_iam_access_key`\n    * `aws_iam_group`\n    * `aws_iam_group_policy`\n    * `aws_iam_group_policy_attachment`\n    * `aws_iam_instance_profile`\n    * `aws_iam_policy`\n    * `aws_iam_role`\n    * `aws_iam_role_policy`\n    * `aws_iam_role_policy_attachment`\n    * `aws_iam_user`\n    * `aws_iam_user_group_membership`\n    * `aws_iam_user_policy`\n    * `aws_iam_user_policy_attachment`\n*   `igw`\n    * `aws_internet_gateway`\n*   `iot`\n    * `aws_iot_thing`\n    * `aws_iot_thing_type`\n    * `aws_iot_topic_rule`\n    * `aws_iot_role_alias`\n*   `kinesis`\n    * `aws_kinesis_stream`\n*   `kms`\n    * `aws_kms_key`\n    * `aws_kms_alias`\n    * `aws_kms_grant`\n*   `lambda`\n    * `aws_lambda_event_source_mapping`\n    * `aws_lambda_function`\n    * `aws_lambda_function_event_invoke_config`\n    * `aws_lambda_layer_version`\n    * `aws_lambda_permission`\n*   `logs`\n    * `aws_cloudwatch_log_group`\n*   `media_package`\n    * `aws_media_package_channel`\n*   `media_store`\n    * `aws_media_store_container`\n*   `medialive`\n    * `aws_medialive_channel`\n    * `aws_medialive_input`\n    * `aws_medialive_input_security_group`\n*   `mq`\n    * `aws_mq_broker`\n*   `msk`\n    * `aws_msk_cluster`\n*   `nacl`\n    * `aws_network_acl`\n*   `nat`\n    * `aws_nat_gateway`\n*   `opsworks`\n    * `aws_opsworks_application`\n    * `aws_opsworks_custom_layer`\n    * `aws_opsworks_instance`\n    * `aws_opsworks_java_app_layer`\n    * `aws_opsworks_php_app_layer`\n    * `aws_opsworks_rds_db_instance`\n    * `aws_opsworks_stack`\n    * `aws_opsworks_static_web_layer`\n    * `aws_opsworks_user_profile`\n*   `organization`\n    * `aws_organizations_account`\n    * `aws_organizations_organization`\n    * `aws_organizations_organizational_unit`\n    * `aws_organizations_policy`\n    * `aws_organizations_policy_attachment`\n*   `qldb`\n    * `aws_qldb_ledger`\n*   `rds`\n    * `aws_db_instance`\n    * `aws_db_proxy`\n    * `aws_db_cluster`\n    * `aws_db_cluster_snapshot`\n    * `aws_db_parameter_group`\n    * `aws_db_snapshot`\n    * `aws_db_subnet_group`\n    * `aws_db_option_group`\n    * `aws_db_event_subscription`\n    * `aws_rds_global_cluster`\n*   `redshift`\n    * `aws_redshift_cluster`\n    * `aws_redshift_event_subscription`\n    * `aws_redshift_parameter_group`\n    * `aws_redshift_snapshot_schedule`\n    * `aws_redshift_snapshot_schedule_association`\n    * `aws_redshift_subnet_group`\n*   `resourcegroups`\n    * `aws_resourcegroups_group`\n*   `route53`\n    * `aws_route53_zone`\n    * `aws_route53_record`\n    * `aws_route53_health_check`\n*   `route_table`\n    * `aws_route_table`\n    * `aws_main_route_table_association`\n    * `aws_route_table_association`\n*   `s3`\n    * `aws_s3_bucket`\n*   `secretsmanager`\n    * `aws_secretsmanager_secret`\n*   `securityhub`\n    * `aws_securityhub_account`\n    * `aws_securityhub_member`\n    * `aws_securityhub_standards_subscription`\n*   `servicecatalog`\n    * `aws_servicecatalog_portfolio`\n*   `ses`\n    * `aws_ses_configuration_set`\n    * `aws_ses_domain_identity`\n    * `aws_ses_email_identity`\n    * `aws_ses_receipt_rule`\n    * `aws_ses_receipt_rule_set`\n    * `aws_ses_template`\n*   `sfn`\n    * `aws_sfn_activity`\n    * `aws_sfn_state_machine`\n*   `sg`\n    * `aws_security_group`\n    * `aws_security_group_rule` (if a rule cannot be inlined)\n*   `sns`\n    * `aws_sns_topic`\n    * `aws_sns_topic_subscription`\n*   `sqs`\n    * `aws_sqs_queue`\n*   `ssm`\n    * `aws_ssm_parameter`\n*   `subnet`\n    * `aws_subnet`\n*   `swf`\n    * `aws_swf_domain`\n*   `transit_gateway`\n    * `aws_ec2_transit_gateway_route_table`\n    * `aws_ec2_transit_gateway_vpc_attachment`\n*   `vpc`\n    * `aws_vpc`\n*   `vpc_endpoint`\n    * `aws_vpc_endpoint`\n*   `vpc_peering`\n    * `aws_vpc_peering_connection`\n*   `vpn_connection`\n    * `aws_vpn_connection`\n*   `vpn_gateway`\n    * `aws_vpn_gateway`\n*   `waf`\n    * `aws_waf_byte_match_set`\n    * `aws_waf_geo_match_set`\n    * `aws_waf_ipset`\n    * `aws_waf_rate_based_rule`\n    * `aws_waf_regex_match_set`\n    * `aws_waf_regex_pattern_set`\n    * `aws_waf_rule`\n    * `aws_waf_rule_group`\n    * `aws_waf_size_constraint_set`\n    * `aws_waf_sql_injection_match_set`\n    * `aws_waf_web_acl`\n    * `aws_waf_xss_match_set`\n*   `waf_regional`\n    * `aws_wafregional_byte_match_set`\n    * `aws_wafregional_geo_match_set`\n    * `aws_wafregional_ipset`\n    * `aws_wafregional_rate_based_rule`\n    * `aws_wafregional_regex_match_set`\n    * `aws_wafregional_regex_pattern_set`\n    * `aws_wafregional_rule`\n    * `aws_wafregional_rule_group`\n    * `aws_wafregional_size_constraint_set`\n    * `aws_wafregional_sql_injection_match_set`\n    * `aws_wafregional_web_acl`\n    * `aws_wafregional_xss_match_set`\n*   `wafv2_cloudfront`\n    * `aws_wafv2_ip_set`\n    * `aws_wafv2_regex_pattern_set`\n    * `aws_wafv2_rule_group`\n    * `aws_wafv2_web_acl`\n    * `aws_wafv2_web_acl_logging_configuration`\n*   `wafv2_regional`\n    * `aws_wafv2_ip_set`\n    * `aws_wafv2_regex_pattern_set`\n    * `aws_wafv2_rule_group`\n    * `aws_wafv2_web_acl`\n    * `aws_wafv2_web_acl_association`\n    * `aws_wafv2_web_acl_logging_configuration`\n*   `workspaces`\n    * `aws_workspaces_directory`\n    * `aws_workspaces_ip_group`\n    * `aws_workspaces_workspace`\n*   `xray`\n    * `aws_xray_sampling_rule`\n\n#### Global services\n\nAWS services that are global will be imported without specified region even if several regions will be passed. It is to ensure only one representation of an AWS resource is imported.\n\nList of global AWS services:\n*   `budgets`\n*   `cloudfront`\n*   `ecrpublic`\n*   `iam`\n*   `organization`\n*   `route53`\n*   `waf`\n\n#### Attribute filters\n\nAttribute filters allow filtering across different resource types by its attributes.\n\n```\nterraformer import aws --resources=ec2_instance,ebs --filter=\"Name=tags.costCenter;Value=20000:'20001:1'\" --regions=eu-west-1\n```\nWill only import AWS EC2 instances along with EBS volumes annotated with tag `costCenter` with values `20000` or `20001:1`. Attribute filters are by default applicable to all resource types although it's possible to specify to what resource type a given filter should be applicable to by providing `Type=<type>` parameter. For example:\n```\nterraformer import aws --resources=ec2_instance,ebs --filter=Type=ec2_instance;Name=tags.costCenter;Value=20000:'20001:1' --regions=eu-west-1\n```\nWill work as same as example above with a change the filter will be applicable only to `ec2_instance` resources.\n\nFew more examples - How to import ec2 instance based on instance name and id\n```\nterraformer import aws --resources=ec2_instance --filter=\"Name=tags.Name;Value=Terraformer\" --regions=us-east-1\n```\nThis command imports ec2 instance having name as Terraformer.\n```\nterraformer import aws --resources=ec2_instance --filter=\"Name=id;Value=i-0xxxxxxxxx\" --regions=us-east-1\n```\nThis command imports ec2 instance having instance-id as i-0xxxxxxxxx.\n\nDue to fact API Gateway generates a lot of resources, it's possible to issue a filtering query to retrieve resources related to a given REST API by tags. To fetch resources related to a REST API resource with a tag `STAGE` and value `dev`, add parameter `--filter=\"Type=api_gateway_rest_api;Name=tags.STAGE;Value=dev\"`.\n\n#### SQS queues retrieval\n\nTerraformer uses AWS [ListQueues](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_ListQueues.html) API call to fetch available queues. The API is able to return only up to 1000 queues and an additional name prefix should be passed to filter the list results. It's possible to pass `QueueNamePrefix` parameter by environmental variable `SQS_PREFIX`.\n\n#### Security groups and rules\n\nTerraformer by default will try to keep rules in security groups as long as no circular dependencies are detected. This approach is implemented to keep the rules as tidy as possible but there can be cases when this behaviour is not desirable (see [GoogleCloudPlatform/terraformer#493](https://github.com/GoogleCloudPlatform/terraformer/issues/493)). To make Terraformer split rules from security groups, add `SPLIT_SG_RULES` environmental variable with any value.\n"
  },
  {
    "path": "docs/azure.md",
    "content": "# Use with Azure\n\n## Authentication\n\n### Supported Methods\n\n- [Azure CLI](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/azure_cli)\n- [managed identities for Azure resources](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/managed_service_identity)\n- [Service Principal with Client Certificate](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_certificate)\n- [Service Principal with Client Secret](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_client_secret)\n- [Service Principal with Open ID Connect](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_oidc)\n\n### Examples\n\n``` sh\n# Using Azure CLI (az login)\nexport ARM_SUBSCRIPTION_ID=[SUBSCRIPTION_ID]\n\n# Using Managed identities for Azure resources\nexport ARM_SUBSCRIPTION_ID=[SUBSCRIPTION_ID]\nexport ARM_CLIENT_ID=[CLIENT_ID]  # only necessary for user assigned identity\nexport ARM_TENANT_ID=[TENANT_ID]\nexport ARM_USE_MSI=true\nexport ARM_MSI_ENDPOINT=[ARM_MSI_ENDPOINT] # only necessary when the msi endpoint is different than the well-known one\n\n# Using Service Principal with Client Certificate\nexport ARM_SUBSCRIPTION_ID=[SUBSCRIPTION_ID]\nexport ARM_CLIENT_ID=[CLIENT_ID] # only necessary for user assigned identity\nexport ARM_TENANT_ID=[TENANT_ID]\nexport ARM_CLIENT_CERTIFICATE_PATH=\"/path/to/my/client/certificate.pfx\"\nexport ARM_CLIENT_CERTIFICATE_PASSWORD=[CLIENT_CERTIFICATE_PASSWORD]\n\n# Using Service Principal with Client Secret\nexport ARM_SUBSCRIPTION_ID=[SUBSCRIPTION_ID]\nexport ARM_CLIENT_ID=[CLIENT_ID]\nexport ARM_TENANT_ID=[TENANT_ID]\nexport ARM_CLIENT_SECRET=[CLIENT_SECRET]\n\n# Using Service Principal with Open ID Connect\nexport ARM_SUBSCRIPTION_ID=[SUBSCRIPTION_ID]\nexport ARM_CLIENT_ID=[CLIENT_ID]\nexport ARM_TENANT_ID=[TENANT_ID]\nexport ARM_USE_OIDC=true\n\n# Using deprecated ADAL authentication for throubleshooting\nexport ARM_USE_ADAL=true\n\n./terraformer import azure -r resource_group\n./terraformer import azure -R my_resource_group -r virtual_network,resource_group\n./terraformer import azure -r resource_group --filter=resource_group=/subscriptions/<Subscription id>/resourceGroups/<RGNAME>\n```\n\n## List of supported Azure resources\n\n*   `analysis`\n    * `azurerm_analysis_services_server`\n*   `app_service`\n    * `azurerm_app_service`\n*   `application_gateway`\n    * `azurerm_application_gateway`\n*   `container`\n    * `azurerm_container_group`\n    * `azurerm_container_registry`\n    * `azurerm_container_registry_webhook`\n*   `cosmosdb`\n    * `azurerm_cosmosdb_account`\n    * `azurerm_cosmosdb_sql_container`\n    * `azurerm_cosmosdb_sql_database`\n    * `azurerm_cosmosdb_table`\n*   `data_factory`\n    * `azurerm_data_factory`\n    * `azurerm_data_factory_custom_dataset`\n    * `azurerm_data_factory_data_flow`\n    * `azurerm_data_factory_dataset_azure_blob`\n    * `azurerm_data_factory_dataset_binary`\n    * `azurerm_data_factory_dataset_cosmosdb_sqlapi`\n    * `azurerm_data_factory_dataset_delimited_text`\n    * `azurerm_data_factory_dataset_http`\n    * `azurerm_data_factory_dataset_json`\n    * `azurerm_data_factory_dataset_mysql`\n    * `azurerm_data_factory_dataset_parquet`\n    * `azurerm_data_factory_dataset_postgresql`\n    * `azurerm_data_factory_dataset_snowflake`\n    * `azurerm_data_factory_dataset_sql_server_table`\n    * `azurerm_data_factory_integration_runtime_azure`\n    * `azurerm_data_factory_integration_runtime_azure_ssis`\n    * `azurerm_data_factory_integration_runtime_managed`\n    * `azurerm_data_factory_integration_runtime_self_hosted`\n    * `azurerm_data_factory_linked_custom_service`\n    * `azurerm_data_factory_linked_service_azure_blob_storage`\n    * `azurerm_data_factory_linked_service_azure_databricks`\n    * `azurerm_data_factory_linked_service_azure_file_storage`\n    * `azurerm_data_factory_linked_service_azure_function`\n    * `azurerm_data_factory_linked_service_azure_search`\n    * `azurerm_data_factory_linked_service_azure_sql_database`\n    * `azurerm_data_factory_linked_service_azure_table_storage`\n    * `azurerm_data_factory_linked_service_cosmosdb`\n    * `azurerm_data_factory_linked_service_data_lake_storage_gen2`\n    * `azurerm_data_factory_linked_service_key_vault`\n    * `azurerm_data_factory_linked_service_kusto`\n    * `azurerm_data_factory_linked_service_mysql`\n    * `azurerm_data_factory_linked_service_odata`\n    * `azurerm_data_factory_linked_service_postgresql`\n    * `azurerm_data_factory_linked_service_sftp`\n    * `azurerm_data_factory_linked_service_snowflake`\n    * `azurerm_data_factory_linked_service_sql_server`\n    * `azurerm_data_factory_linked_service_synapse`\n    * `azurerm_data_factory_linked_service_web`\n    * `azurerm_data_factory_pipeline`\n    * `azurerm_data_factory_trigger_blob_event`\n    * `azurerm_data_factory_trigger_schedule`\n    * `azurerm_data_factory_trigger_tumbling_window`\n*   `database`\n    * `azurerm_mariadb_configuration`\n    * `azurerm_mariadb_database`\n    * `azurerm_mariadb_firewall_rule`\n    * `azurerm_mariadb_server`\n    * `azurerm_mariadb_virtual_network_rule`\n    * `azurerm_mysql_configuration`\n    * `azurerm_mysql_database`\n    * `azurerm_mysql_firewall_rule`\n    * `azurerm_mysql_server`\n    * `azurerm_mysql_virtual_network_rule`\n    * `azurerm_postgresql_configuration`\n    * `azurerm_postgresql_database`\n    * `azurerm_postgresql_firewall_rule`\n    * `azurerm_postgresql_server`\n    * `azurerm_postgresql_virtual_network_rule`\n    * `azurerm_sql_active_directory_administrator`\n    * `azurerm_sql_database`\n    * `azurerm_sql_elasticpool`\n    * `azurerm_sql_failover_group`\n    * `azurerm_sql_firewall_rule`\n    * `azurerm_sql_server`\n    * `azurerm_sql_virtual_network_rule`\n*   `databricks`\n    * `azurerm_databricks_workspace`\n*   `disk`\n    * `azurerm_managed_disk`\n*   `dns`\n    * `azurerm_dns_a_record`\n    * `azurerm_dns_aaaa_record`\n    * `azurerm_dns_caa_record`\n    * `azurerm_dns_cname_record`\n    * `azurerm_dns_mx_record`\n    * `azurerm_dns_ns_record`\n    * `azurerm_dns_ptr_record`\n    * `azurerm_dns_srv_record`\n    * `azurerm_dns_txt_record`\n    * `azurerm_dns_zone`\n*   `eventhub`\n    * `azurerm_eventhub`\n    * `azurerm_eventhub_consumer_group`\n    * `azurerm_eventhub_namespace`\n    * `azurerm_eventhub_namespace_authorization_rule`\n*   `load_balancer`\n    * `azurerm_lb`\n    * `azurerm_lb_backend_address_pool`\n    * `azurerm_lb_nat_rule`\n    * `azurerm_lb_probe`\n*   `network_interface`\n    * `azurerm_network_interface`\n*   `network_security_group`\n    * `azurerm_network_security_group`\n    * `azurerm_network_security_rule`\n*   `network_watcher`\n    * `azurerm_network_packet_capture`\n    * `azurerm_network_watcher`\n    * `azurerm_network_watcher_flow_log`\n*   `private_dns`\n    * `azurerm_private_dns_a_record`\n    * `azurerm_private_dns_aaaa_record`\n    * `azurerm_private_dns_cname_record`\n    * `azurerm_private_dns_mx_record`\n    * `azurerm_private_dns_ptr_record`\n    * `azurerm_private_dns_srv_record`\n    * `azurerm_private_dns_txt_record`\n    * `azurerm_private_dns_zone`\n    * `azurerm_private_dns_zone_virtual_network_link`\n*   `private_endpoint`\n    * `azurerm_private_endpoint`\n    * `azurerm_private_link_service`\n*   `public_ip`\n    * `azurerm_public_ip`\n    * `azurerm_public_ip_prefix`\n*   `purview`\n    * `azurerm_purview_account`\n*   `redis`\n    * `azurerm_redis_cache`\n*   `resource_group`\n    * `azurerm_management_lock`\n    * `azurerm_resource_group`\n*   `route_table`\n    * `azurerm_route`\n    * `azurerm_route_filter`\n    * `azurerm_route_table`\n*   `scaleset`\n    * `azurerm_virtual_machine_scale_set`\n*   `security_center`\n    * `azurerm_security_center_contact`\n    * `azurerm_security_center_subscription_pricing`\n*   `storage_account`\n    * `azurerm_storage_account`\n    * `azurerm_storage_blob`\n    * `azurerm_storage_container`\n*   `subnet`\n    * `azurerm_subnet`\n    * `azurerm_subnet_nat_gateway_association`\n    * `azurerm_subnet_network_security_group_association`\n    * `azurerm_subnet_route_table_association`\n    * `azurerm_subnet_service_endpoint_storage_policy`\n*   `synapse`\n    * `azurerm_synapse_firewall_rule`\n    * `azurerm_synapse_managed_private_endpoint`\n    * `azurerm_synapse_private_link_hub`\n    * `azurerm_synapse_spark_pool`\n    * `azurerm_synapse_sql_pool`\n    * `azurerm_synapse_workspace`\n*   `virtual_machine`\n    * `azurerm_ssh_public_key`\n    * `azurerm_virtual_machine`\n*   `virtual_network`\n    * `azurerm_virtual_network`\n\n## Notes\n\n### Virtual networks and subnets\n\nTerraformer will import `azurerm_virtual_network` config with inlined subnet information swipped, in order to avoid any potential circular dependencies. To import the subnet information, please also import `azurerm_subnet`.\n"
  },
  {
    "path": "docs/azuread.md",
    "content": "### Use with Azure Active Directory\n\nExample:\n\n```\n$ export ARM_TENANT_ID=<TENANT_ID>\n$ export ARM_CLIENT_ID=<CLIENT_ID>\n$ export ARM_CLIENT_SECRET=<CLIENT_SECRET>\n$ terraformer import azuread --resources=user,application\n```\n\nList of supported AzureAD services:\n\n*   `app_role_assignment`\n    * `azuread_app_role_assignment`\n*   `application`\n    * `azuread_application`\n*   `group`\n    * `azuread_group`\n*   `service_principal`\n    * `azuread_service_principal`\n*   `user`\n    * `azuread_user`\n"
  },
  {
    "path": "docs/azuredevops.md",
    "content": "# Use with Azure DevOps\n\nSupports access via [Personal Access Token](https://registry.terraform.io/providers/microsoft/azuredevops/latest/docs/guides/authenticating_using_the_personal_access_token).\n\n## Example\n\n``` sh\nexport AZDO_ORG_SERVICE_URL=\"https://dev.azure.com/<Your Org Name>\"\nexport AZDO_PERSONAL_ACCESS_TOKEN=\"<Personal Access Token>\"\n\n./terraformer import azuredevops -r *\n./terraformer import azuredevops -r project,git_repository\n```\n\n## List of supported Azure DevOps resources\n\n* `git_repository`\n  * `azuredevops_git_repository`\n* `group`\n  * `azuredevops_group`\n* `project`\n  * `azuredevops_project`\n\n## Notes\n\nSince [Terraform Provider for Azure DevOps](https://github.com/microsoft/terraform-provider-azuredevops) `version 0.17`.\n"
  },
  {
    "path": "docs/cloudflare.md",
    "content": "### Use with Cloudflare\n\nExample using a Cloudflare API Key and corresponding email:\n```\nexport CLOUDFLARE_API_KEY=[CLOUDFLARE_API_KEY]\nexport CLOUDFLARE_EMAIL=[CLOUDFLARE_EMAIL]\nexport CLOUDFLARE_ACCOUNT_ID=[CLOUDFLARE_ACCOUNT_ID]\n ./terraformer import cloudflare --resources=firewall,dns\n```\n\nor using a Cloudflare API Token:\n\n```\nexport CLOUDFLARE_API_TOKEN=[CLOUDFLARE_API_TOKEN]\nexport CLOUDFLARE_ACCOUNT_ID=[CLOUDFLARE_ACCOUNT_ID]\n ./terraformer import cloudflare --resources=firewall,dns\n```\n\nList of supported Cloudflare services:\n\n* `access`\n  * `cloudflare_access_application`\n* `account_member`\n  * `cloudflare_account_member`\n* `dns`\n  * `cloudflare_record`\n  * `cloudflare_zone`\n* `firewall`\n  * `cloudflare_access_rule`\n  * `cloudflare_filter`\n  * `cloudflare_firewall_rule`\n  * `cloudflare_rate_limit`\n  * `cloudflare_zone_lockdown`\n* `page_rule`\n  * `cloudflare_page_rule`\n"
  },
  {
    "path": "docs/commercetools.md",
    "content": "### Use with [Commercetools](https://commercetools.com/de/)\n\nThis provider use the [terraform-provider-commercetools](https://github.com/labd/terraform-provider-commercetools). The terraformer provider was build by [Dustin Deus](https://github.com/StarpTech).\n\nExample:\n\nExport required variables:\n\n```bash\nexport CTP_PROJECT_KEY=key\nexport CTP_CLIENT_ID=foo\nexport CTP_CLIENT_SECRET=bar\nexport CTP_CLIENT_SCOPE=scope\n```\n\nExport optional variables in case default values are not appropriate:\n\n```bash\nexport CTP_BASE_URL=base_url # default: https://api.sphere.io\nexport CTP_TOKEN_URL=token_url # default: https://auth.sphere.io\n```\n\nRun terraformer\n\n```bash\n./terraformer plan commercetools -r=types # Only planning\n./terraformer import commercetools -r=types # Import commercetools types\n```\n\nList of supported [commercetools](https://commercetools.com/de/) resources:\n\n- `api_extension`\n  - `commercetools_api_extension`\n- `channel`\n  - `commercetools_channel`\n- `custom_object`\n  - `commercetools_custom_object`\n- `product_type`\n  - `commercetools_product_type`\n- `shipping_method`\n  - `commercetools_shipping_method`\n- `shipping_zone`\n  - `commercetools_shipping_zone`\n- `state`\n  - `commercetools_state`\n- `store`\n  - `commercetools_store`\n- `subscription`\n  - `commercetools_subscription`\n- `tax_category`\n  - `commercetools_tax_category`\n- `types`\n  - `commercetools_type`\n"
  },
  {
    "path": "docs/datadog.md",
    "content": "# Use Terraformer with [Datadog](https://www.datadoghq.com/)\n\nThis provider uses the [terraform-provider-datadog](https://registry.terraform.io/providers/DataDog/datadog/latest).\n\n##  Usage\n### 1. Installation\nFirst you will need to install Terraformer with the Datadog provider. See the [README](https://github.com/GoogleCloudPlatform/terraformer#installation).\n\n### 2. Set up a template Terraform workspace\nBefore you can use Terraformer, you need to create a template workspace so that Terraformer\ncan access the [DataDog/datadog](https://registry.terraform.io/providers/DataDog/datadog/latest) provider.\n\nTo do this, create a new directory with a basic `provider.tf` file:\n```hcl\nterraform {\n  required_providers {\n    datadog = {\n      source  = \"DataDog/datadog\"\n      version = \"3.20.0\"\n    }\n  }\n}\n\nprovider \"datadog\" {\n  # Configuration options\n}\n```\n\nthen run:\n```bash\n$ terraform init\n````\n\nYou should see the output: `Terraform has been successfully initialized!`\n\n### 3. Run Terraformer\n\n```bash\nexport DATADOG_API_KEY=Datadog API key. More information on this at https://docs.datadoghq.com/account_management/api-app-keys/ \nexport DATADOG_HOST=Datadog API host i.e. https://api.datadoghq.eu which can be found at https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site\nexport DATADOG_APP_KEY=Datadog APP key. More information on this at https://docs.datadoghq.com/account_management/api-app-keys/ \n\n./terraformer import datadog --resources=* \n```\n\nYou can also specify only certain kinds of resources to import as well, i.e. `--resources=dashboard`.\n\n### 4. Inspect the imported Terraform files\n\nYou should now see a `generated/` subdirectory with generated files.\n\nYou can now initialize and use your new generated resources:\n```bash\n$ terraform init\n$ terraform plan # No changes. Your infrastructure matches the configuration.\n```\n\n### Filtering Resources\n\nYou can use the `filter` argument to restrict the import of Terraform resources.\n\nFiltering based on Tags follows the convention `--filter=\"Name=tags;Value='your tag'\"`.\n\n```bash\n# Import monitors based on multiple tags\n./terraformer import datadog --resources=monitor --filter=\"Name=tags;Value='foo:bar'\" --filter=\"Name=tags;Value='env:production'\"\n\n# Import monitor where tag doesn't include colon\n./terraformer import datadog --resources=monitor --filter=\"Name=tags;Value=anExampleTag\"\n```\n\nFiltering based on resource ID:\n\n```bash\n# Import dashboard based on the dashboard ID\n./terraformer import datadog --resources=dashboard --filter=dashboard=some-id\n\n# Import based on multiple resource IDs\n ./terraformer import datadog --resources=monitor --filter=monitor=id1:id2:id4\n```\n\nTag filters are order specific. For example, if your monitor has tags (in the order) `atag: atagvalue`, `foo:bar` but you filter for `--filter=\"Name=tags;Value='foo:bar'\" --filter=\"Name=tags;Value='atag: atagvalue'\"`, the monitor would not be imported.\n\n## Supported Datadog resources\n\n*   `dashboard`\n    * `datadog_dashboard`\n*   `dashboard_json`\n    * `datadog_dashboard_json`\n*   `dashboard_list`\n    * `datadog_dashboard_list`\n*   `downtime`\n    * `datadog_downtime`\n*   `integration_aws`\n    * `datadog_integration_aws`\n*   `integration_aws_lambda_arn`\n    * `datadog_integration_aws_lambda_arn`\n*   `integration_aws_log_collection`\n    * `datadog_integration_aws_log_collection`\n*   `integration_azure`\n    * `datadog_integration_azure`\n        * **_NOTE:_** Sensitive field `client_secret` is not generated and needs to be manually set\n*   `integration_gcp`\n    * `datadog_integration_gcp`\n        * **_NOTE:_** Sensitive fields `private_key, private_key_id, client_id` is not generated and needs to be manually set\n*   `integration_pagerduty`\n    * `datadog_integration_pagerduty`\n*   `integration_pagerduty_service_object`\n    * `datadog_integration_pagerduty_service_object`\n*   `integration_slack_channel`\n    * `datadog_integration_slack_channel`\n        * **_NOTE:_** Importing resource requires resource ID or `account_name` to be passed via [Filter][1] option\n*   `logs_archive`\n    * `datadog_logs_archive`\n*   `logs_archive_order`\n    * `datadog_logs_archive_order`\n*   `logs_custom_pipeline`\n    * `datadog_logs_custom_pipeline`\n*   `logs_index`\n    * `datadog_logs_index`\n*   `logs_index_order`\n    * `datadog_logs_index_order`\n*   `logs_integration_pipeline`\n    * `datadog_logs_integration_pipeline`\n*   `logs_pipeline_order`\n    * `datadog_logs_pipeline_order`\n*   `metric_metadata`\n    * `datadog_metric_metadata`\n        * **_NOTE:_** Importing resource requires resource ID's to be passed via [Filter][1] option\n*   `monitor`\n    * `datadog_monitor`\n*   `role`\n    * `datadog_role`\n*   `security_monitoring_default_rule`\n    * `datadog_security_monitoring_default_rule`\n*   `security_monitoring_rule`\n    * `datadog_security_monitoring_rule`\n*   `service_level_objective`\n    * `datadog_service_level_objective`\n*   `synthetics_global_variable`\n    * `datadog_synthetics_global_variable`\n        * **_NOTE:_** Importing resource requires resource ID's to be passed via [Filter][1] option\n*   `synthetics_private_location`\n    * `datadog_synthetics_private_location`\n*   `synthetics_test`\n    * `datadog_synthetics_test`\n*   `user`\n    * `datadog_user`\n\n[1]: https://github.com/GoogleCloudPlatform/terraformer/blob/master/README.md#filtering\n"
  },
  {
    "path": "docs/digitalocean.md",
    "content": "### Use with DigitalOcean\n\nExample:\n\n```\nexport DIGITALOCEAN_TOKEN=[DIGITALOCEAN_TOKEN]\n./terraformer import digitalocean -r project,droplet\n```\n\nList of supported DigitalOcean resources:\n\n*   `cdn`\n    * `digitalocean_cdn`\n*   `certificate`\n    * `digitalocean_certificate`\n*   `database_cluster`\n    * `digitalocean_database_cluster`\n    * `digitalocean_database_connection_pool`\n    * `digitalocean_database_db`\n    * `digitalocean_database_replica`\n    * `digitalocean_database_user`\n*   `domain`\n    * `digitalocean_domain`\n    * `digitalocean_record`\n*   `droplet`\n    * `digitalocean_droplet`\n*   `droplet_snapshot`\n    * `digitalocean_droplet_snapshot`\n*   `firewall`\n    * `digitalocean_firewall`\n*   `floating_ip`\n    * `digitalocean_floating_ip`\n*   `kubernetes_cluster`\n    * `digitalocean_kubernetes_cluster`\n    * `digitalocean_kubernetes_node_pool`\n*   `loadbalancer`\n    * `digitalocean_loadbalancer`\n*   `project`\n    * `digitalocean_project`\n*   `ssh_key`\n    * `digitalocean_ssh_key`\n*   `tag`\n    * `digitalocean_tag`\n*   `volume`\n    * `digitalocean_volume`\n*   `volume_snapshot`\n    * `digitalocean_volume_snapshot`\n*   `vpc`\n    * `digitalocean_vpc`\n"
  },
  {
    "path": "docs/equinixmetal.md",
    "content": "### Use with Equinix Metal\n\nExample:\n\n```\nexport METAL_AUTH_TOKEN=[METAL_AUTH_TOKEN]\nexport PACKET_PROJECT_ID=[PROJECT_ID]\n./terraformer import metal -r volume,device\n```\n\nList of supported Equinix Metal resources:\n\n*   `device`\n    * `metal_device`\n*   `spotmarketrequest`\n    * `metal_spot_market_request`\n*   `sshkey`\n    * `metal_ssh_key`\n*   `volume`\n    * `metal_volume`\n"
  },
  {
    "path": "docs/fastly.md",
    "content": "### Use with Fastly\n\nExample:\n\n```\nexport FASTLY_API_KEY=[FASTLY_API_KEY]\nexport FASTLY_CUSTOMER_ID=[FASTLY_CUSTOMER_ID]\n./terraformer import fastly -r service_v1,user\n```\n\nList of supported Fastly resources:\n\n*   `service_v1`\n    * `fastly_service_acl_entries_v1`\n    * `fastly_service_compute`\n    * `fastly_service_dictionary_items_v1`\n    * `fastly_service_dynamic_snippet_content_v1`\n    * `fastly_service_v1`\n*   `tls_subscription`\n    * `fastly_tls_subscription`\n*   `user`\n    * `fastly_user_v1`\n"
  },
  {
    "path": "docs/gcp.md",
    "content": "### Use with GCP\n\nIn order to access the information from your Google Project, you need to provide authentication credentials\nby setting up the environment variable `GOOGLE_APPLICATION_CREDENTIALS` with the file path of the JSON\nfile that contains your service account key. \n\n[![asciicast](https://asciinema.org/a/243961.svg)](https://asciinema.org/a/243961)\n\nExample:\n\n```\nterraformer import google --resources=gcs,forwardingRules,httpHealthChecks --connect=true --regions=europe-west1,europe-west4 --projects=aaa,fff\nterraformer import google --resources=gcs,forwardingRules,httpHealthChecks --filter=compute_firewall=rule1:rule2:rule3 --regions=europe-west1 --projects=aaa,fff\n```\n\nFor google-beta provider:\n\n```\nterraformer import google --resources=gcs,forwardingRules,httpHealthChecks --regions=europe-west4 --projects=aaa --provider-type beta\n```\n\nList of supported GCP services:\n\n*   `addresses`\n    * `google_compute_address`\n*   `autoscalers`\n    * `google_compute_autoscaler`\n*   `backendBuckets`\n    * `google_compute_backend_bucket`\n*   `backendServices`\n    * `google_compute_backend_service`\n*   `bigQuery`\n    * `google_bigquery_dataset`\n    * `google_bigquery_table`\n*   `cloudFunctions`\n    * `google_cloudfunctions_function`\n    * `google_cloudfunctions2_function`\n*   `cloudbuild`\n    * `google_cloudbuild_trigger`\n*   `cloudsql`\n    * `google_sql_database`\n    * `google_sql_database_instance`\n*   `dataProc`\n    * `google_dataproc_cluster`\n*   `disks`\n    * `google_compute_disk`\n*   `dns`\n    * `google_dns_managed_zone`\n    * `google_dns_record_set`\n*   `externalVpnGateways`\n    * `google_compute_external_vpn_gateway`\n*   `firewall`\n    * `google_compute_firewall`\n*   `forwardingRules`\n    * `google_compute_forwarding_rule`\n*   `gcs`\n    * `google_storage_bucket`\n    * `google_storage_bucket_acl`\n    * `google_storage_bucket_iam_binding`\n    * `google_storage_bucket_iam_member`\n    * `google_storage_bucket_iam_policy`\n    * `google_storage_default_object_acl`\n    * `google_storage_notification`\n*   `gke`\n    * `google_container_cluster`\n    * `google_container_node_pool`\n*   `globalAddresses`\n    * `google_compute_global_address`\n*   `globalForwardingRules`\n    * `google_compute_global_forwarding_rule`\n*   `healthChecks`\n    * `google_compute_health_check`\n*   `httpHealthChecks`\n    * `google_compute_http_health_check`\n*   `httpsHealthChecks`\n    * `google_compute_https_health_check`\n*   `iam`\n    * `google_project_iam_custom_role`\n    * `google_project_iam_member`\n    * `google_service_account`\n*   `images`\n    * `google_compute_image`\n*   `instanceGroupManagers`\n    * `google_compute_instance_group_manager`\n*   `instanceGroups`\n    * `google_compute_instance_group`\n*   `instanceTemplates`\n    * `google_compute_instance_template`\n*   `instances`\n    * `google_compute_instance`\n*   `interconnectAttachments`\n    * `google_compute_interconnect_attachment`\n*   `kms`\n    * `google_kms_crypto_key`\n    * `google_kms_key_ring`\n*   `logging`\n    * `google_logging_metric`\n*   `memoryStore`\n    * `google_redis_instance`\n*   `monitoring`\n    * `google_monitoring_alert_policy`\n    * `google_monitoring_group`\n    * `google_monitoring_notification_channel`\n    * `google_monitoring_uptime_check_config`\n*   `networks`\n    * `google_compute_network`\n*   `nodeGroups`\n    * `google_compute_node_group`\n*   `nodeTemplates`\n    * `google_compute_node_template`\n*   `packetMirrorings`\n    * `google_compute_packet_mirroring`\n*   `project`\n    * `google_project`\n*   `pubsub`\n    * `google_pubsub_subscription`\n    * `google_pubsub_topic`\n*   `regionAutoscalers`\n    * `google_compute_region_autoscaler`\n*   `regionBackendServices`\n    * `google_compute_region_backend_service`\n*   `regionDisks`\n    * `google_compute_region_disk`\n*   `regionHealthChecks`\n    * `google_compute_region_health_check`\n*   `regionInstanceGroupManagers`\n    * `google_compute_region_instance_group_manager`\n*   `regionInstanceGroups`\n    * `google_compute_region_instance_group`\n*   `regionSslCertificates`\n    * `google_compute_region_ssl_certificate`\n*   `regionTargetHttpProxies`\n    * `google_compute_region_target_http_proxy`\n*   `regionTargetHttpsProxies`\n    * `google_compute_region_target_https_proxy`\n*   `regionUrlMaps`\n    * `google_compute_region_url_map`\n*   `reservations`\n    * `google_compute_reservation`\n*   `resourcePolicies`\n    * `google_compute_resource_policy`\n*   `routers`\n    * `google_compute_router`\n*   `routes`\n    * `google_compute_route`\n*   `schedulerJobs`\n    * `google_cloud_scheduler_job`\n*   `securityPolicies`\n    * `google_compute_security_policy`\n*   `sslCertificates`\n    * `google_compute_managed_ssl_certificate`\n*   `sslPolicies`\n    * `google_compute_ssl_policy`\n*   `subnetworks`\n    * `google_compute_subnetwork`\n*   `targetHttpProxies`\n    * `google_compute_target_http_proxy`\n*   `targetHttpsProxies`\n    * `google_compute_target_https_proxy`\n*   `targetInstances`\n    * `google_compute_target_instance`\n*   `targetPools`\n    * `google_compute_target_pool`\n*   `targetSslProxies`\n    * `google_compute_target_ssl_proxy`\n*   `targetTcpProxies`\n    * `google_compute_target_tcp_proxy`\n*   `targetVpnGateways`\n    * `google_compute_vpn_gateway`\n*   `urlMaps`\n    * `google_compute_url_map`\n*   `vpnTunnels`\n    * `google_compute_vpn_tunnel`\n\nYour `tf` and `tfstate` files are written by default to\n`generated/gcp/zone/service`.\n"
  },
  {
    "path": "docs/github.md",
    "content": "### Use with GitHub\n\nExample:\n\n```\n ./terraformer import github --owner=YOUR_ORGANIZATION --resources=repositories --token=YOUR_TOKEN // or GITHUB_TOKEN in env\n ./terraformer import github --owner=YOUR_ORGANIZATION --resources=repositories --filter=repository=id1:id2:id4 --token=YOUR_TOKEN // or GITHUB_TOKEN in env\n\n  ./terraformer import github --owner=YOUR_ORGANIZATION --resources=repositories --base-url=https://your-enterprise-github-url\n```\n\nSupports only organizational resources. List of supported resources:\n\n*   `members`\n    * `github_membership`\n*   `organization_blocks`\n    * `github_organization_block`\n*   `organization_projects`\n    * `github_organization_project`\n*   `organization_webhooks`\n    * `github_organization_webhook`\n*   `repositories`\n    * `github_branch_protection`\n    * `github_repository`\n    * `github_repository_collaborator`\n    * `github_repository_deploy_key`\n    * `github_repository_webhook`\n*   `teams`\n    * `github_team`\n    * `github_team_membership`\n    * `github_team_repository`\n*   `user_ssh_keys`\n    * `github_user_ssh_key`\n\nNotes:\n* Terraformer can't get webhook secrets from the GitHub API. If you use a secret token in any of your webhooks, running `terraform plan` will result in a change being detected:\n=> `configuration.#: \"1\" => \"0\"` in tfstate only.\n"
  },
  {
    "path": "docs/gitlab.md",
    "content": "### Use with GitLab\n\nExample:\n\n```shell\n./terraformer import gitlab --group=GROUP_TO_IMPORT --resources=projects --token=YOUR_TOKEN # or GITLAB_TOKEN in env\n./terraformer import gitlab --group=GROUP_TO_IMPORT --resources=groups --base-url=https://your-self-hosted-gitlab-domain/api/v4\n```\n\nList of supported resources:\n\n* `groups`\n  * `gitlab_group_membership`\n  * `gitlab_group_variable`\n* `projects`\n  * `gitlab_branch_protection`\n  * `gitlab_project`\n  * `gitlab_project_membership`\n  * `gitlab_project_value`\n  * `gitlab_tag_protection`\n"
  },
  {
    "path": "docs/gmailfilter.md",
    "content": "### Use with GmailFilter\n\nSupport [Using Service Accounts](https://github.com/yamamoto-febc/terraform-provider-gmailfilter/blob/master/README.md#using-a-service-accountg-suite-users-only) or [Using Application Default Credentials](https://github.com/yamamoto-febc/terraform-provider-gmailfilter/blob/master/README.md#using-an-application-default-credential).\n\nExample:\n\n```\n# Using Service Accounts\nexport GOOGLE_CREDENTIALS=/path/to/client_secret.json\nexport IMPERSONATED_USER_EMAIL=\"foobar@example.com\"\n\n# Using Application Default Credentials\ngcloud auth application-default login \\\n  --client-id-file=client_secret.json \\\n  --scopes \\\nhttps://www.googleapis.com/auth/gmail.labels,\\\nhttps://www.googleapis.com/auth/gmail.settings.basic\n\n./terraformer import gmailfilter -r=filter,label\n```\n\nList of supported GmailFilter resources:\n\n*   `filter`\n    * `gmailfilter_filter`\n*   `label`\n    * `gmailfilter_label`\n"
  },
  {
    "path": "docs/grafana.md",
    "content": "### Use with [Grafana](https://grafana.com)\n\nThis provider uses the [terraform-provider-grafana](https://registry.terraform.io/providers/grafana/grafana/latest).\n\n#### Example\n\n```\nGRAFANA_AUTH=api_token GRAFANA_URL=https://stack.grafana.net ./terraformer import grafana -r=grafana_dashboard // Import with Grafana API token\nGRAFANA_AUTH=username:password GRAFANA_URL=https://stack.grafana.net ./terraformer import grafana -r=grafana_dashboard // Import with HTTP basic auth\n```\n\n#### Configuration\n\n| Env variable               | Description | Required | Default |\n| -------------------------- | -------------------------------------------------------------------- | --- | - |\n| GRAFANA_AUTH               | API token or HTTP basic auth (if pattern is `username:password`)     | yes | - |\n| GRAFANA_URL                | URL to the Grafana instance, e.g. https://stack.grafana.net          | yes | - |\n| GRAFANA_ORG_ID             | Grafana organisation ID                                              | no  | 1 |\n| HTTPS_TLS_KEY              | Path to TLS key file                                                 | no  | - |\n| HTTPS_TLS_CERT             | Path to TLS cert file                                                | no  | - |\n| HTTPS_CA_CERT              | Path to CA cert file                                                 | no  | - |\n| HTTPS_INSECURE_SKIP_VERIFY | Whether to skip TLS certificate validation (1 for true, 0 for false) | no  | 0 |\n\nList of supported [Grafana](https://grafana.com) resources:\n\n* `dashboard`\n  * `grafana_dashboard`\n* `folder`\n  * `grafana_folder`\n"
  },
  {
    "path": "docs/heroku.md",
    "content": "### Use with Heroku\n\nThis utilizes [terraform-provider-heroku](https://registry.terraform.io/providers/heroku/heroku/latest).\n\nHeroku organizes itself by apps. This importer tool is designed to capture complete apps with all their dependent resources like addons, domains, etc.\n\n#### Apps by ID, Not Name\n\nApps must be identified by ID (UUID). Even though some resources may import successfully when filtering by app name, apps themselves must be identified by ID. To get an app ID, use Heroku CLI to get the top-level `id` property:\n\n```\nheroku apps:info --json --app=<NAME>\n```\n\n#### App Config Vars\n\nWhen importing apps, their settable config vars (those not from add-ons) are added to the Terraform configuration as `config_vars`. These may contain secrets, and can manually be split into `sensitive_config_vars` before the plan/apply.\n\n#### Builds\n\nThe imported configuration cannot build & launch apps in a new place. To launch apps that have been imported with Terraformer, one of the following is required:\n* source pushed to the new Heroku apps, `git push heroku master` from each app's repo\n* new apps added to an existing Heroku pipelines and promoted to, via the web dashbord or CLI\n* new apps connected for GitHub deployments, via the web dashboard\n* a [`heroku_build` resource](https://registry.terraform.io/providers/heroku/heroku/latest/docs/resources/build) added to the Terraform configuration.\n\n#### Example\n\n✏️  *Please replace angle-bracketed* `<VALUES>` *with your specific values.*\n\n```\nexport HEROKU_API_KEY=<token>\n\n# All team's apps\n./terraformer import heroku --resources=app --team=<NAME>\n\n# Specific app(s), by UUID\n./terraformer import heroku --resources=app --filter=app=<ID>\n./terraformer import heroku --resources=app --filter=app=<ID>:<ID2>:<ID3>\n\n# Output directory\n./terraformer import heroku --resources=app --filter=app=<ID> --path-pattern='{output}/{provider}/<DIRECTORY NAME>'\n\n# All enabled features of HEROKU_API_KEY's Heroku account\n./terraformer import heroku --resources=account_feature\n```\n\nHeroku Terraformer resources with the terraform-provider-heroku resources they import:\n\n*   `account_feature`\n    * `heroku_account_feature`\n*   `app`\n    * `heroku_addon`\n    * `heroku_addon_attachment` (includes attachments to other apps)\n    * `heroku_app`\n    * `heroku_app_feature`\n    * `heroku_app_webhook`\n    * `heroku_domain`\n    * `heroku_drain`\n    * `heroku_formation`\n    * `heroku_ssl`\n*   `pipeline`\n    * `heroku_pipeline`\n*   `pipeline_coupling`\n    * `heroku_pipeline_coupling`\n*   `team_collaborator`\n    * `heroku_team_collaborator`\n*   `team_member`\n    * `heroku_team_member`\n\n"
  },
  {
    "path": "docs/honeycombio.md",
    "content": "### Use with Honeycomb.io\n\n#### Example\n\n```sh\nexport HONEYCOMB_API_KEY=MYAPIKEY\n./terraformer import honeycombio --resources=board,trigger\n```\n\n#### List of supported Honeycomb resources\n\n* `board`\n  * `honeycombio_board`\n  * `honeycombio_query`\n  * `honeycombio_query_annotation`\n* `derived_column`\n  * `honeycombio_derived_column`\n* `trigger`\n  * `honeycombio_query`\n  * `honeycombio_trigger`\n* `slo`\n  * `honeycombio_burn_alert`\n  * `honeycombio_derived_column`\n  * `honeycombio_slo`\n\n#### A note about Environment-wide assets\n\nIf no datasets are specified via the `--datasets` argument, and the API key is *not* for a Honeycomb Classic environment, the `__all__` dataset for Environment-wide assets (e.g. derived columns, boards) will be appended to the dataset list.\n\nIf you wish to import a specific list of datasets *including* environment-wide assets (e.g. derived columns, boards) you must add `__all__` to the list of provided datasets.\n\n```sh\nexport HONEYCOMB_API_KEY=MYAPIKEY\n./terraformer import honeycombio --resources=derived_column,board --datasets=__all__,my.service\n```\n"
  },
  {
    "path": "docs/ibmcloud.md",
    "content": "### Use with IBM Cloud\n\nIf you want to run Terraformer with the IBM Cloud provider plugin on your system, complete the following steps:\n\n\n1. Export IBM Cloud API key as environment variables.\n    Example:\n\n    ```\n    export IC_API_KEY=<IBMCLOUD_API_KEY>\n    terraformer import ibm -r ibm_cos,ibm_iam....\n    ```\n2. Use flag for Resource Group to classify resources accordingly.\n    Example:\n\n    ```\n    export IC_API_KEY=<IBMCLOUD_API_KEY>\n    terraformer import ibm --resources=ibm_is_vpc --resource_group=default\n    terraformer import ibm --resources=ibm_function --region=us-south\n    ```\nList of supported IBM Cloud resources:\n\n*   `ibm_certificate_manager`\n    * `ibm_certificate_manager_import`\n    * `ibm_certificate_manager_order`\n    * `ibm_resource_instance`\n*   `ibm_cis`\n    * `ibm_cis`\n    * `ibm_cis_cache_settings`\n    * `ibm_cis_certificate_order`\n    * `ibm_cis_custom_page`\n    * `ibm_cis_dns_record`\n    * `ibm_cis_domain`\n    * `ibm_cis_domain_settings`\n    * `ibm_cis_edge_functions_action`\n    * `ibm_cis_edge_functions_trigger`\n    * `ibm_cis_filter`\n    * `ibm_cis_firewall`\n    * `ibm_cis_global_load_balancer`\n    * `ibm_cis_healthcheck`\n    * `ibm_cis_origin_pool`\n    * `ibm_cis_page_rule`\n    * `ibm_cis_range_app`\n    * `ibm_cis_rate_limit`\n    * `ibm_cis_routing`\n    * `ibm_cis_tls_settings`\n    * `ibm_cis_waf_group`\n    * `ibm_cis_waf_package`\n*   `ibm_cloud_atracker`\n*   `ibm_cloud_logdna`\n*   `ibm_cloud_sysdig_monitor`\n*   `ibm_cloud_watson_machine_learning`\n*   `ibm_cloud_watson_studio`\n*   `ibm_code_engine`\n*   `ibm_container_cluster`\n    * `ibm_container_cluster`\n    * `ibm_container_nlb_dns`\n    * `ibm_container_worker_pool`\n*   `ibm_container_vpc_cluster`\n    * `ibm_container_vpc_cluster`\n    * `ibm_container_vpc_worker_pool`\n*   `ibm_continuous_delivery`\n* `ibm_cd_toolchain`\n    * `ibm_cd_tekton_pipeline`\n    * `ibm_cd_tekton_pipeline_definition`\n    * `ibm_cd_tekton_pipeline_property`\n    * `ibm_cd_tekton_pipeline_trigger`\n    * `ibm_cd_tekton_pipeline_trigger_property`\n    * `ibm_cd_toolchain_tool_appconfig`\n    * `ibm_cd_toolchain_tool_artifactory`\n    * `ibm_cd_toolchain_tool_bitbucketgit`\n    * `ibm_cd_toolchain_tool_custom`\n    * `ibm_cd_toolchain_tool_devopsinsights`\n    * `ibm_cd_toolchain_tool_eventnotifications`\n    * `ibm_cd_toolchain_tool_githubconsolidated`\n    * `ibm_cd_toolchain_tool_gitlab`\n    * `ibm_cd_toolchain_tool_hashicorpvault`\n    * `ibm_cd_toolchain_tool_hostedgit`\n    * `ibm_cd_toolchain_tool_jenkins`\n    * `ibm_cd_toolchain_tool_jira`\n    * `ibm_cd_toolchain_tool_keyprotect`\n    * `ibm_cd_toolchain_tool_nexus`\n    * `ibm_cd_toolchain_tool_pagerduty`\n    * `ibm_cd_toolchain_tool_pipeline`\n    * `ibm_cd_toolchain_tool_privateworker`\n    * `ibm_cd_toolchain_tool_saucelabs`\n    * `ibm_cd_toolchain_tool_secretsmanager`\n    * `ibm_cd_toolchain_tool_securitycompliance`\n    * `ibm_cd_toolchain_tool_slack`\n    * `ibm_cd_toolchain_tool_sonarqube`\n*   `ibm_cos`\n    * `ibm_cos_bucket`\n    * `ibm_resource_instance`\n*   `ibm_database_etcd`\n    * `ibm_database`\n*   `ibm_database_mongo`\n    * `ibm_database`\n*   `ibm_database_postgresql`\n    * `ibm_database`\n*   `ibm_database_rabbitmq`\n    * `ibm_database`\n*   `ibm_database_redis`\n    * `ibm_database`\n*   `ibm_direct_link`\n    * `ibm_dl_gateway`\n    * `ibm_dl_provider_gateway`\n    * `ibm_dl_virtual_connection`\n*   `ibm_function`\n    * `ibm_function_action`\n    * `ibm_function_package`\n    * `ibm_function_rule`\n    * `ibm_function_trigger`\n*   `ibm_iam`\n    * `ibm_iam_access_group`\n    * `ibm_iam_access_group_dynamic_rule`\n    * `ibm_iam_access_group_members`\n    * `ibm_iam_access_group_policy`\n    * `ibm_iam_authorization_policy`\n    * `ibm_iam_custom_role`\n    * `ibm_iam_service_id`\n    * `ibm_iam_service_policy`\n    * `ibm_iam_user_policy`\n*   `ibm_is_floating_ip`\n*   `ibm_is_flow_log`\n*   `ibm_is_ike_policy`\n*   `ibm_is_image`\n*   `ibm_is_instance`\n*   `ibm_is_instance_group`\n    * `ibm_is_instance_group`\n    * `ibm_is_instance_group_manager`\n    * `ibm_is_instance_group_manager_policy`\n*   `ibm_is_instance_template`\n*   `ibm_is_ipsec_policy`\n*   `ibm_is_lb`\n    * `ibm_is_lb_listener`\n    * `ibm_is_lb_listener_policy`\n    * `ibm_is_lb_listener_policy_rule`\n    * `ibm_is_lb_pool`\n    * `ibm_is_lb_pool_member`\n*   `ibm_is_network_acl`\n*   `ibm_is_public_gateway`\n*   `ibm_is_security_group`\n    * `ibm_is_security_group`\n    * `ibm_is_security_group_rule`\n*   `ibm_is_ssh_key`\n*   `ibm_is_subnet`\n*   `ibm_is_volume`\n*   `ibm_is_vpc`\n    * `ibm_is_vpc`\n    * `ibm_is_vpc_address_prefix`\n    * `ibm_is_vpc_route`\n    * `ibm_is_vpc_routing_table`\n    * `ibm_is_vpc_routing_table_route`\n*   `ibm_is_vpn_gateway`\n    * `ibm_is_vpn_gateway`\n    * `ibm_is_vpn_gateway_connections`\n*   `ibm_kp`\n    * `ibm_kms_key`\n    * `ibm_resource_instance`\n*   `ibm_private_dns`\n    * `ibm_dns_glb`\n    * `ibm_dns_glb_monitor`\n    * `ibm_dns_glb_pool`\n    * `ibm_dns_permitted_network`\n    * `ibm_dns_resource_record`\n    * `ibm_dns_zone`\n    * `ibm_resource_instance`\n*   `ibm_satellite_control_plane`\n    * `ibm_satellite_cluster`\n    * `ibm_satellite_host`\n    * `ibm_satellite_location`\n*   `ibm_satellite_data_plane`\n    * `ibm_is_floating_ip`\n    * `ibm_is_instance`\n    * `ibm_is_security_group`\n    * `ibm_is_ssh_key`\n    * `ibm_is_subnet`\n    * `ibm_is_vpc`\n*   `ibm_secrets_manager`\n*   `ibm_transit_gateway`\n    * `ibm_tg_connection`\n    * `ibm_tg_gateway` \n*   `ibm_vpe_gateway`\n    * `ibm_is_virtual_endpoint_gateway`\n    * `ibm_is_virtual_endpoint_gateway_ip`\n"
  },
  {
    "path": "docs/ionoscloud.md",
    "content": "# Use with IONOS Cloud\n\n## Authentication\n\nProper credential must be configured, before it can be used.\n\nYou can set the environment variables for *HTTP basic authentication*:\n\nexport IONOS_USERNAME=\"username\"\nexport IONOS_PASSWORD=\"password\"\n\nOr you can use *token authentication*:\n\nexport IONOS_TOKEN=\"token\"\n\n\n## List of supported IONOS Cloud resources\n\n* [`application_loadbalancer`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/application_loadbalancer)\n* [`application_loadbalancer_forwardingrule`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/application_loadbalancer_forwardingrule)\n* [`backup_unit`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/backup_unit)\n* [`certificate`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/certificate)\n* [`container_registry`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/container_registry)\n* [`container_registry_token`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/container_registry_token)\n* [`datacenter`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/datacenter)\n* [`dataplatform_cluster`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/dataplatform_cluster)\n* [`dataplatform_node_pool`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/dataplatform_node_pool)\n* [`dns_record`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/dns_record)\n* [`dns_zone`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/dns_zone)\n* [`firewall`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/firewall)\n* [`group`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/group)\n* [`ipblock`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/ipblock)\n* [`ipfailover`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/ipfailover)\n* [`k8s_cluster`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/k8s_cluster)\n* [`k8s_node_pool`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/k8s_node_pool)\n* [`lan`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/lan)\n* [`loadbalancer`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/loadbalancer)\n* [`logging_pipeline`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/logging_pipeline)\n* [`mongo_cluster`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/dbaas_mongo_cluster)\n* [`mongo_user`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/dbaas_mongo_user)\n* [`natgateway`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/natgateway)\n* [`natgateway_rule`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/natgateway_rule)\n* [`networkloadbalancer`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/networkloadbalancer)\n* [`networkloadbalancer_forwardingrule`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/networkloadbalancer_forwardingrule)\n* [`nic`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/nic)\n* [`pg_cluster`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/dbaas_pgsql_cluster)\n* [`pg_database`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/dbaas_pgsql_database)\n* [`pg_user`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/dbaas_pgsql_user)\n* [`private_crossconnect`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/private_crossconnect)\n* [`s3_key`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/s3_key)\n* [`server`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/server)\n* [`share`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/share)\n* [`target_group`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/target_group)\n* [`user`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/user)\n* [`volume`](https://registry.terraform.io/providers/ionos-cloud/ionoscloud/latest/docs/resources/volume)\n\nWe allow only resources that provide valid terraform plans to be imported.\nIf you do not see your resource in the tf plan, please enable TF_LOG=debug and check logs \nfor a message that will let you know why the resource was not imported.\n\n#### Notes:\n - A server must have a `NIC` and a `volume` attached to be allowed to be imported by terraformer.\n - A server must also have a `BootVolume` set.\n\n\n"
  },
  {
    "path": "docs/keycloak.md",
    "content": "### Use with Keycloak\n\nExample:\n\n```\n export KEYCLOAK_URL=https://foo.bar.localdomain\n export KEYCLOAK_BASE_PATH=/auth # Only users of the legacy Wildfly distribution will need to set this.\n export KEYCLOAK_CLIENT_ID=[KEYCLOAK_CLIENT_ID]\n export KEYCLOAK_CLIENT_SECRET=[KEYCLOAK_CLIENT_SECRET]\n export RED_HAT_SSO=1 # Only users of the RH-SSO distribution will need to set this.\n\n terraformer import keycloak --resources=realms\n terraformer import keycloak --resources=realms --filter=realm=name1:name2:name3\n terraformer import keycloak --resources=realms --targets realmA,realmB\n```\n\nHere is the list of resources which are currently supported by Keycloak provider v.4.0.1:\n\n- `realms`\n  - `keycloak_default_groups`\n  - `keycloak_group`\n  - `keycloak_group_memberships`\n  - `keycloak_group_roles`\n  - `keycloak_ldap_full_name_mapper`\n  - `keycloak_ldap_group_mapper`\n  - `keycloak_ldap_hardcoded_group_mapper`\n  - `keycloak_ldap_hardcoded_role_mapper`\n  - `keycloak_ldap_msad_lds_user_account_control_mapper`\n  - `keycloak_ldap_msad_user_account_control_mapper`\n  - `keycloak_ldap_user_attribute_mapper`\n  - `keycloak_ldap_user_federation`\n  - `keycloak_openid_audience_protocol_mapper`\n  - `keycloak_openid_audience_resolve_protocol_mapper`\n  - `keycloak_openid_client`\n  - `keycloak_openid_client_default_scopes`\n  - `keycloak_openid_client_optional_scopes`\n  - `keycloak_openid_client_scope`\n  - `keycloak_openid_client_service_account_role`\n  - `keycloak_openid_full_name_protocol_mapper`\n  - `keycloak_openid_group_membership_protocol_mapper`\n  - `keycloak_openid_hardcoded_claim_protocol_mapper`\n  - `keycloak_openid_hardcoded_role_protocol_mapper` (only for client roles)\n  - `keycloak_openid_script_protocol_mapper` (support for this protocol mapper was removed in Keycloak 18)\n  - `keycloak_openid_user_attribute_protocol_mapper`\n  - `keycloak_openid_user_client_role_protocol_mapper`\n  - `keycloak_openid_user_property_protocol_mapper`\n  - `keycloak_openid_user_realm_role_protocol_mapper`\n  - `keycloak_openid_user_session_note_protocol_mapper`\n  - `keycloak_realm`\n  - `keycloak_required_action`\n  - `keycloak_role`\n  - `keycloak_user`\n"
  },
  {
    "path": "docs/kubernetes.md",
    "content": "### Use with Kubernetes\n\nExample:\n\n```\n terraformer import kubernetes --resources=deployments,services,storageclasses\n terraformer import kubernetes --resources=deployments,services,storageclasses --filter=deployment=name1:name2:name3\n```\n\nAll Kubernetes resources that are currently supported by the Kubernetes provider, are also supported by this module. Here is the list of resources which are currently supported by Kubernetes provider v.1.4:\n\n*   `clusterrolebinding`\n    * `kubernetes_cluster_role_binding`\n*   `configmaps`\n    * `kubernetes_config_map`\n*   `deployments`\n    * `kubernetes_deployment`\n*   `horizontalpodautoscalers`\n    * `kubernetes_horizontal_pod_autoscaler`\n*   `limitranges`\n    * `kubernetes_limit_range`\n*   `namespaces`\n    * `kubernetes_namespace`\n*   `persistentvolumes`\n    * `kubernetes_persistent_volume`\n*   `persistentvolumeclaims`\n    * `kubernetes_persistent_volume_claim`\n*   `pods`\n    * `kubernetes_pod`\n*   `replicationcontrollers`\n    * `kubernetes_replication_controller`\n*   `resourcequotas`\n    * `kubernetes_resource_quota`\n*   `secrets`\n    * `kubernetes_secret`\n*   `services`\n    * `kubernetes_service`\n*   `serviceaccounts`\n    * `kubernetes_service_account`\n*   `statefulsets`\n    * `kubernetes_stateful_set`\n*   `storageclasses`\n    * `kubernetes_storage_class`\n    \n#### Known issues\n\n* Terraform Kubernetes provider is rejecting resources with \":\" characters in their names (as they don't meet DNS-1123), while it's allowed for certain types in Kubernetes, e.g. ClusterRoleBinding.\n* Because Terraform flatmap uses \".\" to detect the keys for unflattening the maps, some keys with \".\" in their names are being considered as the maps.\n* Since the library assumes empty strings to be empty values (not \"0\"), there are some issues with optional integer keys that are restricted to be positive.\n"
  },
  {
    "path": "docs/launchdarkly.md",
    "content": "### Use with Launchdarkly\n\nExample:\n\n```\nexport LAUNCHDARKLY_ACCESS_TOKEN=[LAUNCHDARKLY_ACCESS_TOKEN]\n./terraformer import launchdarkly -r project\n```\n\nList of supported LaunchDarkly resources:\n\n*   `project`\n    * `launchdarkly_project`\n"
  },
  {
    "path": "docs/linode.md",
    "content": "### Use with Linode\n\nExample:\n\n```\nexport LINODE_TOKEN=[LINODE_TOKEN]\n./terraformer import linode -r instance\n```\n\nList of supported Linode resources:\n\n*   `domain`\n    * `linode_domain`\n    * `linode_domain_record`\n*   `image`\n    * `linode_image`\n*   `instance`\n    * `linode_instance`\n*   `nodebalancer`\n    * `linode_nodebalancer`\n    * `linode_nodebalancer_config`\n    * `linode_nodebalancer_node`\n*   `rdns`\n    * `linode_rdns`\n*   `sshkey`\n    * `linode_sshkey`\n*   `stackscript`\n    * `linode_stackscript`\n*   `token`\n    * `linode_token`\n*   `volume`\n    * `linode_volume`\n"
  },
  {
    "path": "docs/logz.md",
    "content": "### Use with Logz.io\n\nExample:\n\n```\n LOGZIO_API_TOKEN=foobar LOGZIO_BASE_URL=https://api-eu.logz.io ./terraformer import logzio -r=alerts,alert_notification_endpoints // Import Logz.io alerts and alert notification endpoints\n```\n\nList of supported Logz.io resources:\n\n*   `alert_notification_endpoints`\n    * `logzio_endpoint`\n*   `alerts`\n    * `logzio_alert`\n"
  },
  {
    "path": "docs/mackerel.md",
    "content": "### Use with Mackerel\n\nExample:\n\n```bash\n ./terraformer import mackerel --resources=service --api-key=YOUR_MACKEREL_API_KEY // or MACKEREL_API_KEY in env --app-key=YOUR_MACKEREL_API_KEY\n ./terraformer import mackerel --resources=service --filter=service=name1:name2:name4 --api-key=YOUR_MACKEREL_API_KEY // or MACKEREL_API_KEY in env --app-key=YOUR_MACKEREL_API_KEY\n ./terraformer import mackerel --resources=aws_integration --filter=aws_integration=id1:id2:id4 --api-key=YOUR_MACKEREL_API_KEY // or MACKEREL_API_KEY in env --app-key=YOUR_MACKEREL_API_KEY\n```\n\nList of supported Mackerel services:\n\n*   `alert_group_setting`\n    * `mackerel_alert_group_setting`\n*   `aws_integration`\n    * `mackerel_aws_integration`\n        * Sensitive field `secret_key` is not generated and needs to be manually set\n        * Sensitive field `external_id` is not generated and needs to be manually set\n*   `channel`\n    * `mackerel_channel`\n*   `downtime`\n    * `mackerel_downtime`\n*   `monitor`\n    * `mackerel_monitor`\n*   `notification_group`\n    * `mackerel_notification_group`\n*   `role`\n    * `mackerel_role`\n*   `service`\n    * `mackerel_service`"
  },
  {
    "path": "docs/mikrotik.md",
    "content": "### Use with [Mikrotik](https://wiki.mikrotik.com/wiki/Manual:TOC)\n\nThis provider uses the [terraform-provider-mikrotik](https://github.com/ddelnano/terraform-provider-mikrotik). The terraformer provider was built by [Dom Del Nano](https://github.com/ddelnano).\n\nExample:\n\n```\n## Warning! You should not expose your mikrotik creds through your bash history. Export them to your shell in a safe way when doing this for real!\n\nMIKROTIK_HOST=router-hostname:8728 MIKROTIK_USER=username MIKROTIK_PASSWORD=password terraformer  import mikrotik -r=dhcp_lease\n\n# Import only static IPs\nMIKROTIK_HOST=router-hostname:8728 MIKROTIK_USER=username MIKROTIK_PASSWORD=password terraformer  import mikrotik -r=dhcp_lease --filter='Name=dynamic;Value=false'\n```\n\nList of supported mikrotik resources:\n\n* `mikrotik_dhcp_lease`"
  },
  {
    "path": "docs/myrasec.md",
    "content": "### Use with Myra Security\n\nExample using a Myra Security API Key and corresponding Token:\n\n```\nexport MYRASEC_API_SECRET=[MYRASEC_API_SECRET]\nexport MYRASEC_API_KEY=[MYRASEC_API_KEY]\n./terraformer import myrasec --resources=domain\n```\n\nList of supported Myra Security services:\n\n* `cache_setting`\n  * `myrasec_cache_setting`\n* `dns_record`\n  * `myrasec_dns_record`\n* `domain`\n  * `myrasec_domain`\n* `error_page`\n  * `myrasec_error_page`\n* `ip_filter`\n  * `myrasec_ip_filter`\n* `maintenance`\n  * `myrasec_maintenance`\n* `ratelimit`\n  * `myrasec_ratelimit`\n* `redirect`\n  * `myrasec_redirect`\n* `settings`\n  * `myrasec_settings`\n* `waf_rule`\n  * `myrasec_waf_rule`\n"
  },
  {
    "path": "docs/ns1.md",
    "content": "### Use with NS1\n\nExample:\n\n```\n$ export NS1_APIKEY=[NS1_APIKEY]\n$ terraformer import ns1 -r zone,monitoringjob,team\n```\n\nList of supported NS1 resources:\n\n*   `monitoringjob`\n    * `ns1_monitoringjob`\n*   `team`\n    * `ns1_team`\n*   `zone`\n    * `ns1_zone`\n"
  },
  {
    "path": "docs/octopus.md",
    "content": "### Use with OctopusDeploy\n\nExample:\n\n```\nexport OCTOPUS_CLI_SERVER=http://localhost:8081/\nexport OCTOPUS_CLI_API_KEY=API-CK7DQ8BMJCUUBSHAJCDIATXUO\n\nterraformer import octopusdeploy --resources=tagsets\n```\n\n* `accounts`\n  * `octopusdeploy_account`\n* `certificates`\n  * `octopusdeploy_certificate`\n* `environments`\n  * `octopusdeploy_environment`\n* `feeds`\n  * `octopusdeploy_feed`\n* `libraryvariablesets`\n  * `octopusdeploy_library_variable_set`\n* `lifecycles`\n  * `octopusdeploy_lifecycle`\n* `projects`\n  * `octopusdeploy_project`\n* `projectgroups`\n  * `octopusdeploy_project_group`\n* `projecttriggers`\n  * `octopusdeploy_project_deployment_target_trigger`\n* `tagsets`\n  * `octopusdeploy_tag_set`\n"
  },
  {
    "path": "docs/okta.md",
    "content": "### Use with Okta\n\nExample:\n\n```\n$ export OKTA_ORG_NAME=<ORG_NAME>\n$ export OKTA_BASE_URL=<BASE_URL>\n$ export OKTA_API_TOKEN=<API_TOKEN>\n$ terraformer import okta --resources=okta_user,okta_group\n```\n\nIf you login to your Okta instance at: https://dev-12345678.okta.com/ you would configure:\n```\n$ export OKTA_ORG_NAME=dev-12345678\n$ export OKTA_BASE_URL=okta.com\n```\n\n\nList of supported Okta services:\n\n*    `app`\n     * `okta_app_auto_login`\n     * `okta_app_basic_auth`\n     * `okta_app_bookmark`\n     * `okta_app_oauth`\n     * `okta_app_saml`\n     * `okta_app_secure_password_store`\n     * `okta_app_signon_policy`\n     * `okta_app_signon_policy_rule`\n     * `okta_app_swa`\n     * `okta_app_three_field`\n*    `authorization_server`\n     * `okta_auth_server`\n     * `okta_auth_server_claim`\n     * `okta_auth_server_policy`\n     * `okta_auth_server_policy_rule`\n     * `okta_auth_server_scope`\n*    `event_hook`\n*    * `okta_event_hook`\n*    `factor`\n     * `okta_factor`\n*    `group`\n     * `okta_group`\n     * `okta_group_rule`\n*    `idp`\n     * `okta_idp_oidc`\n     * `okta_idp_saml`\n     * `okta_idp_social`\n*    `inline_hook`\n*    * `okta_inline_hook`\n*    `network_zone`\n     * `okta_network_zone`\n*    `policy`\n     * `okta_policy_mfa`\n     * `okta_policy_password`\n     * `okta_policy_rule_mfa`\n     * `okta_policy_rule_password`\n     * `okta_policy_rule_signon`\n     * `okta_policy_signon`\n*    `template_sms`\n     * `okta_template_sms`\n*    `trusted_origin`\n     * `okta_trusted_origin`\n*    `user`\n     * `okta_user`\n*    `user_type`\n     * `okta_user_type`\n"
  },
  {
    "path": "docs/opal.md",
    "content": "# Use terraformer with [Opal](https://opal.dev)\n\n##  Usage\n### 1. Installation\nFirst you will need to install terraformer with the opal provider. See the [readme](https://github.com/GoogleCloudPlatform/terraformer#installation).\n\n### 2. Set up a template terraform workspace\nBefore you can use terraformer, you need to create a template workspace so that terraformer\ncan access the [opalsecurity/opal](https://registry.terraform.io/providers/opalsecurity/opal/latest) provider.\n\nTo do this, create a new directory with a basic `provider.tf` file:\n```hcl\nterraform {\n  required_providers {\n    opal = {\n      source = \"opalsecurity/opal\"\n      version = \"0.0.2\"\n    }\n  }\n}\n\nprovider \"opal\" {\n  # Configuration options\n}\n```\n\nthen run:\n```bash\n$ terraform init\n````\n\nYou should see the output: `Terraform has been successfully initialized!`\n\n### 3. Run terraformer:\n\n```bash\nexport OPAL_AUTH_TOKEN=Your token from https://app.opal.dev/settings#api\n# If you are running an on-prem installation, you will need to provide a base url as well:\n# export OPAL_BASE_URL=Your token from https://my.opal.com\n\n./terraformer import opal --resources=* --path-pattern {output}/{provider}\n```\n\nYou can also specify only certain kinds of resources to import as well, i.e. `--resources=owner`.\n\nNote that we currently do not support the terraformer `--filter` flag.\n\n### 4. Inspect the imported terraform files\n\nYou should now see a `generated/` subdirectory with generated files. If you are using\nterraform version `>= 0.13`, you will need to run a state migration:\n```bash\n$ cd generated/opal/\n$ terraform state replace-provider -auto-approve \"registry.terraform.io/-/opal\" \"opalsecurity/opal\"\n```\n\nYou can now initialize and use your new generated resources:\n```bash\n$ terraform init\n$ terraform plan # No changes. Your infrastructure matches the configuration.\n```\n\n## Supported Opal resources:\n\n*   `group`\n    * `opal_group`\n*   `message_channels`\n    * `opal_message_channels`\n*   `on_call_schedules`\n    * `opal_on_call_schedules`\n*   `owner`\n    * `opal_owner`\n*   `resource`\n    * `opal_resource`\n"
  },
  {
    "path": "docs/openstack.md",
    "content": "### Use with OpenStack\n\nExample:\n\n```\n terraformer import openstack --resources=compute,networking --regions=RegionOne\n```\n\nList of supported OpenStack services:\n\n*   `blockstorage`\n    * `openstack_blockstorage_volume_v1`\n    * `openstack_blockstorage_volume_v2`\n    * `openstack_blockstorage_volume_v3`\n*   `compute`\n    * `openstack_compute_instance_v2`\n*   `networking`\n    * `openstack_networking_secgroup_v2`\n    * `openstack_networking_secgroup_rule_v2`\n"
  },
  {
    "path": "docs/opsgenie.md",
    "content": "### Use with Opsgenie\n\nExample:\n\n```\n terraformer import opsgenie --resources=team,user --api-key=YOUR_API_KEY // or OPSGENIE_API_KEY in env\n```\n\nList of supported Opsgenie services:\n\n*   `team`\n    * `opsgenie_team`\n*   `user`\n    * `opsgenie_user`\n"
  },
  {
    "path": "docs/pagerduty.md",
    "content": "### Use with PagerDuty\n\nExample:\n\n```\n./terraformer import pagerduty -r team,schedule,user  -t YOUR_PAGERDUTY_TOKEN // or PAGERDUTY_TOKEN in env\n```\nInstructions to obtain a Auth Token: https://developer.pagerduty.com/docs/rest-api-v2/authentication/\n\nList of supported PagerDuty resources:\n\n* `business_service`\n  * `pagerduty_business_service`\n* `escalation_policy`\n  * `pagerduty_escalation_policy`\n* `ruleset`\n  * `pagerduty_ruleset`\n  * `pagerduty_ruleset_rule`\n* `schedule`\n  * `pagerduty_schedule`\n* `service`\n  * `pagerduty_service`\n  * `pagerduty_service_event_rule`\n* `team`\n  * `pagerduty_team`\n  * `pagerduty_team_membership`\n* `user`\n  * `pagerduty_user`\n"
  },
  {
    "path": "docs/panos.md",
    "content": "### Use with PAN-OS\n\nExample:\n\n```\n export PANOS_HOSTNAME=192.168.1.1\n export PANOS_USERNAME=[PANOS_USERNAME]\n export PANOS_PASSWORD=[PANOS_PASSWORD]\n\n terraformer import panos --resources=firewall_device_config,firewall_networking,firewall_objects,firewall_policy\n```\nThe list of usable environment variables is the same as the [pango go-client](https://github.com/PaloAltoNetworks/pango):\n*  `PANOS_HOSTNAME`\n*  `PANOS_USERNAME`\n*  `PANOS_PASSWORD`\n*  `PANOS_API_KEY`\n*  `PANOS_PROTOCOL`\n*  `PANOS_PORT`\n*  `PANOS_TIMEOUT`\n*  `PANOS_TARGET`\n*  `PANOS_HEADERS`\n*  `PANOS_VERIFY_CERTIFICATE`\n*  `PANOS_LOGGING`\n\nHere is the list of resources which are currently supported:\n\n*   `firewall_device_config`\n    * `panos_email_server_profile`\n    * `panos_general_settings`\n    * `panos_http_server_profile`\n    * `panos_snmptrap_server_profile`\n    * `panos_syslog_server_profile`\n    * `panos_telemetry`\n*   `firewall_networking`\n    * `panos_aggregate_interface`\n    * `panos_bfd_profile`\n    * `panos_bgp`\n    * `panos_bgp_aggregate`\n    * `panos_bgp_aggregate_advertise_filter`\n    * `panos_bgp_aggregate_suppress_filter`\n    * `panos_bgp_auth_profile` # The secret argument will contain \"(incorrect)\"\n    * `panos_bgp_conditional_adv`\n    * `panos_bgp_conditional_adv_advertise_filter`\n    * `panos_bgp_conditional_adv_non_exist_filter`\n    * `panos_bgp_dampening_profile`\n    * `panos_bgp_export_rule_group`\n    * `panos_bgp_import_rule_group`\n    * `panos_bgp_peer`\n    * `panos_bgp_peer_group`\n    * `panos_bgp_redist_rule`\n    * `panos_ethernet_interface`\n    * `panos_gre_tunnel`\n    * `panos_ike_crypto_profile`\n    * `panos_ike_gateway`\n    * `panos_ipsec_crypto_profile`\n    * `panos_ipsec_tunnel`\n    * `panos_ipsec_tunnel_proxy_id_ipv4`\n    * `panos_layer2_subinterface`\n    * `panos_layer3_subinterface`\n    * `panos_loopback_interface`\n    * `panos_management_profile`\n    * `panos_monitor_profile`\n    * `panos_redistribution_profile`\n    * `panos_static_route_ipv4`\n    * `panos_tunnel_interface`\n    * `panos_virtual_router`\n    * `panos_vlan`\n    * `panos_vlan_interface`\n    * `panos_zone`\n*   `firewall_objects`\n    * `panos_address_group`\n    * `panos_address_object`\n    * `panos_administrative_tag`\n    * `panos_anti_spyware_security_profile`\n    * `panos_antivirus_security_profile`\n    * `panos_application_group`\n    * `panos_application_object`\n    * `panos_custom_data_pattern_object`\n    * `panos_data_filtering_security_profile`\n    * `panos_dos_protection_profile`\n    * `panos_dynamic_user_group`\n    * `panos_edl`\n    * `panos_file_blocking_security_profile`\n    * `panos_log_forwarding_profile`\n    * `panos_service_group`\n    * `panos_service_object`\n    * `panos_url_filtering_security_profile`\n    * `panos_vulnerability_security_profile`\n    * `panos_wildfire_analysis_security_profile`\n*   `firewall_policy`\n    * `panos_nat_rule_group`\n    * `panos_pbf_rule_group`\n    * `panos_security_rule_group`\n*   `panorama_device_config`\n    * `panos_device_group_parent`\n    * `panos_panorama_device_group`\n    * `panos_panorama_email_server_profile`\n    * `panos_panorama_http_server_profile`\n    * `panos_panorama_snmptrap_server_profile`\n    * `panos_panorama_syslog_server_profile`\n    * `panos_panorama_template`\n    * `panos_panorama_template_stack`\n    * `panos_panorama_template_variable`\n*   `panorama_networking`\n    * `panos_panorama_aggregate_interface`\n    * `panos_panorama_bfd_profile`\n    * `panos_panorama_bgp`\n    * `panos_panorama_bgp_aggregate`\n    * `panos_panorama_bgp_aggregate_advertise_filter`\n    * `panos_panorama_bgp_aggregate_suppress_filter`\n    * `panos_panorama_bgp_auth_profile` # The secret argument will contain \"(incorrect)\"\n    * `panos_panorama_bgp_conditional_adv`\n    * `panos_panorama_bgp_conditional_adv_advertise_filter`\n    * `panos_panorama_bgp_conditional_adv_non_exist_filter`\n    * `panos_panorama_bgp_dampening_profile`\n    * `panos_panorama_bgp_export_rule_group`\n    * `panos_panorama_bgp_import_rule_group`\n    * `panos_panorama_bgp_peer`\n    * `panos_panorama_bgp_peer_group`\n    * `panos_panorama_bgp_redist_rule`\n    * `panos_panorama_ethernet_interface`\n    * `panos_panorama_gre_tunnel`\n    * `panos_panorama_ike_crypto_profile`\n    * `panos_panorama_ike_gateway`\n    * `panos_panorama_ipsec_crypto_profile`\n    * `panos_panorama_ipsec_tunnel`\n    * `panos_panorama_ipsec_tunnel_proxy_id_ipv4`\n    * `panos_panorama_layer2_subinterface`\n    * `panos_panorama_layer3_subinterface`\n    * `panos_panorama_loopback_interface`\n    * `panos_panorama_management_profile`\n    * `panos_panorama_monitor_profile`\n    * `panos_panorama_redistribution_profile`\n    * `panos_panorama_static_route_ipv4`\n    * `panos_panorama_tunnel_interface`\n    * `panos_panorama_virtual_router`\n    * `panos_panorama_vlan`\n    * `panos_panorama_vlan_interface`\n    * `panos_panorama_zone`\n*   `panorama_objects`\n    * `panos_address_object`\n    * `panos_anti_spyware_security_profile`\n    * `panos_antivirus_security_profile`\n    * `panos_custom_data_pattern_object`\n    * `panos_data_filtering_security_profile`\n    * `panos_dos_protection_profile`\n    * `panos_dynamic_user_group`\n    * `panos_file_blocking_security_profile`\n    * `panos_panorama_address_group`\n    * `panos_panorama_administrative_tag`\n    * `panos_panorama_application_group`\n    * `panos_panorama_application_object`\n    * `panos_panorama_edl`\n    * `panos_panorama_log_forwarding_profile`\n    * `panos_panorama_service_group`\n    * `panos_panorama_service_object`\n    * `panos_url_filtering_security_profile`\n    * `panos_vulnerability_security_profile`\n    * `panos_wildfire_analysis_security_profile`\n*   `panorama_plugins`\n    * `panos_panorama_gcp_account`\n    * `panos_panorama_gke_cluster`\n    * `panos_panorama_gke_cluster_group`\n*   `panorama_policy`\n    * `panos_panorama_nat_rule_group`\n    * `panos_panorama_pbf_rule_group`\n    * `panos_panorama_security_rule_group`\n"
  },
  {
    "path": "docs/rabbitmq.md",
    "content": "### Use with RabbitMQ\n\nExample:\n\n```\n export RABBITMQ_SERVER_URL=http://foo.bar.localdomain:15672\n export RABBITMQ_USERNAME=[RABBITMQ_USERNAME]\n export RABBITMQ_PASSWORD=[RABBITMQ_PASSWORD]\n\n terraformer import rabbitmq --resources=vhosts,queues,exchanges\n terraformer import rabbitmq --resources=vhosts,queues,exchanges --filter=vhost=name1:name2:name3\n```\n\nAll RabbitMQ resources that are currently supported by the RabbitMQ provider, are also supported by this module. Here is the list of resources which are currently supported by RabbitMQ provider v.1.1.0:\n\n*   `bindings`\n    * `rabbitmq_binding`\n*   `exchanges`\n    * `rabbitmq_exchange`\n*   `permissions`\n    * `rabbitmq_permissions`\n*   `policies`\n    * `rabbitmq_policy`\n*   `queues`\n    * `rabbitmq_queue`\n*   `users`\n    * `rabbitmq_user`\n*   `vhosts`\n    * `rabbitmq_vhost`\n"
  },
  {
    "path": "docs/relic.md",
    "content": "### Use with New Relic\n\nExample:\n\n```\n./terraformer import newrelic -r alert,infra,synthetics --api-key=NRAK-XXXXXXXX --account-id=XXXXX\n```\n\nList of supported New Relic resources:\n\n*   `alert`\n    * `newrelic_alert_channel`\n    * `newrelic_alert_condition`\n    * `newrelic_alert_policy`\n    * `newrelic_nrql_alert_condition`\n*   `alertchannel`\n    * `newrelic_alert_channel`\n*   `alertcondition`\n    * `newrelic_alert_condition`\n    * `newrelic_nrql_alert_condition`\n*   `alertpolicy`\n    * `newrelic_alert_policy`\n*   `infra`\n    * `newrelic_infra_alert_condition`\n*   `synthetics`\n    * `newrelic_synthetics_monitor`\n*   `tags`\n    * `newrelic_entity_tags`\n"
  },
  {
    "path": "docs/tencentcloud.md",
    "content": "### Use with TencentCloud\n\nExample:\n\n```\n$ export TENCENTCLOUD_SECRET_ID=<SECRET_ID>\n$ export TENCENTCLOUD_SECRET_KEY=<SECRET_KEY>\n$ terraformer import tencentcloud --resources=cvm,cbs --regions=ap-guangzhou\n```\n\nList of supported TencentCloud services:\n\n*    `as`\n     * `tencentcloud_as_scaling_config`\n     * `tencentcloud_as_scaling_group`\n*    `cbs`\n     * `tencentcloud_cbs_storage`\n*    `cdn`\n     * `tencentcloud_cdn_domain`\n*    `cfs`\n     * `tencentcloud_cfs_file_system`\n*    `clb`\n     * `tencentcloud_clb_instance`\n*    `cos`\n     * `tencentcloud_cos_bucket`\n*    `cvm`\n     * `tencentcloud_instance`\n*    `elasticsearch`\n     * `tencentcloud_elasticsearch_instance`\n*    `gaap`\n     * `tencentcloud_gaap_proxy`\n     * `tencentcloud_gaap_realserver`\n*    `key_pair`\n     * `tencentcloud_key_pair`\n*    `mongodb`\n     * `tencentcloud_mongodb_instance`\n*    `mysql`\n     * `tencentcloud_mysql_instance`\n     * `tencentcloud_mysql_readonly_instance`\n*    `redis`\n     * `tencentcloud_redis_instance`\n*    `scf`\n     * `tencentcloud_scf_function`\n*    `security_group`\n     * `tencentcloud_security_group`\n*    `ssl`\n     * `tencentcloud_ssl_certificate`\n*    `subnet`\n     * `tencentcloud_subnet`\n*    `tcaplus`\n     * `tencentcloud_tcaplus_cluster`\n*    `vpc`\n     * `tencentcloud_vpc`\n*    `vpn`\n     * `tencentcloud_vpn_gateway`\n"
  },
  {
    "path": "docs/vault.md",
    "content": "### Use with Vault\n\nExample:\n\n```\n ./terraformer import vault --resources=aws_secret_backend_role --token=YOUR_VAULT_TOKEN // or VAULT_TOKEN in env --address=YOUR_VAULT_ADDRESS // or VAULT_ADDR in env\n ./terraformer import vault --resources=policy --filter=policy=id1:id2:id4 --token=YOUR_VAULT_TOKEN // or VAULT_TOKEN in env --address=YOUR_VAULT_ADDRESS // or VAULT_ADDR in env\n```\n\nList of supported Vault resources:\n\n* `ad_secret_backend`\n    * `ad_secret_backend`\n* `ad_secret_backend_role`\n    * `ad_secret_backend_role`\n* `alicloud_auth_backend_role`\n    * `alicloud_auth_backend_role`\n* `approle_auth_backend_role`\n    * `approle_auth_backend_role`\n* `aws_auth_backend_role`\n    * `aws_auth_backend_role`\n* `aws_secret_backend`\n    * `aws_secret_backend`\n* `aws_secret_backend_role`\n    * `aws_secret_backend_role`\n* `azure_auth_backend_role`\n    * `azure_auth_backend_role`\n* `azure_secret_backend`\n    * `azure_secret_backend`\n* `azure_secret_backend_role`\n    * `azure_secret_backend_role`\n* `cert_auth_backend_role`\n    * `cert_auth_backend_role`\n* `consul_secret_backend`\n    * `consul_secret_backend`\n* `consul_secret_backend_role`\n    * `consul_secret_backend_role`\n* `database_secret_backend_role`\n    * `database_secret_backend_role`\n* `gcp_auth_backend`\n    * `gcp_auth_backend`\n* `gcp_auth_backend_role`\n    * `gcp_auth_backend_role`\n* `gcp_secret_backend`\n    * `gcp_secret_backend`\n* `generic_secret`\n    * `generic_secret`\n* `github_auth_backend`\n    * `github_auth_backend`\n* `jwt_auth_backend`\n    * `jwt_auth_backend`\n* `jwt_auth_backend_role`\n    * `jwt_auth_backend_role`\n* `kubernetes_auth_backend_role`\n    * `kubernetes_auth_backend_role`\n* `ldap_auth_backend`\n    * `ldap_auth_backend`\n* `ldap_auth_backend_group`\n    * `ldap_auth_backend_group`\n* `ldap_auth_backend_user`\n    * `ldap_auth_backend_user`\n* `nomad_secret_backend`\n    * `nomad_secret_backend`\n* `okta_auth_backend`\n    * `okta_auth_backend`\n* `okta_auth_backend_group`\n    * `okta_auth_backend_group`\n* `okta_auth_backend_user`\n    * `okta_auth_backend_user`\n* `pki_secret_backend`\n    * `pki_secret_backend`\n* `pki_secret_backend_role`\n    * `pki_secret_backend_role`\n* `policy`\n    * `policy`\n* `rabbitmq_secret_backend`\n    * `rabbitmq_secret_backend`\n* `rabbitmq_secret_backend_role`\n    * `rabbitmq_secret_backend_role`\n* `ssh_secret_backend_role`\n    * `ssh_secret_backend_role`\n* `terraform_cloud_secret_backend`\n    * `terraform_cloud_secret_backend`\n* `token_auth_backend_role`\n    * `token_auth_backend_role`\n\n[1]: https://github.com/GoogleCloudPlatform/terraformer/blob/master/README.md#filtering\n"
  },
  {
    "path": "docs/vultr.md",
    "content": "### Use with Vultr\n\nExample:\n\n```\nexport VULTR_API_KEY=[VULTR_API_KEY]\n./terraformer import vultr -r server\n```\n\nList of supported Vultr resources:\n\n*   `bare_metal_server`\n    * `vultr_bare_metal_server`\n*   `block_storage`\n    * `vultr_block_storage`\n*   `dns_domain`\n    * `vultr_dns_domain`\n    * `vultr_dns_record`\n*   `firewall_group`\n    * `vultr_firewall_group`\n    * `vultr_firewall_rule`\n*   `network`\n    * `vultr_network`\n*   `reserved_ip`\n    * `vultr_reserved_ip`\n*   `server`\n    * `vultr_server`\n*   `snapshot`\n    * `vultr_snapshot`\n*   `ssh_key`\n    * `vultr_ssh_key`\n*   `startup_script`\n    * `vultr_startup_script`\n*   `user`\n    * `vultr_user`\n"
  },
  {
    "path": "docs/xen.md",
    "content": "### Use with [Xen Orchestra](https://xen-orchestra.com/)\n\nThis provider uses the [terraform-provider-xenorchestra](https://github.com/ddelnano/terraform-provider-xenorchestra). The terraformer provider was built by [Dom Del Nano](https://github.com/ddelnano) on behalf of [Vates SAS](https://vates.fr/) who is sponsoring Dom to work on the project.\n\nExample:\n\n```\n## Warning! You should not expose your xenorchestra creds through your bash history. Export them to your shell in a safe way when doing this for real!\n\nXOA_URL=ws://your-xenorchestra-domain XOA_USER=username XOA_PASSWORD=password terraformer import xenorchestra -r=acl\n```\n\nList of supported xenorchestra resources:\n\n* `xenorchestra_acl`\n* `xenorchestra_resource_set`\n"
  },
  {
    "path": "docs/yandex.md",
    "content": "### Use with Yandex Cloud\n\nExample:\n\n```\nexport YC_TOKEN=[YANDEX_CLOUD_OAUTH_OR_IAM_TOKEN]\n./terraformer import yandex -r subnet --folder_ids <comma-separated folder IDs>\n```\n\nList of supported Yandex resources:\n\n*   `disk`\n    * `yandex_compute_disk`\n*   `instance`\n    * `yandex_compute_instance`\n*   `network`\n    * `yandex_vpc_network`\n*   `subnet`\n    * `yandex_vpc_subnet`\n\nYour `tf` and `tfstate` files are written by default to\n`generated/yandex/service`."
  },
  {
    "path": "go.mod",
    "content": "module github.com/GoogleCloudPlatform/terraformer\n\ngo 1.24.0\nrequire (\n\tcloud.google.com/go v0.116.0 // indirect\n\tcloud.google.com/go/logging v1.12.0\n\tcloud.google.com/go/storage v1.50.0\n\tgithub.com/Azure/azure-sdk-for-go v63.4.0+incompatible\n\tgithub.com/Azure/azure-storage-blob-go v0.10.0\n\tgithub.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect\n\tgithub.com/Azure/go-autorest/autorest v0.11.27\n\tgithub.com/IBM-Cloud/bluemix-go v0.0.0-20220624043500-d538cb4fd9be\n\tgithub.com/IBM/go-sdk-core/v3 v3.3.1\n\tgithub.com/IBM/go-sdk-core/v4 v4.9.0\n\tgithub.com/IBM/go-sdk-core/v5 v5.18.1\n\tgithub.com/IBM/ibm-cos-sdk-go v1.5.0\n\tgithub.com/IBM/keyprotect-go-client v0.8.1\n\tgithub.com/IBM/networking-go-sdk v0.30.0\n\tgithub.com/IBM/platform-services-go-sdk v0.26.1\n\tgithub.com/IBM/vpc-go-sdk v0.64.0\n\tgithub.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect\n\tgithub.com/OctopusDeploy/go-octopusdeploy v1.6.0\n\tgithub.com/PaloAltoNetworks/pango v0.8.0\n\tgithub.com/SAP/go-hdb v0.105.2 // indirect\n\tgithub.com/SermoDigital/jose v0.9.1 // indirect\n\tgithub.com/aliyun/alibaba-cloud-sdk-go v1.61.1247\n\tgithub.com/aliyun/aliyun-tablestore-go-sdk v4.1.2+incompatible\n\tgithub.com/apache/openwhisk-client-go v0.0.0-20210106144548-17d556327cd3\n\tgithub.com/aws/aws-sdk-go-v2 v1.36.3\n\tgithub.com/aws/aws-sdk-go-v2/config v1.26.1\n\tgithub.com/aws/aws-sdk-go-v2/credentials v1.16.12\n\tgithub.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.26.5\n\tgithub.com/aws/aws-sdk-go-v2/service/acm v1.22.5\n\tgithub.com/aws/aws-sdk-go-v2/service/apigateway v1.21.5\n\tgithub.com/aws/aws-sdk-go-v2/service/appsync v1.26.5\n\tgithub.com/aws/aws-sdk-go-v2/service/autoscaling v1.36.5\n\tgithub.com/aws/aws-sdk-go-v2/service/batch v1.30.5\n\tgithub.com/aws/aws-sdk-go-v2/service/budgets v1.20.5\n\tgithub.com/aws/aws-sdk-go-v2/service/cloud9 v1.22.3\n\tgithub.com/aws/aws-sdk-go-v2/service/cloudformation v1.42.4\n\tgithub.com/aws/aws-sdk-go-v2/service/cloudfront v1.32.5\n\tgithub.com/aws/aws-sdk-go-v2/service/cloudhsmv2 v1.19.5\n\tgithub.com/aws/aws-sdk-go-v2/service/cloudtrail v1.35.5\n\tgithub.com/aws/aws-sdk-go-v2/service/cloudwatch v1.32.0\n\tgithub.com/aws/aws-sdk-go-v2/service/cloudwatchevents v1.21.5\n\tgithub.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.29.5\n\tgithub.com/aws/aws-sdk-go-v2/service/codebuild v1.26.5\n\tgithub.com/aws/aws-sdk-go-v2/service/codecommit v1.19.5\n\tgithub.com/aws/aws-sdk-go-v2/service/codedeploy v1.22.1\n\tgithub.com/aws/aws-sdk-go-v2/service/codepipeline v1.22.5\n\tgithub.com/aws/aws-sdk-go-v2/service/cognitoidentity v1.21.5\n\tgithub.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider v1.31.5\n\tgithub.com/aws/aws-sdk-go-v2/service/configservice v1.43.5\n\tgithub.com/aws/aws-sdk-go-v2/service/datapipeline v1.19.5\n\tgithub.com/aws/aws-sdk-go-v2/service/devicefarm v1.20.5\n\tgithub.com/aws/aws-sdk-go-v2/service/docdb v1.29.5\n\tgithub.com/aws/aws-sdk-go-v2/service/dynamodb v1.26.6\n\tgithub.com/aws/aws-sdk-go-v2/service/ec2 v1.141.0\n\tgithub.com/aws/aws-sdk-go-v2/service/ecr v1.24.5\n\tgithub.com/aws/aws-sdk-go-v2/service/ecrpublic v1.21.5\n\tgithub.com/aws/aws-sdk-go-v2/service/ecs v1.56.3\n\tgithub.com/aws/aws-sdk-go-v2/service/efs v1.26.5\n\tgithub.com/aws/aws-sdk-go-v2/service/eks v1.35.5\n\tgithub.com/aws/aws-sdk-go-v2/service/elasticache v1.34.5\n\tgithub.com/aws/aws-sdk-go-v2/service/elasticbeanstalk v1.20.5\n\tgithub.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.21.5\n\tgithub.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.26.5\n\tgithub.com/aws/aws-sdk-go-v2/service/elasticsearchservice v1.24.5\n\tgithub.com/aws/aws-sdk-go-v2/service/emr v1.49.0\n\tgithub.com/aws/aws-sdk-go-v2/service/firehose v1.22.5\n\tgithub.com/aws/aws-sdk-go-v2/service/glue v1.72.4\n\tgithub.com/aws/aws-sdk-go-v2/service/iam v1.28.5\n\tgithub.com/aws/aws-sdk-go-v2/service/identitystore v1.28.3\n\tgithub.com/aws/aws-sdk-go-v2/service/iot v1.46.5\n\tgithub.com/aws/aws-sdk-go-v2/service/kafka v1.28.5\n\tgithub.com/aws/aws-sdk-go-v2/service/kinesis v1.24.5\n\tgithub.com/aws/aws-sdk-go-v2/service/kms v1.27.5\n\tgithub.com/aws/aws-sdk-go-v2/service/lambda v1.49.5\n\tgithub.com/aws/aws-sdk-go-v2/service/medialive v1.43.3\n\tgithub.com/aws/aws-sdk-go-v2/service/mediapackage v1.28.5\n\tgithub.com/aws/aws-sdk-go-v2/service/mediastore v1.18.5\n\tgithub.com/aws/aws-sdk-go-v2/service/mq v1.20.5\n\tgithub.com/aws/aws-sdk-go-v2/service/opsworks v1.19.5\n\tgithub.com/aws/aws-sdk-go-v2/service/organizations v1.23.5\n\tgithub.com/aws/aws-sdk-go-v2/service/qldb v1.19.5\n\tgithub.com/aws/aws-sdk-go-v2/service/rds v1.64.5\n\tgithub.com/aws/aws-sdk-go-v2/service/redshift v1.39.6\n\tgithub.com/aws/aws-sdk-go-v2/service/resourcegroups v1.19.5\n\tgithub.com/aws/aws-sdk-go-v2/service/route53 v1.35.5\n\tgithub.com/aws/aws-sdk-go-v2/service/s3 v1.47.5\n\tgithub.com/aws/aws-sdk-go-v2/service/secretsmanager v1.25.5\n\tgithub.com/aws/aws-sdk-go-v2/service/securityhub v1.43.5\n\tgithub.com/aws/aws-sdk-go-v2/service/servicecatalog v1.25.5\n\tgithub.com/aws/aws-sdk-go-v2/service/ses v1.19.5\n\tgithub.com/aws/aws-sdk-go-v2/service/sfn v1.24.5\n\tgithub.com/aws/aws-sdk-go-v2/service/sns v1.26.5\n\tgithub.com/aws/aws-sdk-go-v2/service/sqs v1.29.5\n\tgithub.com/aws/aws-sdk-go-v2/service/ssm v1.44.5\n\tgithub.com/aws/aws-sdk-go-v2/service/ssoadmin v1.23.5\n\tgithub.com/aws/aws-sdk-go-v2/service/sts v1.26.5\n\tgithub.com/aws/aws-sdk-go-v2/service/swf v1.20.5\n\tgithub.com/aws/aws-sdk-go-v2/service/waf v1.18.5\n\tgithub.com/aws/aws-sdk-go-v2/service/wafregional v1.19.5\n\tgithub.com/aws/aws-sdk-go-v2/service/wafv2 v1.43.5\n\tgithub.com/aws/aws-sdk-go-v2/service/workspaces v1.35.5\n\tgithub.com/aws/aws-sdk-go-v2/service/xray v1.23.5\n\tgithub.com/cenkalti/backoff v2.2.1+incompatible // indirect\n\tgithub.com/cloudflare/cloudflare-go v0.13.6\n\tgithub.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 // indirect\n\tgithub.com/containerd/continuity v0.1.0 // indirect\n\tgithub.com/ddelnano/terraform-provider-mikrotik/client v0.0.0-20210401060029-7f652169b2c4\n\tgithub.com/ddelnano/terraform-provider-xenorchestra/client v0.0.0-20210401070256-0d721c6762ef\n\tgithub.com/denisenkom/go-mssqldb v0.10.0 // indirect\n\tgithub.com/denverdino/aliyungo v0.0.0-20200327235253-d59c209c7e93\n\tgithub.com/dgrijalva/jwt-go v3.2.0+incompatible\n\tgithub.com/digitalocean/godo v1.83.0\n\tgithub.com/docker/go-connections v0.4.0 // indirect\n\tgithub.com/duosecurity/duo_api_golang v0.0.0-20201112143038-0e07e9f869e3 // indirect\n\tgithub.com/elazarl/go-bindata-assetfs v1.0.1 // indirect\n\tgithub.com/fastly/go-fastly/v7 v7.0.0\n\tgithub.com/fatih/structs v1.1.0 // indirect\n\tgithub.com/gocql/gocql v0.0.0-20210707082121-9a3953d1826d // indirect\n\tgithub.com/google/go-github/v35 v35.1.0\n\tgithub.com/gophercloud/gophercloud v1.0.0\n\tgithub.com/grafana/grafana-api-golang-client v0.0.0-20210218192924-9ccd2365d2a6\n\tgithub.com/hashicorp/go-azure-helpers v0.36.0\n\tgithub.com/hashicorp/go-cleanhttp v0.5.2\n\tgithub.com/hashicorp/go-hclog v1.6.3\n\tgithub.com/hashicorp/go-memdb v1.3.2 // indirect\n\tgithub.com/hashicorp/go-plugin v1.4.4\n\tgithub.com/hashicorp/hcl v1.0.0\n\tgithub.com/hashicorp/terraform v0.12.31\n\tgithub.com/hashicorp/vault v0.10.4\n\tgithub.com/heimweh/go-pagerduty v0.0.0-20210930203304-530eff2acdc6\n\tgithub.com/heroku/heroku-go/v5 v5.4.1\n\tgithub.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519 // indirect\n\tgithub.com/honeycombio/terraform-provider-honeycombio v0.10.0\n\tgithub.com/iancoleman/strcase v0.3.0\n\tgithub.com/ionos-cloud/sdk-go-dbaas-mongo v1.3.1\n\tgithub.com/ionos-cloud/sdk-go-dbaas-postgres v1.1.2\n\tgithub.com/ionos-cloud/sdk-go/v6 v6.1.3\n\tgithub.com/jefferai/jsonx v1.0.1 // indirect\n\tgithub.com/jmespath/go-jmespath v0.4.0\n\tgithub.com/jonboydell/logzio_client v1.2.0\n\tgithub.com/labd/commercetools-go-sdk v0.3.1\n\tgithub.com/linode/linodego v0.24.1\n\tgithub.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5\n\tgithub.com/mrparkers/terraform-provider-keycloak v0.0.0-20221013232944-56f37a07590d\n\tgithub.com/nicksnyder/go-i18n v1.10.1 // indirect\n\tgithub.com/okta/okta-sdk-golang/v2 v2.12.2-0.20220602195034-d7ea6917663f\n\tgithub.com/opencontainers/image-spec v1.0.2 // indirect\n\tgithub.com/opencontainers/runc v1.1.12 // indirect\n\tgithub.com/opsgenie/opsgenie-go-sdk-v2 v1.2.9\n\tgithub.com/ory/dockertest v3.3.5+incompatible // indirect\n\tgithub.com/packethost/packngo v0.30.0\n\tgithub.com/pkg/errors v0.9.1\n\tgithub.com/ryanuber/go-glob v1.0.0 // indirect\n\tgithub.com/spf13/cobra v1.1.1\n\tgithub.com/spf13/pflag v1.0.5\n\tgithub.com/tencentyun/cos-go-sdk-v5 v0.7.34\n\tgithub.com/vultr/govultr v1.1.1\n\tgithub.com/xanzy/go-gitlab v0.50.2\n\tgithub.com/yandex-cloud/go-genproto v0.0.0-20220314102905-1acaee8ca7eb\n\tgithub.com/yandex-cloud/go-sdk v0.0.0-20220314105123-d0c2a928feb6\n\tgithub.com/zclconf/go-cty v1.11.0\n\tgithub.com/zorkian/go-datadog-api v2.30.0+incompatible\n\tgolang.org/x/oauth2 v0.24.0\n\tgolang.org/x/text v0.23.0\n\tgonum.org/v1/gonum v0.7.0\n\tgoogle.golang.org/api v0.214.0\n\tgoogle.golang.org/genproto v0.0.0-20241118233622-e639e219e697\n\tgopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect\n\tk8s.io/apimachinery v0.24.2\n\tk8s.io/client-go v0.24.2\n)\n\nrequire (\n\tgithub.com/IBM-Cloud/container-services-go-sdk v0.0.0-20210705152127-41ca00fc9a62\n\tgithub.com/IBM/go-sdk-core v1.1.0\n\tgithub.com/aws/aws-sdk-go-v2/internal/ini v1.7.2 // indirect\n\tgithub.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect\n\tgithub.com/mackerelio/mackerel-client-go v0.21.0\n\tgithub.com/okta/terraform-provider-okta v0.0.0-20210924173942-a5a664459d3b\n\tgithub.com/zclconf/go-cty-yaml v1.0.2 // indirect\n)\n\nrequire (\n\tgithub.com/Microsoft/go-winio v0.5.1 // indirect\n\tgithub.com/antihax/optional v1.0.0 // indirect\n\tgithub.com/gofrs/uuid v3.2.0+incompatible // indirect\n\tgithub.com/launchdarkly/api-client-go v5.3.0+incompatible\n)\n\nrequire github.com/newrelic/newrelic-client-go v1.1.0\n\nrequire (\n\tgithub.com/Azure/azure-pipeline-go v0.2.2 // indirect\n\tgithub.com/Azure/go-autorest v14.2.0+incompatible // indirect\n\tgithub.com/Azure/go-autorest/autorest/adal v0.9.18 // indirect\n\tgithub.com/Azure/go-autorest/autorest/azure/cli v0.4.4 // indirect\n\tgithub.com/Azure/go-autorest/autorest/date v0.3.0 // indirect\n\tgithub.com/Azure/go-autorest/autorest/to v0.4.0 // indirect\n\tgithub.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect\n\tgithub.com/Azure/go-autorest/logger v0.2.1 // indirect\n\tgithub.com/Azure/go-autorest/tracing v0.6.0 // indirect\n\tgithub.com/BurntSushi/toml v1.1.0 // indirect\n\tgithub.com/Masterminds/goutils v1.1.1 // indirect\n\tgithub.com/Masterminds/semver v1.5.0 // indirect\n\tgithub.com/Masterminds/sprig v2.22.0+incompatible // indirect\n\tgithub.com/agext/levenshtein v1.2.3 // indirect\n\tgithub.com/apparentlymart/go-cidr v1.1.0 // indirect\n\tgithub.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect\n\tgithub.com/appscode/go-querystring v0.0.0-20170504095604-0126cfb3f1dc // indirect\n\tgithub.com/armon/go-radix v1.0.0 // indirect\n\tgithub.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect\n\tgithub.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 // indirect\n\tgithub.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.10 // indirect\n\tgithub.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34 // indirect\n\tgithub.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34 // indirect\n\tgithub.com/aws/aws-sdk-go-v2/internal/v4a v1.2.9 // indirect\n\tgithub.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 // indirect\n\tgithub.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.9 // indirect\n\tgithub.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.10 // indirect\n\tgithub.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.9 // indirect\n\tgithub.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.9 // indirect\n\tgithub.com/aws/aws-sdk-go-v2/service/sso v1.18.5 // indirect\n\tgithub.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.5 // indirect\n\tgithub.com/aws/smithy-go v1.22.2\n\tgithub.com/beevik/etree v1.1.0 // indirect\n\tgithub.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect\n\tgithub.com/bgentry/speakeasy v0.1.0 // indirect\n\tgithub.com/blang/semver v3.5.1+incompatible // indirect\n\tgithub.com/bmatcuk/doublestar v1.1.5 // indirect\n\tgithub.com/cenkalti/backoff/v4 v4.1.3 // indirect\n\tgithub.com/crewjam/saml v0.4.13 // indirect\n\tgithub.com/davecgh/go-spew v1.1.1 // indirect\n\tgithub.com/dghubble/sling v1.1.0 // indirect\n\tgithub.com/dimchansky/utfbom v1.1.1 // indirect\n\tgithub.com/docker/go-units v0.4.0 // indirect\n\tgithub.com/fatih/color v1.16.0 // indirect\n\tgithub.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect\n\tgithub.com/ghodss/yaml v1.0.0 // indirect\n\tgithub.com/go-logr/logr v1.4.2 // indirect\n\tgithub.com/go-openapi/errors v0.22.0 // indirect\n\tgithub.com/go-openapi/strfmt v0.23.0 // indirect\n\tgithub.com/go-playground/locales v0.14.1 // indirect\n\tgithub.com/go-playground/universal-translator v0.18.1 // indirect\n\tgithub.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48 // indirect\n\tgithub.com/go-routeros/routeros v0.0.0-20210123142807-2a44d57c6730 // indirect\n\tgithub.com/gogo/protobuf v1.3.2 // indirect\n\tgithub.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect\n\tgithub.com/golang/protobuf v1.5.4 // indirect\n\tgithub.com/golang/snappy v0.0.4 // indirect\n\tgithub.com/google/go-cmp v0.6.0 // indirect\n\tgithub.com/google/go-querystring v1.1.0 // indirect\n\tgithub.com/google/gofuzz v1.1.0 // indirect\n\tgithub.com/google/jsonapi v1.0.0 // indirect\n\tgithub.com/google/uuid v1.6.0 // indirect\n\tgithub.com/googleapis/gax-go/v2 v2.14.0 // indirect\n\tgithub.com/gorilla/websocket v1.4.2 // indirect\n\tgithub.com/hashicorp/errwrap v1.1.0 // indirect\n\tgithub.com/hashicorp/go-getter v1.7.5 // indirect\n\tgithub.com/hashicorp/go-multierror v1.1.1 // indirect\n\tgithub.com/hashicorp/go-retryablehttp v0.7.7 // indirect\n\tgithub.com/hashicorp/go-rootcerts v1.0.0 // indirect\n\tgithub.com/hashicorp/go-safetemp v1.0.0 // indirect\n\tgithub.com/hashicorp/go-sockaddr v1.0.0 // indirect\n\tgithub.com/hashicorp/go-uuid v1.0.3 // indirect\n\tgithub.com/hashicorp/go-version v1.6.0 // indirect\n\tgithub.com/hashicorp/golang-lru v0.5.4 // indirect\n\tgithub.com/hashicorp/hcl/v2 v2.14.0 // indirect\n\tgithub.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590 // indirect\n\tgithub.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect\n\tgithub.com/huandu/xstrings v1.3.2 // indirect\n\tgithub.com/imdario/mergo v0.3.13 // indirect\n\tgithub.com/inconshreveable/mousetrap v1.0.0 // indirect\n\tgithub.com/jonboulle/clockwork v0.2.2 // indirect\n\tgithub.com/json-iterator/go v1.1.12 // indirect\n\tgithub.com/kelseyhightower/envconfig v1.4.0 // indirect\n\tgithub.com/klauspost/compress v1.15.11 // indirect\n\tgithub.com/leodido/go-urn v1.4.0 // indirect\n\tgithub.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect\n\tgithub.com/mattn/go-colorable v0.1.13 // indirect\n\tgithub.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d // indirect\n\tgithub.com/mattn/go-isatty v0.0.20 // indirect\n\tgithub.com/mitchellh/cli v1.1.2 // indirect\n\tgithub.com/mitchellh/copystructure v1.2.0 // indirect\n\tgithub.com/mitchellh/go-homedir v1.1.0\n\tgithub.com/mitchellh/go-testing-interface v1.14.1 // indirect\n\tgithub.com/mitchellh/go-wordwrap v1.0.0 // indirect\n\tgithub.com/mitchellh/hashstructure v1.0.0 // indirect\n\tgithub.com/mitchellh/mapstructure v1.5.0 // indirect\n\tgithub.com/mitchellh/reflectwalk v1.0.2 // indirect\n\tgithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect\n\tgithub.com/modern-go/reflect2 v1.0.2 // indirect\n\tgithub.com/mozillazg/go-httpheader v0.2.1 // indirect\n\tgithub.com/oklog/run v1.1.0 // indirect\n\tgithub.com/oklog/ulid v1.3.1 // indirect\n\tgithub.com/opencontainers/go-digest v1.0.0 // indirect\n\tgithub.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627 // indirect\n\tgithub.com/pborman/uuid v1.2.0 // indirect\n\tgithub.com/pelletier/go-toml v1.7.0 // indirect\n\tgithub.com/peterhellberg/link v1.1.0 // indirect\n\tgithub.com/pmezard/go-difflib v1.0.0 // indirect\n\tgithub.com/posener/complete v1.2.1 // indirect\n\tgithub.com/russellhaering/goxmldsig v1.2.0 // indirect\n\tgithub.com/sergi/go-diff v1.2.0 // indirect\n\tgithub.com/sirupsen/logrus v1.8.1 // indirect\n\tgithub.com/sourcegraph/jsonrpc2 v0.0.0-20210201082850-366fbb520750 // indirect\n\tgithub.com/spf13/afero v1.10.0 // indirect\n\tgithub.com/stretchr/testify v1.10.0 // indirect\n\tgithub.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect\n\tgithub.com/ulikunitz/xz v0.5.10 // indirect\n\tgithub.com/vmihailenco/msgpack/v4 v4.3.12 // indirect\n\tgithub.com/vmihailenco/tagparser v0.1.2 // indirect\n\tgithub.com/xdg-go/pbkdf2 v1.0.0 // indirect\n\tgithub.com/xdg-go/scram v1.1.2 // indirect\n\tgithub.com/xdg-go/stringprep v1.0.4 // indirect\n\tgithub.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect\n\tgo.mongodb.org/mongo-driver v1.14.0 // indirect\n\tgo.opencensus.io v0.24.0 // indirect\n\tgolang.org/x/crypto v0.36.0 // indirect\n\tgolang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect\n\tgolang.org/x/net v0.38.0 // indirect\n\tgolang.org/x/sync v0.12.0 // indirect\n\tgolang.org/x/sys v0.31.0 // indirect\n\tgolang.org/x/term v0.30.0 // indirect\n\tgolang.org/x/time v0.8.0 // indirect\n\tgolang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect\n\tgoogle.golang.org/appengine v1.6.8 // indirect\n\tgoogle.golang.org/grpc v1.67.3 // indirect\n\tgoogle.golang.org/protobuf v1.35.2 // indirect\n\tgopkg.in/auth0.v5 v5.21.1\n\tgopkg.in/go-playground/assert.v1 v1.2.1 // indirect\n\tgopkg.in/go-playground/validator.v9 v9.31.0 // indirect\n\tgopkg.in/inf.v0 v0.9.1 // indirect\n\tgopkg.in/ini.v1 v1.62.0 // indirect\n\tgopkg.in/square/go-jose.v2 v2.6.0 // indirect\n\tgopkg.in/yaml.v2 v2.4.0 // indirect\n\tgopkg.in/yaml.v3 v3.0.1 // indirect\n\tk8s.io/api v0.24.2 // indirect\n\tk8s.io/klog/v2 v2.60.1 // indirect\n\tk8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect\n\tsigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect\n\tsigs.k8s.io/yaml v1.2.0 // indirect\n)\n\nrequire github.com/PuerkitoBio/rehttp v1.0.0 // indirect\n\nrequire (\n\tcloud.google.com/go/cloudbuild v1.19.0\n\tcloud.google.com/go/cloudtasks v1.13.2\n\tcloud.google.com/go/iam v1.2.2\n\tcloud.google.com/go/monitoring v1.21.2\n\tgithub.com/DataDog/datadog-api-client-go/v2 v2.11.0\n\tgithub.com/Myra-Security-GmbH/myrasec-go/v2 v2.28.0\n\tgithub.com/bradleyfalzon/ghinstallation/v2 v2.1.0\n\tgithub.com/manicminer/hamilton v0.44.0\n\tgithub.com/opalsecurity/opal-go v1.0.19\n\tgopkg.in/ns1/ns1-go.v2 v2.6.5\n)\n\nrequire (\n\tcel.dev/expr v0.16.1 // indirect\n\tcloud.google.com/go/auth v0.13.0 // indirect\n\tcloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect\n\tcloud.google.com/go/compute/metadata v0.6.0 // indirect\n\tcloud.google.com/go/longrunning v0.6.2 // indirect\n\tgithub.com/DataDog/zstd v1.5.2 // indirect\n\tgithub.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0 // indirect\n\tgithub.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.1 // indirect\n\tgithub.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1 // indirect\n\tgithub.com/Myra-Security-GmbH/signature v1.0.0 // indirect\n\tgithub.com/PuerkitoBio/purell v1.1.1 // indirect\n\tgithub.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect\n\tgithub.com/cespare/xxhash/v2 v2.3.0 // indirect\n\tgithub.com/clbanning/mxj v1.8.4 // indirect\n\tgithub.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 // indirect\n\tgithub.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect\n\tgithub.com/emicklei/go-restful v2.16.0+incompatible // indirect\n\tgithub.com/envoyproxy/go-control-plane/envoy v1.32.3 // indirect\n\tgithub.com/envoyproxy/protoc-gen-validate v1.1.0 // indirect\n\tgithub.com/felixge/httpsnoop v1.0.4 // indirect\n\tgithub.com/gabriel-vasile/mimetype v1.4.3 // indirect\n\tgithub.com/go-jose/go-jose/v3 v3.0.4 // indirect\n\tgithub.com/go-logr/stdr v1.2.2 // indirect\n\tgithub.com/go-openapi/jsonpointer v0.19.5 // indirect\n\tgithub.com/go-openapi/jsonreference v0.19.5 // indirect\n\tgithub.com/go-openapi/swag v0.19.14 // indirect\n\tgithub.com/go-playground/validator/v10 v10.19.0 // indirect\n\tgithub.com/goccy/go-json v0.10.2 // indirect\n\tgithub.com/golang-jwt/jwt/v4 v4.5.2 // indirect\n\tgithub.com/google/gnostic v0.5.7-v3refs // indirect\n\tgithub.com/google/go-github/v45 v45.2.0 // indirect\n\tgithub.com/google/s2a-go v0.1.8 // indirect\n\tgithub.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect\n\tgithub.com/hashicorp/terraform-plugin-log v0.7.0 // indirect\n\tgithub.com/josharian/intern v1.0.0 // indirect\n\tgithub.com/lestrrat-go/backoff/v2 v2.0.8 // indirect\n\tgithub.com/lestrrat-go/blackmagic v1.0.2 // indirect\n\tgithub.com/lestrrat-go/httpcc v1.0.1 // indirect\n\tgithub.com/lestrrat-go/iter v1.0.2 // indirect\n\tgithub.com/lestrrat-go/jwx v1.2.29 // indirect\n\tgithub.com/lestrrat-go/option v1.0.1 // indirect\n\tgithub.com/mailru/easyjson v0.7.6 // indirect\n\tgithub.com/manicminer/hamilton-autorest v0.2.0 // indirect\n\tgithub.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect\n\tgithub.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect\n\tgithub.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect\n\tgithub.com/valyala/fastjson v1.6.3 // indirect\n\tgo.opentelemetry.io/contrib/detectors/gcp v1.29.0 // indirect\n\tgo.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect\n\tgo.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect\n\tgo.opentelemetry.io/otel v1.29.0 // indirect\n\tgo.opentelemetry.io/otel/metric v1.29.0 // indirect\n\tgo.opentelemetry.io/otel/sdk v1.29.0 // indirect\n\tgo.opentelemetry.io/otel/sdk/metric v1.29.0 // indirect\n\tgo.opentelemetry.io/otel/trace v1.29.0 // indirect\n\tgolang.org/x/tools/cmd/cover v0.1.0-deprecated // indirect\n\tgoogle.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 // indirect\n\tgoogle.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect\n\tk8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 // indirect\n\tsigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect\n)\n\nrequire (\n\tgithub.com/IBM/continuous-delivery-go-sdk/v2 v2.0.2\n\tgithub.com/aws/aws-sdk-go v1.44.122\n\tgithub.com/aws/aws-sdk-go-v2/service/directconnect v1.30.1\n\tgithub.com/gofrs/uuid/v3 v3.1.2\n\tgithub.com/ionos-cloud/sdk-go-cert-manager v1.0.0\n\tgithub.com/ionos-cloud/sdk-go-container-registry v1.0.0\n\tgithub.com/ionos-cloud/sdk-go-dataplatform v1.0.1\n\tgithub.com/ionos-cloud/sdk-go-dns v1.1.1\n\tgithub.com/ionos-cloud/sdk-go-logging v1.0.1\n\tgithub.com/okta/okta-sdk-golang/v5 v5.0.1\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/as v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cbs v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfs v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.694\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.694\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb v1.0.392\n\tgithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc v1.0.392\n)\n\nreplace gopkg.in/jarcoal/httpmock.v1 => github.com/jarcoal/httpmock v1.0.5\n\nreplace gopkg.in/ns1/ns1-go.v2 => github.com/ns1/ns1-go/v2 v2.6.5\n\nreplace github.com/tencentcloud/tencentcloud-sdk-go => github.com/tencentcloud/tencentcloud-sdk-go v1.0.392\n"
  },
  {
    "path": "go.sum",
    "content": "bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8=\ncel.dev/expr v0.16.1 h1:NR0+oFYzR1CqLFhTAqg3ql59G9VfN8fKq1TCHJ6gq1g=\ncel.dev/expr v0.16.1/go.mod h1:AsGA5zb3WruAEQeQng1RZdGEXmBj0jvMWh6l5SnNuC8=\ncloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=\ncloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=\ncloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=\ncloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=\ncloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=\ncloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=\ncloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=\ncloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=\ncloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=\ncloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=\ncloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=\ncloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=\ncloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=\ncloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=\ncloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=\ncloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=\ncloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY=\ncloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=\ncloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=\ncloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=\ncloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY=\ncloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM=\ncloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY=\ncloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ=\ncloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=\ncloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4=\ncloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc=\ncloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA=\ncloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A=\ncloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc=\ncloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU=\ncloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA=\ncloud.google.com/go v0.116.0 h1:B3fRrSDkLRt5qSHWe40ERJvhvnQwdZiHu0bJOpldweE=\ncloud.google.com/go v0.116.0/go.mod h1:cEPSRWPzZEswwdr9BxE6ChEn01dWlTaF05LiC2Xs70U=\ncloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw=\ncloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY=\ncloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI=\ncloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4=\ncloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4=\ncloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0=\ncloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ=\ncloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk=\ncloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o=\ncloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s=\ncloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0=\ncloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY=\ncloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw=\ncloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI=\ncloud.google.com/go/auth v0.13.0 h1:8Fu8TZy167JkW8Tj3q7dIkr2v4cndv41ouecJx0PAHs=\ncloud.google.com/go/auth v0.13.0/go.mod h1:COOjD9gwfKNKz+IIduatIhYJQIc0mG3H102r/EMxX6Q=\ncloud.google.com/go/auth/oauth2adapt v0.2.6 h1:V6a6XDu2lTwPZWOawrAa9HUK+DB2zfJyTuciBG5hFkU=\ncloud.google.com/go/auth/oauth2adapt v0.2.6/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8=\ncloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0=\ncloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8=\ncloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=\ncloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=\ncloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=\ncloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=\ncloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=\ncloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=\ncloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA=\ncloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY=\ncloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s=\ncloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM=\ncloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI=\ncloud.google.com/go/cloudbuild v1.19.0 h1:Uo0bL251yvyWsNtO3Og9m5Z4S48cgGf3IUX7xzOcl8s=\ncloud.google.com/go/cloudbuild v1.19.0/go.mod h1:ZGRqbNMrVGhknIIjwASa6MqoRTOpXIVMSI+Ew5DMPuY=\ncloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY=\ncloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI=\ncloud.google.com/go/cloudtasks v1.13.2 h1:x6Qw5JyNbH3reL0arUtlYf77kK6OVjZZ//8JCvUkLro=\ncloud.google.com/go/cloudtasks v1.13.2/go.mod h1:2pyE4Lhm7xY8GqbZKLnYk7eeuh8L0JwAvXx1ecKxYu8=\ncloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow=\ncloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM=\ncloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M=\ncloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s=\ncloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU=\ncloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U=\ncloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU=\ncloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I=\ncloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg=\ncloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I=\ncloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4=\ncloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0=\ncloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs=\ncloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc=\ncloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM=\ncloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ=\ncloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo=\ncloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE=\ncloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I=\ncloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ=\ncloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo=\ncloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA=\ncloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=\ncloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=\ncloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo=\ncloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ=\ncloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4=\ncloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0=\ncloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8=\ncloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU=\ncloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU=\ncloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y=\ncloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg=\ncloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk=\ncloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w=\ncloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=\ncloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk=\ncloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg=\ncloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM=\ncloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA=\ncloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o=\ncloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A=\ncloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0=\ncloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0=\ncloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc=\ncloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY=\ncloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc=\ncloud.google.com/go/iam v1.2.2 h1:ozUSofHUGf/F4tCNy/mu9tHLTaxZFLOUiKzjcgWHGIA=\ncloud.google.com/go/iam v1.2.2/go.mod h1:0Ys8ccaZHdI1dEUilwzqng/6ps2YB6vRsjIe00/+6JY=\ncloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic=\ncloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI=\ncloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8=\ncloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08=\ncloud.google.com/go/logging v1.12.0 h1:ex1igYcGFd4S/RZWOCU51StlIEuey5bjqwH9ZYjHibk=\ncloud.google.com/go/logging v1.12.0/go.mod h1:wwYBt5HlYP1InnrtYI0wtwttpVU1rifnMT7RejksUAM=\ncloud.google.com/go/longrunning v0.6.2 h1:xjDfh1pQcWPEvnfjZmwjKQEcHnpz6lHjfy7Fo0MK+hc=\ncloud.google.com/go/longrunning v0.6.2/go.mod h1:k/vIs83RN4bE3YCswdXC5PFfWVILjm3hpEUlSko4PiI=\ncloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4=\ncloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w=\ncloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE=\ncloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM=\ncloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY=\ncloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s=\ncloud.google.com/go/monitoring v1.21.2 h1:FChwVtClH19E7pJ+e0xUhJPGksctZNVOk2UhMmblmdU=\ncloud.google.com/go/monitoring v1.21.2/go.mod h1:hS3pXvaG8KgWTSz+dAdyzPrGUYmi2Q+WFX8g2hqVEZU=\ncloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA=\ncloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o=\ncloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ=\ncloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU=\ncloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY=\ncloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34=\ncloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs=\ncloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg=\ncloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E=\ncloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU=\ncloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0=\ncloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA=\ncloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0=\ncloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI=\ncloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=\ncloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=\ncloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=\ncloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=\ncloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4=\ncloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o=\ncloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk=\ncloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo=\ncloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg=\ncloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4=\ncloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg=\ncloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c=\ncloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y=\ncloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A=\ncloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4=\ncloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY=\ncloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s=\ncloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI=\ncloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA=\ncloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4=\ncloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0=\ncloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU=\ncloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU=\ncloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc=\ncloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs=\ncloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg=\ncloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM=\ncloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ=\ncloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=\ncloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=\ncloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=\ncloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=\ncloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=\ncloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=\ncloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y=\ncloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc=\ncloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s=\ncloud.google.com/go/storage v1.50.0 h1:3TbVkzTooBvnZsk7WaAQfOsNrdoM8QHusXA1cpk6QJs=\ncloud.google.com/go/storage v1.50.0/go.mod h1:l7XeiD//vx5lfqE3RavfmU9yvk5Pp0Zhcv482poyafY=\ncloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw=\ncloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g=\ncloud.google.com/go/trace v1.11.2 h1:4ZmaBdL8Ng/ajrgKqY5jfvzqMXbrDcBsUGXOT9aqTtI=\ncloud.google.com/go/trace v1.11.2/go.mod h1:bn7OwXd4pd5rFuAnTrzBuoZ4ax2XQeG3qNgYmfCy0Io=\ncloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU=\ncloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4=\ncloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0=\ncloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo=\ncloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo=\ncloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE=\ncloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg=\ncloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0=\ncloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M=\ndmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=\ngithub.com/Azure/azure-pipeline-go v0.2.2 h1:6oiIS9yaG6XCCzhgAgKFfIWyo4LLCiDhZot6ltoThhY=\ngithub.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc=\ngithub.com/Azure/azure-sdk-for-go v35.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=\ngithub.com/Azure/azure-sdk-for-go v36.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=\ngithub.com/Azure/azure-sdk-for-go v63.4.0+incompatible h1:fle3M5Q7vr8auaiPffKyUQmLbvYeqpw30bKU6PrWJFo=\ngithub.com/Azure/azure-sdk-for-go v63.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=\ngithub.com/Azure/azure-storage-blob-go v0.10.0 h1:evCwGreYo3XLeBV4vSxLbLiYb6e0SzsJiXQVRGsRXxs=\ngithub.com/Azure/azure-storage-blob-go v0.10.0/go.mod h1:ep1edmW+kNQx4UfWM9heESNmQdijykocJ0YOxmMX8SE=\ngithub.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=\ngithub.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=\ngithub.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=\ngithub.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=\ngithub.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=\ngithub.com/Azure/go-autorest/autorest v0.9.2/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=\ngithub.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA=\ngithub.com/Azure/go-autorest/autorest v0.11.24/go.mod h1:G6kyRlFnTuSbEYkQGawPfsCswgme4iYf6rfSKUDzbCc=\ngithub.com/Azure/go-autorest/autorest v0.11.27 h1:F3R3q42aWytozkV8ihzcgMO4OA4cuqr3bNlsEuF6//A=\ngithub.com/Azure/go-autorest/autorest v0.11.27/go.mod h1:7l8ybrIdUmGqZMTD0sRtAr8NvbHjfofbf8RSP2q7w7U=\ngithub.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=\ngithub.com/Azure/go-autorest/autorest/adal v0.8.1-0.20191028180845-3492b2aff503/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc=\ngithub.com/Azure/go-autorest/autorest/adal v0.8.3/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q=\ngithub.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M=\ngithub.com/Azure/go-autorest/autorest/adal v0.9.14/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M=\ngithub.com/Azure/go-autorest/autorest/adal v0.9.18 h1:kLnPsRjzZZUF3K5REu/Kc+qMQrvuza2bwSnNdhmzLfQ=\ngithub.com/Azure/go-autorest/autorest/adal v0.9.18/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ=\ngithub.com/Azure/go-autorest/autorest/azure/cli v0.2.0/go.mod h1:WWTbGPvkAg3I4ms2j2s+Zr5xCGwGqTQh+6M2ZqOczkE=\ngithub.com/Azure/go-autorest/autorest/azure/cli v0.4.4 h1:iuooz5cZL6VRcO7DVSFYxRcouqn6bFVE/e77Wts50Zk=\ngithub.com/Azure/go-autorest/autorest/azure/cli v0.4.4/go.mod h1:yAQ2b6eP/CmLPnmLvxtT1ALIY3OR1oFcCqVBi8vHiTc=\ngithub.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=\ngithub.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g=\ngithub.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw=\ngithub.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=\ngithub.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=\ngithub.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=\ngithub.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=\ngithub.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=\ngithub.com/Azure/go-autorest/autorest/mocks v0.4.2 h1:PGN4EDXnuQbojHbU0UWoNvmu9AGVwYHG9/fkDYhtAfw=\ngithub.com/Azure/go-autorest/autorest/mocks v0.4.2/go.mod h1:Vy7OitM9Kei0i1Oj+LvyAWMXJHeKH1MVlzFugfVrmyU=\ngithub.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA=\ngithub.com/Azure/go-autorest/autorest/to v0.4.0 h1:oXVqrxakqqV1UZdSazDOPOLvOIz+XA683u8EctwboHk=\ngithub.com/Azure/go-autorest/autorest/to v0.4.0/go.mod h1:fE8iZBn7LQR7zH/9XU2NcPR4o9jEImooCeWJcYV/zLE=\ngithub.com/Azure/go-autorest/autorest/validation v0.2.0/go.mod h1:3EEqHnBxQGHXRYq3HT1WyXAvT7LLY3tl70hw6tQIbjI=\ngithub.com/Azure/go-autorest/autorest/validation v0.3.1 h1:AgyqjAd94fwNAoTjl/WQXg4VvFeRFpO+UhNyRXqF1ac=\ngithub.com/Azure/go-autorest/autorest/validation v0.3.1/go.mod h1:yhLgjC0Wda5DYXl6JAsWyUe4KVNffhoDhG0zVzUMo3E=\ngithub.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=\ngithub.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg=\ngithub.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=\ngithub.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=\ngithub.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo=\ngithub.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=\ngithub.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=\ngithub.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=\ngithub.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=\ngithub.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=\ngithub.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=\ngithub.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4=\ngithub.com/DataDog/datadog-api-client-go/v2 v2.11.0 h1:7KCEQ3S90PIH1GcqFHcnwDpNfZbqa2BsiF8OYmLb4Jk=\ngithub.com/DataDog/datadog-api-client-go/v2 v2.11.0/go.mod h1:kntOqXEh1SmjwSDzW/eJkr9kS7EqttvEkelglWtJRbg=\ngithub.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8=\ngithub.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=\ngithub.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0 h1:3c8yed4lgqTt+oTQ+JNMDo+F4xprBf+O/il4ZC0nRLw=\ngithub.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0/go.mod h1:obipzmGjfSjam60XLwGfqUkJsfiheAl+TUjG+4yzyPM=\ngithub.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.1 h1:UQ0AhxogsIRZDkElkblfnwjc3IaltCm2HUMvezQaL7s=\ngithub.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.48.1/go.mod h1:jyqM3eLpJ3IbIFDTKVz2rF9T/xWGW0rIriGwnz8l9Tk=\ngithub.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.48.1 h1:oTX4vsorBZo/Zdum6OKPA4o7544hm6smoRv1QjpTwGo=\ngithub.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.48.1/go.mod h1:0wEl7vrAD8mehJyohS9HZy+WyEOaQO2mJx86Cvh93kM=\ngithub.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1 h1:8nn+rsCvTq9axyEh382S0PFLBeaFwNsT43IrPWzctRU=\ngithub.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.48.1/go.mod h1:viRWSEhtMZqz1rhwmOVKkWl6SwmVowfL9O2YR5gI2PE=\ngithub.com/IBM-Cloud/bluemix-go v0.0.0-20220624043500-d538cb4fd9be h1:PTW3J9z39tJYnmtdAxi8WvTWQXfkOflTJw6noyjnno4=\ngithub.com/IBM-Cloud/bluemix-go v0.0.0-20220624043500-d538cb4fd9be/go.mod h1:tfNN3lCKuA2+SQvndt0+5CjPr2qn/wdNLjrue1GrOhY=\ngithub.com/IBM-Cloud/container-services-go-sdk v0.0.0-20210705152127-41ca00fc9a62 h1:MOkcr6qQGk4tY542ZJ1DggVh2WUP72EEyLB79llFVH8=\ngithub.com/IBM-Cloud/container-services-go-sdk v0.0.0-20210705152127-41ca00fc9a62/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY=\ngithub.com/IBM/continuous-delivery-go-sdk/v2 v2.0.2 h1:yCJJnSLNYkpF7v9n0tw8CpQbSy43E/NbFOopRf1PgoM=\ngithub.com/IBM/continuous-delivery-go-sdk/v2 v2.0.2/go.mod h1:2MajFr6C5H2jyj7qtjBxAPnZAjbPiK4CAJNk3fKNnPo=\ngithub.com/IBM/go-sdk-core v1.1.0 h1:pV73lZqr9r1xKb3h08c1uNG3AphwoV5KzUzhS+pfEqY=\ngithub.com/IBM/go-sdk-core v1.1.0/go.mod h1:2pcx9YWsIsZ3I7kH+1amiAkXvLTZtAq9kbxsfXilSoY=\ngithub.com/IBM/go-sdk-core/v3 v3.3.1 h1:DoXjP1+Wm8Yd4XJsvBMRcYLvQwSLFnzKlMjSrg3Rzpw=\ngithub.com/IBM/go-sdk-core/v3 v3.3.1/go.mod h1:lk9eOzNbNltPf3CBpcg1Ewkhw4qC3u2QCCKDRsUA2M0=\ngithub.com/IBM/go-sdk-core/v4 v4.9.0 h1:OkSg5kaEfVoNuBA4IsIOz8Ur5rbGHbWxmWCZ7nK/oc0=\ngithub.com/IBM/go-sdk-core/v4 v4.9.0/go.mod h1:DbQ+3pFoIjxGGTEiA9zQ2V0cemMNmFMkLBBnR729HKg=\ngithub.com/IBM/go-sdk-core/v5 v5.5.1/go.mod h1:Sn+z+qTDREQvCr+UFa22TqqfXNxx3o723y8GsfLV8e0=\ngithub.com/IBM/go-sdk-core/v5 v5.8.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc0XQUqRO9Jc=\ngithub.com/IBM/go-sdk-core/v5 v5.10.1/go.mod h1:u/33BzPy8sthgEhSeBnf6/kPCqwvC9VKw5byfqQfbe0=\ngithub.com/IBM/go-sdk-core/v5 v5.18.1 h1:wdftQO8xejECTWTKF3FGXyW0McKxxDAopH7MKwA187c=\ngithub.com/IBM/go-sdk-core/v5 v5.18.1/go.mod h1:3ywpylZ41WhWPusqtpJZWopYlt2brebcphV7mA2JncU=\ngithub.com/IBM/ibm-cos-sdk-go v1.5.0 h1:YCmAgsdtp/irQep5g+62OvjLNj35tMXLqTC5jQ+YjWo=\ngithub.com/IBM/ibm-cos-sdk-go v1.5.0/go.mod h1:4mqv/ejW1PKW+Ij6ytU+W8j1UZeLmSEsR5K+flBaWMY=\ngithub.com/IBM/keyprotect-go-client v0.8.1 h1:viTQCtoeWQeDRTe8S0ed++uM4J2uf1DGuQbV9mNTCj8=\ngithub.com/IBM/keyprotect-go-client v0.8.1/go.mod h1:yr8h2noNgU8vcbs+vhqoXp3Lmv73PI0zAc6VMgFvWwM=\ngithub.com/IBM/networking-go-sdk v0.30.0 h1:GUfvq4AOK0iTUEodPL2k812y2W1GdZs6hUTa81KUKys=\ngithub.com/IBM/networking-go-sdk v0.30.0/go.mod h1:tVxXclpQs8nQJYPTr9ZPNC1voaPNQLy8iy/72oVfFtM=\ngithub.com/IBM/platform-services-go-sdk v0.26.1 h1:8maFrdgp8su5H99v5/fith9ft+nE1V7RRpcM3jBUKYs=\ngithub.com/IBM/platform-services-go-sdk v0.26.1/go.mod h1:ZFuISyKu+qekMfvFebzqJ8AIpNlRqI7a6WuieGfjGuA=\ngithub.com/IBM/vpc-go-sdk v0.64.0 h1:0x2jakapXxXYTTr0EdrwuXa6h0couSK+FTDGxd8jChA=\ngithub.com/IBM/vpc-go-sdk v0.64.0/go.mod h1:VBR6bAznHsNCFA89Ue4JFQpqCcFp8F5neqbCFCyks4Q=\ngithub.com/Jeffail/gabs/v2 v2.1.0 h1:6dV9GGOjoQgzWTQEltZPXlJdFloxvIq7DwqgxMCbq30=\ngithub.com/Jeffail/gabs/v2 v2.1.0/go.mod h1:xCn81vdHKxFUuWWAaD5jCTQDNPBMh5pPs9IJ+NcziBI=\ngithub.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=\ngithub.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=\ngithub.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=\ngithub.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=\ngithub.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=\ngithub.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60=\ngithub.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=\ngithub.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY=\ngithub.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=\ngithub.com/Myra-Security-GmbH/myrasec-go/v2 v2.28.0 h1:/j5vGm0MB++gzimxjR53JCB/7PApCfxdaV52nU5FTC8=\ngithub.com/Myra-Security-GmbH/myrasec-go/v2 v2.28.0/go.mod h1:A3VaeNipYmfNnHIJVEzyBmfHSWjK7c9aNfbpmRbFiS8=\ngithub.com/Myra-Security-GmbH/signature v1.0.0 h1:u46nIxnffLLb8pCe6ic2w7OmSSEJk4warn3W4Vp2GjQ=\ngithub.com/Myra-Security-GmbH/signature v1.0.0/go.mod h1:zgyy5MGBCezqxVOjrG3THQJqsIfJ04LWtQv3Q4Ug2+Y=\ngithub.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46 h1:lsxEuwrXEAokXB9qhlbKWPpo3KMLZQ5WB5WLQRW1uq0=\ngithub.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=\ngithub.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw=\ngithub.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk=\ngithub.com/OctopusDeploy/go-octopusdeploy v1.6.0 h1:r9ThVuANGkzm3noAjLF/i7LUcxQxbCJwpvn1DLwPoOA=\ngithub.com/OctopusDeploy/go-octopusdeploy v1.6.0/go.mod h1:maPbD8azyb2mcNN6E4SGrwiLN7XmDSML5ui+mcWR/R0=\ngithub.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=\ngithub.com/PaloAltoNetworks/pango v0.8.0 h1:ABzKykGkKZSzsAMW3n2SQ3rwK+dXKDZQbQSSyDBuXmU=\ngithub.com/PaloAltoNetworks/pango v0.8.0/go.mod h1:xpwEKL6CHhniRcqKYTjIiGBzPd3QIyto3sz2ynsP1qg=\ngithub.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=\ngithub.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=\ngithub.com/PuerkitoBio/rehttp v1.0.0 h1:aJ7A7YI2lIvOxcJVeUZY4P6R7kKZtLeONjgyKGwOIu8=\ngithub.com/PuerkitoBio/rehttp v1.0.0/go.mod h1:ItsOiHl4XeMOV3rzbZqQRjLc3QQxbE6391/9iNG7rE8=\ngithub.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=\ngithub.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=\ngithub.com/QcloudApi/qcloud_sign_golang v0.0.0-20141224014652-e4130a326409/go.mod h1:1pk82RBxDY/JZnPQrtqHlUFfCctgdorsd9M06fMynOM=\ngithub.com/SAP/go-hdb v0.105.2 h1:ZVsCj1fMBYFfAG9ZlsA9ARmM3dv24tzotBS2ghyKY0c=\ngithub.com/SAP/go-hdb v0.105.2/go.mod h1:+xdpA6/O3mALSp1bmn8yldN2aq1TCxZ7Ah0AuAm8B7E=\ngithub.com/SermoDigital/jose v0.9.1 h1:atYaHPD3lPICcbK1owly3aPm0iaJGSGPi0WD4vLznv8=\ngithub.com/SermoDigital/jose v0.9.1/go.mod h1:ARgCUhI1MHQH+ONky/PAtmVHQrP5JlGY0F3poXOp/fA=\ngithub.com/Unknwon/com v0.0.0-20151008135407-28b053d5a292/go.mod h1:KYCjqMOeHpNuTOiFQU6WEcTG7poCJrUs0YgyHNtn1no=\ngithub.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw=\ngithub.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=\ngithub.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=\ngithub.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=\ngithub.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=\ngithub.com/agl/ed25519 v0.0.0-20150830182803-278e1ec8e8a6 h1:LoeFxdq5zUCBQPhbQKE6zvoGwHMxCBlqwbH9+9kHoHA=\ngithub.com/agl/ed25519 v0.0.0-20150830182803-278e1ec8e8a6/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0=\ngithub.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=\ngithub.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=\ngithub.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=\ngithub.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190329064014-6e358769c32a/go.mod h1:T9M45xf79ahXVelWoOBmH0y4aC1t5kXO5BxwyakgIGA=\ngithub.com/aliyun/alibaba-cloud-sdk-go v1.61.1247 h1:2RSX5oi4GuhZnOpuW5EA6618G8mvP1X88o/4rleB5/A=\ngithub.com/aliyun/alibaba-cloud-sdk-go v1.61.1247/go.mod h1:9CMdKNL3ynIGPpfTcdwTvIm8SGuAZYYC4jFVSSvE1YQ=\ngithub.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190103054945-8205d1f41e70/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=\ngithub.com/aliyun/aliyun-tablestore-go-sdk v4.1.2+incompatible h1:ABQ7FF+IxSFHDMOTtjCfmMDMHiCq6EsAoCV/9sFinaM=\ngithub.com/aliyun/aliyun-tablestore-go-sdk v4.1.2+incompatible/go.mod h1:LDQHRZylxvcg8H7wBIDfvO5g/cy4/sz1iucBlc2l3Jw=\ngithub.com/antchfx/xpath v0.0.0-20190129040759-c8489ed3251e/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk=\ngithub.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M=\ngithub.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=\ngithub.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=\ngithub.com/apache/openwhisk-client-go v0.0.0-20210106144548-17d556327cd3 h1:CMvrWrV6C3FOAscQwvCcRGQyQ93KLMTUXCFFS+JGgP4=\ngithub.com/apache/openwhisk-client-go v0.0.0-20210106144548-17d556327cd3/go.mod h1:jLLKYP7+1+LFlIJW1n9U1gqeveLM1HIwa4ZHNOFxjPw=\ngithub.com/apparentlymart/go-cidr v1.0.1/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc=\ngithub.com/apparentlymart/go-cidr v1.1.0 h1:2mAhrMoF+nhXqxTzSZMUzDHkLjmIHC+Zzn4tdgBZjnU=\ngithub.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc=\ngithub.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=\ngithub.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I=\ngithub.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM=\ngithub.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=\ngithub.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=\ngithub.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=\ngithub.com/apparentlymart/go-versions v0.0.2-0.20180815153302-64b99f7cb171/go.mod h1:JXY95WvQrPJQtudvNARshgWajS7jNNlM90altXIPNyI=\ngithub.com/appscode/go-querystring v0.0.0-20170504095604-0126cfb3f1dc h1:LoL75er+LKDHDUfU5tRvFwxH0LjPpZN8OoG8Ll+liGU=\ngithub.com/appscode/go-querystring v0.0.0-20170504095604-0126cfb3f1dc/go.mod h1:w648aMHEgFYS6xb0KVMMtZ2uMeemhiKCuD2vj6gY52A=\ngithub.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=\ngithub.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=\ngithub.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=\ngithub.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I=\ngithub.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=\ngithub.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=\ngithub.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=\ngithub.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=\ngithub.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=\ngithub.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=\ngithub.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=\ngithub.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=\ngithub.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=\ngithub.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM=\ngithub.com/aws/aws-sdk-go v1.25.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=\ngithub.com/aws/aws-sdk-go v1.30.12/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=\ngithub.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48=\ngithub.com/aws/aws-sdk-go v1.44.122 h1:p6mw01WBaNpbdP2xrisz5tIkcNwzj/HysobNoaAHjgo=\ngithub.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=\ngithub.com/aws/aws-sdk-go-v2 v1.36.3 h1:mJoei2CxPutQVxaATCzDUjcZEjVRdpsiiXi2o38yqWM=\ngithub.com/aws/aws-sdk-go-v2 v1.36.3/go.mod h1:LLXuLpgzEbD766Z5ECcRmi8AzSwfZItDtmABVkRLGzg=\ngithub.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 h1:OCs21ST2LrepDfD3lwlQiOqIGp6JiEUqG84GzTDoyJs=\ngithub.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4/go.mod h1:usURWEKSNNAcAZuzRn/9ZYPT8aZQkR7xcCtunK/LkJo=\ngithub.com/aws/aws-sdk-go-v2/config v1.26.1 h1:z6DqMxclFGL3Zfo+4Q0rLnAZ6yVkzCRxhRMsiRQnD1o=\ngithub.com/aws/aws-sdk-go-v2/config v1.26.1/go.mod h1:ZB+CuKHRbb5v5F0oJtGdhFTelmrxd4iWO1lf0rQwSAg=\ngithub.com/aws/aws-sdk-go-v2/credentials v1.16.12 h1:v/WgB8NxprNvr5inKIiVVrXPuuTegM+K8nncFkr1usU=\ngithub.com/aws/aws-sdk-go-v2/credentials v1.16.12/go.mod h1:X21k0FjEJe+/pauud82HYiQbEr9jRKY3kXEIQ4hXeTQ=\ngithub.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.10 h1:w98BT5w+ao1/r5sUuiH6JkVzjowOKeOJRHERyy1vh58=\ngithub.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.10/go.mod h1:K2WGI7vUvkIv1HoNbfBA1bvIZ+9kL3YVmWxeKuLQsiw=\ngithub.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34 h1:ZK5jHhnrioRkUNOc+hOgQKlUL5JeC3S6JgLxtQ+Rm0Q=\ngithub.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34/go.mod h1:p4VfIceZokChbA9FzMbRGz5OV+lekcVtHlPKEO0gSZY=\ngithub.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34 h1:SZwFm17ZUNNg5Np0ioo/gq8Mn6u9w19Mri8DnJ15Jf0=\ngithub.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34/go.mod h1:dFZsC0BLo346mvKQLWmoJxT+Sjp+qcVR1tRVHQGOH9Q=\ngithub.com/aws/aws-sdk-go-v2/internal/ini v1.7.2 h1:GrSw8s0Gs/5zZ0SX+gX4zQjRnRsMJDJ2sLur1gRBhEM=\ngithub.com/aws/aws-sdk-go-v2/internal/ini v1.7.2/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY=\ngithub.com/aws/aws-sdk-go-v2/internal/v4a v1.2.9 h1:ugD6qzjYtB7zM5PN/ZIeaAIyefPaD82G8+SJopgvUpw=\ngithub.com/aws/aws-sdk-go-v2/internal/v4a v1.2.9/go.mod h1:YD0aYBWCrPENpHolhKw2XDlTIWae2GKXT1T4o6N6hiM=\ngithub.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.26.5 h1:UdqJHYgBmOYhVA1ixaECd4MTS7EoqWdDeP87YuDauB0=\ngithub.com/aws/aws-sdk-go-v2/service/accessanalyzer v1.26.5/go.mod h1:grUsKCGlUQ80qedCiWN8LMlqmm97v81jr/sM1GXBjfg=\ngithub.com/aws/aws-sdk-go-v2/service/acm v1.22.5 h1:GNTWQH4PWazAsb3VXePxGKwzi7OiU8AedMajRJoQEQ8=\ngithub.com/aws/aws-sdk-go-v2/service/acm v1.22.5/go.mod h1:yAwtFXtwrusYjymwgH4ofDG3by5KZvoBt8m87zYzotY=\ngithub.com/aws/aws-sdk-go-v2/service/apigateway v1.21.5 h1:5ZS6foV/73y4oDZuuwYgPh6htPrTOTdYy6eWnCHGleU=\ngithub.com/aws/aws-sdk-go-v2/service/apigateway v1.21.5/go.mod h1:P/zwE9uiC6eK/kL3CS60lxTTVC2zAvaS4iW31io41V4=\ngithub.com/aws/aws-sdk-go-v2/service/appsync v1.26.5 h1:sE3C1/KFq6alTwYZRNZz1D+tepwdWP3BijOxh4wipbc=\ngithub.com/aws/aws-sdk-go-v2/service/appsync v1.26.5/go.mod h1:q6yeacrYIXpYt156QvapKEPTn7X7TpeP3R6mVzRhNKE=\ngithub.com/aws/aws-sdk-go-v2/service/autoscaling v1.36.5 h1:kyNx3ieC65DxlJvkKYer8/PbP35YN2fn8T4jJYGQBtA=\ngithub.com/aws/aws-sdk-go-v2/service/autoscaling v1.36.5/go.mod h1:ldeYLrGhWz2aMgCEL7He3+YbJAG5xn1K/fFFKRkyzd0=\ngithub.com/aws/aws-sdk-go-v2/service/batch v1.30.5 h1:plf1gPkD4t7yFygClkfxYREpDnLu/tub6tJO6U31TKU=\ngithub.com/aws/aws-sdk-go-v2/service/batch v1.30.5/go.mod h1:PueWUeJBztSAvgaTrbefYvj+kOhBbjE2nia473vk2L8=\ngithub.com/aws/aws-sdk-go-v2/service/budgets v1.20.5 h1:w1xR0sN2WxxFFNbho+ZV8nPMSQYh5xpSb2gcYyTNAHo=\ngithub.com/aws/aws-sdk-go-v2/service/budgets v1.20.5/go.mod h1:D4rKTOJy1j5RRfdSp13l4KYTRIGScMFORz9hf/OJKtk=\ngithub.com/aws/aws-sdk-go-v2/service/cloud9 v1.22.3 h1:FfMvSbgRZAkp3abKOGR0bjWgSabXgZxEDFYHcfwW9qk=\ngithub.com/aws/aws-sdk-go-v2/service/cloud9 v1.22.3/go.mod h1:R80rQE5F5/Qf+l4pTpxq8GiEd0OqLo3/S5bNBNEs04A=\ngithub.com/aws/aws-sdk-go-v2/service/cloudformation v1.42.4 h1:nQkJLC3ytsYFW1nVzBwbOaJ2EZ8MEclsVcF94S1sNPg=\ngithub.com/aws/aws-sdk-go-v2/service/cloudformation v1.42.4/go.mod h1:oPk8ZMctRUtGC13pOE83Zp0baZgJsmzuKm4IRR+zQOI=\ngithub.com/aws/aws-sdk-go-v2/service/cloudfront v1.32.5 h1:synDXYpTr5FA80g8twNr49Dd7iAKnxerp93l/kNm/cQ=\ngithub.com/aws/aws-sdk-go-v2/service/cloudfront v1.32.5/go.mod h1:Dil6nVeCPyPc1gF5EeCrVUTtXexn80MpfqhgSp/Zb64=\ngithub.com/aws/aws-sdk-go-v2/service/cloudhsmv2 v1.19.5 h1:JXE1e32WM9tcbmuMkUSkshrPbPx3BHyKdr/Nd5esBtg=\ngithub.com/aws/aws-sdk-go-v2/service/cloudhsmv2 v1.19.5/go.mod h1:FWvN0r5YbVNn720DJCj6LS+VnDrwhiQL4CbOJOF3P6A=\ngithub.com/aws/aws-sdk-go-v2/service/cloudtrail v1.35.5 h1:6X70+Ss+gahJ+NGwB78k6SZ8954bOYyuYBzT1nPwTuk=\ngithub.com/aws/aws-sdk-go-v2/service/cloudtrail v1.35.5/go.mod h1:zrqdG1b+4AGoTwTMVFzvzY7ARB3GPo4gKRuK8WPEo8w=\ngithub.com/aws/aws-sdk-go-v2/service/cloudwatch v1.32.0 h1:f426fLs4hcrLuczLBqWf1Ob6FKJhISaR4e9Iw3Scr5A=\ngithub.com/aws/aws-sdk-go-v2/service/cloudwatch v1.32.0/go.mod h1:G63GKqSBLpBmO3tN1/PwM2NC65XvSd00zJWTZk202bc=\ngithub.com/aws/aws-sdk-go-v2/service/cloudwatchevents v1.21.5 h1:IBwUbUGzX/62lkOkMavEA3hQBntVNZogB+9zBrXrXxA=\ngithub.com/aws/aws-sdk-go-v2/service/cloudwatchevents v1.21.5/go.mod h1:BgyRFD5chOPRKRndfjCfT+WzA78QPoE6kZ046iXFFwk=\ngithub.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.29.5 h1:0yGqcpfnCyG4La+uIi3ziT/VzjxP4C7pGs39RxcGUEM=\ngithub.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.29.5/go.mod h1:RDU4fPO0Yb1nRUjQouqJj/bF+Ppz2XdXpWsWvxDXFS4=\ngithub.com/aws/aws-sdk-go-v2/service/codebuild v1.26.5 h1:EPnlDd4V2EXywlOPAw/pMUW4PHUgSulKm4zXFU6bixE=\ngithub.com/aws/aws-sdk-go-v2/service/codebuild v1.26.5/go.mod h1:G2JUWf01sbb5/A8qGcM4dqy4nbl4y4IGWmaCDWAvA2Y=\ngithub.com/aws/aws-sdk-go-v2/service/codecommit v1.19.5 h1:CHpw3CFV86XJT67HkArvkzamj+qZV6bJ8MTN2951G20=\ngithub.com/aws/aws-sdk-go-v2/service/codecommit v1.19.5/go.mod h1:pI87yFGLN6qjkKhI4Hdh1cpcak8bu/QAJFesJNCSj7k=\ngithub.com/aws/aws-sdk-go-v2/service/codedeploy v1.22.1 h1:cyRoT4yeLGEQk8ad4Se82INAA8Xcu6xr1grQ684GYnQ=\ngithub.com/aws/aws-sdk-go-v2/service/codedeploy v1.22.1/go.mod h1:RiusqJl55/p7S8LNMh2J3ZsDHDqxRiPdsfIaZRKeEUo=\ngithub.com/aws/aws-sdk-go-v2/service/codepipeline v1.22.5 h1:Uxm+6jQU5Rq2LWZfH4a9DENvjKFRsTMJDUw1tyXyilY=\ngithub.com/aws/aws-sdk-go-v2/service/codepipeline v1.22.5/go.mod h1:wY21OfcNenDYnYH62dD4hqQuPHxtBUmaC/3a1WHcHd0=\ngithub.com/aws/aws-sdk-go-v2/service/cognitoidentity v1.21.5 h1:aaFwcq8XL+NXToT35R4G2nkh8bSqpP0YgEWympuZmzs=\ngithub.com/aws/aws-sdk-go-v2/service/cognitoidentity v1.21.5/go.mod h1:IG2Q0oe0DXSRLdn6FoyVmfJw1Mwy+XNMtkL8VWh+kcw=\ngithub.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider v1.31.5 h1:7NweDhxX/c0bhnLouJkmDpGThdmZAWEbrZeYVnjDvls=\ngithub.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider v1.31.5/go.mod h1:Rtaozi1JFmyQgaxIdXYdvXBsVmk8Yv0wd3krebIR8FA=\ngithub.com/aws/aws-sdk-go-v2/service/configservice v1.43.5 h1:EZb5NJxZf20Tx4/yWkwqAGjY/iXr3Gkpgm6bCaeX5Hw=\ngithub.com/aws/aws-sdk-go-v2/service/configservice v1.43.5/go.mod h1:v3tquqvNb80onGXFvY1b12PaSLe4j3d1TG4HO4KsbG4=\ngithub.com/aws/aws-sdk-go-v2/service/datapipeline v1.19.5 h1:zkIKbco/gM4fmbU90ajz4ah3ErgAgot7aTE0PpIxNuE=\ngithub.com/aws/aws-sdk-go-v2/service/datapipeline v1.19.5/go.mod h1:+G+TF84SIgMdGDjZKKYPpx6LwXSN4QcywQGa8e2vJ1U=\ngithub.com/aws/aws-sdk-go-v2/service/devicefarm v1.20.5 h1:Qb3OR2IpH29EkESNmUtsyuj6DDfdM4X3Qnv7UmW4xOA=\ngithub.com/aws/aws-sdk-go-v2/service/devicefarm v1.20.5/go.mod h1:O66Kiw8O4IS2V4GQOv8CUDDsAWiRoENYyQXWSXBuvTw=\ngithub.com/aws/aws-sdk-go-v2/service/directconnect v1.30.1 h1:U2VtqwmOzP7sZYWmrnapl3j3KLxIntWyK0RU3uGBIPk=\ngithub.com/aws/aws-sdk-go-v2/service/directconnect v1.30.1/go.mod h1:IVHMPfXzPHdq2JuZmnyreo2Dhhlu84Vel/tochYKgh8=\ngithub.com/aws/aws-sdk-go-v2/service/docdb v1.29.5 h1:txsajy47TIyoL7/BQt0VwqmzLPIsfAT/RWI9iD4q5vU=\ngithub.com/aws/aws-sdk-go-v2/service/docdb v1.29.5/go.mod h1:8d1RpdlgxFU6VO2aWru1ckR0Vsm4EgqCZgOamw5OHpw=\ngithub.com/aws/aws-sdk-go-v2/service/dynamodb v1.26.6 h1:kSdpnPOZL9NG5QHoKL5rTsdY+J+77hr+vqVMsPeyNe0=\ngithub.com/aws/aws-sdk-go-v2/service/dynamodb v1.26.6/go.mod h1:o7TD9sjdgrl8l/g2a2IkYjuhxjPy9DMP2sWo7piaRBQ=\ngithub.com/aws/aws-sdk-go-v2/service/ec2 v1.141.0 h1:cP43vFYAQyREOp972C+6d4+dzpxo3HolNvWfeBvr2Yg=\ngithub.com/aws/aws-sdk-go-v2/service/ec2 v1.141.0/go.mod h1:qjhtI9zjpUHRc6khtrIM9fb48+ii6+UikL3/b+MKYn0=\ngithub.com/aws/aws-sdk-go-v2/service/ecr v1.24.5 h1:wLPDAUFT50NEXGXpywRU3AA74pg35RJjWol/68ruvQQ=\ngithub.com/aws/aws-sdk-go-v2/service/ecr v1.24.5/go.mod h1:AOHmGMoPtSY9Zm2zBuwUJQBisIvYAZeA1n7b6f4e880=\ngithub.com/aws/aws-sdk-go-v2/service/ecrpublic v1.21.5 h1:PQp21GBlGNaQ+AVJAB8w2KTmLx0DkFS2fDET2Iy3+f0=\ngithub.com/aws/aws-sdk-go-v2/service/ecrpublic v1.21.5/go.mod h1:WMntdAol8KgeYsa5sDZPsRTXs4jVZIMYu0eQVVIQxnc=\ngithub.com/aws/aws-sdk-go-v2/service/ecs v1.56.3 h1:h0BpYI0wr4b1kVliz4wlQ8Z+liaPj81gKM5vq6SGP0k=\ngithub.com/aws/aws-sdk-go-v2/service/ecs v1.56.3/go.mod h1:wAtdeFanDuF9Re/ge4DRDaYe3Wy1OGrU7jG042UcuI4=\ngithub.com/aws/aws-sdk-go-v2/service/efs v1.26.5 h1:N1ezZV2yy7NV2w/bA4s4I/+0n2xpL4DzlmroEg5qFsg=\ngithub.com/aws/aws-sdk-go-v2/service/efs v1.26.5/go.mod h1:PJHqaboMcF/eLy1F/Y9hyls4CQGP5+T5f0iRq6CPXu4=\ngithub.com/aws/aws-sdk-go-v2/service/eks v1.35.5 h1:LEYyWSnfdSSysPr5JWUkNwOD0MvXKfE/BX6Frg/lr1A=\ngithub.com/aws/aws-sdk-go-v2/service/eks v1.35.5/go.mod h1:L1uv3UgQlAkdM9v0gpec7nnfUiQkCnGMjBE7MJArfWQ=\ngithub.com/aws/aws-sdk-go-v2/service/elasticache v1.34.5 h1:Pvx/iGFuXerLKDKPwmi4a1fVfXWcOeqMgxrJXLz3jxw=\ngithub.com/aws/aws-sdk-go-v2/service/elasticache v1.34.5/go.mod h1:iPx2i26hgUULkNh1Jk4QzYzzQKd2nXl/rD9Fm5hQ2uk=\ngithub.com/aws/aws-sdk-go-v2/service/elasticbeanstalk v1.20.5 h1:wUyVpgx2Rs8wYFbzeZTN2uzAuORh8Ea5iV1eIDjatM0=\ngithub.com/aws/aws-sdk-go-v2/service/elasticbeanstalk v1.20.5/go.mod h1:EhlhcjyCljBHkCR17DvnvSnmVYrdgsIzPTH3+vnhaV0=\ngithub.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.21.5 h1:q3slz7FaD3/kfslN6elBR4hx69VDuyaIClbNn9juWHE=\ngithub.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.21.5/go.mod h1:N37+67ROdmH7BgLyp1cwCjRpKism3cwkeDlOktRLXMQ=\ngithub.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.26.5 h1:AKlGBk57mRssGQmWqV3I/azLW1Sb7RnlYbJEqTlpKEY=\ngithub.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.26.5/go.mod h1:Tpt4kC8x1HfYuh2rG/6yXZrxjABETERrUl9IdA/IS98=\ngithub.com/aws/aws-sdk-go-v2/service/elasticsearchservice v1.24.5 h1:/40f1MiUBfOZiaIp+2/xAwxjOIRWCZmr7LpZDxNRFAE=\ngithub.com/aws/aws-sdk-go-v2/service/elasticsearchservice v1.24.5/go.mod h1:vdW3E+OGoxDd9p64XSY5jK5mXvxpVQb4NxyPi4mWF5o=\ngithub.com/aws/aws-sdk-go-v2/service/emr v1.49.0 h1:iyNarFKc6R5kDCUGkBD7bBVYuIU1+XgkoXRohk61MeI=\ngithub.com/aws/aws-sdk-go-v2/service/emr v1.49.0/go.mod h1:mPh07TO8BmyIzp9VkTf6CI8NoC73iSnP//oSa+PNZQg=\ngithub.com/aws/aws-sdk-go-v2/service/firehose v1.22.5 h1:c9bCovMv4xhzuTab5LjN11E4jZz04SRqqpHcw3+WGWI=\ngithub.com/aws/aws-sdk-go-v2/service/firehose v1.22.5/go.mod h1:fI1Diyj3ls4HjwKVx1zX9/qQIORnF9skk5bzRydNbjs=\ngithub.com/aws/aws-sdk-go-v2/service/glue v1.72.4 h1:4zoqdS+svLp0a83g7YsYRR/9cNdDlL2nWyshNsDUSe4=\ngithub.com/aws/aws-sdk-go-v2/service/glue v1.72.4/go.mod h1:ALQEuXs/XUdwrkAucRl3juNFbiomoaPICShOoGzHNiE=\ngithub.com/aws/aws-sdk-go-v2/service/iam v1.28.5 h1:Ts2eDDuMLrrmd0ARlg5zSoBQUvhdthgiNnPdiykTJs0=\ngithub.com/aws/aws-sdk-go-v2/service/iam v1.28.5/go.mod h1:kKI0gdVsf+Ev9knh/3lBJbchtX5LLNH25lAzx3KDj3Q=\ngithub.com/aws/aws-sdk-go-v2/service/identitystore v1.28.3 h1:zQMIlYXYHFzrurTKozpXFTGs0M5kwWgG8jL8EKGp8xg=\ngithub.com/aws/aws-sdk-go-v2/service/identitystore v1.28.3/go.mod h1:7nGvrQXBNp7k5yYpwpmxGucYTPY39d0cxjmANAeWwYE=\ngithub.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 h1:/b31bi3YVNlkzkBrm9LfpaKoaYZUxIAj4sHfOTmLfqw=\ngithub.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4/go.mod h1:2aGXHFmbInwgP9ZfpmdIfOELL79zhdNYNmReK8qDfdQ=\ngithub.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.9 h1:/90OR2XbSYfXucBMJ4U14wrjlfleq/0SB6dZDPncgmo=\ngithub.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.9/go.mod h1:dN/Of9/fNZet7UrQQ6kTDo/VSwKPIq94vjlU16bRARc=\ngithub.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.10 h1:h8uweImUHGgyNKrxIUwpPs6XiH0a6DJ17hSJvFLgPAo=\ngithub.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.10/go.mod h1:LZKVtMBiZfdvUWgwg61Qo6kyAmE5rn9Dw36AqnycvG8=\ngithub.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.9 h1:Nf2sHxjMJR8CSImIVCONRi4g0Su3J+TSTbS7G0pUeMU=\ngithub.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.9/go.mod h1:idky4TER38YIjr2cADF1/ugFMKvZV7p//pVeV5LZbF0=\ngithub.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.9 h1:iEAeF6YC3l4FzlJPP9H3Ko1TXpdjdqWffxXjp8SY6uk=\ngithub.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.9/go.mod h1:kjsXoK23q9Z/tLBrckZLLyvjhZoS+AGrzqzUfEClvMM=\ngithub.com/aws/aws-sdk-go-v2/service/iot v1.46.5 h1:IAA0Wq9xs17crvcblb//YPc+5PL24ufWLFyiftTMmSc=\ngithub.com/aws/aws-sdk-go-v2/service/iot v1.46.5/go.mod h1:ElzivGpQ+aPNIVhQ0ebZUMX2SnJApaCXrR6HI0zaYAM=\ngithub.com/aws/aws-sdk-go-v2/service/kafka v1.28.5 h1:yCkyZDGahaCaAkdpVx8Te05t6eW2FarBLunVC8S23nU=\ngithub.com/aws/aws-sdk-go-v2/service/kafka v1.28.5/go.mod h1:/KmX+vXMPJGAB56reo95tnsXa6QPNx6qli4L1AmYb7E=\ngithub.com/aws/aws-sdk-go-v2/service/kinesis v1.24.5 h1:UdJjiGHU0YzHKEMJ377Ufv7YLxlxlR5uKJ4JWQKElk4=\ngithub.com/aws/aws-sdk-go-v2/service/kinesis v1.24.5/go.mod h1:Sj7qc+P/GOGOPMDn8+B7Cs+WPq1Gk+R6CXRXVhZtWcA=\ngithub.com/aws/aws-sdk-go-v2/service/kms v1.27.5 h1:7lKTr8zJ2nVaVgyII+7hUayTi7xWedMuANiNVXiD2S8=\ngithub.com/aws/aws-sdk-go-v2/service/kms v1.27.5/go.mod h1:D9FVDkZjkZnnFHymJ3fPVz0zOUlNSd0xcIIVmmrAac8=\ngithub.com/aws/aws-sdk-go-v2/service/lambda v1.49.5 h1:ZHVbzOnoj5nXxUug8iWzqg2Tmp6Jc4CE5tPfoE96qrs=\ngithub.com/aws/aws-sdk-go-v2/service/lambda v1.49.5/go.mod h1:0V5z1X/8NA9eQ5cZSz5ZaHU8xA/hId2ZAlsHeO7Jrdk=\ngithub.com/aws/aws-sdk-go-v2/service/medialive v1.43.3 h1:/Ub7sD+eD7K6FWQeuALyVApqyec5Ngk893X3VrVPN6c=\ngithub.com/aws/aws-sdk-go-v2/service/medialive v1.43.3/go.mod h1:fH6Wz0q9JXupxmSgCFPwxymnpiX6PitFx2f/AqjuayM=\ngithub.com/aws/aws-sdk-go-v2/service/mediapackage v1.28.5 h1:z+b1lClMC3rSxlUQqRbpGh/uMmUHWC96uQ+AzzZpens=\ngithub.com/aws/aws-sdk-go-v2/service/mediapackage v1.28.5/go.mod h1:wGaElJ8kmGJ08nnirzZ/6iWKqBPErlHqtpkbx9go82Q=\ngithub.com/aws/aws-sdk-go-v2/service/mediastore v1.18.5 h1:g3OTOmpKiizSAVLdNQtlkVVV0ZQUHiM8AVrfhe4odnE=\ngithub.com/aws/aws-sdk-go-v2/service/mediastore v1.18.5/go.mod h1:s/I6apAbgm2cnQRFSO6/765hjcMDiaIS6J3h6AtbUY0=\ngithub.com/aws/aws-sdk-go-v2/service/mq v1.20.5 h1:CouaDeKKMVD16Fce/cUOXn2fLRXbnxTXXiTs7Huz9CU=\ngithub.com/aws/aws-sdk-go-v2/service/mq v1.20.5/go.mod h1:phfKOOpMQhlBv2KE8gF17P82zLcSedA9b7fMSGTLBdQ=\ngithub.com/aws/aws-sdk-go-v2/service/opsworks v1.19.5 h1:8DdUNzI6lO4J10Wo8UDB+NwevTie/xJhkFyLUCASUGM=\ngithub.com/aws/aws-sdk-go-v2/service/opsworks v1.19.5/go.mod h1:25AgMzpaX7VEOMSrJQ0FWbXwnLEJxPX2IfcdEgiuiwI=\ngithub.com/aws/aws-sdk-go-v2/service/organizations v1.23.5 h1:4sW8XPTtuH6PX8CUcpUxBKg0Pf67k1MOOgq9Y+v4ls8=\ngithub.com/aws/aws-sdk-go-v2/service/organizations v1.23.5/go.mod h1:AMzAwJifk4gEft+ElIMFjOb2qUNqHODfjSszVL5Nfeo=\ngithub.com/aws/aws-sdk-go-v2/service/qldb v1.19.5 h1:dzxL7EqY37jp4AGBbMXyZT+koN8WMCEO0XCPuLp17pw=\ngithub.com/aws/aws-sdk-go-v2/service/qldb v1.19.5/go.mod h1:tN5rVxOznGnV6y5gXixoL83vMOAuPTFAnqafo813M8A=\ngithub.com/aws/aws-sdk-go-v2/service/rds v1.64.5 h1:HzkVXbafwf/N+uwNzuXaOpXwG2z8mi7nYFRKHeH/hFQ=\ngithub.com/aws/aws-sdk-go-v2/service/rds v1.64.5/go.mod h1:MYzRMSdY70kcS8AFg0aHmk/xj6VAe0UfaCCoLrBWPow=\ngithub.com/aws/aws-sdk-go-v2/service/redshift v1.39.6 h1:3F+My2KgZqnc6CPks4bkVoogqFyf1nP0iF4mAQ96XWc=\ngithub.com/aws/aws-sdk-go-v2/service/redshift v1.39.6/go.mod h1:8hU0Ax6q6QA+jrMcWTE0A4YH594MQoWP3EzGO3GH5Dw=\ngithub.com/aws/aws-sdk-go-v2/service/resourcegroups v1.19.5 h1:WDwFoNiIKvLkQJPSYs/KGefGknjn45xKQVTW96Lpcx0=\ngithub.com/aws/aws-sdk-go-v2/service/resourcegroups v1.19.5/go.mod h1:kHgibL7mHteV68QqxEWk/+GfSioAUZGBlz4e3Vs2r60=\ngithub.com/aws/aws-sdk-go-v2/service/route53 v1.35.5 h1:WVQIKVwv56JY+I0b2fFeRGCTSi/Xupa87z7y8HZ6l5g=\ngithub.com/aws/aws-sdk-go-v2/service/route53 v1.35.5/go.mod h1:F9El48+5Tf+TkYJB/6M9H7oqXw9Mr9eVetwJ6SUql7g=\ngithub.com/aws/aws-sdk-go-v2/service/s3 v1.47.5 h1:Keso8lIOS+IzI2MkPZyK6G0LYcK3My2LQ+T5bxghEAY=\ngithub.com/aws/aws-sdk-go-v2/service/s3 v1.47.5/go.mod h1:vADO6Jn+Rq4nDtfwNjhgR84qkZwiC6FqCaXdw/kYwjA=\ngithub.com/aws/aws-sdk-go-v2/service/secretsmanager v1.25.5 h1:qYi/BfDrWXZxlmRjlKCyFmtI4HKJwW8OKDKhKRAOZQI=\ngithub.com/aws/aws-sdk-go-v2/service/secretsmanager v1.25.5/go.mod h1:4Ae1NCLK6ghmjzd45Tc33GgCKhUWD2ORAlULtMO1Cbs=\ngithub.com/aws/aws-sdk-go-v2/service/securityhub v1.43.5 h1:lXjoZFvSuEvRGytYmGqVeADzlCJMSyC3DIuz2IkJC4Q=\ngithub.com/aws/aws-sdk-go-v2/service/securityhub v1.43.5/go.mod h1:f//4sy7Yk66HjLWyQcFb6Vtkp/HEforV7G99czcsq54=\ngithub.com/aws/aws-sdk-go-v2/service/servicecatalog v1.25.5 h1:QQJW2wsXbrKQzVVcF4Al8i/SsZwa10u4oiVqHO6Z/ng=\ngithub.com/aws/aws-sdk-go-v2/service/servicecatalog v1.25.5/go.mod h1:A2GckGn7OnOhsuRqL78SEVwSC12MVoIlS+CASp/hhd0=\ngithub.com/aws/aws-sdk-go-v2/service/ses v1.19.5 h1:UtMeZ6nekIh4TMGHe6Z74lYUMH6a7TsIJ04H/lEJrSA=\ngithub.com/aws/aws-sdk-go-v2/service/ses v1.19.5/go.mod h1:NYwXuc3P3A8Iy6Dr6rXomW9g5VC2Ol+H2LlhLud+Aek=\ngithub.com/aws/aws-sdk-go-v2/service/sfn v1.24.5 h1:S3erzHe/G3McykJwmTcBm5d2Rmykd8jmY9KjV5Usd8Q=\ngithub.com/aws/aws-sdk-go-v2/service/sfn v1.24.5/go.mod h1:goJW4NkHiLfCWTNykK9w7PkACje1y9OIT1IOn8kmRvw=\ngithub.com/aws/aws-sdk-go-v2/service/sns v1.26.5 h1:umyC9zH/A1w8AXrrG7iMxT4Rfgj80FjfvLannWt5vuE=\ngithub.com/aws/aws-sdk-go-v2/service/sns v1.26.5/go.mod h1:IrcbquqMupzndZ20BXxDxjM7XenTRhbwBOetk4+Z5oc=\ngithub.com/aws/aws-sdk-go-v2/service/sqs v1.29.5 h1:cJb4I498c1mrOVrRqYTcnLD65AFqUuseHfzHdNZHL9U=\ngithub.com/aws/aws-sdk-go-v2/service/sqs v1.29.5/go.mod h1:mCUv04gd/7g+/HNzDB4X6dzJuygji0ckvB3Lg/TdG5Y=\ngithub.com/aws/aws-sdk-go-v2/service/ssm v1.44.5 h1:5SI5O2tMp/7E/FqhYnaKdxbWjlCi2yujjNI/UO725iU=\ngithub.com/aws/aws-sdk-go-v2/service/ssm v1.44.5/go.mod h1:uXndCJoDO9gpuK24rNWVCnrGNUydKFEAYAZ7UU9S0rQ=\ngithub.com/aws/aws-sdk-go-v2/service/sso v1.18.5 h1:ldSFWz9tEHAwHNmjx2Cvy1MjP5/L9kNoR0skc6wyOOM=\ngithub.com/aws/aws-sdk-go-v2/service/sso v1.18.5/go.mod h1:CaFfXLYL376jgbP7VKC96uFcU8Rlavak0UlAwk1Dlhc=\ngithub.com/aws/aws-sdk-go-v2/service/ssoadmin v1.23.5 h1:WaH4tywTDnktvZFmNEMlgxJ89CjDxpedqI/AtJ0wJBs=\ngithub.com/aws/aws-sdk-go-v2/service/ssoadmin v1.23.5/go.mod h1:8o8oOg3mQJcmwWdjfVSILMWrSJyXiohzTFuqYMrmy6Q=\ngithub.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.5 h1:2k9KmFawS63euAkY4/ixVNsYYwrwnd5fIvgEKkfZFNM=\ngithub.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.5/go.mod h1:W+nd4wWDVkSUIox9bacmkBP5NMFQeTJ/xqNabpzSR38=\ngithub.com/aws/aws-sdk-go-v2/service/sts v1.26.5 h1:5UYvv8JUvllZsRnfrcMQ+hJ9jNICmcgKPAO1CER25Wg=\ngithub.com/aws/aws-sdk-go-v2/service/sts v1.26.5/go.mod h1:XX5gh4CB7wAs4KhcF46G6C8a2i7eupU19dcAAE+EydU=\ngithub.com/aws/aws-sdk-go-v2/service/swf v1.20.5 h1:9CU3kwRGpUReKubOsmxgG9LfaVpZ1PW/ON+5ZTKu5Gs=\ngithub.com/aws/aws-sdk-go-v2/service/swf v1.20.5/go.mod h1:i01QTdCHqrntRqtNeYmxUSDCcmXERzFCePIcHDjASHE=\ngithub.com/aws/aws-sdk-go-v2/service/waf v1.18.5 h1:NlQCMx/Wdcfp0CUv/O0/pIxHFVfVQpi7PGW2VPEzAyY=\ngithub.com/aws/aws-sdk-go-v2/service/waf v1.18.5/go.mod h1:dt95s99CPqt1PaNybPwirXfJQBy511oG6D80ovhOXbQ=\ngithub.com/aws/aws-sdk-go-v2/service/wafregional v1.19.5 h1:LlhW4EBQWSzzYplTe4GUP4yhNjSF/uP7kMAbkBwTm5k=\ngithub.com/aws/aws-sdk-go-v2/service/wafregional v1.19.5/go.mod h1:2oZK2+HubIHH/juGod6WXE2EDzV6/084O/ZecM5ZB5c=\ngithub.com/aws/aws-sdk-go-v2/service/wafv2 v1.43.5 h1:8iixoEN4rUe8tIWeT9QPbh22Ipu8czawmvo4KavymzM=\ngithub.com/aws/aws-sdk-go-v2/service/wafv2 v1.43.5/go.mod h1:y3yChmvnpx/kuhvUEaKkNDih3FjWuuB+qUCK6WVRhfs=\ngithub.com/aws/aws-sdk-go-v2/service/workspaces v1.35.5 h1:f0Ci0wO9AnBjpeeZjahBD41gib79vdaPcipk29MPKXs=\ngithub.com/aws/aws-sdk-go-v2/service/workspaces v1.35.5/go.mod h1:vkYsJdF9sZl/o1eoK8tSSjzAT+R87QjswOGSTZfyO0Y=\ngithub.com/aws/aws-sdk-go-v2/service/xray v1.23.5 h1:uCqKSGx5Esj9ZW6/zZ7tslkM65aH+qjHO3yboiRqcLo=\ngithub.com/aws/aws-sdk-go-v2/service/xray v1.23.5/go.mod h1:VmWKTNu6V1qRG+skNKkYt7VOFohYdtOp7B2OSvpBZac=\ngithub.com/aws/smithy-go v1.22.2 h1:6D9hW43xKFrRx/tXXfAlIZc4JI+yQe6snnWcQyxSyLQ=\ngithub.com/aws/smithy-go v1.22.2/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=\ngithub.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0 h1:0NmehRCgyk5rljDQLKUO+cRJCnduDyn11+zGZIc9Z48=\ngithub.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0/go.mod h1:6L7zgvqo0idzI7IO8de6ZC051AfXb5ipkIJ7bIA2tGA=\ngithub.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc=\ngithub.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs=\ngithub.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=\ngithub.com/benbjohnson/clock v1.0.3 h1:vkLuvpK4fmtSCuo60+yC63p7y0BmQ8gm5ZXGuBCJyXg=\ngithub.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=\ngithub.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=\ngithub.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=\ngithub.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas=\ngithub.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4=\ngithub.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=\ngithub.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=\ngithub.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=\ngithub.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=\ngithub.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=\ngithub.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=\ngithub.com/bmatcuk/doublestar v1.1.5 h1:2bNwBOmhyFEFcoB3tGvTD5xanq+4kyOZlB8wFYbMjkk=\ngithub.com/bmatcuk/doublestar v1.1.5/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=\ngithub.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=\ngithub.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=\ngithub.com/bradleyfalzon/ghinstallation/v2 v2.1.0 h1:5+NghM1Zred9Z078QEZtm28G/kfDfZN/92gkDlLwGVA=\ngithub.com/bradleyfalzon/ghinstallation/v2 v2.1.0/go.mod h1:Xg3xPRN5Mcq6GDqeUVhFbjEWMb4JHCyWEeeBGEYQoTU=\ngithub.com/c2h5oh/datasize v0.0.0-20200112174442-28bbd4740fee/go.mod h1:S/7n9copUssQ56c7aAgHqftWO4LTf4xY6CGWt8Bc+3M=\ngithub.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=\ngithub.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=\ngithub.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=\ngithub.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4=\ngithub.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=\ngithub.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=\ngithub.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=\ngithub.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=\ngithub.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=\ngithub.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=\ngithub.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s=\ngithub.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=\ngithub.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=\ngithub.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=\ngithub.com/clbanning/mxj v1.8.4 h1:HuhwZtbyvyOw+3Z1AowPkU87JkJUSv751ELWaiTpj8I=\ngithub.com/clbanning/mxj v1.8.4/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng=\ngithub.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=\ngithub.com/cloudflare/cloudflare-go v0.13.6 h1:G6aw092fOkvkHODCxf8EHLPqHN2BVxHU4RoTFjS51xo=\ngithub.com/cloudflare/cloudflare-go v0.13.6/go.mod h1:gNGW6MkPPVLhjgaXq4vaS7WnTaQpCfl6DE1W9JuWyt8=\ngithub.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 h1:tuijfIjZyjZaHq9xDUh0tNitwXshJpbLkqMOJv4H3do=\ngithub.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21/go.mod h1:po7NpZ/QiTKzBKyrsEAxwnTamCoh8uDk/egRpQ7siIc=\ngithub.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=\ngithub.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=\ngithub.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=\ngithub.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=\ngithub.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=\ngithub.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=\ngithub.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=\ngithub.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=\ngithub.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=\ngithub.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 h1:QVw89YDxXxEe+l8gU8ETbOasdwEV+avkR75ZzsVV9WI=\ngithub.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8=\ngithub.com/containerd/continuity v0.1.0 h1:UFRRY5JemiAhPZrr/uE0n8fMTLcZsUvySPr1+D7pgr8=\ngithub.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM=\ngithub.com/coreos/bbolt v1.3.0/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=\ngithub.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=\ngithub.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=\ngithub.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=\ngithub.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=\ngithub.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=\ngithub.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=\ngithub.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=\ngithub.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=\ngithub.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=\ngithub.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=\ngithub.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=\ngithub.com/crewjam/httperr v0.2.0/go.mod h1:Jlz+Sg/XqBQhyMjdDiC+GNNRzZTD7x39Gu3pglZ5oH4=\ngithub.com/crewjam/saml v0.4.13 h1:TYHggH/hwP7eArqiXSJUvtOPNzQDyQ7vwmwEqlFWhMc=\ngithub.com/crewjam/saml v0.4.13/go.mod h1:igEejV+fihTIlHXYP8zOec3V5A8y3lws5bQBFsTm4gA=\ngithub.com/dave/jennifer v1.4.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg=\ngithub.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=\ngithub.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=\ngithub.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=\ngithub.com/dchest/uniuri v1.2.0/go.mod h1:fSzm4SLHzNZvWLvWJew423PhAzkpNQYq+uNLq4kxhkY=\ngithub.com/ddelnano/terraform-provider-mikrotik/client v0.0.0-20210401060029-7f652169b2c4 h1:AMuZg5VR0/QGCqFpO4CUwAhZc4tbgDHpM8c4SvMt2yM=\ngithub.com/ddelnano/terraform-provider-mikrotik/client v0.0.0-20210401060029-7f652169b2c4/go.mod h1:JrRtRlTHCkdIr7OTHCAonKS2yWwmwdqnvf+JEy+OYAA=\ngithub.com/ddelnano/terraform-provider-xenorchestra/client v0.0.0-20210401070256-0d721c6762ef h1:q/XC0MjIz8cl/NtyKKewDns6mNd2cUzLQ5Xnh+jGoRg=\ngithub.com/ddelnano/terraform-provider-xenorchestra/client v0.0.0-20210401070256-0d721c6762ef/go.mod h1:1T10mQuoIeT4CXsvyc1G1m/+L7mWv6p7cBwmAut/uB0=\ngithub.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=\ngithub.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs=\ngithub.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=\ngithub.com/denisenkom/go-mssqldb v0.10.0 h1:QykgLZBorFE95+gO3u9esLd0BmbvpWp0/waNNZfHBM8=\ngithub.com/denisenkom/go-mssqldb v0.10.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=\ngithub.com/denverdino/aliyungo v0.0.0-20200327235253-d59c209c7e93 h1:ujQ4DKs+MqFWy/hoLAU4Ey/nQhqJ6pXyocMDbVJ4qSw=\ngithub.com/denverdino/aliyungo v0.0.0-20200327235253-d59c209c7e93/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0=\ngithub.com/dghubble/sling v1.1.0 h1:DLu20Bq2qsB9cI5Hldaxj+TMPEaPpPE8IR2kvD22Atg=\ngithub.com/dghubble/sling v1.1.0/go.mod h1:ZcPRuLm0qrcULW2gOrjXrAWgf76sahqSyxXyVOvkunE=\ngithub.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=\ngithub.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=\ngithub.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=\ngithub.com/digitalocean/godo v1.83.0 h1:K9CveJyECNLwrQnGZG+ovgapr7l5OuvQ6xZSKKW9Nz0=\ngithub.com/digitalocean/godo v1.83.0/go.mod h1:BPCqvwbjbGqxuUnIKB4EvS/AX7IDnNmt5fwvIkWo+ew=\ngithub.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8=\ngithub.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=\ngithub.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=\ngithub.com/dnaeon/go-vcr v0.0.0-20180920040454-5637cf3d8a31/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=\ngithub.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=\ngithub.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=\ngithub.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=\ngithub.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=\ngithub.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=\ngithub.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=\ngithub.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=\ngithub.com/duosecurity/duo_api_golang v0.0.0-20201112143038-0e07e9f869e3 h1:7/i/g2rlBeX1DHg5xTrR2hiFi87ZrqRWV3eLZUApjdI=\ngithub.com/duosecurity/duo_api_golang v0.0.0-20201112143038-0e07e9f869e3/go.mod h1:jdoEJUIrTIxN7nNTwwqA3TBNcSM+W1lrWM6OXVhjbG8=\ngithub.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=\ngithub.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ=\ngithub.com/dylanmei/winrmtest v0.0.0-20190225150635-99b7fe2fddf1/go.mod h1:lcy9/2gH1jn/VCLouHA6tOEwLoNVd4GW6zhuKLmHC2Y=\ngithub.com/elazarl/go-bindata-assetfs v1.0.1 h1:m0kkaHRKEu7tUIUFVwhGGGYClXvyl4RE03qmvRTNfbw=\ngithub.com/elazarl/go-bindata-assetfs v1.0.1/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=\ngithub.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=\ngithub.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94 h1:VIy7cdK7ufs7ctpTFkXJHm1uP3dJSnCGSPysEICB1so=\ngithub.com/elazarl/goproxy v0.0.0-20220417044921-416226498f94/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=\ngithub.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=\ngithub.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=\ngithub.com/emicklei/go-restful v2.16.0+incompatible h1:rgqiKNjTnFQA6kkhFe16D8epTksy9HQ1MyrbDXSdYhM=\ngithub.com/emicklei/go-restful v2.16.0+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=\ngithub.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=\ngithub.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=\ngithub.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=\ngithub.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=\ngithub.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=\ngithub.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=\ngithub.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=\ngithub.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=\ngithub.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=\ngithub.com/envoyproxy/go-control-plane v0.13.4 h1:zEqyPVyku6IvWCFwux4x9RxkLOMUL+1vC9xUFv5l2/M=\ngithub.com/envoyproxy/go-control-plane v0.13.4/go.mod h1:kDfuBlDVsSj2MjrLEtRWtHlsWIFcGyB2RMO44Dc5GZA=\ngithub.com/envoyproxy/go-control-plane/envoy v1.32.3 h1:hVEaommgvzTjTd4xCaFd+kEQ2iYBtGxP6luyLrx6uOk=\ngithub.com/envoyproxy/go-control-plane/envoy v1.32.3/go.mod h1:F6hWupPfh75TBXGKA++MCT/CZHFq5r9/uwt/kQYkZfE=\ngithub.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI=\ngithub.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4=\ngithub.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=\ngithub.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM=\ngithub.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4=\ngithub.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=\ngithub.com/fastly/go-fastly/v7 v7.0.0 h1:Qz6AHosQtSbp8u3aQyGruXNFF/yAqvvjaUCNvTM1XS4=\ngithub.com/fastly/go-fastly/v7 v7.0.0/go.mod h1:WdssHSSIe41/a5juIJagw8MCTA9m7xQ1TVLRcBQQuS8=\ngithub.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=\ngithub.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=\ngithub.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=\ngithub.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=\ngithub.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=\ngithub.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=\ngithub.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=\ngithub.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=\ngithub.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=\ngithub.com/form3tech-oss/jwt-go v3.2.1+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=\ngithub.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=\ngithub.com/form3tech-oss/jwt-go v3.2.3+incompatible h1:7ZaBxOI7TMoYBfyA3cQHErNNyAWIKUMIwqxEtgHOs5c=\ngithub.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=\ngithub.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=\ngithub.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=\ngithub.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=\ngithub.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=\ngithub.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=\ngithub.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=\ngithub.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg=\ngithub.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=\ngithub.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=\ngithub.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=\ngithub.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=\ngithub.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=\ngithub.com/go-jose/go-jose/v3 v3.0.4 h1:Wp5HA7bLQcKnf6YYao/4kpRpVMp/yf6+pJKV8WFSaNY=\ngithub.com/go-jose/go-jose/v3 v3.0.4/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=\ngithub.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=\ngithub.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=\ngithub.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=\ngithub.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=\ngithub.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=\ngithub.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=\ngithub.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=\ngithub.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=\ngithub.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=\ngithub.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=\ngithub.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=\ngithub.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94=\ngithub.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M=\ngithub.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w=\ngithub.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE=\ngithub.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=\ngithub.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=\ngithub.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=\ngithub.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=\ngithub.com/go-openapi/jsonreference v0.19.5 h1:1WJP/wi4OjB4iV8KVbH73rQaoialJrqv8gitZLxGLtM=\ngithub.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg=\ngithub.com/go-openapi/strfmt v0.19.4/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk=\ngithub.com/go-openapi/strfmt v0.19.10/go.mod h1:qBBipho+3EoIqn6YDI+4RnQEtj6jT/IdKm+PAlXxSUc=\ngithub.com/go-openapi/strfmt v0.20.1/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk=\ngithub.com/go-openapi/strfmt v0.20.2/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk=\ngithub.com/go-openapi/strfmt v0.21.2/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k=\ngithub.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c=\ngithub.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4=\ngithub.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=\ngithub.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng=\ngithub.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=\ngithub.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=\ngithub.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=\ngithub.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=\ngithub.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=\ngithub.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=\ngithub.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=\ngithub.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=\ngithub.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=\ngithub.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=\ngithub.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=\ngithub.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=\ngithub.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=\ngithub.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4=\ngithub.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=\ngithub.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48 h1:JVrqSeQfdhYRFk24TvhTZWU0q8lfCojxZQFi3Ou7+uY=\ngithub.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=\ngithub.com/go-routeros/routeros v0.0.0-20210123142807-2a44d57c6730 h1:EuqwWLv/LPPjhvFqkeD2bz+FOlvw2DjvDI7vK8GVeyY=\ngithub.com/go-routeros/routeros v0.0.0-20210123142807-2a44d57c6730/go.mod h1:em1mEqFKnoeQuQP9Sg7i26yaW8o05WwcNj7yLhrXxSQ=\ngithub.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=\ngithub.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=\ngithub.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=\ngithub.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=\ngithub.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=\ngithub.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=\ngithub.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=\ngithub.com/gobs/pretty v0.0.0-20180724170744-09732c25a95b h1:/vQ+oYKu+JoyaMPDsv5FzwuL2wwWBgBbtj/YLCi4LuA=\ngithub.com/gobs/pretty v0.0.0-20180724170744-09732c25a95b/go.mod h1:Xo4aNUOrJnVruqWQJBtW6+bTBDTniY8yZum5rF3b5jw=\ngithub.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0=\ngithub.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY=\ngithub.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg=\ngithub.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=\ngithub.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI=\ngithub.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs=\ngithub.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI=\ngithub.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI=\ngithub.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk=\ngithub.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28=\ngithub.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo=\ngithub.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk=\ngithub.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw=\ngithub.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360=\ngithub.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg=\ngithub.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE=\ngithub.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8=\ngithub.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc=\ngithub.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc=\ngithub.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4=\ngithub.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4=\ngithub.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ=\ngithub.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0=\ngithub.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw=\ngithub.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=\ngithub.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=\ngithub.com/gocql/gocql v0.0.0-20210707082121-9a3953d1826d h1:k544nNVphXK4Yt0FTduvOvCfJabEY/DMkdNw0zpCwBE=\ngithub.com/gocql/gocql v0.0.0-20210707082121-9a3953d1826d/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8=\ngithub.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=\ngithub.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=\ngithub.com/gofrs/uuid/v3 v3.1.2 h1:V3IBv1oU82x6YIr5txe3azVHgmOKYdyKQTowm9moBlY=\ngithub.com/gofrs/uuid/v3 v3.1.2/go.mod h1:xPwMqoocQ1L5G6pXX5BcE7N5jlzn2o19oqAKxwZW/kI=\ngithub.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=\ngithub.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=\ngithub.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=\ngithub.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=\ngithub.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=\ngithub.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A=\ngithub.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=\ngithub.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=\ngithub.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=\ngithub.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=\ngithub.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=\ngithub.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=\ngithub.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=\ngithub.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=\ngithub.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=\ngithub.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=\ngithub.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=\ngithub.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=\ngithub.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=\ngithub.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=\ngithub.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=\ngithub.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=\ngithub.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=\ngithub.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=\ngithub.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=\ngithub.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=\ngithub.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=\ngithub.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=\ngithub.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=\ngithub.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=\ngithub.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=\ngithub.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=\ngithub.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=\ngithub.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=\ngithub.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=\ngithub.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=\ngithub.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=\ngithub.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=\ngithub.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=\ngithub.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=\ngithub.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=\ngithub.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=\ngithub.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=\ngithub.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=\ngithub.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=\ngithub.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=\ngithub.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=\ngithub.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=\ngithub.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=\ngithub.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=\ngithub.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=\ngithub.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=\ngithub.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=\ngithub.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=\ngithub.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=\ngithub.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=\ngithub.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA=\ngithub.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54=\ngithub.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ=\ngithub.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=\ngithub.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=\ngithub.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=\ngithub.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=\ngithub.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=\ngithub.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=\ngithub.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=\ngithub.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=\ngithub.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=\ngithub.com/google/go-github/v35 v35.1.0 h1:KkwZnKWQ/0YryvXjZlCN/3EGRJNp6VCZPKo+RG9mG28=\ngithub.com/google/go-github/v35 v35.1.0/go.mod h1:s0515YVTI+IMrDoy9Y4pHt9ShGpzHvHO8rZ7L7acgvs=\ngithub.com/google/go-github/v45 v45.2.0 h1:5oRLszbrkvxDDqBCNj2hjDZMKmvexaZ1xw/FCD+K3FI=\ngithub.com/google/go-github/v45 v45.2.0/go.mod h1:FObaZJEDSTa/WGCzZ2Z3eoCDXWJKMenWWTrd8jrta28=\ngithub.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=\ngithub.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=\ngithub.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=\ngithub.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=\ngithub.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=\ngithub.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g=\ngithub.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=\ngithub.com/google/jsonapi v1.0.0 h1:qIGgO5Smu3yJmSs+QlvhQnrscdZfFhiV6S8ryJAglqU=\ngithub.com/google/jsonapi v1.0.0/go.mod h1:YYHiRPJT8ARXGER8In9VuLv4qvLfDmA9ULQqptbLE4s=\ngithub.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=\ngithub.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=\ngithub.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=\ngithub.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=\ngithub.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk=\ngithub.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc=\ngithub.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0=\ngithub.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=\ngithub.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=\ngithub.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=\ngithub.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=\ngithub.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=\ngithub.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM=\ngithub.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA=\ngithub.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=\ngithub.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=\ngithub.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=\ngithub.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=\ngithub.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=\ngithub.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=\ngithub.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=\ngithub.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8=\ngithub.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg=\ngithub.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw=\ngithub.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA=\ngithub.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=\ngithub.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=\ngithub.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=\ngithub.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM=\ngithub.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM=\ngithub.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM=\ngithub.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c=\ngithub.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo=\ngithub.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY=\ngithub.com/googleapis/gax-go/v2 v2.14.0 h1:f+jMrjBPl+DL9nI4IQzLUxMq7XrAqFYB7hBPqMNIe8o=\ngithub.com/googleapis/gax-go/v2 v2.14.0/go.mod h1:lhBCnjdLrWRaPvLWhmc8IS24m9mr07qSYnHncrgo+zk=\ngithub.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=\ngithub.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=\ngithub.com/gophercloud/gophercloud v0.0.0-20190208042652-bc37892e1968/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4=\ngithub.com/gophercloud/gophercloud v1.0.0 h1:9nTGx0jizmHxDobe4mck89FyQHVyA3CaXLIUSGJjP9k=\ngithub.com/gophercloud/gophercloud v1.0.0/go.mod h1:Q8fZtyi5zZxPS/j9aj3sSxtvj41AdQMDwyo1myduD5c=\ngithub.com/gophercloud/utils v0.0.0-20190128072930-fbb6ab446f01/go.mod h1:wjDF8z83zTeg5eMLml5EBSlAhbF7G8DobyI1YsMuyzw=\ngithub.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=\ngithub.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=\ngithub.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=\ngithub.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=\ngithub.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=\ngithub.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=\ngithub.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=\ngithub.com/grafana/grafana-api-golang-client v0.0.0-20210218192924-9ccd2365d2a6 h1:jFAfnEad6JNc0EFbCGxL75m8GoBG/J7/1fAAXseaIf8=\ngithub.com/grafana/grafana-api-golang-client v0.0.0-20210218192924-9ccd2365d2a6/go.mod h1:jFjwT3lvwl4JKqCw3guRJvlQ1/fmhER1h3Zgix3z7jw=\ngithub.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=\ngithub.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=\ngithub.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=\ngithub.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=\ngithub.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=\ngithub.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=\ngithub.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=\ngithub.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=\ngithub.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8=\ngithub.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=\ngithub.com/hashicorp/aws-sdk-go-base v0.4.0/go.mod h1:eRhlz3c4nhqxFZJAahJEFL7gh6Jyj5rQmQc7F9eHFyQ=\ngithub.com/hashicorp/consul v0.0.0-20171026175957-610f3c86a089/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI=\ngithub.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=\ngithub.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=\ngithub.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=\ngithub.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=\ngithub.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=\ngithub.com/hashicorp/go-azure-helpers v0.10.0/go.mod h1:YuAtHxm2v74s+IjQwUG88dHBJPd5jL+cXr5BGVzSKhE=\ngithub.com/hashicorp/go-azure-helpers v0.36.0 h1:8+aX2wh40tnO0tmk6HD1hz7+EGM9qINalBu60ae7di8=\ngithub.com/hashicorp/go-azure-helpers v0.36.0/go.mod h1:gcutZ/Hf/O7YN9M3UIvyZ9l0Rxv7Yrc9x5sSfM9cuSw=\ngithub.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg=\ngithub.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=\ngithub.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=\ngithub.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=\ngithub.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=\ngithub.com/hashicorp/go-getter v1.4.2-0.20200106182914-9813cbd4eb02/go.mod h1:7qxyCd8rBfcShwsvxgIguu4KbS3l8bUCwg2Umn7RjeY=\ngithub.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4=\ngithub.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744=\ngithub.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI=\ngithub.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=\ngithub.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=\ngithub.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=\ngithub.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=\ngithub.com/hashicorp/go-immutable-radix v0.0.0-20180129170900-7f3cd4390caa/go.mod h1:6ij3Z20p+OhOkCSrA0gImAWoHYQRGbnlcuk6XYTiaRw=\ngithub.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=\ngithub.com/hashicorp/go-immutable-radix v1.3.0 h1:8exGP7ego3OmkfksihtSouGMZ+hQrhxx+FVELeXpVPE=\ngithub.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=\ngithub.com/hashicorp/go-memdb v1.3.2 h1:RBKHOsnSszpU6vxq80LzC2BaQjuuvoyaQbkLTf7V7g8=\ngithub.com/hashicorp/go-memdb v1.3.2/go.mod h1:Mluclgwib3R93Hk5fxEfiRhB+6Dar64wWh71LpNSe3g=\ngithub.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=\ngithub.com/hashicorp/go-msgpack v0.5.4/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=\ngithub.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=\ngithub.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=\ngithub.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=\ngithub.com/hashicorp/go-plugin v1.3.0/go.mod h1:F9eH4LrE/ZsRdbwhfjs9k9HoDUwAHnYtXdgmf1AVNs0=\ngithub.com/hashicorp/go-plugin v1.4.4 h1:NVdrSdFRt3SkZtNckJ6tog7gbpRrcbOjQi/rgF7JYWQ=\ngithub.com/hashicorp/go-plugin v1.4.4/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s=\ngithub.com/hashicorp/go-retryablehttp v0.5.1/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=\ngithub.com/hashicorp/go-retryablehttp v0.5.2/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=\ngithub.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=\ngithub.com/hashicorp/go-retryablehttp v0.6.7/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=\ngithub.com/hashicorp/go-retryablehttp v0.6.8/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=\ngithub.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=\ngithub.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=\ngithub.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=\ngithub.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=\ngithub.com/hashicorp/go-rootcerts v1.0.0 h1:Rqb66Oo1X/eSV1x66xbDccZjhJigjg0+e82kpwzSwCI=\ngithub.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=\ngithub.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo=\ngithub.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=\ngithub.com/hashicorp/go-slug v0.4.1/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8=\ngithub.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=\ngithub.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs=\ngithub.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=\ngithub.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=\ngithub.com/hashicorp/go-tfe v0.8.1/go.mod h1:XAV72S4O1iP8BDaqiaPLmL2B4EE6almocnOn8E8stHc=\ngithub.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=\ngithub.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=\ngithub.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=\ngithub.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=\ngithub.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=\ngithub.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=\ngithub.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=\ngithub.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=\ngithub.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=\ngithub.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=\ngithub.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=\ngithub.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=\ngithub.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=\ngithub.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=\ngithub.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=\ngithub.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w=\ngithub.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=\ngithub.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=\ngithub.com/hashicorp/hcl/v2 v2.0.0/go.mod h1:oVVDG71tEinNGYCxinCYadcmKU9bglqW9pV3txagJ90=\ngithub.com/hashicorp/hcl/v2 v2.3.0/go.mod h1:d+FwDBbOLvpAM3Z6J7gPj/VoAGkNe/gm352ZhjJ/Zv8=\ngithub.com/hashicorp/hcl/v2 v2.14.0 h1:jX6+Q38Ly9zaAJlAjnFVyeNSNCKKW8D0wvyg7vij5Wc=\ngithub.com/hashicorp/hcl/v2 v2.14.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=\ngithub.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590 h1:2yzhWGdgQUWZUCNK+AoO35V+HTsgEmcM4J9IkArh7PI=\ngithub.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590/go.mod h1:n2TSygSNwsLJ76m8qFXTSc7beTb+auJxYdqrnoqwZWE=\ngithub.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=\ngithub.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=\ngithub.com/hashicorp/memberlist v0.1.0/go.mod h1:ncdBp14cuox2iFOq3kDiquKU6fqsTBc3W6JvZwjxxsE=\ngithub.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=\ngithub.com/hashicorp/serf v0.0.0-20160124182025-e4ec8cc423bb/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE=\ngithub.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=\ngithub.com/hashicorp/terraform v0.12.31 h1:df2bOxAOaR2r8kDfkqNlNk4anH2DjkPwJ4K7mEwUd9M=\ngithub.com/hashicorp/terraform v0.12.31/go.mod h1:CBxNAiTW0pLap44/3GU4j7cYE2bMhkKZNlHPcr4P55U=\ngithub.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7 h1:Pc5TCv9mbxFN6UVX0LH6CpQrdTM5YjbVI2w15237Pjk=\ngithub.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7/go.mod h1:p+ivJws3dpqbp1iP84+npOyAmTTOLMgCzrXd3GSdn/A=\ngithub.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs=\ngithub.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfDdhUjHf9zcs/BCoNHAc7IK4=\ngithub.com/hashicorp/terraform-plugin-sdk/v2 v2.23.0 h1:D4EeQm0piYXIHp6ZH3zjyP2Elq6voC64x3GZptaiefA=\ngithub.com/hashicorp/terraform-plugin-sdk/v2 v2.23.0/go.mod h1:xkJGavPvP9kYS/VbiW8o7JuTNgPwm7Tiw/Ie/b46r4c=\ngithub.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg=\ngithub.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=\ngithub.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg=\ngithub.com/hashicorp/vault v0.10.4 h1:4x0lHxui/ZRp/B3E0Auv1QNBJpzETqHR2kQD3mHSBJU=\ngithub.com/hashicorp/vault v0.10.4/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0=\ngithub.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=\ngithub.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 h1:xixZ2bWeofWV68J+x6AzmKuVM/JWCQwkWm6GW/MUR6I=\ngithub.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=\ngithub.com/heimweh/go-pagerduty v0.0.0-20210930203304-530eff2acdc6 h1:/D0VtHEOCdotE1vSB9XznceAjIGkUieZ4BF6VKUIqNU=\ngithub.com/heimweh/go-pagerduty v0.0.0-20210930203304-530eff2acdc6/go.mod h1:JtJGtgN0y9KOCaqFMZFaBCWskpO/KK3Ro9TwjP9ss6w=\ngithub.com/heroku/heroku-go/v5 v5.4.1 h1:J1nNnR3/571b2iUDHl+y1B3VkhKm6YOXIq9GGzQUv5s=\ngithub.com/heroku/heroku-go/v5 v5.4.1/go.mod h1:Uo3XhGPwaTpniR4X1e50BDjg4SzdFk2Bd2mgYZVkfHo=\ngithub.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519 h1:nqAlWFEdqI0ClbTDrhDvE/8LeQ4pftrqKUX9w5k0j3s=\ngithub.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519/go.mod h1:pFlLw2CfqZiIBOx6BuCeRLCrfxBJipTY0nIOF/VbGcI=\ngithub.com/honeycombio/terraform-provider-honeycombio v0.10.0 h1:860Lh9qPUr31seT2vwOFEkQZfoweoBZcPRt95NXU5GI=\ngithub.com/honeycombio/terraform-provider-honeycombio v0.10.0/go.mod h1:aXUdWxBmngRwaY3qzC++u0UQfpTRODSUnigplxb5Xfs=\ngithub.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=\ngithub.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=\ngithub.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=\ngithub.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE=\ngithub.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=\ngithub.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=\ngithub.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=\ngithub.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=\ngithub.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=\ngithub.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=\ngithub.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=\ngithub.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=\ngithub.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=\ngithub.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=\ngithub.com/ionos-cloud/sdk-go-cert-manager v1.0.0 h1:pPIhdjTB3rjP9x3Cf6B4j8NTZ1u2v/w7/0h7GtFs/Ig=\ngithub.com/ionos-cloud/sdk-go-cert-manager v1.0.0/go.mod h1:nFzMT0UNtNiLIuDGYj8pulHFQiVVql43oEX/eQIyr5Q=\ngithub.com/ionos-cloud/sdk-go-container-registry v1.0.0 h1:03FKtFfHdOPZdXxRAFWgivbhmkyY4xk+R79EffoFt/4=\ngithub.com/ionos-cloud/sdk-go-container-registry v1.0.0/go.mod h1:AtjqGZWAvd5J1rRR0wHhZ8nMrR/yJm45z8KB3p8rrvs=\ngithub.com/ionos-cloud/sdk-go-dataplatform v1.0.1 h1:3BeDDlHl9mQAYmgdg8EsgsXbPMDfL4pJhXzmTPHNpA0=\ngithub.com/ionos-cloud/sdk-go-dataplatform v1.0.1/go.mod h1:YitNqq01IAbzMr1GpXIDW1+pvhiY9eUs7/+rB9UitXE=\ngithub.com/ionos-cloud/sdk-go-dbaas-mongo v1.3.1 h1:+tDoZ8IEPxYwJd6fDIpWksNJs9Zzw7Pu5A39jTew058=\ngithub.com/ionos-cloud/sdk-go-dbaas-mongo v1.3.1/go.mod h1:rxOAeyAU6BTfghJibSRDdRNrKm2cIXMpSMe7JIWewJ8=\ngithub.com/ionos-cloud/sdk-go-dbaas-postgres v1.1.2 h1:AaKbci+kVS6/k43VwJwmXxCJ7pzj9jwuOPqO8Wd5560=\ngithub.com/ionos-cloud/sdk-go-dbaas-postgres v1.1.2/go.mod h1:nmJEwuRX65A5/PxwvdFW0XrV+N6WFYnMV1TiIafAwz4=\ngithub.com/ionos-cloud/sdk-go-dns v1.1.1 h1:Qdf5mXYt9ZeRl4zZQxGrvamFkKm1X9WeARyB9/WYhKg=\ngithub.com/ionos-cloud/sdk-go-dns v1.1.1/go.mod h1:l9gYdwtUshlBOiIi4nHn3RCX81XlV3VoNvLJrO2VfHg=\ngithub.com/ionos-cloud/sdk-go-logging v1.0.1 h1:MB9jPoBUL3mZ+ois7kXYy67x0FopAw2aihMGdr2wu1k=\ngithub.com/ionos-cloud/sdk-go-logging v1.0.1/go.mod h1:P2JQJpUgH3ZyfyJmv6jMwcB1NJIVVZSL+/bllhWpwc8=\ngithub.com/ionos-cloud/sdk-go/v6 v6.1.3 h1:vb6yqdpiqaytvreM0bsn2pXw+1YDvEk2RKSmBAQvgDQ=\ngithub.com/ionos-cloud/sdk-go/v6 v6.1.3/go.mod h1:Ox3W0iiEz0GHnfY9e5LmAxwklsxguuNFEUSu0gVRTME=\ngithub.com/jarcoal/httpmock v1.2.0 h1:gSvTxxFR/MEMfsGrvRbdfpRUMBStovlSRLw0Ep1bwwc=\ngithub.com/jarcoal/httpmock v1.2.0/go.mod h1:oCoTsnAz4+UoOUIf5lJOWV2QQIW5UoeUI6aM2YnWAZk=\ngithub.com/jefferai/jsonx v1.0.1 h1:GvWkLWihoLqDG0BSP45TUQJH9qsINX50PVrFULgpc/I=\ngithub.com/jefferai/jsonx v1.0.1/go.mod h1:yFo3l2fcm7cZVHGq3HKLXE+Pd4RWuRjNBDHksM7XekQ=\ngithub.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE=\ngithub.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74=\ngithub.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=\ngithub.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=\ngithub.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik=\ngithub.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=\ngithub.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=\ngithub.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=\ngithub.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=\ngithub.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=\ngithub.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=\ngithub.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=\ngithub.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=\ngithub.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ=\ngithub.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=\ngithub.com/jonboydell/logzio_client v1.2.0 h1:SkvYSgpJcLG0P9agjwF99oFiKtBiaXH8MZt7OmtwmvQ=\ngithub.com/jonboydell/logzio_client v1.2.0/go.mod h1:ZXJYF4M9/chuG+4fQDS9BN6CqXqokUjtQOjdMqzGC/Y=\ngithub.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=\ngithub.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=\ngithub.com/joyent/triton-go v0.0.0-20180313100802-d8f9c0314926/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA=\ngithub.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=\ngithub.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=\ngithub.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=\ngithub.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=\ngithub.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=\ngithub.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=\ngithub.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=\ngithub.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=\ngithub.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=\ngithub.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=\ngithub.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=\ngithub.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=\ngithub.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4=\ngithub.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA=\ngithub.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=\ngithub.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=\ngithub.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba h1:NARVGAAgEXvoMeNPHhPFt1SBt1VMznA3Gnz9d0qj+co=\ngithub.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M=\ngithub.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=\ngithub.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=\ngithub.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=\ngithub.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=\ngithub.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=\ngithub.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c=\ngithub.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=\ngithub.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=\ngithub.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=\ngithub.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=\ngithub.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=\ngithub.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=\ngithub.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=\ngithub.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=\ngithub.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=\ngithub.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=\ngithub.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=\ngithub.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=\ngithub.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=\ngithub.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=\ngithub.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=\ngithub.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=\ngithub.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=\ngithub.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=\ngithub.com/labd/commercetools-go-sdk v0.3.1 h1:Fk8/VKKDSNHhyVhDywJdmzUt3JSpNoFZbHJndwjVBls=\ngithub.com/labd/commercetools-go-sdk v0.3.1/go.mod h1:I+KKNALlg6PcSertsVA7E442koO99GT7gldWqwZlUGo=\ngithub.com/launchdarkly/api-client-go v5.3.0+incompatible h1:xB4QGNbNzAUm2UDdtlsHhmCrs6l7OQGWFgs1xB6s/u8=\ngithub.com/launchdarkly/api-client-go v5.3.0+incompatible/go.mod h1:INGa7NUZYSwVozwPV7l6ikgD7pzSOpZvg9I5sqCZIWs=\ngithub.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=\ngithub.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=\ngithub.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=\ngithub.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=\ngithub.com/lestrrat-go/backoff/v2 v2.0.8 h1:oNb5E5isby2kiro9AgdHLv5N5tint1AnDVVf2E2un5A=\ngithub.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y=\ngithub.com/lestrrat-go/blackmagic v1.0.2 h1:Cg2gVSc9h7sz9NOByczrbUvLopQmXrfFx//N+AkAr5k=\ngithub.com/lestrrat-go/blackmagic v1.0.2/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU=\ngithub.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE=\ngithub.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E=\ngithub.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI=\ngithub.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4=\ngithub.com/lestrrat-go/jwx v1.2.29 h1:QT0utmUJ4/12rmsVQrJ3u55bycPkKqGYuGT4tyRhxSQ=\ngithub.com/lestrrat-go/jwx v1.2.29/go.mod h1:hU8k2l6WF0ncx20uQdOmik/Gjg6E3/wIRtXSNFeZuB8=\ngithub.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=\ngithub.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU=\ngithub.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I=\ngithub.com/lib/pq v1.0.0 h1:X5PMW56eZitiTeO7tKzZxFCSpbFZJtkMMooicw2us9A=\ngithub.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=\ngithub.com/likexian/gokit v0.0.0-20190309162924-0a377eecf7aa/go.mod h1:QdfYv6y6qPA9pbBA2qXtoT8BMKha6UyNbxWGWl/9Jfk=\ngithub.com/likexian/gokit v0.0.0-20190418170008-ace88ad0983b/go.mod h1:KKqSnk/VVSW8kEyO2vVCXoanzEutKdlBAPohmGXkxCk=\ngithub.com/likexian/gokit v0.0.0-20190501133040-e77ea8b19cdc/go.mod h1:3kvONayqCaj+UgrRZGpgfXzHdMYCAO0KAt4/8n0L57Y=\ngithub.com/likexian/gokit v0.20.15/go.mod h1:kn+nTv3tqh6yhor9BC4Lfiu58SmH8NmQ2PmEl+uM6nU=\ngithub.com/likexian/simplejson-go v0.0.0-20190409170913-40473a74d76d/go.mod h1:Typ1BfnATYtZ/+/shXfFYLrovhFyuKvzwrdOnIDHlmg=\ngithub.com/likexian/simplejson-go v0.0.0-20190419151922-c1f9f0b4f084/go.mod h1:U4O1vIJvIKwbMZKUJ62lppfdvkCdVd2nfMimHK81eec=\ngithub.com/likexian/simplejson-go v0.0.0-20190502021454-d8787b4bfa0b/go.mod h1:3BWwtmKP9cXWwYCr5bkoVDEfLywacOv0s06OBEDpyt8=\ngithub.com/linode/linodego v0.24.1 h1:3s7/F54z9XZfefzrFqnHMD9DIEYVyOddPm+gyTEFFzc=\ngithub.com/linode/linodego v0.24.1/go.mod h1:GSBKPpjoQfxEfryoCRcgkuUOCuVtGHWhzI8OMdycNTE=\ngithub.com/lusis/go-artifactory v0.0.0-20160115162124-7e4ce345df82/go.mod h1:y54tfGmO3NKssKveTEFFzH8C/akrSOy/iW9qEAUDV84=\ngithub.com/mackerelio/mackerel-client-go v0.21.0 h1:7s0GBxpHqHsUMm1hRz1HSHxhcFT15LnWIYar77Hnd1I=\ngithub.com/mackerelio/mackerel-client-go v0.21.0/go.mod h1:/GNOj+y1eFsd3CK8c6IQ/uS38/GT0+NWImk5YGJs5Lk=\ngithub.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=\ngithub.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=\ngithub.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=\ngithub.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=\ngithub.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=\ngithub.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=\ngithub.com/manicminer/hamilton v0.43.0/go.mod h1:lbVyngC+/nCWuDp8UhC6Bw+bh7jcP/E+YwqzHTmzemk=\ngithub.com/manicminer/hamilton v0.44.0 h1:mLb4Vxbt2dsAvOpaB7xd/5D8LaTTX6ACwVP4TmW8qwE=\ngithub.com/manicminer/hamilton v0.44.0/go.mod h1:lbVyngC+/nCWuDp8UhC6Bw+bh7jcP/E+YwqzHTmzemk=\ngithub.com/manicminer/hamilton-autorest v0.2.0 h1:dDL+t2DrQza0EfNYINYCvXISeNwVqzgVAQh+CH/19ZU=\ngithub.com/manicminer/hamilton-autorest v0.2.0/go.mod h1:NselDpNTImEmOc/fa41kPg6YhDt/6S95ejWbTGZ6tlg=\ngithub.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE=\ngithub.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0=\ngithub.com/masterzen/simplexml v0.0.0-20160608183007-4572e39b1ab9/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc=\ngithub.com/masterzen/winrm v0.0.0-20190223112901-5e5c9a7fe54b/go.mod h1:wr1VqkwW0AB5JS0QLy5GpVMS9E3VtRoSYXUYyVk46KY=\ngithub.com/mattermost/xml-roundtrip-validator v0.1.0 h1:RXbVD2UAl7A7nOTR4u7E3ILa4IbtvKBHw64LDsmu9hU=\ngithub.com/mattermost/xml-roundtrip-validator v0.1.0/go.mod h1:qccnGMcpgwcNaBnxqpJpWWUiPNr5H3O8eDgGV9gT5To=\ngithub.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=\ngithub.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=\ngithub.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=\ngithub.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=\ngithub.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=\ngithub.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=\ngithub.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d h1:oNAwILwmgWKFpuU+dXvI6dl9jG2mAWAZLX3r9s0PPiw=\ngithub.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=\ngithub.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=\ngithub.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=\ngithub.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=\ngithub.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=\ngithub.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=\ngithub.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=\ngithub.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=\ngithub.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=\ngithub.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=\ngithub.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=\ngithub.com/mattn/go-shellwords v1.0.4/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o=\ngithub.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=\ngithub.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5 h1:YH424zrwLTlyHSH/GzLMJeu5zhYVZSx5RQxGKm1h96s=\ngithub.com/microsoft/azure-devops-go-api/azuredevops v1.0.0-b5/go.mod h1:PoGiBqKSQK1vIfQ+yVaFcGjDySHvym6FM1cNYnwzbrY=\ngithub.com/miekg/dns v1.0.8/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=\ngithub.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=\ngithub.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=\ngithub.com/mitchellh/cli v1.1.2 h1:PvH+lL2B7IQ101xQL63Of8yFS2y+aDlsFcsqNc+u/Kw=\ngithub.com/mitchellh/cli v1.1.2/go.mod h1:6iaV0fGdElS6dPBx0EApTxHrcWvmJphyh2n8YBLPPZ4=\ngithub.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=\ngithub.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=\ngithub.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=\ngithub.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=\ngithub.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=\ngithub.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=\ngithub.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=\ngithub.com/mitchellh/go-linereader v0.0.0-20190213213312-1b945b3263eb/go.mod h1:OaY7UOoTkkrX3wRwjpYRKafIkkyeD0UtweSHAWWiqQM=\ngithub.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=\ngithub.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=\ngithub.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=\ngithub.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=\ngithub.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=\ngithub.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=\ngithub.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=\ngithub.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=\ngithub.com/mitchellh/hashstructure v1.0.0 h1:ZkRJX1CyOoTkar7p/mLS5TZU4nJ1Rn/F8u9dGS02Q3Y=\ngithub.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ=\ngithub.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=\ngithub.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=\ngithub.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=\ngithub.com/mitchellh/mapstructure v1.3.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=\ngithub.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=\ngithub.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=\ngithub.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=\ngithub.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=\ngithub.com/mitchellh/panicwrap v1.0.0/go.mod h1:pKvZHwWrZowLUzftuFq7coarnxbBXU4aQh3N0BJOeeA=\ngithub.com/mitchellh/prefixedio v0.0.0-20190213213902-5733675afd51/go.mod h1:kB1naBgV9ORnkiTVeyJOI1DavaJkG4oNIq0Af6ZVKUo=\ngithub.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=\ngithub.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=\ngithub.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=\ngithub.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c=\ngithub.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=\ngithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=\ngithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=\ngithub.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=\ngithub.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=\ngithub.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=\ngithub.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=\ngithub.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=\ngithub.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=\ngithub.com/mozillazg/go-httpheader v0.2.1 h1:geV7TrjbL8KXSyvghnFm+NyTux/hxwueTSrwhe88TQQ=\ngithub.com/mozillazg/go-httpheader v0.2.1/go.mod h1:jJ8xECTlalr6ValeXYdOF8fFUISeBAdw6E61aqQma60=\ngithub.com/mrparkers/terraform-provider-keycloak v0.0.0-20221013232944-56f37a07590d h1:xVdKItlI/NYul2S5D+HYyqtFmpHQ0Zk3gsgocmylXwM=\ngithub.com/mrparkers/terraform-provider-keycloak v0.0.0-20221013232944-56f37a07590d/go.mod h1:Fq59kLylPkAJZXaEAE0Pjwv3GjfzzcdE9VDeYzkmPlE=\ngithub.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=\ngithub.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=\ngithub.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=\ngithub.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=\ngithub.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=\ngithub.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=\ngithub.com/newrelic/newrelic-client-go v1.1.0 h1:aflNjzQ21c+2GwBVh+UbAf9lznkRfCcVABoc5UM4IXw=\ngithub.com/newrelic/newrelic-client-go v1.1.0/go.mod h1:RYMXt7hgYw7nzuXIGd2BH0F1AivgWw7WrBhNBQZEB4k=\ngithub.com/nicksnyder/go-i18n v1.10.1 h1:isfg77E/aCD7+0lD/D00ebR2MV5vgeQ276WYyDaCRQc=\ngithub.com/nicksnyder/go-i18n v1.10.1/go.mod h1:e4Di5xjP9oTVrC6y3C7C0HoSYXjSbhh/dU0eUV32nB4=\ngithub.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=\ngithub.com/ns1/ns1-go/v2 v2.6.5 h1:+2eOA0i+R1E8Yu/4lTKnL6rde0bMJ2S3ebs/JelNrAM=\ngithub.com/ns1/ns1-go/v2 v2.6.5/go.mod h1:GMnKY+ZuoJ+lVLL+78uSTjwTz2jMazq6AfGKQOYhsPk=\ngithub.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=\ngithub.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=\ngithub.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=\ngithub.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=\ngithub.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=\ngithub.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=\ngithub.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=\ngithub.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=\ngithub.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=\ngithub.com/okta/okta-sdk-golang/v2 v2.12.2-0.20220602195034-d7ea6917663f h1:6zPIZb9jjYbKfCdkpjERA6tpQKIiX+4+d4WJ8kEJJ8g=\ngithub.com/okta/okta-sdk-golang/v2 v2.12.2-0.20220602195034-d7ea6917663f/go.mod h1:aL3K0likfyLVapi33OsegX+KJf4c6SDapDhlUcXFEvk=\ngithub.com/okta/okta-sdk-golang/v5 v5.0.1 h1:mwFb5udwexoh105EIE6YhgacLIGOFujhNgQ2fhuBsfQ=\ngithub.com/okta/okta-sdk-golang/v5 v5.0.1/go.mod h1:T/vmECtJX33YPZSVD+sorebd8LLhe38Bi/VrFTjgVX0=\ngithub.com/okta/terraform-provider-okta v0.0.0-20210924173942-a5a664459d3b h1:ML6q0susBNxEEXZkifQGjY5ILGJHhU0a72Dm2DHEbSg=\ngithub.com/okta/terraform-provider-okta v0.0.0-20210924173942-a5a664459d3b/go.mod h1:hVb3TxYi4ibGeUpue2Rqm84YhD/473w0Xv0uIlylUY8=\ngithub.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=\ngithub.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=\ngithub.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=\ngithub.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=\ngithub.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=\ngithub.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=\ngithub.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvwxz1E=\ngithub.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=\ngithub.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=\ngithub.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=\ngithub.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=\ngithub.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=\ngithub.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=\ngithub.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=\ngithub.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc=\ngithub.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48=\ngithub.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY=\ngithub.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=\ngithub.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=\ngithub.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo=\ngithub.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0=\ngithub.com/opalsecurity/opal-go v1.0.19 h1:w9JPghoq9ks3/Br/KC/9h8jiJVlY3JJ/k/imq/pMVd8=\ngithub.com/opalsecurity/opal-go v1.0.19/go.mod h1:G7QQIi36kI3kiTl/Dp8AvLDNoui9jqFOSUthcZ0aof4=\ngithub.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=\ngithub.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=\ngithub.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM=\ngithub.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=\ngithub.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss=\ngithub.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8=\ngithub.com/opsgenie/opsgenie-go-sdk-v2 v1.2.9 h1:HwHlfhYFjvgB0mPrXiQFLfAGA5wEpbfNfmceMT3Cw/M=\ngithub.com/opsgenie/opsgenie-go-sdk-v2 v1.2.9/go.mod h1:4OjcxgwdXzezqytxN534MooNmrxRD50geWZxTD7845s=\ngithub.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA=\ngithub.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs=\ngithub.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk=\ngithub.com/packethost/packngo v0.30.0 h1:JVeTwbXXETsLTDQncUbYwIFpkOp/xevXrffM2HrFECI=\ngithub.com/packethost/packngo v0.30.0/go.mod h1:BT/XcdwLVmeMtGPbovnxCpnI1s9ylSE1cs/7pq007NE=\ngithub.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=\ngithub.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627 h1:pSCLCl6joCFRnjpeojzOpEYs4q7Vditq8fySFG5ap3Y=\ngithub.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=\ngithub.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g=\ngithub.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=\ngithub.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=\ngithub.com/pelletier/go-toml v1.7.0 h1:7utD74fnzVc/cpcyy8sjrlFr5vYpypUixARcHIMIGuI=\ngithub.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=\ngithub.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=\ngithub.com/peterhellberg/link v1.1.0 h1:s2+RH8EGuI/mI4QwrWGSYQCRz7uNgip9BaM04HKu5kc=\ngithub.com/peterhellberg/link v1.1.0/go.mod h1:gtSlOT4jmkY8P47hbTc8PTgiDDWpdPbFYl75keYyBB8=\ngithub.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=\ngithub.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=\ngithub.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=\ngithub.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=\ngithub.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=\ngithub.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=\ngithub.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=\ngithub.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo=\ngithub.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=\ngithub.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=\ngithub.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=\ngithub.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=\ngithub.com/posener/complete v1.2.1 h1:LrvDIY//XNo65Lq84G/akBuMGlawHvGBABv8f/ZN6DI=\ngithub.com/posener/complete v1.2.1/go.mod h1:6gapUrK/U1TAN7ciCoNRIdVC5sbdBTUh1DKN0g6uH7E=\ngithub.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=\ngithub.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=\ngithub.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=\ngithub.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=\ngithub.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=\ngithub.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=\ngithub.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=\ngithub.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=\ngithub.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=\ngithub.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=\ngithub.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=\ngithub.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=\ngithub.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=\ngithub.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=\ngithub.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=\ngithub.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=\ngithub.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=\ngithub.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=\ngithub.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=\ngithub.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=\ngithub.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=\ngithub.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=\ngithub.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=\ngithub.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=\ngithub.com/russellhaering/goxmldsig v1.2.0 h1:Y6GTTc9Un5hCxSzVz4UIWQ/zuVwDvzJk80guqzwx6Vg=\ngithub.com/russellhaering/goxmldsig v1.2.0/go.mod h1:gM4MDENBQf7M+V824SGfyIUVFWydB7n0KkEubVJl+Tw=\ngithub.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=\ngithub.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=\ngithub.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=\ngithub.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=\ngithub.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=\ngithub.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=\ngithub.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=\ngithub.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=\ngithub.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=\ngithub.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=\ngithub.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=\ngithub.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=\ngithub.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=\ngithub.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=\ngithub.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=\ngithub.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=\ngithub.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=\ngithub.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=\ngithub.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=\ngithub.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=\ngithub.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=\ngithub.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=\ngithub.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=\ngithub.com/sourcegraph/jsonrpc2 v0.0.0-20210201082850-366fbb520750 h1:j3HKQAXXj5vV3oHyg9pjK3uIM4bidukvv+tR2iJCvFA=\ngithub.com/sourcegraph/jsonrpc2 v0.0.0-20210201082850-366fbb520750/go.mod h1:ZafdZgk/axhT1cvZAPOhw+95nz2I/Ra5qMlU4gTRwIo=\ngithub.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=\ngithub.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=\ngithub.com/spf13/afero v1.2.1/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=\ngithub.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=\ngithub.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY=\ngithub.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=\ngithub.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=\ngithub.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=\ngithub.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=\ngithub.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4=\ngithub.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=\ngithub.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=\ngithub.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=\ngithub.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=\ngithub.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=\ngithub.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=\ngithub.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=\ngithub.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=\ngithub.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=\ngithub.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=\ngithub.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=\ngithub.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=\ngithub.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=\ngithub.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=\ngithub.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=\ngithub.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=\ngithub.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=\ngithub.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=\ngithub.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=\ngithub.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=\ngithub.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=\ngithub.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=\ngithub.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=\ngithub.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=\ngithub.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=\ngithub.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=\ngithub.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=\ngithub.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=\ngithub.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=\ngithub.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=\ngithub.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=\ngithub.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=\ngithub.com/svanharmelen/jsonapi v0.0.0-20180618144545-0c0828c3f16d/go.mod h1:BSTlc8jOjh0niykqEGVXOLXdi9o0r0kR8tCYiMvjFgw=\ngithub.com/tencentcloud/tencentcloud-sdk-go v1.0.392/go.mod h1:l8PU0g9KTDkwn6R4F9WbXXSUwRgKs6k7rj52H4uAcM0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/aa v1.0.392/go.mod h1:DTrc+dJQjeL+2b7KEkfW1RiZqssiHxIMjRWhnt6PmU4=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/aai v1.0.392/go.mod h1:6jmvX/9tx9LoT7lireq2bULrcmgenqF9l4UQdzo143w=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/advisor v1.0.392/go.mod h1:b9+KYFj9jCUIZ8T0DVro/got27tyd/pB0q1QrUFwcSc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/af v1.0.392/go.mod h1:qRv4TLxUNx5dLNZ7JaUdjoHRaSenGmsklagXzDlQROM=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/afc v1.0.392/go.mod h1:hJ0HZsg/3MwzX3ya0HP7w/jPiRvWgRQKYPH528zqY74=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ame v1.0.392/go.mod h1:QJZxSdsMVq+88AuykPcHF8+/ESZ+49gjUuW3DI3CGRo=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ams v1.0.392/go.mod h1:dL3MPh+kkH/Gk1nCYzhsLrDaoGI5cKhkKs30hjFoEBk=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/antiddos v1.0.392/go.mod h1:wBgaaXevSgPnE7yJjAXMc1OzUoYmYvRfTNU0GZSmnVI=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/apcas v1.0.392/go.mod h1:O73rjnaIvuIZgXq90VdQcvRE2TD2cthlPgWQtf7s3tQ=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ape v1.0.392/go.mod h1:WAO+LcyY54GnZHVqcvvfBstOCMSGDVegp8rn2eph1Iw=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/api v1.0.392/go.mod h1:AJICnuPWxCHvi7lKeDnSXKsIsAucS/PWRqTOOOYq48Y=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/apigateway v1.0.392/go.mod h1:21LDdTUcEFD/MQ1K+snj2uxJIgpUdVEVwWDKz0230U4=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/apm v1.0.392/go.mod h1:w8IdLLfXD1VFMAYBS1WXQSFFXGbvtqkj2GT+J+LIVrQ=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/as v1.0.392 h1:lx+6jdd2hwa6T6IX7MUcVlQSQHStP1D8bFMfzIZGKBA=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/as v1.0.392/go.mod h1:3FxZMhKizGLMIUbKcJXgq8i62V/J0jLOCrx2UWbtFAc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/asr v1.0.392/go.mod h1:t8he4SZFbUCsnz5EbWLKSqAy0Is64txTDK1A+Z0/xco=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/asw v1.0.392/go.mod h1:Xvjn7PlQw2zGpxtsCtd5UC5Mql1PvoJVMXf5GmoB0dg=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ba v1.0.392/go.mod h1:qWyBYxpCuNugqV2o4XjCqSPhg5tD5WyYLScwlFtUgXE=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/batch v1.0.392/go.mod h1:Bcf3LrDHo+K7H9roS5ZiuRzmMrPkieME5Anng4nAsOg=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bda v1.0.392/go.mod h1:OULBM5Ih6H1eT893Ll7cE5W/FXybPo3JJ7k/AqUCRDU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/billing v1.0.392/go.mod h1:7sPyME+8pKQ8d1LS0FKdXc8TUKrWDEWRKUM27JLDGzU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bizlive v1.0.392/go.mod h1:nkaF7ItG4fm5rsaLumBSGKY9mXzgQgh3KnIYQUCQaFc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bm v1.0.392/go.mod h1:ids4aIuZSF7mkGVdwliRgATEX8+g30zl1b50nLJsCV0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bmeip v1.0.392/go.mod h1:GGjMWSNMWNQT8kgIiNgdF2fbEeSiMH7MSODyq5GInX4=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bmlb v1.0.392/go.mod h1:SmHUTHpypDQgwR8YyvgBa+hAC2FcrxtuKU1Iv4ij/Jo=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bmvpc v1.0.392/go.mod h1:MrhS7lbR+lb3EwcpbGq/Ejk7CYV7h1s3wSwX1K4X5UM=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bri v1.0.392/go.mod h1:KoaMmozxiAcrZCTWA0sw09002AGLota8Lmqj7yXaeNI=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/bsca v1.0.392/go.mod h1:xW6Fek5SZTm6mpKo9Mj4L9FaKo73DtwiT0nEl4166Wo=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/btoe v1.0.392/go.mod h1:NlXIUbdgsam2OiJq7xncwhJEHZeMAAZ6jyhZ+PH49HI=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cam v1.0.392/go.mod h1:acBn3ulGGf5qxMPOEZhBHk6j5APeHaY+6fNXSzRpdss=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/captcha v1.0.392/go.mod h1:ZFptrAOrdTVhFzK20xyr2V9cAMlMPH+71AuCzPlwDQY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/car v1.0.392/go.mod h1:YZwLxdEO/W31327vqO2qnOzEMbo2KQWDa62/3lZNEmM=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/casb v1.0.392/go.mod h1:ZglyzFGheX3WZ7HK0oVGeG4tkSMkuQx04zXsl2+9vHc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cat v1.0.392/go.mod h1:rkJcPX/KCs/tYEmgZEKpSSzPn94ONIJ6atS9GAc1pzk=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cbs v1.0.392 h1:MM7nFKuiCUiRB62E0tztX0GP9t9jlQWw1RSN25l7Rks=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cbs v1.0.392/go.mod h1:ECpNTElIKrMV8BwEn03XYkamXACRvAlZgx1EAzzcV/4=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ccc v1.0.392/go.mod h1:RX0xmYgKz4dp7U3KhSXEXeXHFHF/pu34CCYwL2IUiyE=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb v1.0.392 h1:eLDYejfjqHlisYwbIw/Gsbrje4sBImQ2C2BMk8RPMxg=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb v1.0.392/go.mod h1:CGSkz34/qQhHongnzxusCdOYGFOv9MNxLswjQvG2F9M=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn v1.0.392 h1:qQtisQ1MhmEvrfOcC8rH58mbVl3yh9GsXG7PMdgJVKw=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn v1.0.392/go.mod h1:o0BPcH6s3XUCTYSd8iIUy7OVVFMM798DOS6ki8Nwabg=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cds v1.0.392/go.mod h1:sgCyJC4soLBpxiiQEcSfrIhZQQr8Zo/UzhqA1uIzbEk=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfg v1.0.392/go.mod h1:CikD4YNymQr1w9fXIRb2E5dSY0nU0irLhwBBTpglY6Y=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfs v1.0.392 h1:glu2KNW0OVonY9HfCFnSBXLaQqlx98MQs7LcgDl4QbM=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfs v1.0.392/go.mod h1:yvq0h/r64qGGI/1sbZKtjnZMMxuALewGjmn8a7XOyss=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfw v1.0.392/go.mod h1:Y0u7gDzZgA0AmfQLNVWs2DR0Sr6m4C33PTJdyevgc+M=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/chdfs v1.0.392/go.mod h1:aR6ahu+EnWWPG8vvwd+POBGNmwvybBRX4I+17QFAocw=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cii v1.0.392/go.mod h1:O0heQoIJ/RwXvRbX8Iy8k/0WOWVavNv1F0crKZKWfa8=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cim v1.0.392/go.mod h1:vLzsLwAc87+FcHxKfHtkerFYKK/3PUkhEx0ztDPYUlI=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cis v1.0.392/go.mod h1:XvMGlOQHUDQgpOBJ+421fQuo68PHEPcVhEPjsBDefGc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ckafka v1.0.392/go.mod h1:MBaIWHX7rPQGet6WE8/OkvJYyNUoSBafxLMudfVNqYY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.392 h1:dlPmKk78DLalajGIOZHuR+TSyBpgn4/QnNk07IFR9p0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.392/go.mod h1:Lt/I8Gr62gOKXesYFHtq/Kv3co2mQrGxBPK7CNuXH6Y=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudaudit v1.0.392/go.mod h1:SZdsFrhJNKJg0gA42wj1eZss6q/UBbN/P1psR4HiONc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cloudhsm v1.0.392/go.mod h1:4KVirYlx2K4Drzfe7sfNAIMsb9lBEOAjB+g8PvXrQa4=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cls v1.0.392/go.mod h1:sZcOFl5A1I43vJOFks/jFAu1shXalQ343pihYZ8qdbs=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cme v1.0.392/go.mod h1:/+8Z5bV/oKyfyu53yYOdqp5skkz8LSPIpBrzfOcq0K8=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cmq v1.0.392/go.mod h1:SLXAFKr/NWd7WY2acH5YZnFMnzk+71tokVHB5V/1dEs=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cms v1.0.392/go.mod h1:82E5sW1ChY7eqBhES81zuoVj3WHgSkLjH0kfEWbS0/s=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.194/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.392/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.694 h1:4dqnDVXv3l7I7lixwAHW7tfFtdg9qfY6rwbq/KUkltQ=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.694/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cpdp v1.0.392/go.mod h1:McFISRmzeVkPd8qZQjQw870DARtJHjJZoHHYMkhYcZA=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cr v1.0.392/go.mod h1:GZTyhAIbF0jhh76vReDXBXqd2+xfI4Fl8bM1mlq6Elg=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.392 h1:nWW99NdwjHzoFiYzk+6QvVjituRpDSgGP33TX4XX+Jk=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.392/go.mod h1:Xj5eC4ddKRtXRNImBqx8MSODhRFA9Z0KS+CyYgJ+l+0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cwp v1.0.392/go.mod h1:QlzpgsD4nxGtYPyqbiW2yMGmIJ5WecWqjeRMkqADDMs=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cws v1.0.392/go.mod h1:WIXgl/T8OJyj4zbFqdISlhsotZ8yoRp7v9hXnhlzpTM=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cynosdb v1.0.392/go.mod h1:8h2D1Fey/CaIdY7WjWW1ASiSLu/VxWj7J2GevI/3z+g=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dayu v1.0.392/go.mod h1:I4045ahQpAeRDhYSURf6wpi6ffl6uQT/reKtdYXs7kI=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dbbrain v1.0.392/go.mod h1:MYyF2jlEODbdIjla6M7YEzE2/ULCX5M/eRrYqYST3c0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dc v1.0.392/go.mod h1:ZH9Pa+f4npIaHKRW7Ll1nbZwA+nzXY1UqmCa1A1+ghQ=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dcdb v1.0.392/go.mod h1:cCmgY7fqFQxOYeNwvpreGCeYRJQLO/flMBpiec75ZSQ=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dlc v1.0.392/go.mod h1:ErUoZLFU9B7ooVZMADuu4jo4EVw5Ms7FlTJoa35Shtk=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.392 h1:7ulkCU1j4Pd1dMP3W1dtIJdbsozpmz6L7yKHqHFMCqs=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.392/go.mod h1:VANa6/5PgNfc/LSztHhGJ/m8gPjNixXThFriVzHbyck=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/domain v1.0.392/go.mod h1:m2tfIT1aLqKSkSs8E+n1UmcXce3c3+1hNQ7ztVHVFTE=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/drm v1.0.392/go.mod h1:RnSU/F5NQjgWV7s6eWx/8jvZlGl0B8n5TrtwbBjXjVQ=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ds v1.0.392/go.mod h1:K0pqZPZ/QbXa3IlSqlkWidZ+5mk4Lqv9yIbb7fJnJxs=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dtf v1.0.392/go.mod h1:KHaFy2Fhrw1W184+056rGgvno/StYQcGDViaedTJznA=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dts v1.0.392/go.mod h1:tHwEOPehg8N174+RnlARbLy/EJYr+53c3M8X9vHwXEY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/eb v1.0.392/go.mod h1:jKUTFz+rcxkhgXzNu/AHmUV3e24ZL480PHEr2xoQaO4=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ecc v1.0.392/go.mod h1:HE635nwo4PyCwFo6iF2dMm5OlVlbQEXolP8r7Tb2jtc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ecdn v1.0.392/go.mod h1:FGf+ZqmszfTxHC/FdA80AS12hnjeTkFVK87HlbxBZOs=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ecm v1.0.392/go.mod h1:m+MgeUMK9aREIyexlQKhTnTJ5LYiJrqgGRP6GbNKxQA=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/eiam v1.0.392/go.mod h1:39LlmWfDCFqF9T0jGmTiPVvdPlUKAE76TleFp6YCYnY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/eis v1.0.392/go.mod h1:WUHGh9a2X2axIsKDNVMGuMS73/HLY8CiET3WGSMMNTM=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/emr v1.0.392/go.mod h1:SezZx9CNe4unY7BESc9EaxOChv+VYJvl63mtIGCUHjE=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es v1.0.392 h1:aMwuttstMjpb3qU6ntBclDtR0eSmsPDAJpiyEAEkjMU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es v1.0.392/go.mod h1:ghv/yzL668faxV8dUzBhhB6GE8MUCmoavmVstX05FNU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ess v1.0.392/go.mod h1:9peIiucX7YNqdwYE7+YMEUWmaU/fIGtT8OmbYeTbH9E=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/essbasic v1.0.392/go.mod h1:y93qrt6/nztrxlM198Xzvmo9/YTUny5HPWTuUz65GO4=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/facefusion v1.0.392/go.mod h1:cqh00UVhniao8Z/L3HznxuitvRFbL7TTxuBTe5ehRT0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/faceid v1.0.392/go.mod h1:ZUMER9kT/kJo+uwiExcY3OHHBFVy/B+Mr0vuZOCJINI=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/fmu v1.0.392/go.mod h1:4R5/lzMKxnFYaE0vVVDQQ/E4f7eRmNIZpNODksTJSkw=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ft v1.0.392/go.mod h1:rE3skyjC2hQdxK0i2vyq5RsEgAACTCbVUTGeO/iHDf8=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.392 h1:rBxgLQ7gFE5Ev4Fql6PlU+IsMzKQCXSh6X40F7REF8Q=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap v1.0.392/go.mod h1:TKZpQh562xb0dpsaLFs4uf4at7sW+RGnUkA3N0cKMdc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gme v1.0.392/go.mod h1:4XTt8t+1vxSg2t7uo5Ajq7lSt+HmibQB8rMWBCm5Q3E=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gpm v1.0.392/go.mod h1:0rBUMMP08FPOQFa2jTRQ0ATqsoU3Tx6C4cTgDP5bz1o=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gs v1.0.392/go.mod h1:79BYK6NXKoIjHTkRjBC6+c/mmXpwsBFzdfkqOVDJEz8=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gse v1.0.392/go.mod h1:gB/l0LL+K9XUQopcPi1Wfx2eFkY6DYjwSf4epps2j0M=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/habo v1.0.392/go.mod h1:xmqWsmtDvIyaKSscWq7q3gRmmRLa58dDXSN2f8OSzlA=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/hcm v1.0.392/go.mod h1:by7q0Kg8lg0IICqxVIt6GUwC2yTMObLM9SbH88HzKvY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/iai v1.0.392/go.mod h1:8qUUJmLmmXs3j0NC2jYEW0X6qCLmURmUBCqBdXdEE28=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ic v1.0.392/go.mod h1:Oo9GxHp0swP0V7v8O6qVRmUz6KrxmKNh10yWmE9x9zk=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/icr v1.0.392/go.mod h1:qtDyLZi6BbO6TAbobxvw7CgYHmV2ql4SKWxmEARiEEU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ie v1.0.392/go.mod h1:xoz5jyHsmu3vAJIbh87b6igKGbk8VvHJX7mfdBeiR3A=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/iecp v1.0.392/go.mod h1:jtXZaxT4yytIRHwecWJ+YHw/+dvcSWnPha6P7PIT9XU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/iir v1.0.392/go.mod h1:fW5G0GgVtu1Wr78eYiy3ZGoxHdqxmMN/FVwQGNpSukk=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ims v1.0.392/go.mod h1:Ea1ma3CcF1MOf4JKmBud0YWX71AMFrUy2EykkwK0/TY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/iot v1.0.392/go.mod h1:YH0Km2MqGTDMLNQ3ub4y6bGzsOjwywoylhp9MaHaH1s=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/iotcloud v1.0.392/go.mod h1:/ebe2zzlLC5kFk1j4sSa2QPG0vLEKm0mJKrdlXy/sKg=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/iotexplorer v1.0.392/go.mod h1:sHmWtm7yEa1mSTq54mjQFM0DqovGpocDa/OJz/VUZlM=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/iottid v1.0.392/go.mod h1:Lu/i31pEyb0YLv5/sHfZpC62IqQGAoehp1L56ARcor0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/iotvideo v1.0.392/go.mod h1:j5QCiQjD05zDCqvkV6w+gVDRE95+bJQiW196qxRHvlY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/iotvideoindustry v1.0.392/go.mod h1:580f4WsV3LH9XnlhRczqBEQiqZxbvAhdMrEYdv1WyIU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ivld v1.0.392/go.mod h1:hjzH+mbhQO4WeygU3hphHRa5tSmOjG3rCM5+GM6Ykps=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.194/go.mod h1:yrBKWhChnDqNz1xuXdSbWXG56XawEq0G5j1lg4VwBD4=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.392/go.mod h1:GECqXBLYXn7xqyXCN/YIQ45bUNF7gDJQAFp6qjJkj7Q=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lighthouse v1.0.392/go.mod h1:wRW2TQqQP/zr5/GGKbJP0Ab8UEewgWYGpNUs85RMFTI=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/live v1.0.392/go.mod h1:at09OZ+afnnCDlodmPigsNAle6jWFG1bSel4wcE066U=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lowcode v1.0.392/go.mod h1:57aMhnIwwjq0+SoBFRFPfDWp69DpAlOPgqwT39pt1Vg=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/lp v1.0.392/go.mod h1:SgxVJXT6NUC8/0b5cI5Jv/MAkDLb5vzphCCCjqLRV+U=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mariadb v1.0.392/go.mod h1:yX6eN0AK1ZwwvOnQlCpoQZL0rc1WHnGFvTGrne3ezIc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/market v1.0.392/go.mod h1:vNSURyrbZ7bpgbY+OdLmrGb/lVb3YzxerH/3CsYj/Qk=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/memcached v1.0.392/go.mod h1:vaCd1H8VrjORB6qpr2sovQWHW0ab9X39t8IXA/uNvCQ=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mgobe v1.0.392/go.mod h1:08KerdGUIhlraSWBIlTogVmhvayBZbV6RrAxjA5L5bE=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mna v1.0.392/go.mod h1:e4oaaKk3nJsbezC7FCotG542eIJ23R436sOngtn3FTo=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.0.392 h1:cMHisCLz2NBWrb4ejs9Dn4mZL2Kou1qLd7+/KDErSUw=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb v1.0.392/go.mod h1:gxltmLqrwHq8xiraDqQf7WaLQmwy8TTJpLGk0FKFue4=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/monitor v1.0.392/go.mod h1:5gsfhWbRjhwfw8qAkKxdStjlGZgT9gssf4vLpUre+lU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mps v1.0.392/go.mod h1:oA47qOcK8JK2NfeKjGJT+dJuNeUmCEuCmt37IUtIcQY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mrs v1.0.392/go.mod h1:i0un5eEqTNHHn1rDMuzpX6gwSCVW2O/k3RHg7TdZLxA=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ms v1.0.392/go.mod h1:NVAW6DMNDAeKNNSu+RHrelJFfljYZjrh5tuqRO2cqS8=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/msp v1.0.392/go.mod h1:/FFMo+MXMiBzNYmzAcc7aRPUs1bSTZI/Exrxpp67kOY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mvj v1.0.392/go.mod h1:/47BBG877fei7kqJ0Jq8QCId+S3oKhzXVBbW7mBaX7c=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/nlp v1.0.392/go.mod h1:bbYCB6gQZJ2Yh1S1JiA2HtlIfRqogjAaPtchGI2GJcg=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/npp v1.0.392/go.mod h1:HP91NCQgAq8Hh73n21l4pv/4DMRH4slJtLv1sXyTw8c=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/oceanus v1.0.392/go.mod h1:RhImNz5cksJEYsQbbNICLI8/+X9eVM37xvEW5Oh2hNk=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ocr v1.0.392/go.mod h1:mJirSoWUvh6qEgBD/rJ5IDVuiyRppCrgnr+stdjv230=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/organization v1.0.392/go.mod h1:h1J4uZ1Pt/nN6ODcBse8Itz7QAXK2FALKjQkMWX1TpA=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/partners v1.0.392/go.mod h1:BjEofUWcDeQVHRXYX8drn9EmVZXkOOznwSAxITmZjiY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pds v1.0.392/go.mod h1:jVbtUhMGZwdYC5qPhhWlG5wLI/kqHns1aoJ/opH1gBI=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/postgres v1.0.392/go.mod h1:7/xJYJ+/2X1q40woYOEvhaDx1wcHwQ2ZTYPncFnMFeM=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/privatedns v1.0.392/go.mod h1:L6ywKmxdqNziWG5piJdyN83gRS+KMOR2nsqoS5khtNI=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.694 h1:bXkBe6eiNPPY1/7EFFIP2osr+xHonJLcrQzXAAxQ/EY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts v1.0.694/go.mod h1:tfbStI3oCFz07Xve9lZ/3k5BYP0TjK1ncE0qkS3bbII=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rce v1.0.392/go.mod h1:Q+Lj6ujWGd0VijJRdmnisHn0/K5MHlDwETZ5UNoDXRU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.392 h1:TWsBoGmj5VuGyHwCksgKxKrZIwVVwn5bTuDfRbWD/yY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis v1.0.392/go.mod h1:kR0eQOu2//soHJHK8aDmIoU1f4jxamcVtzhuvpPqe3Y=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rkp v1.0.392/go.mod h1:b7TyD37tXbCOYAl01fUZbMdRRvGM0czxmkN7GzMkF+8=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rp v1.0.392/go.mod h1:5uQEYSoTjDIg+LCLsARMHz9N58qaK97v++GH5vrrATQ=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/rum v1.0.392/go.mod h1:wb1CKYRqu8oQAYBOCLpUnyc3A99gms+NvV3YLH0EpHc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.392 h1:X04ZC3AWxxNDZlhJhAqNtVPh/UGNl+ouxKf7HYDsT5o=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf v1.0.392/go.mod h1:XN1T6wRC+7dbBOa5Chyymgr6I+QoGpo8JaMvaHUypLY=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.392 h1:X7JfN/POHwRtzAO35RvaSKXfR1ekH5IPnFlKCNQ7Jrs=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses v1.0.392/go.mod h1:H9la1JWDbuXCx0XVtBRl85uJcYSV+U5SMqYFkQn9wHU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/smh v1.0.392/go.mod h1:WJZvkOhnu9hrxb98KFyKylBdY1AadH1rxiSBHpU4a/k=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/smpn v1.0.392/go.mod h1:8KuArM+vHCijgUsnXmxkpYgtz7niFMLC32GCjeNcYLE=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sms v1.0.392/go.mod h1:ak0fr7abDiet+ndTza5RMOt2Gc2plLQzoLbLbay/pqo=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/soe v1.0.392/go.mod h1:Xys81ogDoqhHma+wp2eZtUgR522a0DSo+OIPUeahupw=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/solar v1.0.392/go.mod h1:ER+ETUwbMzHiU4IdtlSwxTcapTCOnJvKBa+4HWLSeaM=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sqlserver v1.0.392/go.mod h1:zH4UBZ2DAluJDZu+3PFOxmfRLbHNLM8LOC2cHCYbZNI=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssa v1.0.392/go.mod h1:NlHVzaSJWambgqxlPi2sjXZqTPQKkAkdlEs9kM+Bf2Y=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.392 h1:O9BhkAY5DuXsZQMUugrp8r+l8h9c5SBkl9AtgSXYiS0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl v1.0.392/go.mod h1:i7xMr7hiOKobK28YqZxkcPmPAThjxInKOQftIQ1J7nc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sslpod v1.0.392/go.mod h1:h/84RSkOo7dgbGOAwYSV2WdWkUv2OQoVRjNfrJS6jUM=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssm v1.0.392/go.mod h1:NN8F2vmQ4hnA/iCq+/4ekfocQdbIlWvT4rNCjx+DmcI=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/sts v1.0.392/go.mod h1:kWzzUFykmDWPoh3t6mO3Cm0pNJr3P0DHpmfITVVsA+g=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/taf v1.0.392/go.mod h1:p/huA59BWTe2ICfslUzb9CmVkKS3d0kHzaPU1upcUj4=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag v1.0.392/go.mod h1:4lW1UzRtbnhOqKDTTkn6Ur9eBtJyzcgpg4KnLxsp/RM=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat v1.0.392 h1:pvuiEOVPvpWavsVu07LLrU4N+FBklCmCByQRvorNGPc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat v1.0.392/go.mod h1:khrPL4zu0yZ6nCvxmprL/exY5dX+aYLoq0Wf5ZA6zoQ=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tav v1.0.392/go.mod h1:mVONhjO15kJGkTN092oi4C9I92RdC9wE4mlc9q6kmt0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tbaas v1.0.392/go.mod h1:xf2aD/TKZhvw3FHqQw/p6Ye+KpknwV1ieBA75F1mt6w=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tbm v1.0.392/go.mod h1:wf8iEdOIPGM6csi0lGfqnB1j/SX8jr5liwUZwwt6oUc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tbp v1.0.392/go.mod h1:P/+ZRAi4+2nCRGNKHYPI+yCAr3cQZBA00Gag6/zoxMQ=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb v1.0.392 h1:cQKmZLvHVAVn93Vd+Ke4drbRIHysk0d6ASQ9A1WcfL0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb v1.0.392/go.mod h1:xyNB+BwaKN/tavfBJ2DJsbx3FWRF8rUyl/bJ37YiPSQ=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcb v1.0.392/go.mod h1:6caVupBMcNMv8jxHmhbUyZKREjzki1kxmXHqZlNylU4=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcex v1.0.392/go.mod h1:LbBLo9ZxesFf7FgpGaDaOMUr3NbNhjrIzF6jG3mwq6k=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tci v1.0.392/go.mod h1:7JzdYwICHrF8Cz2MWyPw/yo5j9/n2BtqE909Z25VVdc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcm v1.0.392/go.mod h1:VRJDKhxen3gaxn4EisibPAyjewSY3vFaYSsLXoh4bZ0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcr v1.0.392/go.mod h1:3AZguzwaPAwRyLTUQm3h1ROEnnwkgMg49a/myZhBl40=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcss v1.0.392/go.mod h1:ibYN8So3r1ScxmJtGxV8wTs0nGxKvih+IOq6GLNtWzU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdcpg v1.0.392/go.mod h1:m21mWip509ME/nUwrA+n9rBLpBb8Bjuo/HkHuEojkZo=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdid v1.0.392/go.mod h1:Do7u7dYFlitjrrXXMcnLivCGKVXI+mIENqFmqT4V/fs=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tdmq v1.0.392/go.mod h1:LfFhQr0uPl2GrjE0r7XghDu0PUWCoGBilP9NooPmpog=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tem v1.0.392/go.mod h1:afUYlMwHkDmUle3ZGxz32+Q/cwyjFgMgaF62Q+qg6DU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo v1.0.392/go.mod h1:kHQx6ynDcmtj3hjL8HFn8f0VCa88y8j3CouKZAHrEiU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/thpc v1.0.392/go.mod h1:ujCoikwjBD2UmfZspopyqjmEXfpcEma5b3vGxuWYCoU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tia v1.0.392/go.mod h1:t3hDg8esQAI5He9+HHsaBMwPlUtXHLKL1oDZEmNL86g=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tic v1.0.392/go.mod h1:pwNDwFLs3yCtK8HawUDMztUsnyAfSAX9eSndjliZPo8=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ticm v1.0.392/go.mod h1:OXKcfK1xsR9LLLxPbX80AALWddbbYjQeil0rtvqRezA=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tics v1.0.392/go.mod h1:oxphJK1pAeoMPY53av8ww3aUWp96VfrMVp2YG4f6+TU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tiems v1.0.392/go.mod h1:417BQWS7GuL+8l+GpWCr6AkNNZOaUi+j2WilU0J5Ntw=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tiia v1.0.392/go.mod h1:yLS9YsxCW7lXhi1EEKkSwmOxS71g63bPACnRMwpJ16E=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tione v1.0.392/go.mod h1:B7n8S8w3SD4O2/iOMotI9DYkNPkHAlVB6gwsOl6p7J0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tiw v1.0.392/go.mod h1:N3r/BgWXtAEwLl7UAKZQoxeySdgPlVAHDIZL7pyUfnw=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tke v1.0.392/go.mod h1:mT8kOKG0FrQ/fYEucmXco0KKuhfYnZVGuq6R5pTADCU=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tkgdq v1.0.392/go.mod h1:RfAyFVKeT1qyxcSJct/F/eOMbKow0mqc42k2xxabtFk=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tms v1.0.392/go.mod h1:ZeGaxsKctozJ8st9gJN1zjpxDgFOVJ3Oh11hBEAPQb8=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tmt v1.0.392/go.mod h1:vwVvH0u/5U+C3lyBITVbq1Y+xqee3UUdCg24BBMLZ50=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/trtc v1.0.392/go.mod h1:XbzSAobUE9scZu83XjcpnKUHNMuuFNlYp79pXQc6qsA=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tse v1.0.392/go.mod h1:ed7c+8SRuGpq5ugyIvi17IJGWzJQehGF3sFagBoP/cw=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tsf v1.0.392/go.mod h1:dqtYK/21KKNJuctoBL645lisyBaE2ZvX+kRZCzUjZq0=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tsw v1.0.392/go.mod h1:JvTUoj4xCXOlpLSpJvwwNLNyWrnmO/iSd5iwoTpuMNE=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tts v1.0.392/go.mod h1:QwxAQvtIU3tgRzuY21KOWYW3wdV6+coyLZ1IfAcBZm4=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ump v1.0.392/go.mod h1:lYZ7A6MWoBw4FbxJKHTkebpHnbmxoHRIy2PJS5hmBVA=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vm v1.0.392/go.mod h1:OhyaYhAbA0D8t4KeW9c0apOwDw1Hqzol0eY4Ez81IOI=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vms v1.0.392/go.mod h1:PowsbqMUl5Rvy5LcO5aN8QTdI+9xAHxzDEpjMJ0tZ64=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vod v1.0.392/go.mod h1:sSLZPQ/C1k3HDBkNUpDxs5vWua7D7QRlBqYzWG+1FEA=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc v1.0.392 h1:nx8MQ8yJ3srpfEAlKLQKtOsBCBc30QJ3Q0RsSOGSphQ=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc v1.0.392/go.mod h1:IAl660UAxdUtp1rHUwbUwxFCVqwk61xAIRbBk6QtTy8=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/waf v1.0.392/go.mod h1:BQ6k/+94Dyt6lL3c1hCmZ5ZL4mQfA99rc5KYlIbXlRc=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wav v1.0.392/go.mod h1:P6n2vrZrODnn6ZqBI3YVHu1z6b4rgw2sedydTRUlx+A=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/wss v1.0.392/go.mod h1:ozbyiG9k3agJuU5wPO/ApoNgJhmZkhmui6W8wPLSK5w=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/youmall v1.0.392/go.mod h1:gBQJA1TavpoLGMM7xT44iUH9SZANL3AzOEwEgBpdRQM=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/yunjing v1.0.392/go.mod h1:Z7GSc5/y8Y1A65jHwa9M+hIBdPrjUillIJPm9pd/G/U=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/yunsou v1.0.392/go.mod h1:E7+hTFE12O3oveGfTQgXSY+XtxRuPwz0+jX8MLzxVNw=\ngithub.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/zj v1.0.392/go.mod h1:g/Ay6uohIV5fE9+V+el8CBbbm/iVl2zziuHhu8v6zXE=\ngithub.com/tencentyun/cos-go-sdk-v5 v0.0.0-20190808065407-f07404cefc8c/go.mod h1:wk2XFUg6egk4tSDNZtXeKfe2G6690UVyt163PuUxBZk=\ngithub.com/tencentyun/cos-go-sdk-v5 v0.7.34 h1:xm+Pg+6m486y4eugRI7/E4WasbVmpY1hp9QBSRErgp8=\ngithub.com/tencentyun/cos-go-sdk-v5 v0.7.34/go.mod h1:4dCEtLHGh8QPxHEkgq+nFaky7yZxQuYwgSJM87icDaw=\ngithub.com/terraform-providers/terraform-provider-openstack v1.15.0/go.mod h1:2aQ6n/BtChAl1y2S60vebhyJyZXBsuAI5G4+lHrT1Ew=\ngithub.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=\ngithub.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=\ngithub.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=\ngithub.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 h1:nrZ3ySNYwJbSpD6ce9duiP+QkD3JuLCcWkdaehUS/3Y=\ngithub.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80/go.mod h1:iFyPdL66DjUD96XmzVL3ZntbzcflLnznH0fr99w5VqE=\ngithub.com/ugorji/go v0.0.0-20180813092308-00b869d2f4a5/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=\ngithub.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=\ngithub.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=\ngithub.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=\ngithub.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=\ngithub.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=\ngithub.com/valyala/fastjson v1.6.3 h1:tAKFnnwmeMGPbwJ7IwxcTPCNr3uIzoIj3/Fh90ra4xc=\ngithub.com/valyala/fastjson v1.6.3/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=\ngithub.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=\ngithub.com/vmihailenco/msgpack v4.0.1+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=\ngithub.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U=\ngithub.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=\ngithub.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=\ngithub.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vbd1qPqc=\ngithub.com/vmihailenco/tagparser v0.1.2/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=\ngithub.com/vultr/govultr v1.1.1 h1:ntltxMYyJstjKz1v2CLNxFZiqjlt/8HqD1GZeJ/fAMc=\ngithub.com/vultr/govultr v1.1.1/go.mod h1:QXCNTRg0nwu95ayiMC3feYvrAFTLnj94s2FiibIpoC4=\ngithub.com/xanzy/go-gitlab v0.50.2 h1:Qm/um2Jryuqusc6VmN7iZYVTQVzNynzSiuMJDnCU1wE=\ngithub.com/xanzy/go-gitlab v0.50.2/go.mod h1:Q+hQhV508bDPoBijv7YjK/Lvlb4PhVhJdKqXVQrUoAE=\ngithub.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=\ngithub.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=\ngithub.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=\ngithub.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=\ngithub.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=\ngithub.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=\ngithub.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM=\ngithub.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=\ngithub.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=\ngithub.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=\ngithub.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=\ngithub.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=\ngithub.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=\ngithub.com/xlab/treeprint v0.0.0-20161029104018-1d6e34225557/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg=\ngithub.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=\ngithub.com/yandex-cloud/go-genproto v0.0.0-20220314102905-1acaee8ca7eb h1:Wv4GJ82hFYP8LVImxLQESMu3RyJIt/t84ScAdZ9Rfyg=\ngithub.com/yandex-cloud/go-genproto v0.0.0-20220314102905-1acaee8ca7eb/go.mod h1:HEUYX/p8966tMUHHT+TsS0hF/Ca/NYwqprC5WXSDMfE=\ngithub.com/yandex-cloud/go-sdk v0.0.0-20220314105123-d0c2a928feb6 h1:Ct3CuQ5V6qNS7bWaV/TpLff6NJWceWONJCsCRHlIp68=\ngithub.com/yandex-cloud/go-sdk v0.0.0-20220314105123-d0c2a928feb6/go.mod h1:jD5cNrxpacYQh3gHk/yuVZ0GLuUvBnGJUSX0PZM/FCs=\ngithub.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=\ngithub.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=\ngithub.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=\ngithub.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=\ngithub.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=\ngithub.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=\ngithub.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=\ngithub.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=\ngithub.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=\ngithub.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=\ngithub.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s=\ngithub.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=\ngithub.com/zclconf/go-cty v1.2.1/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8=\ngithub.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0=\ngithub.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA=\ngithub.com/zclconf/go-cty-yaml v1.0.1/go.mod h1:IP3Ylp0wQpYm50IHK8OZWKMu6sPJIUgKa8XhiVHura0=\ngithub.com/zclconf/go-cty-yaml v1.0.2 h1:dNyg4QLTrv2IfJpm7Wtxi55ed5gLGOlPrZ6kMd51hY0=\ngithub.com/zclconf/go-cty-yaml v1.0.2/go.mod h1:IP3Ylp0wQpYm50IHK8OZWKMu6sPJIUgKa8XhiVHura0=\ngithub.com/zenazn/goji v1.0.1/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=\ngithub.com/zorkian/go-datadog-api v2.30.0+incompatible h1:R4ryGocppDqZZbnNc5EDR8xGWF/z/MxzWnqTUijDQes=\ngithub.com/zorkian/go-datadog-api v2.30.0+incompatible/go.mod h1:PkXwHX9CUQa/FpB9ZwAD45N1uhCW4MT/Wj7m36PbKss=\ngo.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=\ngo.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM=\ngo.mongodb.org/mongo-driver v1.4.2/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc=\ngo.mongodb.org/mongo-driver v1.5.1/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw=\ngo.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng=\ngo.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80=\ngo.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c=\ngo.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=\ngo.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=\ngo.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=\ngo.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=\ngo.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=\ngo.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=\ngo.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=\ngo.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=\ngo.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=\ngo.opentelemetry.io/contrib/detectors/gcp v1.29.0 h1:TiaiXB4DpGD3sdzNlYQxruQngn5Apwzi1X0DRhuGvDQ=\ngo.opentelemetry.io/contrib/detectors/gcp v1.29.0/go.mod h1:GW2aWZNwR2ZxDLdv8OyC2G8zkRoQBuURgV7RPQgcPoU=\ngo.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc=\ngo.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0/go.mod h1:B9yO6b04uB80CzjedvewuqDhxJxi11s7/GtiGa8bAjI=\ngo.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk=\ngo.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8=\ngo.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw=\ngo.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8=\ngo.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.29.0 h1:WDdP9acbMYjbKIyJUhTvtzj601sVJOqgWdUxSdR/Ysc=\ngo.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.29.0/go.mod h1:BLbf7zbNIONBLPwvFnwNHGj4zge8uTCM/UPIVW1Mq2I=\ngo.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc=\ngo.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8=\ngo.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo=\ngo.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok=\ngo.opentelemetry.io/otel/sdk/metric v1.29.0 h1:K2CfmJohnRgvZ9UAj2/FhIf/okdWcNdBwe1m8xFXiSY=\ngo.opentelemetry.io/otel/sdk/metric v1.29.0/go.mod h1:6zZLdCl2fkauYoZIOn/soQIDSWFmNSRcICarHfuhNJQ=\ngo.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4=\ngo.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ=\ngo.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=\ngo.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=\ngo.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=\ngo.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=\ngo.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=\ngo.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=\ngolang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=\ngolang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=\ngolang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=\ngolang.org/x/crypto v0.0.0-20190222235706-ffb98f73852f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=\ngolang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=\ngolang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=\ngolang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=\ngolang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=\ngolang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=\ngolang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=\ngolang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=\ngolang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=\ngolang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=\ngolang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=\ngolang.org/x/crypto v0.0.0-20200420201142-3c4aac89819a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=\ngolang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=\ngolang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=\ngolang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=\ngolang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=\ngolang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=\ngolang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=\ngolang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=\ngolang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=\ngolang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=\ngolang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=\ngolang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=\ngolang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=\ngolang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=\ngolang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=\ngolang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=\ngolang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=\ngolang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=\ngolang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=\ngolang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=\ngolang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=\ngolang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=\ngolang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=\ngolang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=\ngolang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=\ngolang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=\ngolang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=\ngolang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=\ngolang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=\ngolang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y=\ngolang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=\ngolang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=\ngolang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=\ngolang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=\ngolang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=\ngolang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=\ngolang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=\ngolang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=\ngolang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=\ngolang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=\ngolang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=\ngolang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=\ngolang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=\ngolang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=\ngolang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=\ngolang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug=\ngolang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=\ngolang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=\ngolang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=\ngolang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=\ngolang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=\ngolang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=\ngolang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=\ngolang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=\ngolang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=\ngolang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=\ngolang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=\ngolang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=\ngolang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=\ngolang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=\ngolang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=\ngolang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=\ngolang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=\ngolang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\ngolang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\ngolang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\ngolang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\ngolang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=\ngolang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=\ngolang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=\ngolang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=\ngolang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=\ngolang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=\ngolang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=\ngolang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=\ngolang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=\ngolang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=\ngolang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=\ngolang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=\ngolang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=\ngolang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=\ngolang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=\ngolang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=\ngolang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=\ngolang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=\ngolang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=\ngolang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=\ngolang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=\ngolang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=\ngolang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=\ngolang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=\ngolang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=\ngolang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=\ngolang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=\ngolang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=\ngolang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=\ngolang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=\ngolang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=\ngolang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=\ngolang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=\ngolang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=\ngolang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=\ngolang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=\ngolang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=\ngolang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=\ngolang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=\ngolang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=\ngolang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=\ngolang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=\ngolang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=\ngolang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=\ngolang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=\ngolang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=\ngolang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=\ngolang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=\ngolang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE=\ngolang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE=\ngolang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=\ngolang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=\ngolang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=\ngolang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A=\ngolang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=\ngolang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=\ngolang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=\ngolang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=\ngolang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=\ngolang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=\ngolang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=\ngolang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=\ngolang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=\ngolang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=\ngolang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=\ngolang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=\ngolang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=\ngolang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=\ngolang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=\ngolang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=\ngolang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=\ngolang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=\ngolang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=\ngolang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=\ngolang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=\ngolang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=\ngolang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=\ngolang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=\ngolang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=\ngolang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=\ngolang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=\ngolang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=\ngolang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=\ngolang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=\ngolang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=\ngolang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=\ngolang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=\ngolang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=\ngolang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=\ngolang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=\ngolang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=\ngolang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=\ngolang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=\ngolang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=\ngolang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg=\ngolang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=\ngolang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=\ngolang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=\ngolang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=\ngolang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=\ngolang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=\ngolang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=\ngolang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\ngolang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=\ngolang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=\ngolang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=\ngolang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=\ngolang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=\ngolang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=\ngolang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=\ngolang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=\ngolang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=\ngolang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=\ngolang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=\ngolang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=\ngolang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200601175630-2caf76543d99/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200612022331-742c5eb664c2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=\ngolang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=\ngolang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=\ngolang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=\ngolang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=\ngolang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=\ngolang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=\ngolang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=\ngolang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=\ngolang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=\ngolang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=\ngolang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=\ngolang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=\ngolang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=\ngolang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=\ngolang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=\ngolang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=\ngolang.org/x/tools/cmd/cover v0.1.0-deprecated h1:Rwy+mWYz6loAF+LnG1jHG/JWMHRMMC2/1XX3Ejkx9lA=\ngolang.org/x/tools/cmd/cover v0.1.0-deprecated/go.mod h1:hMDiIvlpN1NoVgmjLjUJE9tMHyxHjFX7RuQ+rW12mSA=\ngolang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngolang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngolang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngolang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngolang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngolang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=\ngolang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=\ngolang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=\ngonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=\ngonum.org/v1/gonum v0.7.0 h1:Hdks0L0hgznZLG9nzXb8vZ0rRvqNvAcgAp84y7Mwkgw=\ngonum.org/v1/gonum v0.7.0/go.mod h1:L02bwd0sqlsvRv41G7wGWFCsVNZFv/k1xzGIxeANHGM=\ngonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0 h1:OE9mWmgKkjJyEmDAAtGMPjXu+YNeGvK9VTSHY6+Qihc=\ngonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw=\ngonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc=\ngoogle.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=\ngoogle.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=\ngoogle.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=\ngoogle.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=\ngoogle.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=\ngoogle.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=\ngoogle.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=\ngoogle.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=\ngoogle.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=\ngoogle.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=\ngoogle.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=\ngoogle.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=\ngoogle.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=\ngoogle.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=\ngoogle.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=\ngoogle.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=\ngoogle.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=\ngoogle.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo=\ngoogle.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4=\ngoogle.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw=\ngoogle.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU=\ngoogle.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k=\ngoogle.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=\ngoogle.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE=\ngoogle.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI=\ngoogle.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I=\ngoogle.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo=\ngoogle.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g=\ngoogle.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA=\ngoogle.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8=\ngoogle.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs=\ngoogle.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA=\ngoogle.golang.org/api v0.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA=\ngoogle.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw=\ngoogle.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg=\ngoogle.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o=\ngoogle.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g=\ngoogle.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw=\ngoogle.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw=\ngoogle.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI=\ngoogle.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s=\ngoogle.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s=\ngoogle.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s=\ngoogle.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70=\ngoogle.golang.org/api v0.214.0 h1:h2Gkq07OYi6kusGOaT/9rnNljuXmqPnaig7WGPmKbwA=\ngoogle.golang.org/api v0.214.0/go.mod h1:bYPpLG8AyeMWwDU6NXoB00xC0DFkikVvd5MfwoxjLqE=\ngoogle.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=\ngoogle.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=\ngoogle.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=\ngoogle.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=\ngoogle.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=\ngoogle.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=\ngoogle.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=\ngoogle.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=\ngoogle.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=\ngoogle.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=\ngoogle.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=\ngoogle.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=\ngoogle.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=\ngoogle.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=\ngoogle.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=\ngoogle.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=\ngoogle.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=\ngoogle.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=\ngoogle.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=\ngoogle.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=\ngoogle.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=\ngoogle.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=\ngoogle.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=\ngoogle.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=\ngoogle.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=\ngoogle.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A=\ngoogle.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=\ngoogle.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=\ngoogle.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=\ngoogle.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24=\ngoogle.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k=\ngoogle.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k=\ngoogle.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=\ngoogle.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48=\ngoogle.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w=\ngoogle.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=\ngoogle.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=\ngoogle.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=\ngoogle.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=\ngoogle.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=\ngoogle.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20211021150943-2b146023228c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=\ngoogle.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=\ngoogle.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=\ngoogle.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=\ngoogle.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=\ngoogle.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=\ngoogle.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=\ngoogle.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=\ngoogle.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=\ngoogle.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=\ngoogle.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo=\ngoogle.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=\ngoogle.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=\ngoogle.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=\ngoogle.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=\ngoogle.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=\ngoogle.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=\ngoogle.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=\ngoogle.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=\ngoogle.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=\ngoogle.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE=\ngoogle.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc=\ngoogle.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=\ngoogle.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=\ngoogle.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=\ngoogle.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=\ngoogle.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=\ngoogle.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=\ngoogle.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=\ngoogle.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=\ngoogle.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=\ngoogle.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=\ngoogle.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw=\ngoogle.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI=\ngoogle.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI=\ngoogle.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U=\ngoogle.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM=\ngoogle.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM=\ngoogle.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s=\ngoogle.golang.org/genproto v0.0.0-20241118233622-e639e219e697 h1:ToEetK57OidYuqD4Q5w+vfEnPvPpuTwedCNVohYJfNk=\ngoogle.golang.org/genproto v0.0.0-20241118233622-e639e219e697/go.mod h1:JJrvXBWRZaFMxBufik1a4RpFw4HhgVtBBWQeQgUj2cc=\ngoogle.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 h1:pgr/4QbFyktUv9CtQ/Fq4gzEE6/Xs7iCXbktaGzLHbQ=\ngoogle.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697/go.mod h1:+D9ySVjN8nY8YCVjc5O7PZDIdZporIDY3KaGfJunh88=\ngoogle.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 h1:8ZmaLZE4XWrtU3MyClkYqqtl6Oegr3235h7jxsDyqCY=\ngoogle.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=\ngoogle.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=\ngoogle.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=\ngoogle.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=\ngoogle.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=\ngoogle.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=\ngoogle.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=\ngoogle.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=\ngoogle.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=\ngoogle.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=\ngoogle.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=\ngoogle.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=\ngoogle.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=\ngoogle.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=\ngoogle.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=\ngoogle.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=\ngoogle.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=\ngoogle.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=\ngoogle.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=\ngoogle.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=\ngoogle.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=\ngoogle.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=\ngoogle.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=\ngoogle.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=\ngoogle.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=\ngoogle.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=\ngoogle.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE=\ngoogle.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=\ngoogle.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=\ngoogle.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k=\ngoogle.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=\ngoogle.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=\ngoogle.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=\ngoogle.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=\ngoogle.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=\ngoogle.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=\ngoogle.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=\ngoogle.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=\ngoogle.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=\ngoogle.golang.org/grpc v1.67.3 h1:OgPcDAFKHnH8X3O4WcO4XUc8GRDeKsKReqbQtiCj7N8=\ngoogle.golang.org/grpc v1.67.3/go.mod h1:YGaHCc6Oap+FzBJTZLBzkGSYt/cvGPFTPxkn7QfSU8s=\ngoogle.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=\ngoogle.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=\ngoogle.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=\ngoogle.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=\ngoogle.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=\ngoogle.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=\ngoogle.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=\ngoogle.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=\ngoogle.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=\ngoogle.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=\ngoogle.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=\ngoogle.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=\ngoogle.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=\ngoogle.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=\ngoogle.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=\ngoogle.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=\ngoogle.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=\ngoogle.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=\ngopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=\ngopkg.in/auth0.v5 v5.21.1 h1:aIqHBmnqaDv4eK2WSpTRsv2dEpT1jdHJPl+iwyDJNoo=\ngopkg.in/auth0.v5 v5.21.1/go.mod h1:k1eJq1+II4rwUlecBabE7u4igEuzKUCEZAMa11PUfQk=\ngopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\ngopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\ngopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\ngopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\ngopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=\ngopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=\ngopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=\ngopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=\ngopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=\ngopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=\ngopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=\ngopkg.in/go-playground/validator.v9 v9.19.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=\ngopkg.in/go-playground/validator.v9 v9.30.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=\ngopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M=\ngopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=\ngopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=\ngopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=\ngopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=\ngopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=\ngopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=\ngopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=\ngopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU=\ngopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=\ngopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=\ngopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=\ngopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=\ngopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI=\ngopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=\ngopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=\ngopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=\ngopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=\ngopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=\ngopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=\ngopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=\ngopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=\ngopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=\ngopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=\ngopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=\ngopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=\ngopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=\ngopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=\ngotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=\ngotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=\nhonnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=\nhonnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=\nhonnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=\nhonnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=\nhonnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=\nhonnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=\nhonnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=\nhonnef.co/go/tools v0.2.2/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY=\nk8s.io/api v0.24.2 h1:g518dPU/L7VRLxWfcadQn2OnsiGWVOadTLpdnqgY2OI=\nk8s.io/api v0.24.2/go.mod h1:AHqbSkTm6YrQ0ObxjO3Pmp/ubFF/KuM7jU+3khoBsOg=\nk8s.io/apimachinery v0.24.2 h1:5QlH9SL2C8KMcrNJPor+LbXVTaZRReml7svPEh4OKDM=\nk8s.io/apimachinery v0.24.2/go.mod h1:82Bi4sCzVBdpYjyI4jY6aHX+YCUchUIrZrXKedjd2UM=\nk8s.io/client-go v0.24.2 h1:CoXFSf8if+bLEbinDqN9ePIDGzcLtqhfd6jpfnwGOFA=\nk8s.io/client-go v0.24.2/go.mod h1:zg4Xaoo+umDsfCWr4fCnmLEtQXyCNXCvJuSsglNcV30=\nk8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=\nk8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=\nk8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=\nk8s.io/klog/v2 v2.60.1 h1:VW25q3bZx9uE3vvdL6M8ezOX79vA2Aq1nEWLqNQclHc=\nk8s.io/klog/v2 v2.60.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=\nk8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42 h1:Gii5eqf+GmIEwGNKQYQClCayuJCe2/4fZUvF7VG99sU=\nk8s.io/kube-openapi v0.0.0-20220328201542-3ee0da9b0b42/go.mod h1:Z/45zLw8lUo4wdiUkI+v/ImEGAvu3WatcZl3lPMR4Rk=\nk8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=\nk8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc=\nk8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=\nrsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=\nrsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=\nrsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=\nrsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=\nsigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 h1:kDi4JBNAsJWfz1aEXhO8Jg87JJaPNLh5tIzYHgStQ9Y=\nsigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2/go.mod h1:B+TnT182UBxE84DiCz4CVE26eOSDAeYCpfDnC2kdKMY=\nsigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=\nsigs.k8s.io/structured-merge-diff/v4 v4.2.1 h1:bKCqE9GvQ5tiVHn5rfn1r+yao3aLQEaLzkkmAkf+A6Y=\nsigs.k8s.io/structured-merge-diff/v4 v4.2.1/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4=\nsigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=\nsigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=\n"
  },
  {
    "path": "main.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\nimport (\n\t\"io\"\n\t\"log\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/cmd\"\n)\n\ntype TerraformerWriter struct {\n\tio.Writer\n}\n\nfunc (t TerraformerWriter) Write(p []byte) (n int, err error) {\n\tif !strings.Contains(string(p), \"[TRACE]\") && !strings.Contains(string(p), \"[DEBUG]\") { // hide TF GRPC client log messages\n\t\treturn os.Stdout.Write(p)\n\t}\n\treturn len(p), nil\n}\n\nfunc main() {\n\tlog.SetOutput(TerraformerWriter{})\n\tif err := cmd.Execute(); err != nil {\n\t\tlog.Println(err)\n\t\tos.Exit(1)\n\t}\n}\n"
  },
  {
    "path": "providers/alicloud/alicloud_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\n// AliCloudProvider Provider for alicloud\ntype AliCloudProvider struct { //nolint\n\tterraformutils.Provider\n\tregion  string\n\tprofile string\n}\n\nconst GlobalRegion = \"alicloud-global\"\n\n// GetConfig Converts json config to go-cty\nfunc (p *AliCloudProvider) GetConfig() cty.Value {\n\tprofile := p.profile\n\tconfig, err := LoadConfigFromProfile(profile)\n\tif err != nil {\n\t\tfmt.Println(\"ERROR:\", err)\n\t}\n\n\tregion := p.region\n\tif region == \"\" {\n\t\tregion = config.RegionID\n\t}\n\n\tvar val cty.Value\n\tif config.RAMRoleArn != \"\" {\n\t\tval = cty.ObjectVal(map[string]cty.Value{\n\t\t\t\"region\":  cty.StringVal(region),\n\t\t\t\"profile\": cty.StringVal(profile),\n\t\t\t\"assume_role\": cty.SetVal([]cty.Value{\n\t\t\t\tcty.ObjectVal(map[string]cty.Value{\n\t\t\t\t\t\"role_arn\": cty.StringVal(config.RAMRoleArn),\n\t\t\t\t}),\n\t\t\t}),\n\t\t})\n\t} else {\n\t\tval = cty.ObjectVal(map[string]cty.Value{\n\t\t\t\"region\":  cty.StringVal(region),\n\t\t\t\"profile\": cty.StringVal(profile),\n\t\t})\n\t}\n\n\treturn val\n}\n\n// GetResourceConnections Gets resource connections for alicloud\nfunc (p AliCloudProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t// TODO: Not implemented\n\t}\n}\n\n// GetProviderData Used for generated HCL2 for the provider\nfunc (p AliCloudProvider) GetProviderData(arg ...string) map[string]interface{} {\n\talicloudConfig := map[string]interface{}{}\n\tif p.region == GlobalRegion {\n\t\talicloudConfig[\"region\"] = \"cn-hangzhou\"\n\t} else {\n\t\talicloudConfig[\"region\"] = p.region\n\t}\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"alicloud\": alicloudConfig,\n\t\t},\n\t}\n}\n\n// Init Loads up command line arguments in the provider\nfunc (p *AliCloudProvider) Init(args []string) error {\n\tp.region = args[0]\n\tp.profile = args[1]\n\treturn nil\n}\n\n// GetName Gets name of provider\nfunc (p *AliCloudProvider) GetName() string {\n\treturn \"alicloud\"\n}\n\n// InitService Initializes the AliCloud service\nfunc (p *AliCloudProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"alicloud: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"region\":  p.region,\n\t\t\"profile\": p.profile,\n\t})\n\treturn nil\n}\n\n// GetSupportedService Gets a list of all supported services\nfunc (p *AliCloudProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"dns\":     &DNSGenerator{},\n\t\t\"ecs\":     &EcsGenerator{},\n\t\t\"keypair\": &KeyPairGenerator{},\n\t\t\"nat\":     &NatGatewayGenerator{},\n\t\t\"pvtz\":    &PvtzGenerator{},\n\t\t\"ram\":     &RAMGenerator{},\n\t\t\"rds\":     &RdsGenerator{},\n\t\t\"sg\":      &SgGenerator{},\n\t\t\"slb\":     &SlbGenerator{},\n\t\t\"vpc\":     &VpcGenerator{},\n\t\t\"vswitch\": &VSwitchGenerator{},\n\t}\n}\n"
  },
  {
    "path": "providers/alicloud/alicloud_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"os\"\n\t\"runtime\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/alicloud/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\n// AliCloudService Service struct for AliCloud\ntype AliCloudService struct { //nolint\n\tterraformutils.Service\n}\n\n// ConfigFile go struct for ~/.aliyun/config.json\ntype ConfigFile struct {\n\tCurrent  string `json:\"current\"`\n\tMetaPath string `json:\"meta_path\"`\n\tProfiles []struct {\n\t\tAccessKeyID     string `json:\"access_key_id\"`\n\t\tAccessKeySecret string `json:\"access_key_secret\"`\n\t\tExpiredSeconds  int    `json:\"expired_seconds\"`\n\t\tKeyPairName     string `json:\"key_pair_name\"`\n\t\tLanguage        string `json:\"language\"`\n\t\tMode            string `json:\"mode\"`\n\t\tName            string `json:\"name\"`\n\t\tOutputFormat    string `json:\"output_format\"`\n\t\tPrivateKey      string `json:\"private_key\"`\n\t\tRAMRoleArn      string `json:\"ram_role_arn\"`\n\t\tRAMRoleName     string `json:\"ram_role_name\"`\n\t\tRAMSessionName  string `json:\"ram_session_name\"`\n\t\tRegionID        string `json:\"region_id\"`\n\t\tRetryCount      int    `json:\"retry_count\"`\n\t\tRetryTimeout    int    `json:\"retry_timeout\"`\n\t\tSite            string `json:\"site\"`\n\t\tStsToken        string `json:\"sts_token\"`\n\t\tVerified        string `json:\"verified\"`\n\t} `json:\"profiles\"`\n}\n\n// LoadClientFromProfile Loads profile from ~/.aliyun/config.json and then applies the region from cmd line\nfunc (s *AliCloudService) LoadClientFromProfile() (*connectivity.AliyunClient, error) {\n\targs := s.GetArgs()\n\tregion := args[\"region\"].(string)\n\tprofileName := args[\"profile\"].(string)\n\n\tconfig, err := LoadConfigFromProfile(profileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconfig.RegionID = region\n\tconfig.Region = connectivity.Region(config.RegionID)\n\n\treturn config.Client()\n}\n\n// LoadConfigFromProfile Loads profile from ~/.aliyun/config.json\nfunc LoadConfigFromProfile(profileName string) (*connectivity.Config, error) {\n\t// Set the path depending on OS from where to pull the config.json\n\tprofilePath := \"\"\n\tif runtime.GOOS == \"windows\" {\n\t\tprofilePath = fmt.Sprintf(\"%s/.aliyun/config.json\", os.Getenv(\"USERPROFILE\"))\n\t} else {\n\t\tprofilePath = fmt.Sprintf(\"%s/.aliyun/config.json\", os.Getenv(\"HOME\"))\n\t}\n\n\t// Make sure the profile exists\n\t_, err := os.Stat(profilePath)\n\tif os.IsNotExist(err) {\n\t\treturn nil, err\n\t}\n\n\t// Try to parse JSON\n\tdata, err := os.ReadFile(profilePath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar configFile ConfigFile\n\terr = json.Unmarshal(data, &configFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// If profile argument is missing then use the config file\n\tcurrentProfile := profileName\n\tif currentProfile == \"\" {\n\t\tcurrentProfile = configFile.Current\n\t}\n\n\t// Default to loading the first profile\n\tconfig := configFile.Profiles[0]\n\n\t// Set profile as current profile\n\tfound := false\n\tfor _, profile := range configFile.Profiles {\n\t\tif currentProfile == profile.Name {\n\t\t\tconfig = profile\n\t\t\tfound = true\n\t\t}\n\t}\n\n\tif !found {\n\t\tfmt.Printf(\"ERROR: Profile %s not found. Using profile %s\\n\", profileName, config.Name)\n\t}\n\n\tconf := connectivity.Config{\n\t\tAccessKey:          config.AccessKeyID,\n\t\tSecretKey:          config.AccessKeySecret,\n\t\tEcsRoleName:        config.Name,\n\t\tRegion:             connectivity.Region(config.RegionID),\n\t\tRegionID:           config.RegionID,\n\t\tSecurityToken:      config.StsToken,\n\t\tRAMRoleArn:         config.RAMRoleArn,\n\t\tRAMRoleSessionName: config.RAMSessionName,\n\t\t// OtsInstanceName:    \"\", // TODO: Figure out what to do with this\n\t\t// AccountId:          \"\", // TODO: Figure out what to do with this\n\t\t// RamRolePolicy:      \"\", // TODO: Figure out what to do with this\n\t}\n\n\treturn &conf, nil\n}\n"
  },
  {
    "path": "providers/alicloud/connectivity/client.go",
    "content": "package connectivity\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"strings\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/alidns\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/pvtz\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/ram\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/rds\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/slb\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/vpc\"\n\t\"github.com/aliyun/aliyun-tablestore-go-sdk/tablestore\"\n\t\"github.com/denverdino/aliyungo/cs\"\n\t\"github.com/hashicorp/terraform/terraform\"\n)\n\n// AliyunClient of aliyun\ntype AliyunClient struct {\n\tRegion                       Region\n\tRegionID                     string\n\tAccessKey                    string\n\tSecretKey                    string\n\tSecurityToken                string\n\tOtsInstanceName              string\n\tconfig                       *Config\n\taccountID                    string\n\tecsconn                      *ecs.Client\n\trdsconn                      *rds.Client\n\tvpcconn                      *vpc.Client\n\tslbconn                      *slb.Client\n\tdnsconn                      *alidns.Client\n\tramconn                      *ram.Client\n\tpvtzconn                     *pvtz.Client\n\ttablestoreconnByInstanceName map[string]*tablestore.TableStoreClient\n\tcsprojectconnByKey           map[string]*cs.ProjectClient\n}\n\ntype APIVersion string\n\nconst DefaultClientRetryCountSmall = 5\nconst Terraform = \"HashiCorp-Terraform\"\nconst Provider = \"Terraform-Provider\"\nconst Module = \"Terraform-Module\"\n\nvar goSdkMutex = sync.RWMutex{} // The Go SDK is not thread-safe\n// The main version number that is being run at the moment.\nvar providerVersion = \"1.57.1\"\nvar terraformVersion = strings.TrimSuffix(terraform.VersionString(), \"-dev\") //nolint\n\n// Client for AliyunClient\nfunc (c *Config) Client() (*AliyunClient, error) {\n\t// Get the auth and region. This can fail if keys/regions were not\n\t// specified and we're attempting to use the environment.\n\tif !c.SkipRegionValidation {\n\t\terr := c.loadAndValidate()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &AliyunClient{\n\t\tconfig:                       c,\n\t\tRegion:                       c.Region,\n\t\tRegionID:                     c.RegionID,\n\t\tAccessKey:                    c.AccessKey,\n\t\tSecretKey:                    c.SecretKey,\n\t\tSecurityToken:                c.SecurityToken,\n\t\tOtsInstanceName:              c.OtsInstanceName,\n\t\taccountID:                    c.AccountID,\n\t\ttablestoreconnByInstanceName: make(map[string]*tablestore.TableStoreClient),\n\t\tcsprojectconnByKey:           make(map[string]*cs.ProjectClient),\n\t}, nil\n}\n\nfunc (client *AliyunClient) WithEcsClient(do func(*ecs.Client) (interface{}, error)) (interface{}, error) {\n\tgoSdkMutex.Lock()\n\tdefer goSdkMutex.Unlock()\n\n\t// Initialize the ECS client if necessary\n\tif client.ecsconn == nil {\n\t\tendpoint := client.config.EcsEndpoint\n\t\tif endpoint == \"\" {\n\t\t\tendpoint = loadEndpoint(client.config.RegionID, ECSCode)\n\t\t}\n\n\t\tif endpoint != \"\" {\n\t\t\terr := endpoints.AddEndpointMapping(client.config.RegionID, string(ECSCode), endpoint)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\tecsconn, err := ecs.NewClientWithOptions(client.config.RegionID, client.getSdkConfig().WithTimeout(time.Duration(60)*time.Second), client.config.getAuthCredential())\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to initialize the ECS client: %#v\", err)\n\t\t}\n\n\t\tif _, err := ecsconn.DescribeRegions(ecs.CreateDescribeRegionsRequest()); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tecsconn.AppendUserAgent(Terraform, terraformVersion)\n\t\tecsconn.AppendUserAgent(Provider, providerVersion)\n\t\tif client.config.ConfigurationSource != \"\" {\n\t\t\tecsconn.AppendUserAgent(Module, client.config.ConfigurationSource)\n\t\t}\n\t\tclient.ecsconn = ecsconn\n\t}\n\n\treturn do(client.ecsconn)\n}\n\nfunc (client *AliyunClient) WithRdsClient(do func(*rds.Client) (interface{}, error)) (interface{}, error) {\n\tgoSdkMutex.Lock()\n\tdefer goSdkMutex.Unlock()\n\n\t// Initialize the RDS client if necessary\n\tif client.rdsconn == nil {\n\t\tendpoint := client.config.RdsEndpoint\n\t\tif endpoint == \"\" {\n\t\t\tendpoint = loadEndpoint(client.config.RegionID, RDSCode)\n\t\t}\n\t\tif endpoint != \"\" {\n\t\t\terr := endpoints.AddEndpointMapping(client.config.RegionID, string(RDSCode), endpoint)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\trdsconn, err := rds.NewClientWithOptions(client.config.RegionID, client.getSdkConfig(), client.config.getAuthCredential())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to initialize the RDS client: %#v\", err)\n\t\t}\n\n\t\trdsconn.AppendUserAgent(Terraform, terraformVersion)\n\t\trdsconn.AppendUserAgent(Provider, providerVersion)\n\t\tif client.config.ConfigurationSource != \"\" {\n\t\t\trdsconn.AppendUserAgent(Module, client.config.ConfigurationSource)\n\t\t}\n\t\tclient.rdsconn = rdsconn\n\t}\n\n\treturn do(client.rdsconn)\n}\n\nfunc (client *AliyunClient) WithSlbClient(do func(*slb.Client) (interface{}, error)) (interface{}, error) {\n\tgoSdkMutex.Lock()\n\tdefer goSdkMutex.Unlock()\n\n\t// Initialize the SLB client if necessary\n\tif client.slbconn == nil {\n\t\tendpoint := client.config.SlbEndpoint\n\t\tif endpoint == \"\" {\n\t\t\tendpoint = loadEndpoint(client.config.RegionID, SLBCode)\n\t\t}\n\t\tif endpoint != \"\" {\n\t\t\terr := endpoints.AddEndpointMapping(client.config.RegionID, string(SLBCode), endpoint)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tslbconn, err := slb.NewClientWithOptions(client.config.RegionID, client.getSdkConfig(), client.config.getAuthCredential())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to initialize the SLB client: %#v\", err)\n\t\t}\n\n\t\tslbconn.AppendUserAgent(Terraform, terraformVersion)\n\t\tslbconn.AppendUserAgent(Provider, providerVersion)\n\t\tif client.config.ConfigurationSource != \"\" {\n\t\t\tslbconn.AppendUserAgent(Module, client.config.ConfigurationSource)\n\t\t}\n\t\tclient.slbconn = slbconn\n\t}\n\n\treturn do(client.slbconn)\n}\n\nfunc (client *AliyunClient) WithVpcClient(do func(*vpc.Client) (interface{}, error)) (interface{}, error) {\n\tgoSdkMutex.Lock()\n\tdefer goSdkMutex.Unlock()\n\n\t// Initialize the VPC client if necessary\n\tif client.vpcconn == nil {\n\t\tendpoint := client.config.VpcEndpoint\n\t\tif endpoint == \"\" {\n\t\t\tendpoint = loadEndpoint(client.config.RegionID, VPCCode)\n\t\t}\n\t\tif endpoint != \"\" {\n\t\t\terr := endpoints.AddEndpointMapping(client.config.RegionID, string(VPCCode), endpoint)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tvpcconn, err := vpc.NewClientWithOptions(client.config.RegionID, client.getSdkConfig(), client.config.getAuthCredential())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to initialize the VPC client: %#v\", err)\n\t\t}\n\n\t\tvpcconn.AppendUserAgent(Terraform, terraformVersion)\n\t\tvpcconn.AppendUserAgent(Provider, providerVersion)\n\t\tif client.config.ConfigurationSource != \"\" {\n\t\t\tvpcconn.AppendUserAgent(Module, client.config.ConfigurationSource)\n\t\t}\n\t\tclient.vpcconn = vpcconn\n\t}\n\n\treturn do(client.vpcconn)\n}\n\nfunc (client *AliyunClient) WithDNSClient(do func(*alidns.Client) (interface{}, error)) (interface{}, error) {\n\tgoSdkMutex.Lock()\n\tdefer goSdkMutex.Unlock()\n\n\t// Initialize the DNS client if necessary\n\tif client.dnsconn == nil {\n\t\tendpoint := client.config.DNSEndpoint\n\t\tif endpoint == \"\" {\n\t\t\tendpoint = loadEndpoint(client.config.RegionID, DNSCode)\n\t\t}\n\t\tif endpoint != \"\" {\n\t\t\terr := endpoints.AddEndpointMapping(client.config.RegionID, string(DNSCode), endpoint)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\tdnsconn, err := alidns.NewClientWithOptions(client.config.RegionID, client.getSdkConfig(), client.config.getAuthCredential())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to initialize the DNS client: %#v\", err)\n\t\t}\n\t\tdnsconn.AppendUserAgent(Terraform, terraformVersion)\n\t\tdnsconn.AppendUserAgent(Provider, providerVersion)\n\t\tif client.config.ConfigurationSource != \"\" {\n\t\t\tdnsconn.AppendUserAgent(Module, client.config.ConfigurationSource)\n\t\t}\n\t\tclient.dnsconn = dnsconn\n\t}\n\n\treturn do(client.dnsconn)\n}\n\nfunc (client *AliyunClient) WithRAMClient(do func(*ram.Client) (interface{}, error)) (interface{}, error) {\n\tgoSdkMutex.Lock()\n\tdefer goSdkMutex.Unlock()\n\n\t// Initialize the RAM client if necessary\n\tif client.ramconn == nil {\n\t\tendpoint := client.config.RAMEndpoint\n\t\tif endpoint == \"\" {\n\t\t\tendpoint = loadEndpoint(client.config.RegionID, RAMCode)\n\t\t}\n\t\tif strings.HasPrefix(endpoint, \"http\") {\n\t\t\tendpoint = fmt.Sprintf(\"https://%s\", strings.TrimPrefix(endpoint, \"http://\"))\n\t\t}\n\t\tif endpoint != \"\" {\n\t\t\terr := endpoints.AddEndpointMapping(client.config.RegionID, string(RAMCode), endpoint)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\tramconn, err := ram.NewClientWithOptions(client.config.RegionID, client.getSdkConfig(), client.config.getAuthCredential())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to initialize the RAM client: %#v\", err)\n\t\t}\n\t\tramconn.AppendUserAgent(Terraform, terraformVersion)\n\t\tramconn.AppendUserAgent(Provider, providerVersion)\n\t\tif client.config.ConfigurationSource != \"\" {\n\t\t\tramconn.AppendUserAgent(Module, client.config.ConfigurationSource)\n\t\t}\n\t\tclient.ramconn = ramconn\n\t}\n\n\treturn do(client.ramconn)\n}\n\nfunc (client *AliyunClient) WithPvtzClient(do func(*pvtz.Client) (interface{}, error)) (interface{}, error) {\n\tgoSdkMutex.Lock()\n\tdefer goSdkMutex.Unlock()\n\n\t// Initialize the PVTZ client if necessary\n\tif client.pvtzconn == nil {\n\t\tendpoint := client.config.PvtzEndpoint\n\t\tif endpoint == \"\" {\n\t\t\tendpoint = loadEndpoint(client.config.RegionID, PVTZCode)\n\t\t}\n\t\tif endpoint != \"\" {\n\t\t\terr := endpoints.AddEndpointMapping(client.config.RegionID, string(PVTZCode), endpoint)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t} else {\n\t\t\terr := endpoints.AddEndpointMapping(client.config.RegionID, string(PVTZCode), \"pvtz.aliyuncs.com\")\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tpvtzconn, err := pvtz.NewClientWithOptions(client.config.RegionID, client.getSdkConfig(), client.config.getAuthCredential())\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to initialize the PVTZ client: %#v\", err)\n\t\t}\n\n\t\tpvtzconn.AppendUserAgent(Terraform, terraformVersion)\n\t\tpvtzconn.AppendUserAgent(Provider, providerVersion)\n\t\tif client.config.ConfigurationSource != \"\" {\n\t\t\tpvtzconn.AppendUserAgent(Module, client.config.ConfigurationSource)\n\t\t}\n\t\tclient.pvtzconn = pvtzconn\n\t}\n\n\treturn do(client.pvtzconn)\n}\n\nfunc (client *AliyunClient) getSdkConfig() *sdk.Config {\n\treturn sdk.NewConfig().\n\t\tWithMaxRetryTime(DefaultClientRetryCountSmall).\n\t\tWithTimeout(time.Duration(30) * time.Second).\n\t\tWithGoRoutinePoolSize(10).\n\t\tWithDebug(false).\n\t\tWithHttpTransport(client.getTransport()).\n\t\tWithScheme(\"HTTPS\")\n}\n\nfunc (client *AliyunClient) getTransport() *http.Transport {\n\thandshakeTimeout, err := strconv.Atoi(os.Getenv(\"TLSHandshakeTimeout\"))\n\tif err != nil {\n\t\thandshakeTimeout = 120\n\t}\n\ttransport := &http.Transport{}\n\ttransport.TLSHandshakeTimeout = time.Duration(handshakeTimeout) * time.Second\n\n\t// After building a new transport and it need to set http proxy to support proxy.\n\tproxyURL := client.getHTTPProxyURL()\n\tif proxyURL != nil {\n\t\ttransport.Proxy = http.ProxyURL(proxyURL)\n\t}\n\treturn transport\n}\n\nfunc (client *AliyunClient) getHTTPProxyURL() *url.URL {\n\tfor _, v := range []string{\"HTTPS_PROXY\", \"https_proxy\", \"HTTP_PROXY\", \"http_proxy\"} {\n\t\tvalue := strings.Trim(os.Getenv(v), \" \")\n\t\tif value != \"\" {\n\t\t\tif !regexp.MustCompile(`^http(s)?://`).MatchString(value) {\n\t\t\t\tvalue = fmt.Sprintf(\"https://%s\", value)\n\t\t\t}\n\t\t\tproxyURL, err := url.Parse(value)\n\t\t\tif err == nil {\n\t\t\t\treturn proxyURL\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/alicloud/connectivity/config.go",
    "content": "package connectivity\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\t\"strings\"\n\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses\"\n\t\"github.com/jmespath/go-jmespath\"\n)\n\nvar securityCredURL = \"http://100.100.100.200/latest/meta-data/ram/security-credentials/\"\n\n// Config of aliyun\ntype Config struct {\n\tAccessKey                string\n\tSecretKey                string\n\tEcsRoleName              string\n\tRegion                   Region\n\tRegionID                 string\n\tSecurityToken            string\n\tOtsInstanceName          string\n\tAccountID                string\n\tRAMRoleArn               string\n\tRAMRoleSessionName       string\n\tRAMRolePolicy            string\n\tRAMRoleSessionExpiration int\n\tEcsEndpoint              string\n\tRdsEndpoint              string\n\tSlbEndpoint              string\n\tVpcEndpoint              string\n\tCenEndpoint              string\n\tEssEndpoint              string\n\tOssEndpoint              string\n\tOnsEndpoint              string\n\tAlikafkaEndpoint         string\n\tDNSEndpoint              string\n\tRAMEndpoint              string\n\tCsEndpoint               string\n\tCrEndpoint               string\n\tCdnEndpoint              string\n\tKmsEndpoint              string\n\tOtsEndpoint              string\n\tCmsEndpoint              string\n\tPvtzEndpoint             string\n\tStsEndpoint              string\n\tLogEndpoint              string\n\tDrdsEndpoint             string\n\tDdsEndpoint              string\n\tGpdbEnpoint              string\n\tKVStoreEndpoint          string\n\tFcEndpoint               string\n\tApigatewayEndpoint       string\n\tDatahubEndpoint          string\n\tMnsEndpoint              string\n\tLocationEndpoint         string\n\tElasticsearchEndpoint    string\n\tNasEndpoint              string\n\tActionTrailEndpoint      string\n\tBssOpenAPIEndpoint       string\n\tDdoscooEndpoint          string\n\tDdosbgpEndpoint          string\n\n\tSkipRegionValidation bool\n\tConfigurationSource  string\n}\n\nfunc (c *Config) loadAndValidate() error {\n\terr := c.validateRegion()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (c *Config) validateRegion() error {\n\tfor _, valid := range ValidRegions {\n\t\tif c.Region == valid {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"Invalid Alibaba Cloud region: %s\", c.RegionID)\n}\n\nfunc (c *Config) getAuthCredential() auth.Credential {\n\tif c.AccessKey != \"\" && c.SecretKey != \"\" {\n\t\tif c.SecurityToken != \"\" {\n\t\t\treturn credentials.NewStsTokenCredential(c.AccessKey, c.SecretKey, c.SecurityToken)\n\t\t}\n\t\tif c.RAMRoleArn != \"\" {\n\t\t\tlog.Printf(\"[INFO] Assume RAM Role specified in provider block assume_role { ... }\")\n\t\t\treturn credentials.NewRamRoleArnWithPolicyCredential(\n\t\t\t\tc.AccessKey, c.SecretKey, c.RAMRoleArn,\n\t\t\t\tc.RAMRoleSessionName, c.RAMRolePolicy, c.RAMRoleSessionExpiration)\n\t\t}\n\t\treturn credentials.NewAccessKeyCredential(c.AccessKey, c.SecretKey)\n\t}\n\tif c.EcsRoleName != \"\" {\n\t\treturn credentials.NewEcsRamRoleCredential(c.EcsRoleName)\n\t}\n\n\treturn credentials.NewAccessKeyCredential(c.AccessKey, c.SecretKey)\n}\n\n// getAuthCredentialByEcsRoleName aims to access meta to get sts credential\n// Actually, the job should be done by sdk, but currently not all resources and products support alibaba-cloud-sdk-go,\n// and their go sdk does support ecs role name.\n// This method is a temporary solution and it should be removed after all go sdk support ecs role name\n// The related PR: https://github.com/terraform-providers/terraform-provider-alicloud/pull/731\nfunc (c *Config) getAuthCredentialByEcsRoleName() (accessKey, secretKey, token string, err error) {\n\tif c.AccessKey != \"\" {\n\t\treturn c.AccessKey, c.SecretKey, c.SecurityToken, nil\n\t}\n\tif c.EcsRoleName == \"\" {\n\t\treturn\n\t}\n\trequestURL := securityCredURL + c.EcsRoleName\n\thttpRequest, err := http.NewRequest(requests.GET, requestURL, strings.NewReader(\"\"))\n\tif err != nil {\n\t\terr = fmt.Errorf(\"build sts requests err: %s\", err.Error())\n\t\treturn\n\t}\n\thttpClient := &http.Client{}\n\thttpResponse, err := httpClient.Do(httpRequest)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"get Ecs sts token err : %s\", err.Error())\n\t\treturn\n\t}\n\n\tresponse := responses.NewCommonResponse()\n\terr = responses.Unmarshal(response, httpResponse, \"\")\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Unmarshal Ecs sts token response err : %s\", err.Error())\n\t\treturn\n\t}\n\n\tif response.GetHttpStatus() != http.StatusOK {\n\t\terr = fmt.Errorf(\"get Ecs sts token err, httpStatus: %d, message = %s\", response.GetHttpStatus(), response.GetHttpContentString())\n\t\treturn\n\t}\n\tvar data interface{}\n\terr = json.Unmarshal(response.GetHttpContentBytes(), &data)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"refresh Ecs sts token err, json.Unmarshal fail: %s\", err.Error())\n\t\treturn\n\t}\n\tcode, err := jmespath.Search(\"Code\", data)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"refresh Ecs sts token err, fail to get Code: %s\", err.Error())\n\t\treturn\n\t}\n\tif code.(string) != \"Success\" {\n\t\terr = fmt.Errorf(\"refresh Ecs sts token err, Code is not Success\")\n\t\treturn\n\t}\n\taccessKeyID, err := jmespath.Search(\"AccessKeyId\", data)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"refresh Ecs sts token err, fail to get AccessKeyId: %s\", err.Error())\n\t\treturn\n\t}\n\taccessKeySecret, err := jmespath.Search(\"AccessKeySecret\", data)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"refresh Ecs sts token err, fail to get AccessKeySecret: %s\", err.Error())\n\t\treturn\n\t}\n\tsecurityToken, err := jmespath.Search(\"SecurityToken\", data)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"refresh Ecs sts token err, fail to get SecurityToken: %s\", err.Error())\n\t\treturn\n\t}\n\n\tif accessKeyID == nil || accessKeySecret == nil || securityToken == nil {\n\t\terr = fmt.Errorf(\"there is no any available accesskey, secret and security token for Ecs role %s\", c.EcsRoleName)\n\t\treturn\n\t}\n\n\treturn accessKeyID.(string), accessKeySecret.(string), securityToken.(string), nil\n}\n\nfunc (c *Config) MakeConfigByEcsRoleName() error {\n\taccessKey, secretKey, token, err := c.getAuthCredentialByEcsRoleName()\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.AccessKey, c.SecretKey, c.SecurityToken = accessKey, secretKey, token\n\treturn nil\n}\n"
  },
  {
    "path": "providers/alicloud/connectivity/endpoint.go",
    "content": "package connectivity\n\nimport (\n\t\"encoding/xml\"\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n)\n\n// Load endpoints from endpoints.xml or environment variables to meet specified application scenario, like private cloud.\ntype ServiceCode string\n\nconst (\n\tECSCode           = ServiceCode(\"ECS\")\n\tESSCode           = ServiceCode(\"ESS\")\n\tRAMCode           = ServiceCode(\"RAM\")\n\tVPCCode           = ServiceCode(\"VPC\")\n\tSLBCode           = ServiceCode(\"SLB\")\n\tRDSCode           = ServiceCode(\"RDS\")\n\tOSSCode           = ServiceCode(\"OSS\")\n\tONSCode           = ServiceCode(\"ONS\")\n\tALIKAFKACode      = ServiceCode(\"ALIKAFKA\")\n\tCONTAINCode       = ServiceCode(\"CS\")\n\tCRCode            = ServiceCode(\"CR\")\n\tDOMAINCode        = ServiceCode(\"DOMAIN\")\n\tCDNCode           = ServiceCode(\"CDN\")\n\tCMSCode           = ServiceCode(\"CMS\")\n\tKMSCode           = ServiceCode(\"KMS\")\n\tOTSCode           = ServiceCode(\"OTS\")\n\tDNSCode           = ServiceCode(\"DNS\")\n\tPVTZCode          = ServiceCode(\"PVTZ\")\n\tLOGCode           = ServiceCode(\"LOG\")\n\tFCCode            = ServiceCode(\"FC\")\n\tDDSCode           = ServiceCode(\"DDS\")\n\tGPDBCode          = ServiceCode(\"GPDB\")\n\tSTSCode           = ServiceCode(\"STS\")\n\tCENCode           = ServiceCode(\"CEN\")\n\tKVSTORECode       = ServiceCode(\"KVSTORE\")\n\tDATAHUBCode       = ServiceCode(\"DATAHUB\")\n\tMNSCode           = ServiceCode(\"MNS\")\n\tCLOUDAPICode      = ServiceCode(\"APIGATEWAY\")\n\tDRDSCode          = ServiceCode(\"DRDS\")\n\tLOCATIONCode      = ServiceCode(\"LOCATION\")\n\tELASTICSEARCHCode = ServiceCode(\"ELASTICSEARCH\")\n\tNASCode           = ServiceCode(\"NAS\")\n\tACTIONTRAILCode   = ServiceCode(\"ACTIONTRAIL\")\n\tBSSOPENAPICode    = ServiceCode(\"BSSOPENAPI\")\n\tDDOSCOOCode       = ServiceCode(\"DDOSCOO\")\n\tDDOSBGPCode       = ServiceCode(\"DDOSBGP\")\n)\n\n// xml\ntype Endpoints struct {\n\tEndpoint []Endpoint `xml:\"Endpoint\"`\n}\n\ntype Endpoint struct {\n\tName      string    `xml:\"name,attr\"`\n\tRegionIds RegionIds `xml:\"RegionIds\"`\n\tProducts  Products  `xml:\"Products\"`\n}\n\ntype RegionIds struct {\n\tRegionID string `xml:\"RegionId\"`\n}\n\ntype Products struct {\n\tProduct []Product `xml:\"Product\"`\n}\n\ntype Product struct {\n\tProductName string `xml:\"ProductName\"`\n\tDomainName  string `xml:\"DomainName\"`\n}\n\nfunc loadEndpoint(region string, serviceCode ServiceCode) string {\n\tendpoint := strings.TrimSpace(os.Getenv(fmt.Sprintf(\"%s_ENDPOINT\", string(serviceCode))))\n\tif endpoint != \"\" {\n\t\treturn endpoint\n\t}\n\n\t// Load current path endpoint file endpoints.xml, if failed, it will load from environment variables TF_ENDPOINT_PATH\n\tdata, err := os.ReadFile(\"./endpoints.xml\")\n\tif err != nil || len(data) == 0 {\n\t\td, e := os.ReadFile(os.Getenv(\"TF_ENDPOINT_PATH\"))\n\t\tif e != nil {\n\t\t\treturn \"\"\n\t\t}\n\t\tdata = d\n\t}\n\tvar endpoints Endpoints\n\terr = xml.Unmarshal(data, &endpoints)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\tfor _, endpoint := range endpoints.Endpoint {\n\t\tif endpoint.RegionIds.RegionID == region {\n\t\t\tfor _, product := range endpoint.Products.Product {\n\t\t\t\tif strings.EqualFold(product.ProductName, string(serviceCode)) {\n\t\t\t\t\treturn strings.TrimSpace(product.DomainName)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\"\n}\n"
  },
  {
    "path": "providers/alicloud/connectivity/regions.go",
    "content": "package connectivity\n\n// Region represents ECS region\ntype Region string\n\n// Constants of region definition\nconst (\n\tHangzhou    = Region(\"cn-hangzhou\")\n\tQingdao     = Region(\"cn-qingdao\")\n\tBeijing     = Region(\"cn-beijing\")\n\tHongkong    = Region(\"cn-hongkong\")\n\tShenzhen    = Region(\"cn-shenzhen\")\n\tShanghai    = Region(\"cn-shanghai\")\n\tZhangjiakou = Region(\"cn-zhangjiakou\")\n\tHuhehaote   = Region(\"cn-huhehaote\")\n\tChengDu     = Region(\"cn-chengdu\")\n\n\tAPSouthEast1 = Region(\"ap-southeast-1\")\n\tAPNorthEast1 = Region(\"ap-northeast-1\")\n\tAPSouthEast2 = Region(\"ap-southeast-2\")\n\tAPSouthEast3 = Region(\"ap-southeast-3\")\n\tAPSouthEast5 = Region(\"ap-southeast-5\")\n\n\tAPSouth1 = Region(\"ap-south-1\")\n\n\tUSWest1 = Region(\"us-west-1\")\n\tUSEast1 = Region(\"us-east-1\")\n\n\tMEEast1 = Region(\"me-east-1\")\n\n\tEUCentral1 = Region(\"eu-central-1\")\n\tEUWest1    = Region(\"eu-west-1\")\n\n\tShenZhenFinance = Region(\"cn-shenzhen-finance-1\")\n\tShanghaiFinance = Region(\"cn-shanghai-finance-1\")\n)\n\nvar ValidRegions = []Region{\n\tHangzhou, Qingdao, Beijing, Shenzhen, Hongkong, Shanghai, Zhangjiakou, Huhehaote, ChengDu,\n\tUSWest1, USEast1,\n\tAPNorthEast1, APSouthEast1, APSouthEast2, APSouthEast3, APSouthEast5,\n\tAPSouth1,\n\tMEEast1,\n\tEUCentral1, EUWest1,\n}\n\nvar EcsClassicSupportedRegions = []Region{Shenzhen, Shanghai, Beijing, Qingdao, Hangzhou, Hongkong, USWest1, APSouthEast1}\nvar EcsSpotNoSupportedRegions = []Region{APSouth1}\nvar SlbGuaranteedSupportedRegions = []Region{Qingdao, Beijing, Hangzhou, Shanghai, Shenzhen, Zhangjiakou, Huhehaote, APSouthEast1, USEast1}\nvar DrdsSupportedRegions = []Region{Beijing, Shenzhen, Hangzhou, Qingdao, Hongkong, Shanghai, Huhehaote, Zhangjiakou}\nvar DrdsClassicNoSupportedRegions = []Region{Hongkong}\nvar GpdbSupportedRegions = []Region{Beijing, Shenzhen, Hangzhou, Shanghai, Hongkong}\n\n// RAMNoSkipRegions resources only one can be owned by one account at the same time,\n// skipped here to avoid multi regions concurrency conflict.\nvar RAMNoSkipRegions = []Region{Hangzhou, EUCentral1, APSouth1}\n\n// ActiontrailNoSkipRegions only one can be owned by one account at the same time,\n// skipped here to avoid multi regions concurrency conflict.\nvar ActiontrailNoSkipRegions = []Region{Hangzhou, EUCentral1, APSouth1}\nvar FcNoSupportedRegions = []Region{Zhangjiakou, Huhehaote, APSouthEast3, APSouthEast5, EUWest1, USEast1, MEEast1}\nvar DatahubSupportedRegions = []Region{Beijing, Hangzhou, Shanghai, Shenzhen, APSouthEast1}\nvar RdsClassicNoSupportedRegions = []Region{APSouth1, APSouthEast2, APSouthEast3, APNorthEast1, EUCentral1, EUWest1, MEEast1}\nvar RdsMultiAzNoSupportedRegions = []Region{Qingdao, APNorthEast1, APSouthEast5, MEEast1}\nvar RdsPPASNoSupportedRegions = []Region{Qingdao, USEast1, APNorthEast1, EUCentral1, MEEast1, APSouthEast2, APSouthEast3, APSouth1, APSouthEast5, ChengDu, EUWest1}\nvar RouteTableNoSupportedRegions = []Region{Beijing, Hangzhou, Shenzhen}\nvar APIGatewayNoSupportedRegions = []Region{Zhangjiakou, Huhehaote, USEast1, USWest1, EUWest1, MEEast1}\nvar OtsHighPerformanceNoSupportedRegions = []Region{Qingdao, Zhangjiakou, Huhehaote, Hongkong, APSouthEast2, APSouthEast5, APNorthEast1, EUCentral1, MEEast1, APSouth1}\nvar OtsCapacityNoSupportedRegions = []Region{APSouthEast1, USWest1, USEast1}\nvar PrivateIPNoSupportedRegions = []Region{Beijing, Hangzhou, Shenzhen}\nvar SwarmSupportedRegions = []Region{Qingdao, Beijing, Zhangjiakou, Huhehaote, Hangzhou, Shanghai, Shenzhen, Hongkong, APNorthEast1, APSouthEast1, APSouthEast2,\n\tAPSouthEast3, USWest1, USEast1, EUCentral1}\nvar ManagedKubernetesSupportedRegions = []Region{Beijing, Hangzhou, Shanghai, APSouthEast1, APSouthEast3, APSouthEast5, APSouth1}\nvar KubernetesSupportedRegions = []Region{Beijing, Zhangjiakou, Huhehaote, Hangzhou, Shanghai, Shenzhen, Hongkong, APNorthEast1, APSouthEast1,\n\tAPSouthEast2, APSouthEast3, APSouthEast5, APSouth1, USEast1, USWest1, EUWest1, MEEast1, EUCentral1}\nvar NasClassicSupportedRegions = []Region{Hangzhou, Qingdao, Beijing, Hongkong, Shenzhen, Shanghai, Zhangjiakou, Huhehaote, ShenZhenFinance, ShanghaiFinance}\nvar CasClassicSupportedRegions = []Region{Hangzhou, APSouth1, MEEast1, EUCentral1, APNorthEast1, APSouthEast2}\nvar CRNoSupportedRegions = []Region{Beijing, Hangzhou, Qingdao, Huhehaote, Zhangjiakou}\nvar MongoDBClassicNoSupportedRegions = []Region{Huhehaote, Zhangjiakou, APSouthEast2, APSouthEast3, APSouthEast5, APSouth1, USEast1, USWest1, APNorthEast1}\nvar MongoDBMultiAzSupportedRegions = []Region{Hangzhou, Beijing, Shenzhen, EUCentral1}\nvar DdoscooSupportedRegions = []Region{Hangzhou}\nvar DdosbgpSupportedRegions = []Region{Hangzhou, Beijing, Shenzhen, Qingdao, Shanghai, Zhangjiakou, Huhehaote}\nvar NetworkACLSupportedRegions = []Region{Hongkong, APSouthEast5, APSouth1}\nvar EssScalingConfigurationMultiSgSupportedRegions = []Region{APSouthEast1, APSouth1}\nvar SlbClassicNoSupportedRegions = []Region{APNorthEast1, APSouthEast2, APSouthEast3, APSouthEast5, APSouth1, USEast1, MEEast1, EUCentral1, EUWest1, Huhehaote, Zhangjiakou}\nvar NasNoSupportedRegions = []Region{Qingdao, APSouth1, APSouthEast3, APSouthEast5}\nvar OssVersioningSupportedRegions = []Region{APSouth1}\nvar OssSseSupportedRegions = []Region{Qingdao, Hangzhou, Beijing, Shanghai, Shenzhen, Hongkong, APNorthEast1, APSouth1, USEast1}\nvar GpdbClassicNoSupportedRegions = []Region{APSouthEast2, APSouthEast3, APSouthEast5, APSouth1, USEast1, USWest1, APNorthEast1, EUCentral1}\nvar OnsNoSupportRegions = []Region{APSouthEast5}\nvar AlikafkaSupportedRegions = []Region{Hangzhou, Qingdao, Beijing, Hongkong, Shenzhen, Shanghai, Zhangjiakou, Huhehaote, APSouthEast1, APSouthEast5, APSouth1}\n"
  },
  {
    "path": "providers/alicloud/dns.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/alicloud/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/alidns\"\n)\n\n// DNSGenerator Struct for generating AliCloud Elastic Compute Service\ntype DNSGenerator struct {\n\tAliCloudService\n}\n\nfunc resourceFromDomain(domain alidns.DomainInDescribeDomains) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tdomain.DomainName,                      // id\n\t\tdomain.DomainId+\"__\"+domain.DomainName, // nolint\n\t\t\"alicloud_alidns_domain\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc resourceFromDomainRecord(record alidns.Record) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\trecord.RecordId,                        // id\n\t\trecord.RecordId+\"__\"+record.DomainName, // nolint\n\t\t\"alicloud_alidns_record\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc initDomains(client *connectivity.AliyunClient) ([]alidns.DomainInDescribeDomains, error) {\n\tremaining := 1\n\tpageNumber := 1\n\tpageSize := 10\n\n\tallDomains := make([]alidns.DomainInDescribeDomains, 0)\n\n\tfor remaining > 0 {\n\t\traw, err := client.WithDNSClient(func(alidnsClient *alidns.Client) (interface{}, error) {\n\t\t\trequest := alidns.CreateDescribeDomainsRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.PageSize = requests.NewInteger(pageSize)\n\t\t\trequest.PageNumber = requests.NewInteger(pageNumber)\n\t\t\treturn alidnsClient.DescribeDomains(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresponse := raw.(*alidns.DescribeDomainsResponse)\n\t\tallDomains = append(allDomains, response.Domains.Domain...)\n\t\tremaining = int(response.TotalCount) - pageNumber*pageSize\n\t\tpageNumber++\n\t}\n\n\treturn allDomains, nil\n}\n\nfunc initDomainRecords(client *connectivity.AliyunClient, allDomains []alidns.DomainInDescribeDomains) ([]alidns.Record, error) {\n\tallDomainRecords := make([]alidns.Record, 0)\n\n\tfor _, domain := range allDomains {\n\t\tremaining := 1\n\t\tpageNumber := 1\n\t\tpageSize := 10\n\n\t\tfor remaining > 0 {\n\t\t\traw, err := client.WithDNSClient(func(alidnsClient *alidns.Client) (interface{}, error) {\n\t\t\t\trequest := alidns.CreateDescribeDomainRecordsRequest()\n\t\t\t\trequest.RegionId = client.RegionID\n\t\t\t\trequest.DomainName = domain.DomainName\n\t\t\t\trequest.PageSize = requests.NewInteger(pageSize)\n\t\t\t\trequest.PageNumber = requests.NewInteger(pageNumber)\n\t\t\t\treturn alidnsClient.DescribeDomainRecords(request)\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tresponse := raw.(*alidns.DescribeDomainRecordsResponse)\n\t\t\tallDomainRecords = append(allDomainRecords, response.DomainRecords.Record...)\n\t\t\tremaining = int(response.TotalCount) - pageNumber*pageSize\n\t\t\tpageNumber++\n\t\t}\n\t}\n\n\treturn allDomainRecords, nil\n}\n\n// InitResources Gets the list of all alidns domain ids and generates resources\nfunc (g *DNSGenerator) InitResources() error {\n\tclient, err := g.LoadClientFromProfile()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tallDomains, err := initDomains(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tallDomainRecords, err := initDomainRecords(client, allDomains)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, domain := range allDomains {\n\t\tresource := resourceFromDomain(domain)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\tfor _, record := range allDomainRecords {\n\t\tresource := resourceFromDomainRecord(record)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/alicloud/ecs.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs\"\n)\n\n// EcsGenerator Struct for generating AliCloud Elastic Compute Service\ntype EcsGenerator struct {\n\tAliCloudService\n}\n\nfunc resourceFromInstance(instance ecs.Instance) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tinstance.InstanceId, // id\n\t\tinstance.InstanceId+\"__\"+instance.InstanceName, // name\n\t\t\"alicloud_instance\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\n// InitResources Gets the list of all ECS instance ids and generates resources\nfunc (g *EcsGenerator) InitResources() error {\n\tclient, err := g.LoadClientFromProfile()\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar filters []ecs.DescribeInstancesTag\n\tfor _, filter := range g.Filter {\n\t\tif strings.HasPrefix(filter.FieldPath, \"tags.\") {\n\t\t\tfilters = append(filters, ecs.DescribeInstancesTag{\n\t\t\t\tKey:   strings.TrimPrefix(filter.FieldPath, \"tags.\"),\n\t\t\t\tValue: filter.AcceptableValues[0],\n\t\t\t})\n\t\t}\n\t}\n\n\tremaining := 1\n\tpageNumber := 1\n\tpageSize := 10\n\n\tallInstances := make([]ecs.Instance, 0)\n\n\tfor remaining > 0 {\n\t\traw, err := client.WithEcsClient(func(ecsClient *ecs.Client) (interface{}, error) {\n\t\t\trequest := ecs.CreateDescribeInstancesRequest()\n\t\t\trequest.Tag = &filters\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.PageSize = requests.NewInteger(pageSize)\n\t\t\trequest.PageNumber = requests.NewInteger(pageNumber)\n\t\t\treturn ecsClient.DescribeInstances(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresponse := raw.(*ecs.DescribeInstancesResponse)\n\t\tallInstances = append(allInstances, response.Instances.Instance...)\n\t\tremaining = response.TotalCount - pageNumber*pageSize\n\t\tpageNumber++\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := resourceFromInstance(instance)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\n// PostConvertHook Runs before HCL files are generated\nfunc (g *EcsGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"alicloud_instance\" {\n\t\t\t// subnet_id is absent in the documentation\n\t\t\t// https://www.terraform.io/docs/providers/alicloud/r/instance.html\n\t\t\tdelete(r.Item, \"subnet_id\")\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/alicloud/key_pair.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs\"\n)\n\n// KeyPairGenerator Struct for generating AliCloud Key pair\ntype KeyPairGenerator struct {\n\tAliCloudService\n}\n\nfunc resourceFromKeyPair(keyPair ecs.KeyPair) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tkeyPair.KeyPairName, // nolint\n\t\tkeyPair.KeyPairName+\"__\"+keyPair.KeyPairName, // nolint\n\t\t\"alicloud_key_pair\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\n// InitResources Gets the list of all key pair ids and generates resources\nfunc (g *KeyPairGenerator) InitResources() error {\n\tclient, err := g.LoadClientFromProfile()\n\tif err != nil {\n\t\treturn err\n\t}\n\tremaining := 1\n\tpageNumber := 1\n\tpageSize := 10\n\n\tallKeyPairs := make([]ecs.KeyPair, 0)\n\n\tfor remaining > 0 {\n\t\traw, err := client.WithEcsClient(func(ecsClient *ecs.Client) (interface{}, error) {\n\t\t\trequest := ecs.CreateDescribeKeyPairsRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.PageSize = requests.NewInteger(pageSize)\n\t\t\trequest.PageNumber = requests.NewInteger(pageNumber)\n\t\t\treturn ecsClient.DescribeKeyPairs(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresponse := raw.(*ecs.DescribeKeyPairsResponse)\n\t\tallKeyPairs = append(allKeyPairs, response.KeyPairs.KeyPair...)\n\t\tremaining = response.TotalCount - pageNumber*pageSize\n\t\tpageNumber++\n\t}\n\n\tfor _, keypair := range allKeyPairs {\n\t\tresource := resourceFromKeyPair(keypair)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/alicloud/nat_gateway.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/vpc\"\n)\n\n// NatGatewayGenerator Struct for generating AliCloud Elastic Compute Service\ntype NatGatewayGenerator struct {\n\tAliCloudService\n}\n\nfunc resourceFromNatGatewayResponse(natGateway vpc.NatGateway) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tnatGateway.NatGatewayId,                      // id\n\t\tnatGateway.NatGatewayId+\"__\"+natGateway.Name, // name\n\t\t\"alicloud_nat_gateway\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\n// InitResources Gets the list of all natgateway NatGateway ids and generates resources\nfunc (g *NatGatewayGenerator) InitResources() error {\n\tclient, err := g.LoadClientFromProfile()\n\tif err != nil {\n\t\treturn err\n\t}\n\tremaining := 1\n\tpageNumber := 1\n\tpageSize := 10\n\n\tallNatGateways := make([]vpc.NatGateway, 0)\n\n\tfor remaining > 0 {\n\t\traw, err := client.WithVpcClient(func(vpcClient *vpc.Client) (interface{}, error) {\n\t\t\trequest := vpc.CreateDescribeNatGatewaysRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.PageSize = requests.NewInteger(pageSize)\n\t\t\trequest.PageNumber = requests.NewInteger(pageNumber)\n\t\t\treturn vpcClient.DescribeNatGateways(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresponse := raw.(*vpc.DescribeNatGatewaysResponse)\n\t\tallNatGateways = append(allNatGateways, response.NatGateways.NatGateway...)\n\t\tremaining = response.TotalCount - pageNumber*pageSize\n\t\tpageNumber++\n\t}\n\n\tfor _, NatGateway := range allNatGateways {\n\t\tresource := resourceFromNatGatewayResponse(NatGateway)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/alicloud/pvtz.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/alicloud/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/pvtz\"\n)\n\n// PvtzGenerator Struct for generating AliCloud private zone\ntype PvtzGenerator struct {\n\tAliCloudService\n}\n\nfunc resourceFromZoneResponse(zone pvtz.Zone) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tzone.ZoneId,                    // id\n\t\tzone.ZoneId+\"__\"+zone.ZoneName, // name\n\t\t\"alicloud_pvtz_zone\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc resourceFromZoneAttachmentResponse(zone pvtz.Zone) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tzone.ZoneId, // id\n\t\tzone.ZoneId+\"__\"+zone.ZoneName+\"_attachment\", // name\n\t\t\"alicloud_pvtz_zone_attachment\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc resourceFromZoneRecordResponse(record pvtz.Record, zoneID string) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tstrconv.FormatInt(record.RecordId, 10)+\":\"+zoneID,     // id\n\t\tstrconv.FormatInt(record.RecordId, 10)+\"__\"+record.Rr, // name\n\t\t\"alicloud_pvtz_zone_record\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc initZones(client *connectivity.AliyunClient) ([]pvtz.Zone, error) {\n\tremaining := 1\n\tpageNumber := 1\n\tpageSize := 10\n\n\tallZones := make([]pvtz.Zone, 0)\n\n\tfor remaining > 0 {\n\t\traw, err := client.WithPvtzClient(func(pvtzClient *pvtz.Client) (interface{}, error) {\n\t\t\trequest := pvtz.CreateDescribeZonesRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.PageSize = requests.NewInteger(pageSize)\n\t\t\trequest.PageNumber = requests.NewInteger(pageNumber)\n\t\t\treturn pvtzClient.DescribeZones(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresponse := raw.(*pvtz.DescribeZonesResponse)\n\t\tallZones = append(allZones, response.Zones.Zone...)\n\t\tremaining = response.TotalItems - pageNumber*pageSize\n\t\tpageNumber++\n\t}\n\treturn allZones, nil\n}\n\nfunc initZoneRecords(client *connectivity.AliyunClient, allZones []pvtz.Zone) ([]pvtz.Record, []string, error) {\n\tallZoneRecords := make([]pvtz.Record, 0)\n\tzoneIds := make([]string, 0)\n\n\tfor _, zone := range allZones {\n\t\tremaining := 1\n\t\tpageNumber := 1\n\t\tpageSize := 10\n\t\tif zone.ZoneId == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor remaining > 0 {\n\t\t\traw, err := client.WithPvtzClient(func(pvtzClient *pvtz.Client) (interface{}, error) {\n\t\t\t\trequest := pvtz.CreateDescribeZoneRecordsRequest()\n\t\t\t\trequest.RegionId = client.RegionID\n\t\t\t\trequest.ZoneId = zone.ZoneId\n\t\t\t\trequest.PageSize = requests.NewInteger(pageSize)\n\t\t\t\trequest.PageNumber = requests.NewInteger(pageNumber)\n\t\t\t\treturn pvtzClient.DescribeZoneRecords(request)\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\n\t\t\tresponse := raw.(*pvtz.DescribeZoneRecordsResponse)\n\t\t\tfor _, zoneRecord := range response.Records.Record {\n\t\t\t\tallZoneRecords = append(allZoneRecords, zoneRecord)\n\t\t\t\tzoneIds = append(zoneIds, zone.ZoneId)\n\t\t\t}\n\t\t\tremaining = response.TotalItems - pageNumber*pageSize\n\t\t\tpageNumber++\n\t\t}\n\t}\n\treturn allZoneRecords, zoneIds, nil\n}\n\n// InitResources Gets the list of all pvtz Zone ids and generates resources\nfunc (g *PvtzGenerator) InitResources() error {\n\tclient, err := g.LoadClientFromProfile()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tallZones, err := initZones(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tallRecords, zoneIds, err := initZoneRecords(client, allZones)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, zone := range allZones {\n\t\tresource := resourceFromZoneResponse(zone)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\tfor _, zone := range allZones {\n\t\tresource := resourceFromZoneAttachmentResponse(zone)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\tfor i, record := range allRecords {\n\t\tresource := resourceFromZoneRecordResponse(record, zoneIds[i])\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\n// PostConvertHook Runs before HCL files are generated\nfunc (g *PvtzGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"alicloud_pvtz_zone_record\" {\n\t\t\t// https://www.terraform.io/docs/providers/alicloud/r/pvtz_zone_record.html#priority\n\t\t\tv, e := strconv.Atoi(r.Item[\"priority\"].(string))\n\t\t\tif v < 1 || v > 50 || e != nil {\n\t\t\t\tdelete(r.Item, \"priority\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/alicloud/ram.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/alicloud/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/ram\"\n)\n\n// RAMGenerator Struct for generating AliCloud Elastic Compute Service\ntype RAMGenerator struct {\n\tAliCloudService\n}\n\nfunc resourceFromRAMRole(role ram.RoleInListRoles) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\trole.RoleName,                  // id\n\t\trole.RoleId+\"__\"+role.RoleName, // name\n\t\t\"alicloud_ram_role\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc resourceFromRAMPolicy(policy ram.PolicyInListPoliciesForRole, roleName string) terraformutils.Resource {\n\t// https://github.com/terraform-providers/terraform-provider-alicloud/blob/master/alicloud/resource_alicloud_ram_role_policy_attachment.go#L93\n\tid := strings.Join([]string{\"role\", policy.PolicyName, policy.PolicyType, roleName}, \":\")\n\n\treturn terraformutils.NewResource(\n\t\tid, // id\n\t\tid+\"__\"+roleName+\"_\"+policy.PolicyName, // name\n\t\t\"alicloud_ram_role_policy_attachment\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc initRoles(client *connectivity.AliyunClient) ([]ram.RoleInListRoles, error) {\n\tallRoles := make([]ram.RoleInListRoles, 0)\n\n\traw, err := client.WithRAMClient(func(ramClient *ram.Client) (interface{}, error) {\n\t\trequest := ram.CreateListRolesRequest()\n\t\trequest.RegionId = client.RegionID\n\t\treturn ramClient.ListRoles(request)\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := raw.(*ram.ListRolesResponse)\n\tallRoles = append(allRoles, response.Roles.Role...)\n\n\treturn allRoles, nil\n}\n\nfunc initRAMPolicyAttachment(client *connectivity.AliyunClient, allRoles []ram.RoleInListRoles) ([]ram.PolicyInListPoliciesForRole, []string, error) {\n\tallRAMPolicies := make([]ram.PolicyInListPoliciesForRole, 0)\n\troleNames := make([]string, 0)\n\n\tfor _, role := range allRoles {\n\t\traw, err := client.WithRAMClient(func(ramClient *ram.Client) (interface{}, error) {\n\t\t\trequest := ram.CreateListPoliciesForRoleRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.RoleName = role.RoleName\n\t\t\treturn ramClient.ListPoliciesForRole(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tresponse := raw.(*ram.ListPoliciesForRoleResponse)\n\t\tfor _, policy := range response.Policies.Policy {\n\t\t\tallRAMPolicies = append(allRAMPolicies, policy)\n\t\t\troleNames = append(roleNames, role.RoleName)\n\t\t}\n\t}\n\n\treturn allRAMPolicies, roleNames, nil\n}\n\n// InitResources Gets the list of all ram role ids and generates resources\nfunc (g *RAMGenerator) InitResources() error {\n\tclient, err := g.LoadClientFromProfile()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tallRoles, err := initRoles(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tallRAMPolicyAttachment, roleNames, err := initRAMPolicyAttachment(client, allRoles)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, role := range allRoles {\n\t\tresource := resourceFromRAMRole(role)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\tfor i, ramPolicy := range allRAMPolicyAttachment {\n\t\tresource := resourceFromRAMPolicy(ramPolicy, roleNames[i])\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\n// PostConvertHook Runs before HCL files are generated\nfunc (g *RAMGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"alicloud_ram_role\" {\n\t\t\t// https://www.terraform.io/docs/providers/alicloud/r/ram_role.html\n\t\t\tdelete(r.Item, \"services\")  // deprecated\n\t\t\tdelete(r.Item, \"ram_users\") // deprecated\n\t\t\tdelete(r.Item, \"version\")   // deprecated\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/alicloud/rds.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/rds\"\n)\n\n// RdsGenerator Struct for generating AliCloud Elastic Compute Service\ntype RdsGenerator struct {\n\tAliCloudService\n}\n\nfunc resourceFromrdsResponse(rds rds.DBInstance) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\trds.DBInstanceId, // nolint\n\t\trds.DBInstanceId+\"__\"+rds.DBInstanceDescription, // nolint\n\t\t\"alicloud_db_instance\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\n// InitResources Gets the list of all rds ids and generates resources\nfunc (g *RdsGenerator) InitResources() error {\n\tclient, err := g.LoadClientFromProfile()\n\tif err != nil {\n\t\treturn err\n\t}\n\tremaining := 1\n\tpageNumber := 1\n\tpageSize := 10\n\n\tallrdss := make([]rds.DBInstance, 0)\n\n\tfor remaining > 0 {\n\t\traw, err := client.WithRdsClient(func(rdsClient *rds.Client) (interface{}, error) {\n\t\t\trequest := rds.CreateDescribeDBInstancesRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.PageSize = requests.NewInteger(pageSize)\n\t\t\trequest.PageNumber = requests.NewInteger(pageNumber)\n\t\t\treturn rdsClient.DescribeDBInstances(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresponse := raw.(*rds.DescribeDBInstancesResponse)\n\t\tallrdss = append(allrdss, response.Items.DBInstance...)\n\t\tremaining = response.TotalRecordCount - pageNumber*pageSize\n\t\tpageNumber++\n\t}\n\n\tfor _, rds := range allrdss {\n\t\tresource := resourceFromrdsResponse(rds)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\n// PostConvertHook Runs before HCL files are generated\nfunc (g *RdsGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"alicloud_db_instance\" {\n\t\t\t// https://www.terraform.io/docs/providers/alicloud/r/db_instance.html#period\n\t\t\tif r.Item[\"instance_charge_type\"] != \"PrePaid\" {\n\t\t\t\tdelete(r.Item, \"period\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/alicloud/sg.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/alicloud/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs\"\n)\n\n// SgGenerator Struct for generating AliCloud Security group\ntype SgGenerator struct {\n\tAliCloudService\n}\n\nfunc resourceFromSecurityGroup(securitygroup ecs.SecurityGroup) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tsecuritygroup.SecurityGroupId,                                      // id\n\t\tsecuritygroup.SecurityGroupId+\"__\"+securitygroup.SecurityGroupName, // name\n\t\t\"alicloud_security_group\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc resourceFromSecurityGroupAttribute(permission ecs.Permission, securityGroup ecs.SecurityGroup) terraformutils.Resource {\n\t// https://github.com/terraform-providers/terraform-provider-alicloud/blob/master/alicloud/resource_alicloud_security_group_rule.go#L153\n\t// sgId + \":\" + direction + \":\" + ptl + \":\" + port + \":\" + nicType + \":\" + cidr_ip + \":\" + policy + \":\" + strconv.Itoa(priority)\n\tid := strings.Join([]string{\n\t\tsecurityGroup.SecurityGroupId,\n\t\tpermission.Direction,\n\t\tpermission.IpProtocol,\n\t\tpermission.PortRange,\n\t\tpermission.NicType,\n\t\tpermission.SourceCidrIp,\n\t\tpermission.Policy,\n\t\tpermission.Priority,\n\t}, \":\")\n\tid = strings.ToLower(id)\n\n\treturn terraformutils.NewResource(\n\t\tid, // id\n\t\tid+\"__\"+securityGroup.SecurityGroupName, // name\n\t\t\"alicloud_security_group_rule\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc initSecurityGroupRules(client *connectivity.AliyunClient, securityGroups []ecs.SecurityGroup) ([]ecs.Permission, []ecs.SecurityGroup, error) {\n\tallPermissions := make([]ecs.Permission, 0)\n\talignedSecurityGroups := make([]ecs.SecurityGroup, 0)\n\n\tfor _, securityGroup := range securityGroups {\n\t\tif securityGroup.SecurityGroupId == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\traw, err := client.WithEcsClient(func(ecsClient *ecs.Client) (interface{}, error) {\n\t\t\trequest := ecs.CreateDescribeSecurityGroupAttributeRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.SecurityGroupId = securityGroup.SecurityGroupId\n\t\t\treturn ecsClient.DescribeSecurityGroupAttribute(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\tresponse := raw.(*ecs.DescribeSecurityGroupAttributeResponse)\n\t\tfor _, zoneRecord := range response.Permissions.Permission {\n\t\t\tallPermissions = append(allPermissions, zoneRecord)\n\t\t\talignedSecurityGroups = append(alignedSecurityGroups, securityGroup)\n\t\t}\n\t}\n\treturn allPermissions, alignedSecurityGroups, nil\n}\n\nfunc initSecurityGroups(client *connectivity.AliyunClient) ([]ecs.SecurityGroup, error) {\n\tremaining := 1\n\tpageNumber := 1\n\tpageSize := 10\n\n\tallSecurityGroups := make([]ecs.SecurityGroup, 0)\n\n\tfor remaining > 0 {\n\t\traw, err := client.WithEcsClient(func(ecsClient *ecs.Client) (interface{}, error) {\n\t\t\trequest := ecs.CreateDescribeSecurityGroupsRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.PageSize = requests.NewInteger(pageSize)\n\t\t\trequest.PageNumber = requests.NewInteger(pageNumber)\n\t\t\treturn ecsClient.DescribeSecurityGroups(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresponse := raw.(*ecs.DescribeSecurityGroupsResponse)\n\t\tallSecurityGroups = append(allSecurityGroups, response.SecurityGroups.SecurityGroup...)\n\t\tremaining = response.TotalCount - pageNumber*pageSize\n\t\tpageNumber++\n\t}\n\n\treturn allSecurityGroups, nil\n}\n\n// InitResources Gets the list of all security group ids and generates resources\nfunc (g *SgGenerator) InitResources() error {\n\tclient, err := g.LoadClientFromProfile()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tallSecurityGroups, err := initSecurityGroups(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tallSecurityGroupRules, alignedSecurityGroups, err := initSecurityGroupRules(client, allSecurityGroups)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, securitygroup := range allSecurityGroups {\n\t\tresource := resourceFromSecurityGroup(securitygroup)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\tfor i, permission := range allSecurityGroupRules {\n\t\tresource := resourceFromSecurityGroupAttribute(permission, alignedSecurityGroups[i])\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\n// PostConvertHook Runs before HCL files are generated\nfunc (g *SgGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"alicloud_security_group\" {\n\t\t\t// inner_access is deprecrated\n\t\t\t// https://www.terraform.io/docs/providers/alicloud/r/security_group.html#inner_access\n\t\t\tdelete(r.Item, \"inner_access\")\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/alicloud/slb.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/alicloud/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/slb\"\n)\n\n// SlbGenerator Struct for generating AliCloud Elastic Compute Service\ntype SlbGenerator struct {\n\tAliCloudService\n}\n\nfunc resourceFromSlbListener(loadBalancer slb.LoadBalancer, suffix string) terraformutils.Resource {\n\tid := loadBalancer.LoadBalancerId + \":\" + suffix\n\treturn terraformutils.NewResource(\n\t\tid, // id\n\t\tid+\"__\"+loadBalancer.LoadBalancerName, // name\n\t\t\"alicloud_slb_listener\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc resourceFromSlbResponse(loadBalancer slb.LoadBalancer) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tloadBalancer.LoadBalancerId,                                    // id\n\t\tloadBalancer.LoadBalancerId+\"__\"+loadBalancer.LoadBalancerName, // name\n\t\t\"alicloud_slb\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc resourceFromVServerGroupResponse(vServerGroup slb.VServerGroup) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tvServerGroup.VServerGroupId,                                    // id\n\t\tvServerGroup.VServerGroupId+\"__\"+vServerGroup.VServerGroupName, // name\n\t\t\"alicloud_slb_server_group\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc initSlb(client *connectivity.AliyunClient) ([]slb.LoadBalancer, error) {\n\tremaining := 1\n\tpageNumber := 1\n\tpageSize := 10\n\n\tallLoadBalancers := make([]slb.LoadBalancer, 0)\n\n\tfor remaining > 0 {\n\t\traw, err := client.WithSlbClient(func(slbClient *slb.Client) (interface{}, error) {\n\t\t\trequest := slb.CreateDescribeLoadBalancersRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.PageSize = requests.NewInteger(pageSize)\n\t\t\trequest.PageNumber = requests.NewInteger(pageNumber)\n\t\t\treturn slbClient.DescribeLoadBalancers(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresponse := raw.(*slb.DescribeLoadBalancersResponse)\n\t\tallLoadBalancers = append(allLoadBalancers, response.LoadBalancers.LoadBalancer...)\n\t\tremaining = response.TotalCount - pageNumber*pageSize\n\t\tpageNumber++\n\t}\n\n\treturn allLoadBalancers, nil\n}\n\nfunc initVServerGroups(client *connectivity.AliyunClient, allLoadBalancers []slb.LoadBalancer) ([]slb.VServerGroup, error) {\n\tallVserverGroups := make([]slb.VServerGroup, 0)\n\tfor _, loadBalancer := range allLoadBalancers {\n\t\tif loadBalancer.LoadBalancerId == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\traw, err := client.WithSlbClient(func(slbClient *slb.Client) (interface{}, error) {\n\t\t\trequest := slb.CreateDescribeVServerGroupsRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.LoadBalancerId = loadBalancer.LoadBalancerId\n\t\t\treturn slbClient.DescribeVServerGroups(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse := raw.(*slb.DescribeVServerGroupsResponse)\n\t\tallVserverGroups = append(allVserverGroups, response.VServerGroups.VServerGroup...)\n\t}\n\n\treturn allVserverGroups, nil\n}\n\nfunc initSlbListeners(client *connectivity.AliyunClient, allLoadBalancers []slb.LoadBalancer) ([]slb.LoadBalancer, []string, error) {\n\talignedLoadBalancers := make([]slb.LoadBalancer, 0)\n\tsuffixes := make([]string, 0)\n\tfor _, loadBalancer := range allLoadBalancers {\n\t\tif loadBalancer.LoadBalancerId == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\traw, err := client.WithSlbClient(func(slbClient *slb.Client) (interface{}, error) {\n\t\t\trequest := slb.CreateDescribeLoadBalancerAttributeRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.LoadBalancerId = loadBalancer.LoadBalancerId\n\t\t\treturn slbClient.DescribeLoadBalancerAttribute(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tresponse := raw.(*slb.DescribeLoadBalancerAttributeResponse)\n\t\tfor _, listenerPortAndProtocol := range response.ListenerPortsAndProtocol.ListenerPortAndProtocol {\n\t\t\tsuffix := fmt.Sprintf(\"%s:%d\", listenerPortAndProtocol.ListenerProtocol, listenerPortAndProtocol.ListenerPort)\n\t\t\tsuffixes = append(suffixes, suffix)\n\n\t\t\talignedLoadBalancers = append(alignedLoadBalancers, loadBalancer)\n\t\t}\n\t}\n\n\treturn alignedLoadBalancers, suffixes, nil\n}\n\n// InitResources Gets the list of all slb loadBalancer ids and generates resources\nfunc (g *SlbGenerator) InitResources() error {\n\tclient, err := g.LoadClientFromProfile()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tallLoadBalancers, err := initSlb(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tallVserverGroups, err := initVServerGroups(client, allLoadBalancers)\n\tif err != nil {\n\t\treturn err\n\t}\n\talignedLoadBalancers, suffixes, err := initSlbListeners(client, allLoadBalancers)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, loadBalancer := range allLoadBalancers {\n\t\tresource := resourceFromSlbResponse(loadBalancer)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\tfor _, vServerGroup := range allVserverGroups {\n\t\tresource := resourceFromVServerGroupResponse(vServerGroup)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\tfor i, alignedSlb := range alignedLoadBalancers {\n\t\tresource := resourceFromSlbListener(alignedSlb, suffixes[i])\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\n// PostConvertHook Runs before HCL files are generated\nfunc (g *SlbGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"alicloud_slb\" {\n\t\t\t// internet is deprecrated\n\t\t\t// https://www.terraform.io/docs/providers/alicloud/r/slb.html#internet\n\t\t\tdelete(r.Item, \"internet\")\n\n\t\t\t// https://www.terraform.io/docs/providers/alicloud/r/slb.html#bandwidth\n\t\t\tif r.Item[\"internet_charge_type\"] == \"PayByTraffic\" {\n\t\t\t\tdelete(r.Item, \"bandwidth\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/alicloud/vpc.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/vpc\"\n)\n\n// VpcGenerator Struct for generating AliCloud Elastic Compute Service\ntype VpcGenerator struct {\n\tAliCloudService\n}\n\nfunc resourceFromVpcResponse(vpc vpc.Vpc) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tvpc.VpcId,                  // id\n\t\tvpc.VpcId+\"__\"+vpc.VpcName, // name\n\t\t\"alicloud_vpc\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\n// InitResources Gets the list of all vpc Vpc ids and generates resources\nfunc (g *VpcGenerator) InitResources() error {\n\tclient, err := g.LoadClientFromProfile()\n\tif err != nil {\n\t\treturn err\n\t}\n\tremaining := 1\n\tpageNumber := 1\n\tpageSize := 10\n\n\tallVpcs := make([]vpc.Vpc, 0)\n\n\tfor remaining > 0 {\n\t\traw, err := client.WithVpcClient(func(vpcClient *vpc.Client) (interface{}, error) {\n\t\t\trequest := vpc.CreateDescribeVpcsRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.PageSize = requests.NewInteger(pageSize)\n\t\t\trequest.PageNumber = requests.NewInteger(pageNumber)\n\t\t\treturn vpcClient.DescribeVpcs(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresponse := raw.(*vpc.DescribeVpcsResponse)\n\t\tallVpcs = append(allVpcs, response.Vpcs.Vpc...)\n\t\tremaining = response.TotalCount - pageNumber*pageSize\n\t\tpageNumber++\n\t}\n\n\tfor _, Vpc := range allVpcs {\n\t\tresource := resourceFromVpcResponse(Vpc)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/alicloud/vswitch.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage alicloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/services/vpc\"\n)\n\n// VSwitchGenerator Struct for generating AliCloud Elastic Compute Service\ntype VSwitchGenerator struct {\n\tAliCloudService\n}\n\nfunc resourceFromVSwitchResponse(vswitch vpc.VSwitch) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tvswitch.VSwitchId, // nolint\n\t\tvswitch.VSwitchId+\"__\"+vswitch.VSwitchName, // nolint\n\t\t\"alicloud_vswitch\",\n\t\t\"alicloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\n// InitResources Gets the list of all vpc VSwitch ids and generates resources\nfunc (g *VSwitchGenerator) InitResources() error {\n\tclient, err := g.LoadClientFromProfile()\n\tif err != nil {\n\t\treturn err\n\t}\n\tremaining := 1\n\tpageNumber := 1\n\tpageSize := 10\n\n\tallVSwitchs := make([]vpc.VSwitch, 0)\n\n\tfor remaining > 0 {\n\t\traw, err := client.WithVpcClient(func(vpcClient *vpc.Client) (interface{}, error) {\n\t\t\trequest := vpc.CreateDescribeVSwitchesRequest()\n\t\t\trequest.RegionId = client.RegionID\n\t\t\trequest.PageSize = requests.NewInteger(pageSize)\n\t\t\trequest.PageNumber = requests.NewInteger(pageNumber)\n\t\t\treturn vpcClient.DescribeVSwitches(request)\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresponse := raw.(*vpc.DescribeVSwitchesResponse)\n\t\tallVSwitchs = append(allVSwitchs, response.VSwitches.VSwitch...)\n\t\tremaining = response.TotalCount - pageNumber*pageSize\n\t\tpageNumber++\n\t}\n\n\tfor _, VSwitch := range allVSwitchs {\n\t\tresource := resourceFromVSwitchResponse(VSwitch)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/action.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tActionAllowEmptyValues = []string{}\n)\n\ntype ActionGenerator struct {\n\tAuth0Service\n}\n\nfunc (g ActionGenerator) createResources(actions []*management.Action) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, action := range actions {\n\t\tresourceName := *action.ID\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceName,\n\t\t\tresourceName+\"_\"+*action.Name,\n\t\t\t\"auth0_action\",\n\t\t\t\"auth0\",\n\t\t\tActionAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *ActionGenerator) InitResources() error {\n\tm := g.generateClient()\n\tlist := []*management.Action{}\n\n\tvar page int\n\tfor {\n\t\tl, err := m.Action.List(management.Page(page))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlist = append(list, l.Actions...)\n\t\tif !l.HasNext() {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\n\tg.Resources = g.createResources(list)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/auth0_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype Auth0Provider struct { //nolint\n\tterraformutils.Provider\n\tdomain       string\n\tclientID     string\n\tclientSecret string\n}\n\nfunc (p *Auth0Provider) Init(args []string) error {\n\torgName := os.Getenv(\"AUTH0_DOMAIN\")\n\tif orgName == \"\" {\n\t\treturn errors.New(\"set AUTH0_DOMAIN env var\")\n\t}\n\tp.domain = orgName\n\n\tbaseURL := os.Getenv(\"AUTH0_CLIENT_ID\")\n\tif baseURL == \"\" {\n\t\treturn errors.New(\"set AUTH0_CLIENT_ID env var\")\n\t}\n\tp.clientID = baseURL\n\n\tapiToken := os.Getenv(\"AUTH0_CLIENT_SECRET\")\n\tif apiToken == \"\" {\n\t\treturn errors.New(\"set AUTH0_CLIENT_SECRET env var\")\n\t}\n\tp.clientSecret = apiToken\n\n\treturn nil\n}\n\nfunc (p *Auth0Provider) GetName() string {\n\treturn \"auth0\"\n}\n\nfunc (p *Auth0Provider) GetSource() string {\n\treturn \"auth0/auth0\"\n}\n\nfunc (p *Auth0Provider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"domain\":        cty.StringVal(p.domain),\n\t\t\"client_id\":     cty.StringVal(p.clientID),\n\t\t\"client_secret\": cty.StringVal(p.clientSecret),\n\t})\n}\n\nfunc (p *Auth0Provider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"domain\":        p.domain,\n\t\t\"client_id\":     p.clientID,\n\t\t\"client_secret\": p.clientSecret,\n\t})\n\treturn nil\n}\n\nfunc (p *Auth0Provider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"auth0_action\":          &ActionGenerator{},\n\t\t\"auth0_client\":          &ClientGenerator{},\n\t\t\"auth0_client_grant\":    &ClientGrantGenerator{},\n\t\t\"auth0_hook\":            &HookGenerator{},\n\t\t\"auth0_resource_server\": &ResourceServerGenerator{},\n\t\t\"auth0_role\":            &RoleGenerator{},\n\t\t\"auth0_rule\":            &RuleGenerator{},\n\t\t\"auth0_rule_config\":     &RuleConfigGenerator{},\n\t\t\"auth0_trigger_binding\": &TriggerBindingGenerator{},\n\t\t\"auth0_user\":            &UserGenerator{},\n\t\t\"auth0_branding\":        &BrandingGenerator{},\n\t\t\"auth0_custom_domain\":   &CustomDomainGenerator{},\n\t\t\"auth0_email\":           &EmailGenerator{},\n\t\t\"auth0_prompt\":          &PromptGenerator{},\n\t\t\"auth0_log_stream\":      &LogStreamGenerator{},\n\t\t\"auth0_tenant\":          &TenantGenerator{},\n\t}\n}\n\nfunc (p Auth0Provider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p Auth0Provider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n"
  },
  {
    "path": "providers/auth0/auth0_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\ntype Auth0Service struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *Auth0Service) generateClient() *management.Management {\n\tauthenticationOption := management.WithClientCredentials(s.Args[\"client_id\"].(string), s.Args[\"client_secret\"].(string))\n\n\tapiClient, err := management.New(s.Args[\"domain\"].(string),\n\t\tauthenticationOption,\n\t\tmanagement.WithDebug(false),\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"%v\", err)\n\t}\n\n\treturn apiClient\n}\n"
  },
  {
    "path": "providers/auth0/branding.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"encoding/base64\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tBrandingAllowEmptyValues = []string{}\n)\n\ntype BrandingGenerator struct {\n\tAuth0Service\n}\n\nfunc (g BrandingGenerator) createResources(branding *management.Branding) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tresourceName := base64.StdEncoding.EncodeToString([]byte(branding.String()))\n\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\tresourceName,\n\t\tresourceName,\n\t\t\"auth0_branding\",\n\t\t\"auth0\",\n\t\tBrandingAllowEmptyValues,\n\t))\n\treturn resources\n}\n\nfunc (g *BrandingGenerator) InitResources() error {\n\tm := g.generateClient()\n\tbranding, err := m.Branding.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(branding)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/client.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tClientAllowEmptyValues = []string{}\n)\n\ntype ClientGenerator struct {\n\tAuth0Service\n}\n\nfunc (g ClientGenerator) createResources(clients []*management.Client) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, client := range clients {\n\t\tresourceName := *client.ClientID\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceName,\n\t\t\tresourceName+\"_\"+*client.Name,\n\t\t\t\"auth0_client\",\n\t\t\t\"auth0\",\n\t\t\tClientAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *ClientGenerator) InitResources() error {\n\tm := g.generateClient()\n\tlist := []*management.Client{}\n\n\tvar page int\n\tfor {\n\t\tl, err := m.Client.List(management.Page(page))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlist = append(list, l.Clients...)\n\t\tif !l.HasNext() {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\n\tg.Resources = g.createResources(list)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/client_grant.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tClientGrantAllowEmptyValues = []string{}\n)\n\ntype ClientGrantGenerator struct {\n\tAuth0Service\n}\n\nfunc (g ClientGrantGenerator) createResources(clientGrantGrants []*management.ClientGrant) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, clientGrant := range clientGrantGrants {\n\t\tresourceName := *clientGrant.ID\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceName,\n\t\t\tresourceName+\"_\"+*clientGrant.ClientID,\n\t\t\t\"auth0_client_grant\",\n\t\t\t\"auth0\",\n\t\t\tClientGrantAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *ClientGrantGenerator) InitResources() error {\n\tm := g.generateClient()\n\tlist := []*management.ClientGrant{}\n\n\tvar page int\n\tfor {\n\t\tl, err := m.ClientGrant.List(management.Page(page))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlist = append(list, l.ClientGrants...)\n\t\tif !l.HasNext() {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\n\tg.Resources = g.createResources(list)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/custom_domain.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tCustomDomainAllowEmptyValues = []string{}\n)\n\ntype CustomDomainGenerator struct {\n\tAuth0Service\n}\n\nfunc (g CustomDomainGenerator) createResources(customDomains []*management.CustomDomain) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, CustomDomain := range customDomains {\n\t\tresourceName := *CustomDomain.ID\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceName,\n\t\t\tresourceName+\"_\"+*CustomDomain.Domain,\n\t\t\t\"auth0_custom_domain\",\n\t\t\t\"auth0\",\n\t\t\tCustomDomainAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *CustomDomainGenerator) InitResources() error {\n\tm := g.generateClient()\n\tlist, err := m.CustomDomain.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(list)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/email.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tEmailAllowEmptyValues = []string{}\n)\n\ntype EmailGenerator struct {\n\tAuth0Service\n}\n\nfunc (g EmailGenerator) createResources(email *management.Email) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tresourceName := *email.Name\n\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\tresourceName,\n\t\tresourceName,\n\t\t\"auth0_email\",\n\t\t\"auth0\",\n\t\tEmailAllowEmptyValues,\n\t))\n\treturn resources\n}\n\nfunc (g *EmailGenerator) InitResources() error {\n\tm := g.generateClient()\n\tEmail, err := m.Email.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(Email)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/hook.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tHookAllowEmptyValues = []string{}\n)\n\ntype HookGenerator struct {\n\tAuth0Service\n}\n\nfunc (g HookGenerator) createResources(hooks []*management.Hook) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, hook := range hooks {\n\t\tresourceName := *hook.ID\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceName,\n\t\t\tresourceName+\"_\"+*hook.Name,\n\t\t\t\"auth0_hook\",\n\t\t\t\"auth0\",\n\t\t\tHookAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *HookGenerator) InitResources() error {\n\tm := g.generateClient()\n\tlist := []*management.Hook{}\n\n\tvar page int\n\tfor {\n\t\tl, err := m.Hook.List(management.Page(page))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlist = append(list, l.Hooks...)\n\t\tif !l.HasNext() {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\n\tg.Resources = g.createResources(list)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/log_stream.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tLogStreamAllowEmptyValues = []string{}\n)\n\ntype LogStreamGenerator struct {\n\tAuth0Service\n}\n\nfunc (g LogStreamGenerator) createResources(logStreams []*management.LogStream) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, LogStream := range logStreams {\n\t\tresourceName := *LogStream.ID\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceName,\n\t\t\tresourceName+\"_\"+*LogStream.Name,\n\t\t\t\"auth0_log_stream\",\n\t\t\t\"auth0\",\n\t\t\tLogStreamAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *LogStreamGenerator) InitResources() error {\n\tm := g.generateClient()\n\tlist, err := m.LogStream.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(list)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/prompt.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"encoding/base64\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tPromptAllowEmptyValues = []string{}\n)\n\ntype PromptGenerator struct {\n\tAuth0Service\n}\n\nfunc (g PromptGenerator) createResources(prompt *management.Prompt) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tresourceName := base64.StdEncoding.EncodeToString([]byte(prompt.String()))\n\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\tresourceName,\n\t\tresourceName,\n\t\t\"auth0_prompt\",\n\t\t\"auth0\",\n\t\tPromptAllowEmptyValues,\n\t))\n\treturn resources\n}\n\nfunc (g *PromptGenerator) InitResources() error {\n\tm := g.generateClient()\n\tprompt, err := m.Prompt.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(prompt)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/resource_server.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tResourceServerAllowEmptyValues = []string{}\n)\n\ntype ResourceServerGenerator struct {\n\tAuth0Service\n}\n\nfunc (g ResourceServerGenerator) createResources(resourceServers []*management.ResourceServer) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, resourceServer := range resourceServers {\n\t\tresourceName := *resourceServer.ID\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceName,\n\t\t\tresourceName+\"_\"+*resourceServer.Name,\n\t\t\t\"auth0_resource_server\",\n\t\t\t\"auth0\",\n\t\t\tResourceServerAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *ResourceServerGenerator) InitResources() error {\n\tm := g.generateClient()\n\tlist := []*management.ResourceServer{}\n\n\tvar page int\n\tfor {\n\t\tl, err := m.ResourceServer.List(management.Page(page))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlist = append(list, l.ResourceServers...)\n\t\tif !l.HasNext() {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\n\tg.Resources = g.createResources(list)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/role.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tRoleAllowEmptyValues = []string{}\n)\n\ntype RoleGenerator struct {\n\tAuth0Service\n}\n\nfunc (g RoleGenerator) createResources(roles []*management.Role) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, role := range roles {\n\t\tresourceName := *role.ID\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceName,\n\t\t\tresourceName+\"_\"+*role.Name,\n\t\t\t\"auth0_role\",\n\t\t\t\"auth0\",\n\t\t\tRoleAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *RoleGenerator) InitResources() error {\n\tm := g.generateClient()\n\tlist := []*management.Role{}\n\n\tvar page int\n\tfor {\n\t\tl, err := m.Role.List(management.Page(page))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlist = append(list, l.Roles...)\n\t\tif !l.HasNext() {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\n\tg.Resources = g.createResources(list)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/rule.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tRuleAllowEmptyValues = []string{}\n)\n\ntype RuleGenerator struct {\n\tAuth0Service\n}\n\nfunc (g RuleGenerator) createResources(rules []*management.Rule) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, rule := range rules {\n\t\tresourceName := *rule.ID\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceName,\n\t\t\tresourceName+\"_\"+*rule.Name,\n\t\t\t\"auth0_rule\",\n\t\t\t\"auth0\",\n\t\t\tRuleAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *RuleGenerator) InitResources() error {\n\tm := g.generateClient()\n\tlist := []*management.Rule{}\n\n\tvar page int\n\tfor {\n\t\tl, err := m.Rule.List(management.Page(page))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlist = append(list, l.Rules...)\n\t\tif !l.HasNext() {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\n\tg.Resources = g.createResources(list)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/rule_config.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tRuleConfigAllowEmptyValues = []string{}\n)\n\ntype RuleConfigGenerator struct {\n\tAuth0Service\n}\n\nfunc (g RuleConfigGenerator) createResources(ruleConfigConfigs []*management.RuleConfig) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, ruleConfig := range ruleConfigConfigs {\n\t\tresourceName := *ruleConfig.Key\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceName,\n\t\t\tresourceName,\n\t\t\t\"auth0_rule_config\",\n\t\t\t\"auth0\",\n\t\t\tRuleConfigAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *RuleConfigGenerator) InitResources() error {\n\tm := g.generateClient()\n\n\tlist, err := m.RuleConfig.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(list)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/tenant.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"encoding/base64\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tTenantAllowEmptyValues = []string{}\n)\n\ntype TenantGenerator struct {\n\tAuth0Service\n}\n\nfunc (g TenantGenerator) createResources(tenant *management.Tenant) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tresourceName := base64.StdEncoding.EncodeToString([]byte(tenant.String()))\n\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\tresourceName,\n\t\tresourceName,\n\t\t\"auth0_tenant\",\n\t\t\"auth0\",\n\t\tTenantAllowEmptyValues,\n\t))\n\treturn resources\n}\n\nfunc (g *TenantGenerator) InitResources() error {\n\tm := g.generateClient()\n\tTenant, err := m.Tenant.Read()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(Tenant)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/trigger_binding.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tTriggerBindingAllowEmptyValues = []string{}\n)\n\ntype TriggerBindingGenerator struct {\n\tAuth0Service\n}\n\nfunc (g TriggerBindingGenerator) createResources(bindings map[string]*management.ActionBinding) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\n\tfor _, binding := range bindings {\n\t\tresourceName := *binding.TriggerID\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tresourceName,\n\t\t\t*binding.ID,\n\t\t\t\"auth0_trigger_binding\",\n\t\t\t\"auth0\",\n\t\t\tmap[string]string{},\n\t\t\tTriggerBindingAllowEmptyValues,\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"trigger\": *binding.TriggerID,\n\t\t\t},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *TriggerBindingGenerator) InitResources() error {\n\tm := g.generateClient()\n\tbindings := map[string]*management.ActionBinding{}\n\n\tt, err := m.Action.Triggers()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, trigger := range t.Triggers {\n\t\tvar page int\n\t\tfor {\n\t\t\tl, err := m.Action.Bindings(*trigger.ID, management.Page(page))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, binding := range l.Bindings {\n\t\t\t\tif _, ok := bindings[*binding.ID]; !ok {\n\t\t\t\t\tbindings[*binding.ID] = binding\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !l.HasNext() {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tpage++\n\t\t}\n\t}\n\n\tg.Resources = g.createResources(bindings)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/auth0/user.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage auth0\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"gopkg.in/auth0.v5/management\"\n)\n\nvar (\n\tUserAllowEmptyValues = []string{}\n)\n\ntype UserGenerator struct {\n\tAuth0Service\n}\n\nfunc (g UserGenerator) createResources(users []*management.User) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, user := range users {\n\t\tresourceName := user.ID\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*resourceName,\n\t\t\t*resourceName,\n\t\t\t\"auth0_user\",\n\t\t\t\"auth0\",\n\t\t\tUserAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *UserGenerator) InitResources() error {\n\tm := g.generateClient()\n\tlist := []*management.User{}\n\n\tvar page int\n\tfor {\n\t\tl, err := m.User.List(management.Page(page))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlist = append(list, l.Users...)\n\t\tif !l.HasNext() {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\n\tg.Resources = g.createResources(list)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/accessanalyzer.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/accessanalyzer\"\n)\n\nvar accessanalyzerAllowEmptyValues = []string{\"tags.\"}\n\ntype AccessAnalyzerGenerator struct {\n\tAWSService\n}\n\nfunc (g *AccessAnalyzerGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := accessanalyzer.NewFromConfig(config)\n\tp := accessanalyzer.NewListAnalyzersPaginator(svc, &accessanalyzer.ListAnalyzersInput{})\n\tvar resources []terraformutils.Resource\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, analyzer := range page.Analyzers {\n\t\t\tresourceName := *analyzer.Name\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_accessanalyzer_analyzer\",\n\t\t\t\t\"aws\",\n\t\t\t\taccessanalyzerAllowEmptyValues))\n\t\t}\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/acm.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/acm\"\n)\n\nvar acmAllowEmptyValues = []string{}\n\nvar acmAdditionalFields = map[string]interface{}{}\n\ntype ACMGenerator struct {\n\tAWSService\n}\n\nfunc (g *ACMGenerator) createCertificatesResources(svc *acm.Client) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tp := acm.NewListCertificatesPaginator(svc, &acm.ListCertificatesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources\n\t\t}\n\t\tfor _, cert := range page.CertificateSummaryList {\n\t\t\tcertArn := *cert.CertificateArn\n\t\t\tcertID := extractCertificateUUID(certArn)\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tcertArn,\n\t\t\t\tcertID+\"_\"+strings.TrimSuffix(*cert.DomainName, \".\"),\n\t\t\t\t\"aws_acm_certificate\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"domain_name\": *cert.DomainName,\n\t\t\t\t},\n\t\t\t\tacmAllowEmptyValues,\n\t\t\t\tacmAdditionalFields,\n\t\t\t))\n\t\t}\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// create terraform resource for each certificates\nfunc (g *ACMGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := acm.NewFromConfig(config)\n\n\tg.Resources = g.createCertificatesResources(svc)\n\treturn nil\n}\n\n// extractCertificateUUID extracts UUID from ARN\nfunc extractCertificateUUID(arn string) string {\n\tif i := strings.Index(arn, \"/\"); i != -1 {\n\t\treturn arn[i+1:]\n\t}\n\treturn arn\n}\n"
  },
  {
    "path": "providers/aws/alb.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2\"\n\t\"github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2/types\"\n)\n\nvar AlbAllowEmptyValues = []string{\"tags.\", \"^condition.\"}\n\ntype AlbGenerator struct {\n\tAWSService\n}\n\nfunc (g *AlbGenerator) loadLB(svc *elasticloadbalancingv2.Client) error {\n\tp := elasticloadbalancingv2.NewDescribeLoadBalancersPaginator(svc, &elasticloadbalancingv2.DescribeLoadBalancersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, lb := range page.LoadBalancers {\n\t\t\tresourceName := StringValue(lb.LoadBalancerName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*lb.LoadBalancerArn,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_lb\",\n\t\t\t\t\"aws\",\n\t\t\t\tAlbAllowEmptyValues,\n\t\t\t))\n\t\t\terr := g.loadLBListener(svc, lb.LoadBalancerArn)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *AlbGenerator) loadLBListener(svc *elasticloadbalancingv2.Client, loadBalancerArn *string) error {\n\tp := elasticloadbalancingv2.NewDescribeListenersPaginator(svc, &elasticloadbalancingv2.DescribeListenersInput{LoadBalancerArn: loadBalancerArn})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, ls := range page.Listeners {\n\t\t\tresourceName := *ls.ListenerArn\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_lb_listener\",\n\t\t\t\t\"aws\",\n\t\t\t\tAlbAllowEmptyValues,\n\t\t\t))\n\t\t\terr := g.loadLBListenerRule(svc, ls.ListenerArn)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\terr = g.loadLBListenerCertificate(svc, &ls)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *AlbGenerator) loadLBListenerRule(svc *elasticloadbalancingv2.Client, listenerArn *string) error {\n\tvar marker *string\n\tfor {\n\t\tlsrs, err := svc.DescribeRules(context.TODO(), &elasticloadbalancingv2.DescribeRulesInput{\n\t\t\tListenerArn: listenerArn,\n\t\t\tMarker:      marker,\n\t\t\tPageSize:    aws.Int32(400)},\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, lsr := range lsrs.Rules {\n\t\t\tif !*lsr.IsDefault {\n\t\t\t\tresourceName := *lsr.RuleArn\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\tresourceName,\n\t\t\t\t\tresourceName,\n\t\t\t\t\t\"aws_lb_listener_rule\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tAlbAllowEmptyValues,\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t\tmarker = lsrs.NextMarker\n\t\tif marker == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *AlbGenerator) loadLBListenerCertificate(svc *elasticloadbalancingv2.Client, loadBalancer *types.Listener) error {\n\tlcs, err := svc.DescribeListenerCertificates(context.TODO(), &elasticloadbalancingv2.DescribeListenerCertificatesInput{\n\t\tListenerArn: loadBalancer.ListenerArn,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, lc := range lcs.Certificates {\n\t\tcertificateArn := *lc.CertificateArn\n\t\tlistenerCertificateID := *loadBalancer.ListenerArn + \"_\" + certificateArn\n\t\tif certificateArn == *loadBalancer.Certificates[0].CertificateArn { // discard default certificate\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tlistenerCertificateID,\n\t\t\tlistenerCertificateID,\n\t\t\t\"aws_lb_listener_certificate\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"listener_arn\":    *loadBalancer.ListenerArn,\n\t\t\t\t\"certificate_arn\": certificateArn,\n\t\t\t},\n\t\t\tAlbAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn err\n}\n\nfunc (g *AlbGenerator) loadLBTargetGroup(svc *elasticloadbalancingv2.Client) error {\n\tp := elasticloadbalancingv2.NewDescribeTargetGroupsPaginator(svc, &elasticloadbalancingv2.DescribeTargetGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, tg := range page.TargetGroups {\n\t\t\tresourceName := StringValue(tg.TargetGroupName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*tg.TargetGroupArn,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_lb_target_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tAlbAllowEmptyValues,\n\t\t\t))\n\t\t\terr := g.loadTargetGroupTargets(svc, tg.TargetGroupArn)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *AlbGenerator) loadTargetGroupTargets(svc *elasticloadbalancingv2.Client, targetGroupArn *string) error {\n\ttargetHealths, err := svc.DescribeTargetHealth(context.TODO(), &elasticloadbalancingv2.DescribeTargetHealthInput{\n\t\tTargetGroupArn: targetGroupArn,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, tgh := range targetHealths.TargetHealthDescriptions {\n\t\tid := fmt.Sprintf(\"%s-%s\", *targetGroupArn, *tgh.Target.Id)\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tid,\n\t\t\tid,\n\t\t\t\"aws_lb_target_group_attachment\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"target_id\":        *tgh.Target.Id,\n\t\t\t\t\"target_group_arn\": *targetGroupArn,\n\t\t\t},\n\t\t\tAlbAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n\n// Generate TerraformResources from AWS API,\nfunc (g *AlbGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := elasticloadbalancingv2.NewFromConfig(config)\n\tif err := g.loadLB(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadLBTargetGroup(svc); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (g *AlbGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_lb_listener\" {\n\t\t\tcontinue\n\t\t}\n\t\tif r.InstanceState.Attributes[\"default_action.0.order\"] == \"0\" {\n\t\t\tdelete(r.Item[\"default_action\"].([]interface{})[0].(map[string]interface{}), \"order\")\n\t\t}\n\t}\n\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_lb_listener_rule\" {\n\t\t\tcontinue\n\t\t}\n\t\tif r.InstanceState.Attributes[\"action.0.order\"] == \"0\" {\n\t\t\tdelete(r.Item[\"action\"].([]interface{})[0].(map[string]interface{}), \"order\")\n\t\t}\n\t\tfor _, lb := range g.Resources {\n\t\t\tif lb.InstanceInfo.Type != \"aws_lb_listener_certificate\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif r.InstanceState.Attributes[\"certificate_arn\"] == lb.InstanceState.Attributes[\"arn\"] {\n\t\t\t\tg.Resources[i].Item[\"certificate_arn\"] = \"${aws_lb_listener_certificate.\" + lb.ResourceName + \".arn}\"\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_lb\" {\n\t\t\tcontinue\n\t\t}\n\t\tif val, ok := r.InstanceState.Attributes[\"access_logs.0.enabled\"]; ok && val == \"false\" {\n\t\t\tdelete(r.Item, \"access_logs\")\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/api_gateway.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/terraformerstring\"\n\t\"github.com/aws/aws-sdk-go-v2/service/apigateway\"\n\t\"github.com/aws/aws-sdk-go-v2/service/apigateway/types\"\n)\n\nvar apiGatewayAllowEmptyValues = []string{\"tags.\", \"parent_id\", \"path_part\"}\n\ntype APIGatewayGenerator struct {\n\tAWSService\n}\n\nfunc (g *APIGatewayGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := apigateway.NewFromConfig(config)\n\n\tif err := g.loadRestApis(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadVpcLinks(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadUsagePlans(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadAPIKeys(svc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *APIGatewayGenerator) loadRestApis(svc *apigateway.Client) error {\n\tp := apigateway.NewGetRestApisPaginator(svc, &apigateway.GetRestApisInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, restAPI := range page.Items {\n\t\t\tif g.shouldFilterRestAPI(restAPI.Tags) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*restAPI.Id,\n\t\t\t\t*restAPI.Id+\"_\"+*restAPI.Name,\n\t\t\t\t\"aws_api_gateway_rest_api\",\n\t\t\t\t\"aws\",\n\t\t\t\tapiGatewayAllowEmptyValues))\n\t\t\tif err := g.loadStages(svc, restAPI.Id); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := g.loadResources(svc, restAPI.Id); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := g.loadModels(svc, restAPI.Id); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := g.loadResponses(svc, restAPI.Id); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := g.loadDocumentationParts(svc, restAPI.Id); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := g.loadAuthorizers(svc, restAPI.Id); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayGenerator) shouldFilterRestAPI(tags map[string]string) bool {\n\tfor _, filter := range g.Filter {\n\t\tif strings.HasPrefix(filter.FieldPath, \"tags.\") && filter.IsApplicable(\"api_gateway_rest_api\") {\n\t\t\ttagName := strings.Replace(filter.FieldPath, \"tags.\", \"\", 1)\n\t\t\tif val, ok := tags[tagName]; ok {\n\t\t\t\treturn !terraformerstring.ContainsString(filter.AcceptableValues, val)\n\t\t\t}\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc (g *APIGatewayGenerator) loadStages(svc *apigateway.Client, restAPIID *string) error {\n\toutput, err := svc.GetStages(context.TODO(), &apigateway.GetStagesInput{\n\t\tRestApiId: restAPIID,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, stage := range output.Item {\n\t\tstageID := *restAPIID + \"/\" + StringValue(stage.StageName)\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tstageID,\n\t\t\tstageID,\n\t\t\t\"aws_api_gateway_stage\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"rest_api_id\": *restAPIID,\n\t\t\t\t\"stage_name\":  *stage.StageName,\n\t\t\t},\n\t\t\tapiGatewayAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayGenerator) loadResources(svc *apigateway.Client, restAPIID *string) error {\n\tp := apigateway.NewGetResourcesPaginator(svc, &apigateway.GetResourcesInput{\n\t\tRestApiId: restAPIID,\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, resource := range page.Items {\n\t\t\tresourceID := *restAPIID + \"/\" + *resource.Id\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tresourceID,\n\t\t\t\tresourceID,\n\t\t\t\t\"aws_api_gateway_resource\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"path\":        StringValue(resource.Path),\n\t\t\t\t\t\"path_part\":   StringValue(resource.PathPart),\n\t\t\t\t\t\"partent_id\":  StringValue(resource.ParentId),\n\t\t\t\t\t\"rest_api_id\": StringValue(restAPIID),\n\t\t\t\t},\n\t\t\t\tapiGatewayAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t\terr := g.loadResourceMethods(svc, restAPIID, resource)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayGenerator) loadModels(svc *apigateway.Client, restAPIID *string) error {\n\tp := apigateway.NewGetModelsPaginator(svc, &apigateway.GetModelsInput{\n\t\tRestApiId: restAPIID,\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\tfor _, model := range page.Items {\n\t\t\tresourceID := *restAPIID + \"/\" + *model.Id\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tresourceID,\n\t\t\t\tresourceID,\n\t\t\t\t\"aws_api_gateway_model\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":         StringValue(model.Name),\n\t\t\t\t\t\"content_type\": StringValue(model.ContentType),\n\t\t\t\t\t\"schema\":       StringValue(model.Schema),\n\t\t\t\t\t\"rest_api_id\":  StringValue(restAPIID),\n\t\t\t\t},\n\t\t\t\tapiGatewayAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayGenerator) loadResourceMethods(svc *apigateway.Client, restAPIID *string, resource types.Resource) error {\n\tfor httpMethod, method := range resource.ResourceMethods {\n\t\tmethodID := *restAPIID + \"/\" + *resource.Id + \"/\" + httpMethod\n\t\tauthorizationType := \"NONE\"\n\t\tif method.AuthorizationType != nil {\n\t\t\tauthorizationType = *method.AuthorizationType\n\t\t}\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tmethodID,\n\t\t\tmethodID,\n\t\t\t\"aws_api_gateway_method\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"rest_api_id\":   *restAPIID,\n\t\t\t\t\"resource_id\":   *resource.Id,\n\t\t\t\t\"http_method\":   httpMethod,\n\t\t\t\t\"authorization\": authorizationType,\n\t\t\t},\n\t\t\tapiGatewayAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\n\t\tmethodDetails, err := svc.GetMethod(context.TODO(), &apigateway.GetMethodInput{\n\t\t\tHttpMethod: &httpMethod,\n\t\t\tResourceId: resource.Id,\n\t\t\tRestApiId:  restAPIID,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif methodDetails.MethodIntegration != nil {\n\t\t\ttypeString := string(methodDetails.MethodIntegration.Type)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tmethodID,\n\t\t\t\tmethodID,\n\t\t\t\t\"aws_api_gateway_integration\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"rest_api_id\": *restAPIID,\n\t\t\t\t\t\"resource_id\": *resource.Id,\n\t\t\t\t\t\"http_method\": httpMethod,\n\t\t\t\t\t\"type\":        typeString,\n\t\t\t\t},\n\t\t\t\tapiGatewayAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t\tintegrationDetails, err := svc.GetIntegration(context.TODO(), &apigateway.GetIntegrationInput{\n\t\t\t\tHttpMethod: &httpMethod,\n\t\t\t\tResourceId: resource.Id,\n\t\t\t\tRestApiId:  restAPIID,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor responseCode := range integrationDetails.IntegrationResponses {\n\t\t\t\tintegrationResponseID := *restAPIID + \"/\" + *resource.Id + \"/\" + httpMethod + \"/\" + responseCode\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\tintegrationResponseID,\n\t\t\t\t\tintegrationResponseID,\n\t\t\t\t\t\"aws_api_gateway_integration_response\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"rest_api_id\": *restAPIID,\n\t\t\t\t\t\t\"resource_id\": *resource.Id,\n\t\t\t\t\t\t\"http_method\": httpMethod,\n\t\t\t\t\t\t\"status_code\": responseCode,\n\t\t\t\t\t},\n\t\t\t\t\tapiGatewayAllowEmptyValues,\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t\tfor responseCode := range methodDetails.MethodResponses {\n\t\t\tresponseID := *restAPIID + \"/\" + *resource.Id + \"/\" + httpMethod + \"/\" + responseCode\n\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tresponseID,\n\t\t\t\tresponseID,\n\t\t\t\t\"aws_api_gateway_method_response\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"rest_api_id\": *restAPIID,\n\t\t\t\t\t\"resource_id\": *resource.Id,\n\t\t\t\t\t\"http_method\": httpMethod,\n\t\t\t\t\t\"status_code\": responseCode,\n\t\t\t\t},\n\t\t\t\tapiGatewayAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayGenerator) loadResponses(svc *apigateway.Client, restAPIID *string) error {\n\tvar position *string\n\tfor {\n\t\tresponse, err := svc.GetGatewayResponses(context.TODO(), &apigateway.GetGatewayResponsesInput{\n\t\t\tRestApiId: restAPIID,\n\t\t\tPosition:  position,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, response := range response.Items {\n\t\t\tif response.DefaultResponse {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresponseTypeString := string(response.ResponseType)\n\t\t\tresponseID := *restAPIID + \"/\" + responseTypeString\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tresponseID,\n\t\t\t\tresponseID,\n\t\t\t\t\"aws_api_gateway_gateway_response\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"rest_api_id\":   *restAPIID,\n\t\t\t\t\t\"response_type\": responseTypeString,\n\t\t\t\t},\n\t\t\t\tapiGatewayAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t\tposition = response.Position\n\t\tif position == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayGenerator) loadDocumentationParts(svc *apigateway.Client, restAPIID *string) error {\n\tvar position *string\n\tfor {\n\t\tresponse, err := svc.GetDocumentationParts(context.TODO(), &apigateway.GetDocumentationPartsInput{\n\t\t\tRestApiId: restAPIID,\n\t\t\tPosition:  position,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, documentationPart := range response.Items {\n\t\t\tdocumentationPartID := *restAPIID + \"/\" + *documentationPart.Id\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tdocumentationPartID,\n\t\t\t\tdocumentationPartID,\n\t\t\t\t\"aws_api_gateway_documentation_part\",\n\t\t\t\t\"aws\",\n\t\t\t\tapiGatewayAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t\tposition = response.Position\n\t\tif position == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayGenerator) loadAuthorizers(svc *apigateway.Client, restAPIID *string) error {\n\tvar position *string\n\tfor {\n\t\tresponse, err := svc.GetAuthorizers(context.TODO(), &apigateway.GetAuthorizersInput{\n\t\t\tRestApiId: restAPIID,\n\t\t\tPosition:  position,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, authorizer := range response.Items {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*authorizer.Id,\n\t\t\t\t*authorizer.Id,\n\t\t\t\t\"aws_api_gateway_authorizer\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"rest_api_id\": *restAPIID,\n\t\t\t\t\t\"name\":        StringValue(authorizer.Name),\n\t\t\t\t},\n\t\t\t\tapiGatewayAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t\tposition = response.Position\n\t\tif position == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayGenerator) loadVpcLinks(svc *apigateway.Client) error {\n\tp := apigateway.NewGetVpcLinksPaginator(svc, &apigateway.GetVpcLinksInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, vpcLink := range page.Items {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*vpcLink.Id,\n\t\t\t\t*vpcLink.Name,\n\t\t\t\t\"aws_api_gateway_vpc_link\",\n\t\t\t\t\"aws\",\n\t\t\t\tapiGatewayAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayGenerator) loadUsagePlans(svc *apigateway.Client) error {\n\tp := apigateway.NewGetUsagePlansPaginator(svc, &apigateway.GetUsagePlansInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, usagePlan := range page.Items {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*usagePlan.Id,\n\t\t\t\t*usagePlan.Name,\n\t\t\t\t\"aws_api_gateway_usage_plan\",\n\t\t\t\t\"aws\",\n\t\t\t\tapiGatewayAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayGenerator) loadAPIKeys(svc *apigateway.Client) error {\n\tp := apigateway.NewGetApiKeysPaginator(svc, &apigateway.GetApiKeysInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, apiKey := range page.Items {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*apiKey.Id,\n\t\t\t\t*apiKey.Name,\n\t\t\t\t\"aws_api_gateway_api_key\",\n\t\t\t\t\"aws\",\n\t\t\t\tapiGatewayAllowEmptyValues))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/api_gatewayv2.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go/aws/session\"\n\t\"github.com/aws/aws-sdk-go/service/apigatewayv2\"\n)\n\nvar apiGatewayV2AllowEmptyValues = []string{\"tags.\", \"parent_id\", \"path_part\"}\n\ntype APIGatewayV2Generator struct {\n\tAWSService\n}\n\nfunc (g *APIGatewayV2Generator) InitResources() error {\n\n\tsvc := apigatewayv2.New(session.Must(session.NewSession()))\n\n\tif err := g.loadRestApis(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadVpcLinks(svc); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) loadRestApis(svc *apigatewayv2.ApiGatewayV2) error {\n\toutput, err := svc.GetApis(&apigatewayv2.GetApisInput{})\n\tif err != nil {\n\t\tfmt.Println(\"Failed to list APIs:\", err)\n\t\treturn err\n\t}\n\n\terr = g.processRestApis(svc, output.Items)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to list APIs:\", err)\n\t\treturn err\n\t}\n\n\tfor output.NextToken != nil {\n\t\toutput, err = svc.GetApis(&apigatewayv2.GetApisInput{\n\t\t\tNextToken: output.NextToken,\n\t\t})\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Failed to list APIs:\", err)\n\t\t\treturn err\n\t\t}\n\t\tif err = g.processRestApis(svc, output.Items); err != nil {\n\t\t\tfmt.Println(\"Failed to list APIs:\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) processRestApis(svc *apigatewayv2.ApiGatewayV2, output []*apigatewayv2.Api) error {\n\tfor _, restAPI := range output {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*restAPI.ApiId,\n\t\t\t*restAPI.ApiId+\"_\"+*restAPI.Name,\n\t\t\t\"aws_apigatewayv2_api\",\n\t\t\t\"aws\",\n\t\t\tapiGatewayV2AllowEmptyValues,\n\t\t))\n\t\tif err := g.loadStages(svc, restAPI.ApiId); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := g.loadModels(svc, restAPI.ApiId); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := g.loadRoutes(svc, restAPI.ApiId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := g.loadAuthorizers(svc, restAPI.ApiId); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) loadStages(svc *apigatewayv2.ApiGatewayV2, restAPIID *string) error {\n\n\toutput, err := svc.GetStages(&apigatewayv2.GetStagesInput{\n\t\tApiId: restAPIID,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.processStages(output.Items, restAPIID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor output.NextToken != nil {\n\t\toutput, err = svc.GetStages(&apigatewayv2.GetStagesInput{\n\t\t\tNextToken: output.NextToken,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = g.processStages(output.Items, restAPIID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) processStages(output []*apigatewayv2.Stage, restAPIID *string) error {\n\tfor _, stage := range output {\n\t\tstageID := *restAPIID + \"/\" + StringValue(stage.StageName)\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tstageID,\n\t\t\tstageID,\n\t\t\t\"aws_api_gateway_stage\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"rest_api_id\": *restAPIID,\n\t\t\t\t\"stage_name\":  *stage.StageName,\n\t\t\t},\n\t\t\tapiGatewayAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) loadModels(svc *apigatewayv2.ApiGatewayV2, restAPIID *string) error {\n\n\toutput, err := svc.GetModels(\n\t\t&apigatewayv2.GetModelsInput{\n\t\t\tApiId: restAPIID,\n\t\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.processModels(output.Items, restAPIID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor output.NextToken != nil {\n\t\toutput, err = svc.GetModels(\n\t\t\t&apigatewayv2.GetModelsInput{\n\t\t\t\tNextToken: output.NextToken,\n\t\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = g.processModels(output.Items, restAPIID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) processModels(output []*apigatewayv2.Model, restAPIID *string) error {\n\tfor _, model := range output {\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*model.ModelId,\n\t\t\t*model.ModelId,\n\t\t\t\"aws_apigatewayv2_model\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":         StringValue(model.Name),\n\t\t\t\t\"content_type\": StringValue(model.ContentType),\n\t\t\t\t\"schema\":       StringValue(model.Schema),\n\t\t\t\t\"api_id\":       StringValue(restAPIID),\n\t\t\t},\n\t\t\tapiGatewayAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) loadRoutes(svc *apigatewayv2.ApiGatewayV2, restAPIID *string) error {\n\n\toutput, err := svc.GetRoutes(\n\t\t&apigatewayv2.GetRoutesInput{\n\t\t\tApiId: restAPIID,\n\t\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.processRoutes(svc, output.Items, restAPIID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor output.NextToken != nil {\n\t\toutput, err := svc.GetRoutes(\n\t\t\t&apigatewayv2.GetRoutesInput{\n\t\t\t\tNextToken: output.NextToken,\n\t\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = g.processRoutes(svc, output.Items, restAPIID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) processRoutes(svc *apigatewayv2.ApiGatewayV2, output []*apigatewayv2.Route, restAPIID *string) error {\n\tfor _, route := range output {\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*route.RouteId,\n\t\t\t*route.RouteId,\n\t\t\t\"aws_apigatewayv2_route\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"api_id\":    *restAPIID,\n\t\t\t\t\"route_key\": *route.RouteKey,\n\t\t\t},\n\t\t\tapiGatewayAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t\tif err := g.loadResponses(svc, restAPIID, route.RouteId); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) loadResponses(svc *apigatewayv2.ApiGatewayV2, restAPIID *string, routeID *string) error {\n\n\toutput, err := svc.GetRouteResponses(\n\t\t&apigatewayv2.GetRouteResponsesInput{\n\t\t\tApiId:   restAPIID,\n\t\t\tRouteId: routeID,\n\t\t})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.processResponses(output.Items, restAPIID, routeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor output.NextToken != nil {\n\t\toutput, err = svc.GetRouteResponses(\n\t\t\t&apigatewayv2.GetRouteResponsesInput{\n\t\t\t\tNextToken: output.NextToken,\n\t\t\t})\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = g.processResponses(output.Items, restAPIID, routeID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\nfunc (g *APIGatewayV2Generator) processResponses(output []*apigatewayv2.RouteResponse, restAPIID *string, routeID *string) error {\n\tfor _, response := range output {\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*response.RouteResponseId,\n\t\t\t*response.RouteResponseId,\n\t\t\t\"aws_apigatewayv2_route_response\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"api_id\":             *restAPIID,\n\t\t\t\t\"route_id\":           *routeID,\n\t\t\t\t\"route_response_key\": \"$default\",\n\t\t\t},\n\t\t\tapiGatewayAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) loadAuthorizers(svc *apigatewayv2.ApiGatewayV2, restAPIID *string) error {\n\n\toutput, err := svc.GetAuthorizers(\n\t\t&apigatewayv2.GetAuthorizersInput{\n\t\t\tApiId: restAPIID,\n\t\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.processAuthorizers(output.Items, restAPIID)\n\n\tfor output.NextToken != nil {\n\t\toutput, err = svc.GetAuthorizers(\n\t\t\t&apigatewayv2.GetAuthorizersInput{\n\t\t\t\tNextToken: output.NextToken,\n\t\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.processAuthorizers(output.Items, restAPIID)\n\t}\n\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) processAuthorizers(output []*apigatewayv2.Authorizer, restAPIID *string) error {\n\tfor _, authoriser := range output {\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*authoriser.AuthorizerId,\n\t\t\t*authoriser.AuthorizerId,\n\t\t\t\"aws_apigatewayv2_authorizer\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"api_id\":          *restAPIID,\n\t\t\t\t\"name\":            StringValue(authoriser.Name),\n\t\t\t\t\"authorizer_type\": *authoriser.AuthorizerType,\n\t\t\t},\n\t\t\tapiGatewayAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\n\t}\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) loadVpcLinks(svc *apigatewayv2.ApiGatewayV2) error {\n\n\toutput, err := svc.GetVpcLinks(\n\t\t&apigatewayv2.GetVpcLinksInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.processVpcLinks(output.Items)\n\n\tfor output.NextToken != nil {\n\t\toutput, err := svc.GetVpcLinks(\n\t\t\t&apigatewayv2.GetVpcLinksInput{\n\t\t\t\tNextToken: output.NextToken,\n\t\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.processVpcLinks(output.Items)\n\t}\n\n\treturn nil\n}\n\nfunc (g *APIGatewayV2Generator) processVpcLinks(output []*apigatewayv2.VpcLink) error {\n\tfor _, vpcLink := range output {\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*vpcLink.VpcLinkId,\n\t\t\t*vpcLink.VpcLinkId,\n\t\t\t\"aws_apigatewayv2_vpc_link\",\n\t\t\t\"aws\",\n\t\t\tapiGatewayAllowEmptyValues))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/appsync.go",
    "content": "package aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/appsync\"\n)\n\ntype AppSyncGenerator struct {\n\tAWSService\n}\n\nfunc (g *AppSyncGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tsvc := appsync.NewFromConfig(config)\n\n\tvar nextToken *string\n\tfor {\n\t\tapis, err := svc.ListGraphqlApis(context.TODO(), &appsync.ListGraphqlApisInput{\n\t\t\tNextToken: nextToken,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, api := range apis.GraphqlApis {\n\t\t\tvar id = *api.ApiId\n\t\t\tvar name = *api.Name\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tname,\n\t\t\t\t\"aws_appsync_graphql_api\",\n\t\t\t\t\"aws\",\n\t\t\t\t[]string{}))\n\t\t}\n\t\tnextToken = apis.NextToken\n\t\tif nextToken == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/autoscaling.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/autoscaling\"\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n)\n\nvar AsgAllowEmptyValues = []string{\"tags.\"}\n\ntype AutoScalingGenerator struct {\n\tAWSService\n}\n\nfunc (g *AutoScalingGenerator) loadAutoScalingGroups(svc *autoscaling.Client) error {\n\tp := autoscaling.NewDescribeAutoScalingGroupsPaginator(svc, &autoscaling.DescribeAutoScalingGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, asg := range page.AutoScalingGroups {\n\t\t\tresourceName := StringValue(asg.AutoScalingGroupName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_autoscaling_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"force_delete\":              \"false\",\n\t\t\t\t\t\"metrics_granularity\":       \"1Minute\",\n\t\t\t\t\t\"wait_for_capacity_timeout\": \"10m\",\n\t\t\t\t},\n\t\t\t\tAsgAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *AutoScalingGenerator) loadLaunchConfigurations(svc *autoscaling.Client) error {\n\tp := autoscaling.NewDescribeLaunchConfigurationsPaginator(svc, &autoscaling.DescribeLaunchConfigurationsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, lc := range page.LaunchConfigurations {\n\t\t\tresourceName := StringValue(lc.LaunchConfigurationName)\n\t\t\tattributes := map[string]string{}\n\t\t\t// only for LaunchConfigurations with userdata, we want get user_data_base64\n\t\t\tif StringValue(lc.UserData) != \"\" {\n\t\t\t\tattributes[\"user_data_base64\"] = \"=\" // need set not empty string to get user_data_base64 from provider\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_launch_configuration\",\n\t\t\t\t\"aws\",\n\t\t\t\tattributes,\n\t\t\t\tAsgAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *AutoScalingGenerator) loadLaunchTemplates(config aws.Config) error {\n\tec2svc := ec2.NewFromConfig(config)\n\n\tp := ec2.NewDescribeLaunchTemplatesPaginator(ec2svc, &ec2.DescribeLaunchTemplatesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, lt := range page.LaunchTemplates {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(lt.LaunchTemplateId),\n\t\t\t\tStringValue(lt.LaunchTemplateName),\n\t\t\t\t\"aws_launch_template\",\n\t\t\t\t\"aws\",\n\t\t\t\tAsgAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\n// Generate TerraformResources from AWS API,\n// from each ASG create 1 TerraformResource.\n// Need only ASG name as ID for terraform resource\n// AWS api support paging\nfunc (g *AutoScalingGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := autoscaling.NewFromConfig(config)\n\tif err := g.loadAutoScalingGroups(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadLaunchConfigurations(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadLaunchTemplates(config); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (g *AutoScalingGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_autoscaling_group\" {\n\t\t\tcontinue\n\t\t}\n\t\tif lcName, exist := r.InstanceState.Attributes[\"launch_configuration\"]; exist {\n\t\t\tfor _, lc := range g.Resources {\n\t\t\t\tif lc.InstanceInfo.Type != \"aws_launch_configuration\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif lcName == lc.InstanceState.Attributes[\"name\"] {\n\t\t\t\t\tg.Resources[i].Item[\"launch_configuration\"] = \"${aws_launch_configuration.\" + lc.ResourceName + \".name}\"\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// TODO add LaunchTemplate and mix policy connection naming\n\t}\n\t// TODO fix tfVar value\n\t/*\n\t\ttemplateFiles := []terraformutils.Resource{}\n\t\tfor i, r := range g.Resources {\n\t\t\tif r.InstanceInfo.Type != \"aws_launch_configuration\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif userDataBase64, exist := r.InstanceState.Attributes[\"user_data_base64\"]; exist {\n\t\t\t\tuserData, err := base64.StdEncoding.DecodeString(userDataBase64)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfileName := \"userdata-\" + r.ServiceName + \".txt\"\n\t\t\t\terr = ioutil.WriteFile(fileName, userData, os.ModePerm) // TODO write files in tf file path\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tuserDataFile := terraformutils.NewResource(\n\t\t\t\t\tr.ServiceName+\"_userdata\",\n\t\t\t\t\tr.ServiceName+\"_userdata\",\n\t\t\t\t\t\"template_file\",\n\t\t\t\t\t\"\",\n\t\t\t\t\tmap[string]string{},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]string{},\n\t\t\t\t)\n\t\t\t\ttfVar := strings.Replace(fmt.Sprintf(\"${base64decode(file(\\\"%s\\\"))}\", fileName), \"\\\\\\\"\", \"\\\"\", -1)\n\t\t\t\tuserDataFile.Item = map[string]interface{}{\n\t\t\t\t\t\"template\": tfVar,\n\t\t\t\t}\n\n\t\t\t\tdelete(g.Resources[i].Item, \"user_data_base64\")\n\t\t\t\tg.Resources[i].Item[\"user_data\"] = \"${template_file.\" + userDataFile.ServiceName + \".rendered}\"\n\t\t\t\ttemplateFiles = append(templateFiles, userDataFile)\n\t\t\t}\n\t\t}\n\t\tg.Resources = append(g.Resources, templateFiles...)\n\t*/\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/aws_facade.go",
    "content": "package aws\n\nimport (\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/providerwrapper\"\n)\n\ntype AwsFacade struct { //nolint\n\tAWSService\n\tservice terraformutils.ServiceGenerator\n}\n\nfunc (s *AwsFacade) SetProviderName(providerName string) {\n\ts.service.SetProviderName(providerName)\n}\n\nfunc (s *AwsFacade) SetVerbose(verbose bool) {\n\ts.service.SetVerbose(verbose)\n}\n\nfunc (s *AwsFacade) ParseFilters(rawFilters []string) {\n\ts.service.ParseFilters(rawFilters)\n}\n\nfunc (s *AwsFacade) ParseFilter(rawFilter string) []terraformutils.ResourceFilter {\n\treturn s.service.ParseFilter(rawFilter)\n}\n\nfunc (s *AwsFacade) SetName(name string) {\n\ts.service.SetName(name)\n}\nfunc (s *AwsFacade) GetName() string {\n\treturn s.service.GetName()\n}\n\nfunc (s *AwsFacade) InitialCleanup() {\n\ts.service.InitialCleanup()\n}\n\nfunc (s *AwsFacade) PostRefreshCleanup() {\n\ts.service.PostRefreshCleanup()\n}\n\nfunc (s *AwsFacade) GetArgs() map[string]interface{} {\n\treturn s.service.GetArgs()\n}\nfunc (s *AwsFacade) SetArgs(args map[string]interface{}) {\n\ts.service.SetArgs(args)\n}\n\nfunc (s *AwsFacade) GetResources() []terraformutils.Resource {\n\treturn s.service.GetResources()\n}\nfunc (s *AwsFacade) SetResources(resources []terraformutils.Resource) {\n\ts.service.SetResources(resources)\n}\n\nfunc (s *AwsFacade) InitResources() error {\n\terr := s.service.InitResources()\n\tif err == nil {\n\t\treturn nil\n\t}\n\tmessage := err.Error()\n\tif strings.Contains(message, \"no such host\") || strings.Contains(message, \"i/o timeout\") ||\n\t\tstrings.Contains(message, \"x509: certificate is valid for\") ||\n\t\tstrings.Contains(message, \"Unavailable Operation\") { // skip not available AWS services\n\t\treturn nil\n\t}\n\treturn err\n}\n\nfunc (s *AwsFacade) PostConvertHook() error {\n\treturn s.service.PostConvertHook()\n}\n\nfunc (s *AwsFacade) PopulateIgnoreKeys(providerWrapper *providerwrapper.ProviderWrapper) {\n\ts.service.PopulateIgnoreKeys(providerWrapper)\n}\n"
  },
  {
    "path": "providers/aws/aws_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"os\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/pkg/errors\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype AWSProvider struct { //nolint\n\tterraformutils.Provider\n\tregion  string\n\tprofile string\n}\n\nconst GlobalRegion = \"aws-global\"\nconst MainRegionPublicPartition = \"us-east-1\"\nconst NoRegion = \"\"\n\n// SupportedGlobalResources should be bound to a default region. AWS doesn't specify in which region default services are\n// placed (see  https://docs.aws.amazon.com/general/latest/gr/rande.html), so we shouldn't assume any region as well\nvar SupportedGlobalResources = []string{\n\t\"budgets\",\n\t\"cloudfront\",\n\t\"ecrpublic\",\n\t\"iam\",\n\t\"organization\",\n\t\"route53\",\n\t\"waf\",\n}\n\n// SupportedEastOnlyResources should be bound to us-east-1 region only, and does not work in any other region.\nvar SupportedEastOnlyResources = []string{\n\t\"wafv2_cloudfront\",\n}\n\nfunc (p AWSProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"alb\": {\n\t\t\t\"sg\":     []string{\"security_groups\", \"id\"},\n\t\t\t\"subnet\": []string{\"subnets\", \"id\"},\n\t\t\t\"alb\": []string{\n\t\t\t\t\"load_balancer_arn\", \"id\",\n\t\t\t\t\"listener_arn\", \"id\",\n\t\t\t\t// TF ALB TG attachment logic doesn't work well with references (doesn't interpolate)\n\t\t\t},\n\t\t},\n\t\t\"auto_scaling\": {\n\t\t\t\"sg\":     []string{\"security_groups\", \"id\"},\n\t\t\t\"subnet\": []string{\"vpc_zone_identifier\", \"id\"},\n\t\t},\n\t\t\"ec2_instance\": {\n\t\t\t\"sg\":     []string{\"vpc_security_group_ids\", \"id\"},\n\t\t\t\"subnet\": []string{\"subnet_id\", \"id\"},\n\t\t\t\"ebs\":    []string{\"ebs_block_device\", \"id\"},\n\t\t},\n\t\t\"elasticache\": {\n\t\t\t\"vpc\":    []string{\"vpc_id\", \"id\"},\n\t\t\t\"subnet\": []string{\"subnet_ids\", \"id\"},\n\t\t\t\"sg\":     []string{\"security_group_ids\", \"id\"},\n\t\t},\n\t\t\"ebs\": {\n\t\t\t// TF EBS attachment logic doesn't work well with references (doesn't interpolate)\n\t\t},\n\t\t\"ecs\": {\n\t\t\t// ECS is not able anymore to support references (doesn't interpolate)\n\t\t\t\"subnet\": []string{\"network_configuration.subnets\", \"id\"},\n\t\t\t\"sg\":     []string{\"network_configuration.security_groups\", \"id\"},\n\t\t},\n\t\t\"eks\": {\n\t\t\t\"subnet\": []string{\"vpc_config.subnet_ids\", \"id\"},\n\t\t\t\"sg\":     []string{\"vpc_config.security_group_ids\", \"id\"},\n\t\t},\n\t\t\"elb\": {\n\t\t\t\"sg\":     []string{\"security_groups\", \"id\"},\n\t\t\t\"subnet\": []string{\"subnets\", \"id\"},\n\t\t},\n\t\t\"igw\": {\"vpc\": []string{\"vpc_id\", \"id\"}},\n\t\t\"identitystore\": {\n\t\t\t\"identitystore\": []string{\n\t\t\t\t\"group_id\", \"id\",\n\t\t\t\t\"member_id\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"msk\": {\n\t\t\t\"subnet\": []string{\"broker_node_group_info.client_subnets\", \"id\"},\n\t\t\t\"sg\":     []string{\"broker_node_group_info.security_groups\", \"id\"},\n\t\t},\n\t\t\"nacl\": {\n\t\t\t\"subnet\": []string{\"subnet_ids\", \"id\"},\n\t\t\t\"vpc\":    []string{\"vpc_id\", \"id\"},\n\t\t},\n\t\t\"organization\": {\n\t\t\t\"organization\": []string{\n\t\t\t\t\"policy_id\", \"id\",\n\t\t\t\t\"parent_id\", \"id\",\n\t\t\t\t\"target_id\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"rds\": {\n\t\t\t\"subnet\": []string{\"subnet_ids\", \"id\"},\n\t\t\t\"sg\":     []string{\"vpc_security_group_ids\", \"id\"},\n\t\t},\n\t\t\"route_table\": {\n\t\t\t\"route_table\": []string{\"route_table_id\", \"id\"},\n\t\t\t\"subnet\":      []string{\"subnet_id\", \"id\"},\n\t\t\t\"vpc\":         []string{\"vpc_id\", \"id\"},\n\t\t},\n\t\t\"sns\": {\n\t\t\t\"sns\": []string{\"topic_arn\", \"id\"},\n\t\t\t\"sqs\": []string{\"endpoint\", \"arn\"},\n\t\t},\n\t\t\"sg\": {\n\t\t\t\"sg\": []string{\n\t\t\t\t\"egress.security_groups\", \"id\",\n\t\t\t\t\"ingress.security_groups\", \"id\",\n\t\t\t\t\"security_group_id\", \"id\",\n\t\t\t\t\"source_security_group_id\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"subnet\": {\"vpc\": []string{\"vpc_id\", \"id\"}},\n\t\t\"transit_gateway\": {\n\t\t\t\"vpc\":             []string{\"vpc_id\", \"id\"},\n\t\t\t\"transit_gateway\": []string{\"transit_gateway_id\", \"id\"},\n\t\t\t\"subnet\":          []string{\"subnet_ids\", \"id\"},\n\t\t\t\"vpn_connection\":  []string{\"vpn_connection_id\", \"id\"},\n\t\t},\n\t\t\"vpn_gateway\": {\"vpc\": []string{\"vpc_id\", \"id\"}},\n\t\t\"vpn_connection\": {\n\t\t\t\"customer_gateway\": []string{\"customer_gateway_id\", \"id\"},\n\t\t\t\"vpn_gateway\":      []string{\"vpn_gateway_id\", \"id\"},\n\t\t},\n\t}\n}\n\nfunc (p AWSProvider) GetProviderData(arg ...string) map[string]interface{} {\n\tawsConfig := map[string]interface{}{}\n\n\tif p.region == GlobalRegion {\n\t\tawsConfig[\"region\"] = MainRegionPublicPartition // For TF to workaround terraform-providers/terraform-provider-aws#1043\n\t} else if p.region != NoRegion {\n\t\tawsConfig[\"region\"] = p.region\n\t}\n\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"aws\": awsConfig,\n\t\t},\n\t}\n}\n\nfunc (p *AWSProvider) GetConfig() cty.Value {\n\tif p.region != GlobalRegion {\n\t\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\t\"region\":                 cty.StringVal(p.region),\n\t\t\t\"skip_region_validation\": cty.True,\n\t\t})\n\t}\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"region\":                 cty.StringVal(\"\"),\n\t\t\"skip_region_validation\": cty.True,\n\t})\n}\n\nfunc (p *AWSProvider) GetBasicConfig() cty.Value {\n\treturn p.GetConfig()\n}\n\n// check projectName in env params\nfunc (p *AWSProvider) Init(args []string) error {\n\tp.region = args[0]\n\tp.profile = args[1]\n\n\t// Terraformer accepts region and profile configuration, so we must detect what env variables to adjust to make Go SDK rely on them. AWS_SDK_LOAD_CONFIG here must be checked to determine correct variable to set.\n\tenableSharedConfig, _ := strconv.ParseBool(os.Getenv(\"AWS_SDK_LOAD_CONFIG\"))\n\tvar err error\n\tif p.region != GlobalRegion && p.region != NoRegion {\n\t\tif enableSharedConfig {\n\t\t\terr = os.Setenv(\"AWS_DEFAULT_REGION\", p.region)\n\t\t} else {\n\t\t\terr = os.Setenv(\"AWS_REGION\", p.region)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif p.profile != \"\" && p.profile != \"default\" {\n\t\tenvVar := \"AWS_PROFILE\"\n\t\tif enableSharedConfig {\n\t\t\tenvVar = \"AWS_DEFAULT_PROFILE\"\n\t\t}\n\n\t\tif err := os.Setenv(envVar, p.profile); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (p *AWSProvider) GetName() string {\n\treturn \"aws\"\n}\n\nfunc (p *AWSProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"aws: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"region\":                 p.region,\n\t\t\"profile\":                p.profile,\n\t\t\"skip_region_validation\": true,\n\t})\n\treturn nil\n}\n\n// GetAWSSupportService return map of support service for AWS\nfunc (p *AWSProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"accessanalyzer\":    &AwsFacade{service: &AccessAnalyzerGenerator{}},\n\t\t\"acm\":               &AwsFacade{service: &ACMGenerator{}},\n\t\t\"alb\":               &AwsFacade{service: &AlbGenerator{}},\n\t\t\"api_gateway\":       &AwsFacade{service: &APIGatewayGenerator{}},\n\t\t\"api_gatewayv2\":     &AwsFacade{service: &APIGatewayV2Generator{}},\n\t\t\"appsync\":           &AwsFacade{service: &AppSyncGenerator{}},\n\t\t\"auto_scaling\":      &AwsFacade{service: &AutoScalingGenerator{}},\n\t\t\"batch\":             &AwsFacade{service: &BatchGenerator{}},\n\t\t\"budgets\":           &AwsFacade{service: &BudgetsGenerator{}},\n\t\t\"cloud9\":            &AwsFacade{service: &Cloud9Generator{}},\n\t\t\"cloudformation\":    &AwsFacade{service: &CloudFormationGenerator{}},\n\t\t\"cloudfront\":        &AwsFacade{service: &CloudFrontGenerator{}},\n\t\t\"cloudhsm\":          &AwsFacade{service: &CloudHsmGenerator{}},\n\t\t\"cloudtrail\":        &AwsFacade{service: &CloudTrailGenerator{}},\n\t\t\"cloudwatch\":        &AwsFacade{service: &CloudWatchGenerator{}},\n\t\t\"codebuild\":         &AwsFacade{service: &CodeBuildGenerator{}},\n\t\t\"codecommit\":        &AwsFacade{service: &CodeCommitGenerator{}},\n\t\t\"codedeploy\":        &AwsFacade{service: &CodeDeployGenerator{}},\n\t\t\"codepipeline\":      &AwsFacade{service: &CodePipelineGenerator{}},\n\t\t\"cognito\":           &AwsFacade{service: &CognitoGenerator{}},\n\t\t\"config\":            &AwsFacade{service: &ConfigGenerator{}},\n\t\t\"customer_gateway\":  &AwsFacade{service: &CustomerGatewayGenerator{}},\n\t\t\"datapipeline\":      &AwsFacade{service: &DataPipelineGenerator{}},\n\t\t\"devicefarm\":        &AwsFacade{service: &DeviceFarmGenerator{}},\n\t\t\"docdb\":             &AwsFacade{service: &DocDBGenerator{}},\n\t\t\"dx\":\t\t\t\t &AwsFacade{service: &DirectConnectGenerator{}},\n\t\t\"dynamodb\":          &AwsFacade{service: &DynamoDbGenerator{}},\n\t\t\"ebs\":               &AwsFacade{service: &EbsGenerator{}},\n\t\t\"ec2_instance\":      &AwsFacade{service: &Ec2Generator{}},\n\t\t\"ecr\":               &AwsFacade{service: &EcrGenerator{}},\n\t\t\"ecrpublic\":         &AwsFacade{service: &EcrPublicGenerator{}},\n\t\t\"ecs\":               &AwsFacade{service: &EcsGenerator{}},\n\t\t\"efs\":               &AwsFacade{service: &EfsGenerator{}},\n\t\t\"eks\":               &AwsFacade{service: &EksGenerator{}},\n\t\t\"eip\":               &AwsFacade{service: &ElasticIPGenerator{}},\n\t\t\"elasticache\":       &AwsFacade{service: &ElastiCacheGenerator{}},\n\t\t\"elastic_beanstalk\": &AwsFacade{service: &BeanstalkGenerator{}},\n\t\t\"elb\":               &AwsFacade{service: &ElbGenerator{}},\n\t\t\"emr\":               &AwsFacade{service: &EmrGenerator{}},\n\t\t\"eni\":               &AwsFacade{service: &EniGenerator{}},\n\t\t\"es\":                &AwsFacade{service: &EsGenerator{}},\n\t\t\"firehose\":          &AwsFacade{service: &FirehoseGenerator{}},\n\t\t\"glue\":              &AwsFacade{service: &GlueGenerator{}},\n\t\t\"iam\":               &AwsFacade{service: &IamGenerator{}},\n\t\t\"identitystore\":     &AwsFacade{service: &IdentityStoreGenerator{}},\n\t\t\"igw\":               &AwsFacade{service: &IgwGenerator{}},\n\t\t\"iot\":               &AwsFacade{service: &IotGenerator{}},\n\t\t\"kinesis\":           &AwsFacade{service: &KinesisGenerator{}},\n\t\t\"kms\":               &AwsFacade{service: &KmsGenerator{}},\n\t\t\"lambda\":            &AwsFacade{service: &LambdaGenerator{}},\n\t\t\"logs\":              &AwsFacade{service: &LogsGenerator{}},\n\t\t\"media_package\":     &AwsFacade{service: &MediaPackageGenerator{}},\n\t\t\"media_store\":       &AwsFacade{service: &MediaStoreGenerator{}},\n\t\t\"medialive\":         &AwsFacade{service: &MediaLiveGenerator{}},\n\t\t\"mq\":                &AwsFacade{service: &MQGenerator{}},\n\t\t\"msk\":               &AwsFacade{service: &MskGenerator{}},\n\t\t\"nacl\":              &AwsFacade{service: &NaclGenerator{}},\n\t\t\"nat\":               &AwsFacade{service: &NatGatewayGenerator{}},\n\t\t\"opsworks\":          &AwsFacade{service: &OpsworksGenerator{}},\n\t\t\"organization\":      &AwsFacade{service: &OrganizationGenerator{}},\n\t\t\"qldb\":              &AwsFacade{service: &QLDBGenerator{}},\n\t\t\"rds\":               &AwsFacade{service: &RDSGenerator{}},\n\t\t\"redshift\":          &AwsFacade{service: &RedshiftGenerator{}},\n\t\t\"resourcegroups\":    &AwsFacade{service: &ResourceGroupsGenerator{}},\n\t\t\"route53\":           &AwsFacade{service: &Route53Generator{}},\n\t\t\"route_table\":       &AwsFacade{service: &RouteTableGenerator{}},\n\t\t\"s3\":                &AwsFacade{service: &S3Generator{}},\n\t\t\"secretsmanager\":    &AwsFacade{service: &SecretsManagerGenerator{}},\n\t\t\"securityhub\":       &AwsFacade{service: &SecurityhubGenerator{}},\n\t\t\"servicecatalog\":    &AwsFacade{service: &ServiceCatalogGenerator{}},\n\t\t\"ses\":               &AwsFacade{service: &SesGenerator{}},\n\t\t\"sfn\":               &AwsFacade{service: &SfnGenerator{}},\n\t\t\"sg\":                &AwsFacade{service: &SecurityGenerator{}},\n\t\t\"sqs\":               &AwsFacade{service: &SqsGenerator{}},\n\t\t\"sns\":               &AwsFacade{service: &SnsGenerator{}},\n\t\t\"ssm\":               &AwsFacade{service: &SsmGenerator{}},\n\t\t\"subnet\":            &AwsFacade{service: &SubnetGenerator{}},\n\t\t\"swf\":               &AwsFacade{service: &SWFGenerator{}},\n\t\t\"transit_gateway\":   &AwsFacade{service: &TransitGatewayGenerator{}},\n\t\t\"waf\":               &AwsFacade{service: &WafGenerator{}},\n\t\t\"waf_regional\":      &AwsFacade{service: &WafRegionalGenerator{}},\n\t\t\"wafv2_cloudfront\":  &AwsFacade{service: NewWafv2CloudfrontGenerator()},\n\t\t\"wafv2_regional\":    &AwsFacade{service: NewWafv2RegionalGenerator()},\n\t\t\"vpc\":               &AwsFacade{service: &VpcGenerator{}},\n\t\t\"vpc_endpoint\":      &AwsFacade{service: &VpcEndpointGenerator{}},\n\t\t\"vpc_peering\":       &AwsFacade{service: &VpcPeeringConnectionGenerator{}},\n\t\t\"vpn_connection\":    &AwsFacade{service: &VpnConnectionGenerator{}},\n\t\t\"vpn_gateway\":       &AwsFacade{service: &VpnGatewayGenerator{}},\n\t\t\"workspaces\":        &AwsFacade{service: &WorkspacesGenerator{}},\n\t\t\"xray\":              &AwsFacade{service: &XrayGenerator{}},\n\t}\n}\n\nfunc StringValue(value *string) string {\n\tif value != nil {\n\t\treturn *value\n\t}\n\treturn \"\"\n}\n"
  },
  {
    "path": "providers/aws/aws_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"os\"\n\t\"regexp\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/sts\"\n\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/config\"\n\t\"github.com/aws/aws-sdk-go-v2/credentials/stscreds\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype AWSService struct { //nolint\n\tterraformutils.Service\n}\n\nvar awsVariable = regexp.MustCompile(`(\\${[0-9A-Za-z:]+})`)\n\nvar configCache *aws.Config\n\nfunc (s *AWSService) generateConfig() (aws.Config, error) {\n\tif configCache != nil {\n\t\treturn *configCache, nil\n\t}\n\n\tbaseConfig, e := s.buildBaseConfig()\n\n\tif e != nil {\n\t\treturn baseConfig, e\n\t}\n\tif s.Verbose {\n\t\tbaseConfig.ClientLogMode = aws.LogRequestWithBody & aws.LogResponseWithBody\n\t}\n\n\tcreds, e := baseConfig.Credentials.Retrieve(context.TODO())\n\n\tif e != nil {\n\t\treturn baseConfig, e\n\t}\n\n\t// terraform cannot ask for MFA token, so we need to pass STS session token, which might contain credentials with MFA requirement\n\taccessKey := os.Getenv(\"AWS_SECRET_ACCESS_KEY\")\n\tif accessKey == \"\" {\n\t\tos.Setenv(\"AWS_ACCESS_KEY_ID\", creds.AccessKeyID)\n\t\tos.Setenv(\"AWS_SECRET_ACCESS_KEY\", creds.SecretAccessKey)\n\n\t\tif creds.SessionToken != \"\" {\n\t\t\tos.Setenv(\"AWS_SESSION_TOKEN\", creds.SessionToken)\n\t\t}\n\t}\n\tconfigCache = &baseConfig\n\treturn baseConfig, nil\n}\n\nfunc (s *AWSService) buildBaseConfig() (aws.Config, error) {\n\tvar loadOptions []func(*config.LoadOptions) error\n\tif s.GetArgs()[\"profile\"].(string) != \"\" {\n\t\tloadOptions = append(loadOptions, config.WithSharedConfigProfile(s.GetArgs()[\"profile\"].(string)))\n\t}\n\tif s.GetArgs()[\"region\"].(string) != \"\" {\n\t\tos.Setenv(\"AWS_REGION\", s.GetArgs()[\"region\"].(string))\n\t}\n\tloadOptions = append(loadOptions, config.WithAssumeRoleCredentialOptions(func(options *stscreds.AssumeRoleOptions) {\n\t\toptions.TokenProvider = stscreds.StdinTokenProvider\n\t}))\n\treturn config.LoadDefaultConfig(context.TODO(), loadOptions...)\n}\n\n// for CF interpolation and IAM Policy variables\nfunc (*AWSService) escapeAwsInterpolation(str string) string {\n\treturn awsVariable.ReplaceAllString(str, \"$$$1\")\n}\n\nfunc (s *AWSService) getAccountNumber(config aws.Config) (*string, error) {\n\tstsSvc := sts.NewFromConfig(config)\n\tidentity, err := stsSvc.GetCallerIdentity(context.TODO(), &sts.GetCallerIdentityInput{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn identity.Account, nil\n}\n"
  },
  {
    "path": "providers/aws/batch.go",
    "content": "package aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/batch\"\n)\n\nvar BatchAllowEmptyValues = []string{\"tags.\"}\n\nvar BatchAdditionalFields = map[string]interface{}{}\n\ntype BatchGenerator struct {\n\tAWSService\n}\n\nfunc (g *BatchGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tbatchClient := batch.NewFromConfig(config)\n\n\tif err := g.loadComputeEnvironments(batchClient); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadJobDefinitions(batchClient); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadJobQueues(batchClient); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *BatchGenerator) loadComputeEnvironments(batchClient *batch.Client) error {\n\tp := batch.NewDescribeComputeEnvironmentsPaginator(batchClient, &batch.DescribeComputeEnvironmentsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, computeEnvironment := range page.ComputeEnvironments {\n\t\t\tcomputeEnvironmentName := StringValue(computeEnvironment.ComputeEnvironmentName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tcomputeEnvironmentName,\n\t\t\t\tcomputeEnvironmentName,\n\t\t\t\t\"aws_batch_compute_environment\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"compute_environment_name\": computeEnvironmentName,\n\t\t\t\t},\n\t\t\t\tBatchAllowEmptyValues,\n\t\t\t\tBatchAdditionalFields,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *BatchGenerator) loadJobDefinitions(batchClient *batch.Client) error {\n\tp := batch.NewDescribeJobDefinitionsPaginator(batchClient, &batch.DescribeJobDefinitionsInput{\n\t\tStatus: aws.String(\"ACTIVE\"),\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, jobDefinition := range page.JobDefinitions {\n\t\t\tjobDefinitionName := StringValue(jobDefinition.JobDefinitionName) + \":\" + fmt.Sprint(jobDefinition.Revision)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tjobDefinitionName,\n\t\t\t\tjobDefinitionName,\n\t\t\t\t\"aws_batch_job_definition\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"arn\": StringValue(jobDefinition.JobDefinitionArn),\n\t\t\t\t},\n\t\t\t\tBatchAllowEmptyValues,\n\t\t\t\tBatchAdditionalFields,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *BatchGenerator) loadJobQueues(batchClient *batch.Client) error {\n\tp := batch.NewDescribeJobQueuesPaginator(batchClient, &batch.DescribeJobQueuesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, jobQueue := range page.JobQueues {\n\t\t\tjobQueueName := StringValue(jobQueue.JobQueueName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tjobQueueName,\n\t\t\t\tjobQueueName,\n\t\t\t\t\"aws_batch_job_queue\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{},\n\t\t\t\tBatchAllowEmptyValues,\n\t\t\t\tBatchAdditionalFields,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/budgets.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/budgets\"\n\t\"github.com/aws/aws-sdk-go-v2/service/budgets/types\"\n)\n\ntype BudgetsGenerator struct {\n\tAWSService\n}\n\nfunc (g *BudgetsGenerator) createResources(budgets []types.Budget, account *string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, budget := range budgets {\n\t\tresourceName := StringValue(budget.BudgetName)\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tfmt.Sprintf(\"%s:%s\", *account, resourceName),\n\t\t\tresourceName,\n\t\t\t\"aws_budgets_budget\",\n\t\t\t\"aws\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *BudgetsGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tbudgetsSvc := budgets.NewFromConfig(config)\n\n\taccount, err := g.getAccountNumber(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutput, err := budgetsSvc.DescribeBudgets(context.TODO(), &budgets.DescribeBudgetsInput{AccountId: account})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(output.Budgets, account)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/cloud9.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/cloud9\"\n\t\"github.com/aws/aws-sdk-go-v2/service/cloud9/types\"\n)\n\nvar cloud9AllowEmptyValues = []string{\"tags.\"}\n\ntype Cloud9Generator struct {\n\tAWSService\n}\n\nfunc (g *Cloud9Generator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := cloud9.NewFromConfig(config)\n\toutput, err := svc.ListEnvironments(context.TODO(), &cloud9.ListEnvironmentsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, environmentID := range output.EnvironmentIds {\n\t\tdetails, _ := svc.DescribeEnvironmentStatus(context.TODO(), &cloud9.DescribeEnvironmentStatusInput{\n\t\t\tEnvironmentId: &environmentID,\n\t\t})\n\t\tif details.Status == types.EnvironmentStatusError ||\n\t\t\tdetails.Status == types.EnvironmentStatusDeleting {\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tenvironmentID,\n\t\t\tenvironmentID,\n\t\t\t\"aws_cloud9_environment_ec2\",\n\t\t\t\"aws\",\n\t\t\tcloud9AllowEmptyValues))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/cloud_front.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/cloudfront\"\n)\n\nvar cloudFrontAllowEmptyValues = []string{\"tags.\"}\n\ntype CloudFrontGenerator struct {\n\tAWSService\n}\n\nfunc (g *CloudFrontGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := cloudfront.NewFromConfig(config)\n\n\tif err := g.loadDistribution(svc); err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadCachePolicy(svc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *CloudFrontGenerator) loadDistribution(svc *cloudfront.Client) error {\n\tp := cloudfront.NewListDistributionsPaginator(svc, &cloudfront.ListDistributionsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, distribution := range page.DistributionList.Items {\n\t\t\tr := terraformutils.NewResource(\n\t\t\t\tStringValue(distribution.Id),\n\t\t\t\tStringValue(distribution.Id),\n\t\t\t\t\"aws_cloudfront_distribution\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"retain_on_delete\": \"false\",\n\t\t\t\t},\n\t\t\t\tcloudFrontAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tr.IgnoreKeys = append(r.IgnoreKeys, \"^active_trusted_signers.(.*)\")\n\t\t\tg.Resources = append(g.Resources, r)\n\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *CloudFrontGenerator) loadCachePolicy(svc *cloudfront.Client) error {\n\tvar marker *string\n\tfor {\n\t\tout, err := svc.ListCachePolicies(context.TODO(), &cloudfront.ListCachePoliciesInput{\n\t\t\tMarker: marker,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, cachePolicy := range out.CachePolicyList.Items {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(cachePolicy.CachePolicy.Id),\n\t\t\t\tStringValue(cachePolicy.CachePolicy.Id),\n\t\t\t\t\"aws_cloudfront_cache_policy\",\n\t\t\t\t\"aws\",\n\t\t\t\tcloudFrontAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t\tmarker = out.CachePolicyList.NextMarker\n\t\tif marker == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *CloudFrontGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_cloudfront_distribution\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, cachePolicy := range g.Resources {\n\t\t\tif cachePolicy.InstanceInfo.Type != \"aws_cloudfront_cache_policy\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif defaultCacheBehavior, ok := r.Item[\"default_cache_behavior\"].([]interface{})[0].(map[string]interface{})[\"cache_policy_id\"]; ok {\n\t\t\t\tif defaultCacheBehavior.(string) == cachePolicy.InstanceState.Attributes[\"id\"] {\n\t\t\t\t\tg.Resources[i].Item[\"default_cache_behavior\"].([]interface{})[0].(map[string]interface{})[\"cache_policy_id\"] = \"${aws_cloudfront_cache_policy.\" + cachePolicy.ResourceName + \".id}\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif orderedCacheBehavior, ok := r.Item[\"ordered_cache_behavior\"].([]interface{}); ok {\n\t\t\t\tfor j, behavior := range orderedCacheBehavior {\n\t\t\t\t\tif behavior, ok := behavior.(map[string]interface{})[\"cache_policy_id\"]; ok && behavior.(string) == cachePolicy.InstanceState.Attributes[\"id\"] {\n\t\t\t\t\t\tg.Resources[i].Item[\"ordered_cache_behavior\"].([]interface{})[j].(map[string]interface{})[\"cache_policy_id\"] = \"${aws_cloudfront_cache_policy.\" + cachePolicy.ResourceName + \".id}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/cloudformation.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/cloudformation\"\n\t\"github.com/aws/aws-sdk-go-v2/service/cloudformation/types\"\n)\n\nvar cloudFormationAllowEmptyValues = []string{\"tags.\"}\n\ntype CloudFormationGenerator struct {\n\tAWSService\n}\n\nfunc (g *CloudFormationGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := cloudformation.NewFromConfig(config)\n\tp := cloudformation.NewListStacksPaginator(svc, &cloudformation.ListStacksInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, stackSummary := range page.StackSummaries {\n\t\t\tif stackSummary.StackStatus == types.StackStatusDeleteComplete {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*stackSummary.StackId,\n\t\t\t\t*stackSummary.StackName,\n\t\t\t\t\"aws_cloudformation_stack\",\n\t\t\t\t\"aws\",\n\t\t\t\tcloudFormationAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\tstackSets, err := svc.ListStackSets(context.TODO(), &cloudformation.ListStackSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, stackSetSummary := range stackSets.Summaries {\n\t\tif stackSetSummary.Status == types.StackSetStatusDeleted {\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*stackSetSummary.StackSetId,\n\t\t\t*stackSetSummary.StackSetName,\n\t\t\t\"aws_cloudformation_stack_set\",\n\t\t\t\"aws\",\n\t\t\tcloudFormationAllowEmptyValues,\n\t\t))\n\n\t\tstackSetInstances, err := svc.ListStackInstances(context.TODO(), &cloudformation.ListStackInstancesInput{\n\t\t\tStackSetName: stackSetSummary.StackSetName,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, stackSetI := range stackSetInstances.Summaries {\n\t\t\tid := StringValue(stackSetI.StackSetId) + \",\" + StringValue(stackSetI.Account) + \",\" + StringValue(stackSetI.Region)\n\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tid,\n\t\t\t\t\"aws_cloudformation_stack_set_instance\",\n\t\t\t\t\"aws\",\n\t\t\t\tcloudFormationAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *CloudFormationGenerator) PostConvertHook() error {\n\tfor _, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"aws_cloudformation_stack\" {\n\t\t\tdelete(resource.Item, \"outputs\")\n\t\t\tif templateBody, ok := resource.InstanceState.Attributes[\"template_body\"]; ok {\n\t\t\t\tresource.Item[\"template_body\"] = g.escapeAwsInterpolation(templateBody)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/cloudhsm.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/cloudhsmv2\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar cloudHsmAllowEmptyValues = []string{\"tags.\"}\n\ntype CloudHsmGenerator struct {\n\tAWSService\n}\n\nfunc (g *CloudHsmGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := cloudhsmv2.NewFromConfig(config)\n\n\tp := cloudhsmv2.NewDescribeClustersPaginator(svc, &cloudhsmv2.DescribeClustersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, cluster := range page.Clusters {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(cluster.ClusterId),\n\t\t\t\tStringValue(cluster.ClusterId),\n\t\t\t\t\"aws_cloudhsm_v2_cluster\",\n\t\t\t\t\"aws\",\n\t\t\t\tcloudHsmAllowEmptyValues,\n\t\t\t))\n\n\t\t\tfor _, hsm := range cluster.Hsms {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\tStringValue(hsm.HsmId),\n\t\t\t\t\tStringValue(hsm.HsmId),\n\t\t\t\t\t\"aws_cloudhsm_v2_hsm\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"cluster_id\": StringValue(hsm.ClusterId),\n\t\t\t\t\t},\n\t\t\t\t\tcloudHsmAllowEmptyValues,\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t))\n\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/cloudtrail.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/cloudtrail\"\n\t\"github.com/aws/aws-sdk-go-v2/service/cloudtrail/types\"\n)\n\nvar cloudtrailAllowEmptyValues = []string{\"tags.\"}\n\ntype CloudTrailGenerator struct {\n\tAWSService\n}\n\nfunc (g *CloudTrailGenerator) createResources(trailList []types.Trail) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, trail := range trailList {\n\t\tresourceName := StringValue(trail.Name)\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceName,\n\t\t\tresourceName,\n\t\t\t\"aws_cloudtrail\",\n\t\t\t\"aws\",\n\t\t\tcloudtrailAllowEmptyValues))\n\t}\n\treturn resources\n}\n\nfunc (g *CloudTrailGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := cloudtrail.NewFromConfig(config)\n\toutput, err := svc.DescribeTrails(context.TODO(), &cloudtrail.DescribeTrailsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output.TrailList)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/cloudwatch.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/cloudwatch\"\n\t\"github.com/aws/aws-sdk-go-v2/service/cloudwatchevents\"\n)\n\nvar cloudwatchAllowEmptyValues = []string{\"tags.\"}\n\ntype CloudWatchGenerator struct {\n\tAWSService\n}\n\nfunc (g *CloudWatchGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tcloudwatchSvc := cloudwatch.NewFromConfig(config)\n\terr := g.createMetricAlarms(cloudwatchSvc)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.createDashboards(cloudwatchSvc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcloudwatcheventsSvc := cloudwatchevents.NewFromConfig(config)\n\terr = g.createRules(cloudwatcheventsSvc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *CloudWatchGenerator) createMetricAlarms(cloudwatchSvc *cloudwatch.Client) error {\n\tvar nextToken *string\n\tfor {\n\t\toutput, err := cloudwatchSvc.DescribeAlarms(context.TODO(), &cloudwatch.DescribeAlarmsInput{\n\t\t\tNextToken: nextToken,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, metricAlarm := range output.MetricAlarms {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*metricAlarm.AlarmName,\n\t\t\t\t*metricAlarm.AlarmName,\n\t\t\t\t\"aws_cloudwatch_metric_alarm\",\n\t\t\t\t\"aws\",\n\t\t\t\tcloudwatchAllowEmptyValues))\n\t\t}\n\t\tnextToken = output.NextToken\n\t\tif nextToken == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *CloudWatchGenerator) createDashboards(cloudwatchSvc *cloudwatch.Client) error {\n\tvar nextToken *string\n\tfor {\n\t\toutput, err := cloudwatchSvc.ListDashboards(context.TODO(), &cloudwatch.ListDashboardsInput{\n\t\t\tNextToken: nextToken,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, dashboardEntry := range output.DashboardEntries {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*dashboardEntry.DashboardName,\n\t\t\t\t*dashboardEntry.DashboardName,\n\t\t\t\t\"aws_cloudwatch_dashboard\",\n\t\t\t\t\"aws\",\n\t\t\t\tcloudwatchAllowEmptyValues))\n\t\t}\n\t\tnextToken = output.NextToken\n\t\tif nextToken == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *CloudWatchGenerator) createRules(cloudwatcheventsSvc *cloudwatchevents.Client) error {\n\tvar listRulesNextToken *string\n\tfor {\n\t\toutput, err := cloudwatcheventsSvc.ListRules(context.TODO(), &cloudwatchevents.ListRulesInput{\n\t\t\tNextToken: listRulesNextToken,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, rule := range output.Rules {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*rule.Name,\n\t\t\t\t*rule.Name,\n\t\t\t\t\"aws_cloudwatch_event_rule\",\n\t\t\t\t\"aws\",\n\t\t\t\tcloudwatchAllowEmptyValues))\n\n\t\t\tvar listTargetsNextToken *string\n\t\t\tfor {\n\t\t\t\ttargetResponse, err := cloudwatcheventsSvc.ListTargetsByRule(context.TODO(), &cloudwatchevents.ListTargetsByRuleInput{\n\t\t\t\t\tRule:      rule.Name,\n\t\t\t\t\tNextToken: listTargetsNextToken,\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfor _, target := range targetResponse.Targets {\n\t\t\t\t\ttargetRef := *rule.Name + \"/\" + *target.Id\n\t\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\t\ttargetRef,\n\t\t\t\t\t\ttargetRef,\n\t\t\t\t\t\t\"aws_cloudwatch_event_target\",\n\t\t\t\t\t\t\"aws\",\n\t\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\t\"rule\":      *rule.Name,\n\t\t\t\t\t\t\t\"target_id\": *target.Id,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcloudwatchAllowEmptyValues,\n\t\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t\t}\n\t\t\t\tlistTargetsNextToken = output.NextToken\n\t\t\t\tif listTargetsNextToken == nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlistRulesNextToken = output.NextToken\n\t\tif listRulesNextToken == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/codebuild.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/codebuild\"\n)\n\nvar codebuildAllowEmptyValues = []string{\"tags.\"}\n\ntype CodeBuildGenerator struct {\n\tAWSService\n}\n\nfunc (g *CodeBuildGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := codebuild.NewFromConfig(config)\n\tp := codebuild.NewListProjectsPaginator(svc, &codebuild.ListProjectsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, project := range page.Projects {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tproject,\n\t\t\t\tproject,\n\t\t\t\t\"aws_codebuild_project\",\n\t\t\t\t\"aws\",\n\t\t\t\tcodebuildAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *CodeBuildGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_codebuild_project\" {\n\t\t\tcontinue\n\t\t}\n\t\tif r.InstanceState.Attributes[\"concurrent_build_limit\"] == \"0\" {\n\t\t\tdelete(r.Item, \"concurrent_build_limit\")\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/codecommit.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/codecommit\"\n)\n\nvar codecommitAllowEmptyValues = []string{\"tags.\"}\n\ntype CodeCommitGenerator struct {\n\tAWSService\n}\n\nfunc (g *CodeCommitGenerator) loadRepository(svc *codecommit.Client) error {\n\tp := codecommit.NewListRepositoriesPaginator(svc, &codecommit.ListRepositoriesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, repository := range page.Repositories {\n\t\t\tresourceName := StringValue(repository.RepositoryName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_codecommit_repository\",\n\t\t\t\t\"aws\",\n\t\t\t\tcodecommitAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *CodeCommitGenerator) loadApprovalRuleTemplate(svc *codecommit.Client) error {\n\tp := codecommit.NewListApprovalRuleTemplatesPaginator(svc, &codecommit.ListApprovalRuleTemplatesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, templateName := range page.ApprovalRuleTemplateNames {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\ttemplateName,\n\t\t\t\ttemplateName,\n\t\t\t\t\"aws_codecommit_approval_rule_template\",\n\t\t\t\t\"aws\",\n\t\t\t\tcodecommitAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *CodeCommitGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := codecommit.NewFromConfig(config)\n\terr := g.loadRepository(svc)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.loadApprovalRuleTemplate(svc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *CodeCommitGenerator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"aws_codecommit_approval_rule_template\" {\n\t\t\tif content, ok := g.Resources[i].Item[\"content\"]; ok {\n\t\t\t\tg.Resources[i].Item[\"content\"] = fmt.Sprintf(`<<CONTENT\n%s\nCONTENT`, content)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/codedeploy.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/codedeploy\"\n)\n\nvar codedeployAllowEmptyValues = []string{\"tags.\"}\n\ntype CodeDeployGenerator struct {\n\tAWSService\n}\n\nfunc (g *CodeDeployGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := codedeploy.NewFromConfig(config)\n\tp := codedeploy.NewListApplicationsPaginator(svc, &codedeploy.ListApplicationsInput{})\n\tvar resources []terraformutils.Resource\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, application := range page.Applications {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\":%s\", application),\n\t\t\t\tapplication,\n\t\t\t\t\"aws_codedeploy_app\",\n\t\t\t\t\"aws\",\n\t\t\t\tcodedeployAllowEmptyValues))\n\t\t}\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/codepipeline.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/codepipeline\"\n)\n\nvar codepipelineAllowEmptyValues = []string{\"tags.\"}\n\ntype CodePipelineGenerator struct {\n\tAWSService\n}\n\nfunc (g *CodePipelineGenerator) loadPipelines(svc *codepipeline.Client) error {\n\tp := codepipeline.NewListPipelinesPaginator(svc, &codepipeline.ListPipelinesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, pipeline := range page.Pipelines {\n\t\t\tresourceName := StringValue(pipeline.Name)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_codepipeline\",\n\t\t\t\t\"aws\",\n\t\t\t\tcodepipelineAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *CodePipelineGenerator) loadWebhooks(svc *codepipeline.Client) error {\n\tp := codepipeline.NewListWebhooksPaginator(svc, &codepipeline.ListWebhooksInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, webhook := range page.Webhooks {\n\t\t\tresourceArn := StringValue(webhook.Arn)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceArn,\n\t\t\t\tresourceArn,\n\t\t\t\t\"aws_codepipeline_webhook\",\n\t\t\t\t\"aws\",\n\t\t\t\tcodepipelineAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *CodePipelineGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := codepipeline.NewFromConfig(config)\n\n\tif err := g.loadPipelines(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadWebhooks(svc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/cognito.go",
    "content": "package aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/cognitoidentity\"\n\t\"github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider\"\n)\n\nvar CognitoAllowEmptyValues = []string{\"tags.\"}\n\nvar CognitoAdditionalFields = map[string]interface{}{}\n\ntype CognitoGenerator struct {\n\tAWSService\n}\n\nconst CognitoMaxResults = 60 // Required field for Cognito API\n\nfunc (g *CognitoGenerator) loadIdentityPools(svc *cognitoidentity.Client) error {\n\tp := cognitoidentity.NewListIdentityPoolsPaginator(svc, &cognitoidentity.ListIdentityPoolsInput{\n\t\tMaxResults: aws.Int32(CognitoMaxResults),\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, pool := range page.IdentityPools {\n\t\t\tvar id = *pool.IdentityPoolId\n\t\t\tvar resourceName = *pool.IdentityPoolName\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tresourceName+\"_\"+id,\n\t\t\t\t\"aws_cognito_identity_pool\",\n\t\t\t\t\"aws\",\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *CognitoGenerator) loadUserPools(svc *cognitoidentityprovider.Client) ([]string, error) {\n\tp := cognitoidentityprovider.NewListUserPoolsPaginator(svc, &cognitoidentityprovider.ListUserPoolsInput{\n\t\tMaxResults: aws.Int32(CognitoMaxResults),\n\t})\n\n\tvar userPoolIds []string\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, pool := range page.UserPools {\n\t\t\tid := *pool.Id\n\t\t\tresourceName := *pool.Name\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tresourceName+\"_\"+id,\n\t\t\t\t\"aws_cognito_user_pool\",\n\t\t\t\t\"aws\",\n\t\t\t\t[]string{}))\n\n\t\t\tuserPoolIds = append(userPoolIds, *pool.Id)\n\t\t}\n\t}\n\treturn userPoolIds, nil\n}\n\nfunc (g *CognitoGenerator) loadUserPoolClients(svc *cognitoidentityprovider.Client, userPoolIds []string) error {\n\tfor _, userPoolID := range userPoolIds {\n\t\tp := cognitoidentityprovider.NewListUserPoolClientsPaginator(svc, &cognitoidentityprovider.ListUserPoolClientsInput{\n\t\t\tUserPoolId: aws.String(userPoolID),\n\t\t\tMaxResults: aws.Int32(CognitoMaxResults),\n\t\t})\n\n\t\tfor p.HasMorePages() {\n\t\t\tpage, err := p.NextPage(context.TODO())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, poolClient := range page.UserPoolClients {\n\t\t\t\tid := *poolClient.ClientId\n\t\t\t\tresourceName := *poolClient.ClientName\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\tid,\n\t\t\t\t\tresourceName+\"_\"+id,\n\t\t\t\t\t\"aws_cognito_user_pool_client\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"user_pool_id\": *poolClient.UserPoolId,\n\t\t\t\t\t},\n\t\t\t\t\tCognitoAllowEmptyValues,\n\t\t\t\t\tCognitoAdditionalFields))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *CognitoGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tsvcCognitoIdentity := cognitoidentity.NewFromConfig(config)\n\tif err := g.loadIdentityPools(svcCognitoIdentity); err != nil {\n\t\treturn err\n\t}\n\tsvcCognitoIdentityProvider := cognitoidentityprovider.NewFromConfig(config)\n\n\tuserPoolIds, err := g.loadUserPools(svcCognitoIdentityProvider)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err = g.loadUserPoolClients(svcCognitoIdentityProvider, userPoolIds); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *CognitoGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_cognito_user_pool\" {\n\t\t\tcontinue\n\t\t}\n\t\tif _, ok := r.InstanceState.Attributes[\"admin_create_user_config.0.unused_account_validity_days\"]; ok {\n\t\t\tif _, okpp := r.InstanceState.Attributes[\"admin_create_user_config.0.unused_account_validity_days\"]; okpp {\n\t\t\t\tdelete(r.Item[\"admin_create_user_config\"].([]interface{})[0].(map[string]interface{}), \"unused_account_validity_days\")\n\t\t\t}\n\t\t}\n\t\tif _, ok := r.InstanceState.Attributes[\"sms_verification_message\"]; ok {\n\t\t\tif _, oktmp := r.InstanceState.Attributes[\"verification_message_template.0.sms_message\"]; oktmp {\n\t\t\t\tdelete(r.Item, \"sms_verification_message\")\n\t\t\t}\n\t\t}\n\t\tif _, ok := r.InstanceState.Attributes[\"email_verification_message\"]; ok {\n\t\t\tif _, oktmp := r.InstanceState.Attributes[\"verification_message_template.0.email_message\"]; oktmp {\n\t\t\t\tdelete(r.Item, \"email_verification_message\")\n\t\t\t}\n\t\t}\n\t\tif _, ok := r.InstanceState.Attributes[\"email_verification_subject\"]; ok {\n\t\t\tif _, oktmp := r.InstanceState.Attributes[\"verification_message_template.0.email_subject\"]; oktmp {\n\t\t\t\tdelete(r.Item, \"email_verification_subject\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/config.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/configservice\"\n)\n\nvar configAllowEmptyValues = []string{\"tags.\"}\n\ntype ConfigGenerator struct {\n\tAWSService\n}\n\nfunc (g *ConfigGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tclient := configservice.NewFromConfig(config)\n\n\tconfigurationRecorderRefs, err := g.addConfigurationRecorders(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.addConfigRules(client, configurationRecorderRefs)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.addDeliveryChannels(client, configurationRecorderRefs)\n\treturn err\n}\n\nfunc (g *ConfigGenerator) addConfigurationRecorders(svc *configservice.Client) ([]string, error) {\n\tconfigurationRecorders, err := svc.DescribeConfigurationRecorders(context.TODO(),\n\t\t&configservice.DescribeConfigurationRecordersInput{})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar configurationRecorderRefs []string\n\tfor _, configurationRecorder := range configurationRecorders.ConfigurationRecorders {\n\t\tname := *configurationRecorder.Name\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tname,\n\t\t\tname,\n\t\t\t\"aws_config_configuration_recorder\",\n\t\t\t\"aws\",\n\t\t\tconfigAllowEmptyValues,\n\t\t))\n\t\tconfigurationRecorderRefs = append(configurationRecorderRefs,\n\t\t\t\"aws_config_configuration_recorder.tfer--\"+name)\n\t}\n\treturn configurationRecorderRefs, nil\n}\n\nfunc (g *ConfigGenerator) addConfigRules(svc *configservice.Client, configurationRecorderRefs []string) error {\n\tvar nextToken *string\n\n\tfor {\n\t\tconfigRules, err := svc.DescribeConfigRules(\n\t\t\tcontext.TODO(),\n\t\t\t&configservice.DescribeConfigRulesInput{\n\t\t\t\tNextToken: nextToken,\n\t\t\t})\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, configRule := range configRules.ConfigRules {\n\t\t\tname := *configRule.ConfigRuleName\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tname,\n\t\t\t\tname,\n\t\t\t\t\"aws_config_config_rule\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{},\n\t\t\t\tconfigAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"depends_on\": configurationRecorderRefs,\n\t\t\t\t},\n\t\t\t))\n\t\t}\n\t\tnextToken = configRules.NextToken\n\t\tif nextToken == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *ConfigGenerator) addDeliveryChannels(svc *configservice.Client, configurationRecorderRefs []string) error {\n\tdeliveryChannels, err := svc.DescribeDeliveryChannels(context.TODO(),\n\t\t&configservice.DescribeDeliveryChannelsInput{})\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, deliveryChannel := range deliveryChannels.DeliveryChannels {\n\t\tname := *deliveryChannel.Name\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tname,\n\t\t\tname,\n\t\t\t\"aws_config_delivery_channel\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{},\n\t\t\tconfigAllowEmptyValues,\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"depends_on\": configurationRecorderRefs,\n\t\t\t},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/customer_gateway.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar customerGatewayAllowEmptyValues = []string{\"tags.\"}\n\ntype CustomerGatewayGenerator struct {\n\tAWSService\n}\n\nfunc (CustomerGatewayGenerator) createResources(cgws *ec2.DescribeCustomerGatewaysOutput) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, cgws := range cgws.CustomerGateways {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(cgws.CustomerGatewayId),\n\t\t\tStringValue(cgws.CustomerGatewayId),\n\t\t\t\"aws_customer_gateway\",\n\t\t\t\"aws\",\n\t\t\tcustomerGatewayAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// from each customer gateway create 1 TerraformResource.\n// Need CustomerGatewayId as ID for terraform resource\nfunc (g *CustomerGatewayGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tcgws, err := svc.DescribeCustomerGateways(context.TODO(), &ec2.DescribeCustomerGatewaysInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(cgws)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/datapipeline.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/datapipeline\"\n)\n\nvar datapipelineAllowEmptyValues = []string{\"tags.\"}\n\ntype DataPipelineGenerator struct {\n\tAWSService\n}\n\nfunc (g *DataPipelineGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := datapipeline.NewFromConfig(config)\n\tp := datapipeline.NewListPipelinesPaginator(svc, &datapipeline.ListPipelinesInput{})\n\tvar resources []terraformutils.Resource\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, pipeline := range page.PipelineIdList {\n\t\t\tpipelineID := StringValue(pipeline.Id)\n\t\t\tpipelineName := StringValue(pipeline.Name)\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tpipelineID,\n\t\t\t\tpipelineName,\n\t\t\t\t\"aws_datapipeline_pipeline\",\n\t\t\t\t\"aws\",\n\t\t\t\tdatapipelineAllowEmptyValues))\n\t\t}\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/devicefarm.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/devicefarm\"\n)\n\nvar devicefarmAllowEmptyValues = []string{\"tags.\"}\n\ntype DeviceFarmGenerator struct {\n\tAWSService\n}\n\nfunc (g *DeviceFarmGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := devicefarm.NewFromConfig(config)\n\tp := devicefarm.NewListProjectsPaginator(svc, &devicefarm.ListProjectsInput{})\n\tvar resources []terraformutils.Resource\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, project := range page.Projects {\n\t\t\tprojectArn := StringValue(project.Arn)\n\t\t\tprojectName := StringValue(project.Name)\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tprojectArn,\n\t\t\t\tprojectName,\n\t\t\t\t\"aws_devicefarm_project\",\n\t\t\t\t\"aws\",\n\t\t\t\tdevicefarmAllowEmptyValues))\n\t\t}\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/docdb.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/docdb\"\n)\n\nvar docDBAllowEmptyValues = []string{\"tags.\"}\n\ntype DocDBGenerator struct {\n\tAWSService\n}\n\nfunc (g *DocDBGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := docdb.NewFromConfig(config)\n\n\tif err := g.getClusters(svc); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tif err := g.getSubnetGroups(svc); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tif err := g.getParameterGroups(svc); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn nil\n}\n\nfunc (g *DocDBGenerator) getClusters(svc *docdb.Client) error {\n\tclusterPaginator := docdb.NewDescribeDBClustersPaginator(svc, &docdb.DescribeDBClustersInput{})\n\tfor clusterPaginator.HasMorePages() {\n\t\tpage, err := clusterPaginator.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, cluster := range page.DBClusters {\n\n\t\t\tresourceName := StringValue(cluster.DBClusterIdentifier)\n\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_docdb_cluster\",\n\t\t\t\t\"aws\",\n\t\t\t\tdocDBAllowEmptyValues))\n\n\t\t\tfor _, member := range cluster.DBClusterMembers {\n\t\t\t\tinstanceName := StringValue(member.DBInstanceIdentifier)\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\tinstanceName,\n\t\t\t\t\tinstanceName,\n\t\t\t\t\t\"aws_docdb_cluster_instance\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tdocDBAllowEmptyValues))\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *DocDBGenerator) getSubnetGroups(svc *docdb.Client) error {\n\tsubnetGroupPaginator := docdb.NewDescribeDBSubnetGroupsPaginator(svc, &docdb.DescribeDBSubnetGroupsInput{})\n\n\tfor subnetGroupPaginator.HasMorePages() {\n\t\tpage, err := subnetGroupPaginator.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, subnetGroup := range page.DBSubnetGroups {\n\t\t\tresourceName := StringValue(subnetGroup.DBSubnetGroupName)\n\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_docdb_subnet_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tdocDBAllowEmptyValues))\n\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *DocDBGenerator) getParameterGroups(svc *docdb.Client) error {\n\tparameterGroupPaginator := docdb.NewDescribeDBClusterParameterGroupsPaginator(svc, &docdb.DescribeDBClusterParameterGroupsInput{})\n\n\tfor parameterGroupPaginator.HasMorePages() {\n\t\tpage, err := parameterGroupPaginator.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, parameterGroup := range page.DBClusterParameterGroups {\n\t\t\tresourceName := StringValue(parameterGroup.DBClusterParameterGroupName)\n\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_docdb_cluster_parameter_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tdocDBAllowEmptyValues))\n\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// PostConvertHook for add policy json as heredoc\nfunc (g *DocDBGenerator) PostConvertHook() error {\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/dx.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/directconnect\"\n)\n\nvar dxAllowEmptyValues = []string{\"tags.\"}\n\ntype DirectConnectGenerator struct {\n\tAWSService\n}\n\nfunc (g *DirectConnectGenerator) getDirectConnectGateways(svc *directconnect.Client) error {\n\tinput := &directconnect.DescribeDirectConnectGatewaysInput{}\n\tfor {\n\t\t// Fetch a page of results\n\t\toutput, err := svc.DescribeDirectConnectGateways(context.TODO(), input)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Process each DirectConnect Gateway\n\t\tfor _, dx := range output.DirectConnectGateways {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*dx.DirectConnectGatewayId, // Dereference the pointer\n\t\t\t\t*dx.DirectConnectGatewayId,\n\t\t\t\t\"aws_dx_gateway\",\n\t\t\t\t\"aws\",\n\t\t\t\tdxAllowEmptyValues,\n\t\t\t))\n\t\t}\n\n\t\t// Check if there are more pages\n\t\tif output.NextToken == nil {\n\t\t\tbreak\n\t\t}\n\n\t\t// Update the input token for the next page\n\t\tinput.NextToken = output.NextToken\n\t}\n\treturn nil\n}\n\nfunc (g *DirectConnectGenerator) getDirectConnectConnections(svc *directconnect.Client) error {\n\tinput := &directconnect.DescribeConnectionsInput{}\n\toutput, err := svc.DescribeConnections(context.TODO(), input)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, dx := range output.Connections {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*dx.ConnectionId, // Dereference the pointer\n\t\t\t*dx.ConnectionName,\n\t\t\t\"aws_dx_connection\",\n\t\t\t\"aws\",\n\t\t\tdxAllowEmptyValues,\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *DirectConnectGenerator) getDirectConnectVritualInterfaces(svc *directconnect.Client) error {\n\tinput := &directconnect.DescribeVirtualInterfacesInput{}\n\toutput, err := svc.DescribeVirtualInterfaces(context.TODO(), input)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, vif := range output.VirtualInterfaces {\n\t\tvar resourceType string\n\n\t\tif *vif.VirtualInterfaceType == \"private\" {\n\t\t\tresourceType = \"aws_dx_private_virtual_interface\"\n\t\t} else if *vif.VirtualInterfaceType == \"public\" {\n\t\t\tresourceType = \"aws_dx_public_virtual_interface\"\n\t\t} else {\n\t\t\tlog.Printf(\"Unknown Virtual Interface Type: %s for ID: %s\", *vif.VirtualInterfaceType, *vif.VirtualInterfaceId)\n\t\t\tcontinue\n\t\t}\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*vif.VirtualInterfaceId,\n\t\t\t*vif.VirtualInterfaceName,\n\t\t\tresourceType,\n\t\t\t\"aws\",\n\t\t\tdxAllowEmptyValues,\n\t\t))\n\t}\n\n\treturn nil\n\n}\n\nfunc (g *DirectConnectGenerator) InitResources() error {\n\tconfig, err := g.generateConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsvc := directconnect.NewFromConfig(config)\n\tif err := g.getDirectConnectGateways(svc); err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\terr = g.getDirectConnectVritualInterfaces(svc)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\terr = g.getDirectConnectConnections(svc)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/dynamodb.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/dynamodb\"\n)\n\nvar dynamodbAllowEmptyValues = []string{\"tags.\"}\n\ntype DynamoDbGenerator struct {\n\tAWSService\n}\n\nfunc (g *DynamoDbGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := dynamodb.NewFromConfig(config)\n\tp := dynamodb.NewListTablesPaginator(svc, &dynamodb.ListTablesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, tableName := range page.TableNames {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\ttableName,\n\t\t\t\ttableName,\n\t\t\t\t\"aws_dynamodb_table\",\n\t\t\t\t\"aws\",\n\t\t\t\tdynamodbAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *DynamoDbGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_dynamodb_table\" {\n\t\t\tcontinue\n\t\t}\n\t\tif val, ok := r.InstanceState.Attributes[\"ttl.0.enabled\"]; ok && val == \"false\" {\n\t\t\tdelete(r.Item, \"ttl\")\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/ebs.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/hashicorp/terraform/helper/hashcode\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2/types\"\n)\n\nvar ebsAllowEmptyValues = []string{\"tags.\"}\n\ntype EbsGenerator struct {\n\tAWSService\n}\n\nfunc (g *EbsGenerator) volumeAttachmentID(device, volumeID, instanceID string) string {\n\treturn fmt.Sprintf(\"vai-%d\", hashcode.String(fmt.Sprintf(\"%s-%s-%s-\", device, instanceID, volumeID)))\n}\n\nfunc (g *EbsGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tvar filters []types.Filter\n\tfor _, filter := range g.Filter {\n\t\tif strings.HasPrefix(filter.FieldPath, \"tags.\") && filter.IsApplicable(\"ebs_volume\") {\n\t\t\tfilters = append(filters, types.Filter{\n\t\t\t\tName:   aws.String(\"tag:\" + strings.TrimPrefix(filter.FieldPath, \"tags.\")),\n\t\t\t\tValues: filter.AcceptableValues,\n\t\t\t})\n\t\t}\n\t}\n\tp := ec2.NewDescribeVolumesPaginator(svc, &ec2.DescribeVolumesInput{\n\t\tFilters: filters,\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, volume := range page.Volumes {\n\t\t\tisRootDevice := false // Let's leave root device configuration to be done in ec2_instance resources\n\n\t\t\tfor _, attachment := range volume.Attachments {\n\t\t\t\tinstances, _ := svc.DescribeInstances(context.TODO(), &ec2.DescribeInstancesInput{\n\t\t\t\t\tInstanceIds: []string{StringValue(attachment.InstanceId)},\n\t\t\t\t})\n\t\t\t\tfor _, reservation := range instances.Reservations {\n\t\t\t\t\tfor _, instance := range reservation.Instances {\n\t\t\t\t\t\tif StringValue(instance.RootDeviceName) == StringValue(attachment.Device) {\n\t\t\t\t\t\t\tisRootDevice = true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !isRootDevice {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\tStringValue(volume.VolumeId),\n\t\t\t\t\tStringValue(volume.VolumeId),\n\t\t\t\t\t\"aws_ebs_volume\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tebsAllowEmptyValues,\n\t\t\t\t))\n\n\t\t\t\tfor _, attachment := range volume.Attachments {\n\t\t\t\t\tif attachment.State == types.VolumeAttachmentStateAttached {\n\t\t\t\t\t\tattachmentID := g.volumeAttachmentID(\n\t\t\t\t\t\t\tStringValue(attachment.Device),\n\t\t\t\t\t\t\tStringValue(attachment.VolumeId),\n\t\t\t\t\t\t\tStringValue(attachment.InstanceId))\n\t\t\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\t\t\tattachmentID,\n\t\t\t\t\t\t\tStringValue(attachment.InstanceId)+\":\"+StringValue(attachment.Device),\n\t\t\t\t\t\t\t\"aws_volume_attachment\",\n\t\t\t\t\t\t\t\"aws\",\n\t\t\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\t\t\"device_name\": StringValue(attachment.Device),\n\t\t\t\t\t\t\t\t\"volume_id\":   StringValue(attachment.VolumeId),\n\t\t\t\t\t\t\t\t\"instance_id\": StringValue(attachment.InstanceId),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[]string{},\n\t\t\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t\t\t))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/ec2.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2/types\"\n)\n\nvar ec2AllowEmptyValues = []string{\"tags.\"}\n\ntype Ec2Generator struct {\n\tAWSService\n}\n\nfunc (g *Ec2Generator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tvar filters []types.Filter\n\tfor _, filter := range g.Filter {\n\t\tif strings.HasPrefix(filter.FieldPath, \"tags.\") && filter.IsApplicable(\"instance\") {\n\t\t\tfilters = append(filters, types.Filter{\n\t\t\t\tName:   aws.String(\"tag:\" + strings.TrimPrefix(filter.FieldPath, \"tags.\")),\n\t\t\t\tValues: filter.AcceptableValues,\n\t\t\t})\n\t\t}\n\t}\n\tp := ec2.NewDescribeInstancesPaginator(svc, &ec2.DescribeInstancesInput{\n\t\tFilters: filters,\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, reservation := range page.Reservations {\n\t\t\tfor _, instance := range reservation.Instances {\n\t\t\t\tname := \"\"\n\t\t\t\tfor _, tag := range instance.Tags {\n\t\t\t\t\tif strings.ToLower(*tag.Key) == \"name\" {\n\t\t\t\t\t\tname = *tag.Value\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tattr, err := svc.DescribeInstanceAttribute(context.TODO(), &ec2.DescribeInstanceAttributeInput{\n\t\t\t\t\tAttribute:  types.InstanceAttributeNameUserData,\n\t\t\t\t\tInstanceId: instance.InstanceId,\n\t\t\t\t})\n\t\t\t\tuserDataBase64 := \"\"\n\t\t\t\tif err == nil && attr.UserData != nil && attr.UserData.Value != nil {\n\t\t\t\t\tuserDataBase64 = *attr.UserData.Value\n\t\t\t\t}\n\t\t\t\tr := terraformutils.NewResource(\n\t\t\t\t\t*instance.InstanceId,\n\t\t\t\t\t*instance.InstanceId+\"_\"+name,\n\t\t\t\t\t\"aws_instance\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"user_data_base64\":  userDataBase64,\n\t\t\t\t\t\t\"source_dest_check\": \"true\",\n\t\t\t\t\t},\n\t\t\t\t\tec2AllowEmptyValues,\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t)\n\t\t\t\tg.Resources = append(g.Resources, r)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *Ec2Generator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_instance\" {\n\t\t\tcontinue\n\t\t}\n\t\tif r.Item[\"root_block_device\"] == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\trootDeviceVolumeType := r.InstanceState.Attributes[\"root_block_device.0.volume_type\"]\n\t\tif !(rootDeviceVolumeType == \"io1\" || rootDeviceVolumeType == \"io2\" || rootDeviceVolumeType == \"gp3\") {\n\t\t\tdelete(r.Item[\"root_block_device\"].([]interface{})[0].(map[string]interface{}), \"iops\")\n\t\t}\n\t\tif rootDeviceVolumeType != \"gp3\" {\n\t\t\tdelete(r.Item[\"root_block_device\"].([]interface{})[0].(map[string]interface{}), \"throughput\")\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/ecr.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ecr\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar ecrAllowEmptyValues = []string{\"tags.\"}\n\ntype EcrGenerator struct {\n\tAWSService\n}\n\nfunc (g *EcrGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tsvc := ecr.NewFromConfig(config)\n\n\tp := ecr.NewDescribeRepositoriesPaginator(svc, &ecr.DescribeRepositoriesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, repository := range page.Repositories {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*repository.RepositoryName,\n\t\t\t\t*repository.RepositoryName,\n\t\t\t\t\"aws_ecr_repository\",\n\t\t\t\t\"aws\",\n\t\t\t\tecrAllowEmptyValues))\n\n\t\t\t_, err := svc.GetRepositoryPolicy(context.TODO(), &ecr.GetRepositoryPolicyInput{\n\t\t\t\tRepositoryName: repository.RepositoryName,\n\t\t\t\tRegistryId:     repository.RegistryId,\n\t\t\t})\n\t\t\tif err == nil {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\t*repository.RepositoryName,\n\t\t\t\t\t*repository.RepositoryName,\n\t\t\t\t\t\"aws_ecr_repository_policy\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tecrAllowEmptyValues))\n\t\t\t}\n\n\t\t\t_, err = svc.GetLifecyclePolicy(context.TODO(), &ecr.GetLifecyclePolicyInput{\n\t\t\t\tRepositoryName: repository.RepositoryName,\n\t\t\t\tRegistryId:     repository.RegistryId,\n\t\t\t})\n\t\t\tif err == nil {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\t*repository.RepositoryName,\n\t\t\t\t\t*repository.RepositoryName,\n\t\t\t\t\t\"aws_ecr_lifecycle_policy\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tecrAllowEmptyValues))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *EcrGenerator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"aws_ecr_repository_policy\" {\n\t\t\tif val, ok := g.Resources[i].Item[\"policy\"]; ok {\n\t\t\t\tpolicy := g.escapeAwsInterpolation(val.(string))\n\t\t\t\tg.Resources[i].Item[\"policy\"] = fmt.Sprintf(`<<POLICY\n%s\nPOLICY`, policy)\n\t\t\t}\n\t\t} else if resource.InstanceInfo.Type == \"aws_ecr_lifecycle_policy\" {\n\t\t\tif val, ok := g.Resources[i].Item[\"policy\"]; ok {\n\t\t\t\tpolicy := g.escapeAwsInterpolation(val.(string))\n\t\t\t\tg.Resources[i].Item[\"policy\"] = fmt.Sprintf(`<<POLICY\n%s\nPOLICY`, policy)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/ecrpublic.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ecrpublic\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar ecrPublicAllowEmptyValues = []string{\"tags.\"}\n\ntype EcrPublicGenerator struct {\n\tAWSService\n}\n\nfunc (g *EcrPublicGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tecrPublicConfig := config.Copy()\n\tecrPublicConfig.Region = MainRegionPublicPartition\n\tsvc := ecrpublic.NewFromConfig(ecrPublicConfig)\n\n\tp := ecrpublic.NewDescribeRepositoriesPaginator(svc, &ecrpublic.DescribeRepositoriesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, repository := range page.Repositories {\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\t*repository.RepositoryName,\n\t\t\t\t*repository.RepositoryName,\n\t\t\t\t\"aws_ecrpublic_repository\",\n\t\t\t\t\"aws\",\n\t\t\t\tecrPublicAllowEmptyValues)\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/ecs.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/ecs\"\n)\n\nvar ecsAllowEmptyValues = []string{\"tags.\"}\n\ntype EcsGenerator struct {\n\tAWSService\n}\n\nfunc (g *EcsGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ecs.NewFromConfig(config)\n\n\tp := ecs.NewListClustersPaginator(svc, &ecs.ListClustersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, clusterArn := range page.ClusterArns {\n\t\t\tarnParts := strings.Split(clusterArn, \"/\")\n\t\t\tclusterName := arnParts[len(arnParts)-1]\n\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tclusterArn,\n\t\t\t\tclusterName,\n\t\t\t\t\"aws_ecs_cluster\",\n\t\t\t\t\"aws\",\n\t\t\t\tecsAllowEmptyValues,\n\t\t\t))\n\n\t\t\tservicePage := ecs.NewListServicesPaginator(svc, &ecs.ListServicesInput{\n\t\t\t\tCluster: &clusterArn,\n\t\t\t})\n\t\t\tfor servicePage.HasMorePages() {\n\t\t\t\tserviceNextPage, err := servicePage.NextPage(context.TODO())\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(err.Error())\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor _, serviceArn := range serviceNextPage.ServiceArns {\n\t\t\t\t\tarnParts := strings.Split(serviceArn, \"/\")\n\t\t\t\t\tserviceName := arnParts[len(arnParts)-1]\n\n\t\t\t\t\tserResp, err := svc.DescribeServices(context.TODO(), &ecs.DescribeServicesInput{\n\t\t\t\t\t\tServices: []string{\n\t\t\t\t\t\t\tserviceName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tCluster: &clusterArn,\n\t\t\t\t\t})\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tfmt.Println(err.Error())\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tserviceDetails := serResp.Services[0]\n\n\t\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\t\tserviceArn,\n\t\t\t\t\t\tclusterName+\"_\"+serviceName,\n\t\t\t\t\t\t\"aws_ecs_service\",\n\t\t\t\t\t\t\"aws\",\n\t\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\t\"task_definition\": StringValue(serviceDetails.TaskDefinition),\n\t\t\t\t\t\t\t\"cluster\":         clusterName,\n\t\t\t\t\t\t\t\"name\":            serviceName,\n\t\t\t\t\t\t\t\"id\":              serviceArn,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tecsAllowEmptyValues,\n\t\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t\t))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\ttaskDefinitionsMap := map[string]terraformutils.Resource{}\n\ttaskDefinitionsPage := ecs.NewListTaskDefinitionsPaginator(svc, &ecs.ListTaskDefinitionsInput{})\n\tfor taskDefinitionsPage.HasMorePages() {\n\t\ttaskDefinitionsNextPage, e := taskDefinitionsPage.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\tfmt.Println(e.Error())\n\t\t\tcontinue\n\t\t}\n\t\tfor _, taskDefinitionArn := range taskDefinitionsNextPage.TaskDefinitionArns {\n\t\t\tarnParts := strings.Split(taskDefinitionArn, \":\")\n\t\t\tdefinitionWithFamily := arnParts[len(arnParts)-2]\n\t\t\trevision, _ := strconv.Atoi(arnParts[len(arnParts)-1])\n\n\t\t\t// fetch only latest revision of task definitions\n\t\t\tif val, ok := taskDefinitionsMap[definitionWithFamily]; !ok || val.AdditionalFields[\"revision\"].(int) < revision {\n\t\t\t\ttaskDefinitionsMap[definitionWithFamily] = terraformutils.NewResource(\n\t\t\t\t\ttaskDefinitionArn,\n\t\t\t\t\tdefinitionWithFamily,\n\t\t\t\t\t\"aws_ecs_task_definition\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"task_definition\":       taskDefinitionArn,\n\t\t\t\t\t\t\"container_definitions\": \"{}\",\n\t\t\t\t\t\t\"family\":                \"test-task\",\n\t\t\t\t\t\t\"arn\":                   taskDefinitionArn,\n\t\t\t\t\t},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\"revision\": revision,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\tfor _, v := range taskDefinitionsMap {\n\t\tdelete(v.AdditionalFields, \"revision\")\n\t\tg.Resources = append(g.Resources, v)\n\t}\n\n\treturn nil\n}\n\nfunc (g *EcsGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_ecs_service\" {\n\t\t\tcontinue\n\t\t}\n\t\tif r.InstanceState.Attributes[\"propagate_tags\"] == \"NONE\" {\n\t\t\tdelete(r.Item, \"propagate_tags\")\n\t\t}\n\t\tdelete(r.Item, \"iam_role\")\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/efs.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/efs\"\n)\n\nvar efsAllowEmptyValues = []string{\"tags.\"}\n\ntype EfsGenerator struct {\n\tAWSService\n}\n\nfunc (g *EfsGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := efs.NewFromConfig(config)\n\tif err := g.loadFileSystem(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadAccessPoint(svc); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (g *EfsGenerator) loadFileSystem(svc *efs.Client) error {\n\tp := efs.NewDescribeFileSystemsPaginator(svc, &efs.DescribeFileSystemsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, fileSystem := range page.FileSystems {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(fileSystem.FileSystemId),\n\t\t\t\tStringValue(fileSystem.FileSystemId),\n\t\t\t\t\"aws_efs_file_system\",\n\t\t\t\t\"aws\",\n\t\t\t\tefsAllowEmptyValues))\n\n\t\t\ttargetsResponse, err := svc.DescribeMountTargets(context.TODO(), &efs.DescribeMountTargetsInput{\n\t\t\t\tFileSystemId: fileSystem.FileSystemId,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, mountTarget := range targetsResponse.MountTargets {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\tStringValue(mountTarget.MountTargetId),\n\t\t\t\t\tStringValue(mountTarget.MountTargetId),\n\t\t\t\t\t\"aws_efs_mount_target\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tefsAllowEmptyValues))\n\t\t\t}\n\n\t\t\tpolicyResponse, err := svc.DescribeFileSystemPolicy(context.TODO(), &efs.DescribeFileSystemPolicyInput{\n\t\t\t\tFileSystemId: fileSystem.FileSystemId,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tStringValue(fileSystem.FileSystemId),\n\t\t\t\tStringValue(fileSystem.FileSystemId),\n\t\t\t\t\"aws_efs_file_system_policy\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"file_system_id\": StringValue(fileSystem.FileSystemId),\n\t\t\t\t\t\"policy\":         StringValue(policyResponse.Policy),\n\t\t\t\t},\n\t\t\t\tefsAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *EfsGenerator) loadAccessPoint(svc *efs.Client) error {\n\tp := efs.NewDescribeAccessPointsPaginator(svc, &efs.DescribeAccessPointsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, fileSystem := range page.AccessPoints {\n\t\t\tid := StringValue(fileSystem.AccessPointId)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tid,\n\t\t\t\t\"aws_efs_access_point\",\n\t\t\t\t\"aws\",\n\t\t\t\tefsAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\n// PostConvertHook for add policy json as heredoc\nfunc (g *EfsGenerator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"aws_efs_file_system_policy\" {\n\t\t\tif val, ok := g.Resources[i].Item[\"policy\"]; ok {\n\t\t\t\tpolicy := g.escapeAwsInterpolation(val.(string))\n\t\t\t\tg.Resources[i].Item[\"policy\"] = fmt.Sprintf(`<<POLICY\n%s\nPOLICY`, policy)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/eip.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar eipAllowEmptyValues = []string{\"tags.\"}\n\ntype ElasticIPGenerator struct {\n\tAWSService\n}\n\nfunc (g *ElasticIPGenerator) createElasticIpsResources(svc *ec2.Client) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\taddresses, err := svc.DescribeAddresses(context.TODO(), &ec2.DescribeAddressesInput{})\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn resources\n\t}\n\n\tfor _, eip := range addresses.Addresses {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(eip.AllocationId),\n\t\t\tStringValue(eip.AllocationId),\n\t\t\t\"aws_eip\",\n\t\t\t\"aws\",\n\t\t\teipAllowEmptyValues,\n\t\t))\n\t}\n\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// create terraform resource for each elastic IPs\nfunc (g *ElasticIPGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\n\tg.Resources = g.createElasticIpsResources(svc)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/eks.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/eks\"\n)\n\nvar eksAllowEmptyValues = []string{\"tags.\"}\n\ntype EksGenerator struct {\n\tAWSService\n}\n\nfunc (g *EksGenerator) getNodeGroups(clusterName string, svc *eks.Client) error {\n\tp := eks.NewListNodegroupsPaginator(svc, &eks.ListNodegroupsInput{\n\t\tClusterName: &clusterName,\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, nodeGroupName := range page.Nodegroups {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%s:%s\", clusterName, nodeGroupName),\n\t\t\t\tnodeGroupName,\n\t\t\t\t\"aws_eks_node_group\",\n\t\t\t\t\"aws\",\n\t\t\t\teksAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *EksGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := eks.NewFromConfig(config)\n\tp := eks.NewListClustersPaginator(svc, &eks.ListClustersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, clusterName := range page.Clusters {\n\t\t\terr := g.getNodeGroups(clusterName, svc)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tclusterName,\n\t\t\t\tclusterName,\n\t\t\t\t\"aws_eks_cluster\",\n\t\t\t\t\"aws\",\n\t\t\t\teksAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *EksGenerator) PostConvertHook() error {\n\tfor _, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"aws_eks_node_group\" {\n\t\t\tif _, ok := resource.Item[\"launch_template\"]; ok {\n\t\t\t\tdelete(resource.Item[\"launch_template\"].([]interface{})[0].(map[string]interface{}), \"id\")\n\t\t\t}\n\t\t\tif _, ok := resource.Item[\"update_config\"]; ok {\n\t\t\t\tdelete(resource.Item[\"update_config\"].([]interface{})[0].(map[string]interface{}), \"max_unavailable_percentage\")\n\t\t\t}\n\t\t\tfor cluster := range g.Resources {\n\t\t\t\tif g.Resources[cluster].InstanceInfo.Type == \"aws_eks_cluster\" {\n\t\t\t\t\tif g.Resources[cluster].Item[\"name\"] == resource.Item[\"cluster_name\"] {\n\t\t\t\t\t\tresource.Item[\"cluster_name\"] = \"${aws_eks_cluster.\" + g.Resources[cluster].InstanceInfo.ResourceAddress().Name + \".name}\"\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/elastic_beanstalk.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/elasticbeanstalk\"\n)\n\nvar beanstalkAllowEmptyValues = []string{\"tags.\"}\n\ntype BeanstalkGenerator struct {\n\tAWSService\n}\n\nfunc (g *BeanstalkGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tclient := elasticbeanstalk.NewFromConfig(config)\n\n\terr := g.addApplications(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.addEnvironments(client)\n\treturn err\n}\n\nfunc (g *BeanstalkGenerator) addApplications(client *elasticbeanstalk.Client) error {\n\tresponse, err := client.DescribeApplications(context.TODO(), &elasticbeanstalk.DescribeApplicationsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, application := range response.Applications {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*application.ApplicationName,\n\t\t\t*application.ApplicationName,\n\t\t\t\"aws_elastic_beanstalk_application\",\n\t\t\t\"aws\",\n\t\t\tbeanstalkAllowEmptyValues,\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *BeanstalkGenerator) addEnvironments(client *elasticbeanstalk.Client) error {\n\tresponse, err := client.DescribeEnvironments(context.TODO(), &elasticbeanstalk.DescribeEnvironmentsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, environment := range response.Environments {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*environment.EnvironmentId,\n\t\t\t*environment.EnvironmentName,\n\t\t\t\"aws_elastic_beanstalk_environment\",\n\t\t\t\"aws\",\n\t\t\tbeanstalkAllowEmptyValues,\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/elasticache.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/elasticache\"\n)\n\nvar elastiCacheAllowEmptyValues = []string{\"tags.\"}\n\ntype ElastiCacheGenerator struct {\n\tAWSService\n}\n\nfunc (g *ElastiCacheGenerator) loadCacheClusters(svc *elasticache.Client) error {\n\tp := elasticache.NewDescribeCacheClustersPaginator(svc, &elasticache.DescribeCacheClustersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, cluster := range page.CacheClusters {\n\t\t\tresourceName := StringValue(cluster.CacheClusterId)\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_elasticache_cluster\",\n\t\t\t\t\"aws\",\n\t\t\t\telastiCacheAllowEmptyValues,\n\t\t\t)\n\t\t\t// redis only - if cluster has Replication Group not need next attributes.\n\t\t\t// terraform-aws provider has ConflictsWith on ReplicationGroupId with all next attributes,\n\t\t\t// but return all attributes on refresh :(\n\t\t\t// https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_elasticache_cluster.go#L167\n\t\t\tif StringValue(cluster.ReplicationGroupId) != \"\" {\n\t\t\t\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\t\t\t\"^availability_zones$\",\n\t\t\t\t\t\"^az_mode$\",\n\t\t\t\t\t\"^engine_version$\",\n\t\t\t\t\t\"^engine$\",\n\t\t\t\t\t\"^maintenance_window$\",\n\t\t\t\t\t\"^node_type$\",\n\t\t\t\t\t\"^notification_topic_arn$\",\n\t\t\t\t\t\"^num_cache_nodes$\",\n\t\t\t\t\t\"^parameter_group_name$\",\n\t\t\t\t\t\"^port$\",\n\t\t\t\t\t\"^security_group_ids.(.*)\",\n\t\t\t\t\t\"^security_group_names$\",\n\t\t\t\t\t\"^snapshot_arns$\",\n\t\t\t\t\t\"^snapshot_name$\",\n\t\t\t\t\t\"^snapshot_retention_limit$\",\n\t\t\t\t\t\"^snapshot_window$\",\n\t\t\t\t\t\"^subnet_group_name$\",\n\t\t\t\t)\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *ElastiCacheGenerator) loadParameterGroups(svc *elasticache.Client) error {\n\tp := elasticache.NewDescribeCacheParameterGroupsPaginator(svc, &elasticache.DescribeCacheParameterGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, parameterGroup := range page.CacheParameterGroups {\n\t\t\tresourceName := StringValue(parameterGroup.CacheParameterGroupName)\n\t\t\tif strings.Contains(resourceName, \".\") {\n\t\t\t\tcontinue // skip default Default ParameterGroups like default.redis5.0\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_elasticache_parameter_group\",\n\t\t\t\t\"aws\",\n\t\t\t\telastiCacheAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *ElastiCacheGenerator) loadSubnetGroups(svc *elasticache.Client) error {\n\tp := elasticache.NewDescribeCacheSubnetGroupsPaginator(svc, &elasticache.DescribeCacheSubnetGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, subnet := range page.CacheSubnetGroups {\n\t\t\tresourceName := StringValue(subnet.CacheSubnetGroupName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_elasticache_subnet_group\",\n\t\t\t\t\"aws\",\n\t\t\t\telastiCacheAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *ElastiCacheGenerator) loadReplicationGroups(svc *elasticache.Client) error {\n\tp := elasticache.NewDescribeReplicationGroupsPaginator(svc, &elasticache.DescribeReplicationGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, replicationGroup := range page.ReplicationGroups {\n\t\t\tresourceName := StringValue(replicationGroup.ReplicationGroupId)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_elasticache_replication_group\",\n\t\t\t\t\"aws\",\n\t\t\t\telastiCacheAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\n// Generate TerraformResources from AWS API,\n// from each database create 1 TerraformResource.\n// Need only database name as ID for terraform resource\n// AWS api support paging\nfunc (g *ElastiCacheGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := elasticache.NewFromConfig(config)\n\n\tif err := g.loadCacheClusters(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadParameterGroups(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadReplicationGroups(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadSubnetGroups(svc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *ElastiCacheGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_elasticache_cluster\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, parameterGroup := range g.Resources {\n\t\t\tif parameterGroup.InstanceInfo.Type != \"aws_elasticache_parameter_group\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif parameterGroup.InstanceState.Attributes[\"name\"] == r.InstanceState.Attributes[\"parameter_group_name\"] {\n\t\t\t\tif strings.HasPrefix(parameterGroup.InstanceState.Attributes[\"family\"], r.InstanceState.Attributes[\"engine\"]) {\n\t\t\t\t\tg.Resources[i].Item[\"parameter_group_name\"] = \"${aws_elasticache_parameter_group.\" + parameterGroup.ResourceName + \".name}\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor _, subnet := range g.Resources {\n\t\t\tif subnet.InstanceInfo.Type != \"aws_elasticache_subnet_group\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif subnet.InstanceState.Attributes[\"name\"] == r.Item[\"subnet_group_name\"] {\n\t\t\t\tg.Resources[i].Item[\"subnet_group_name\"] = \"${aws_elasticache_subnet_group.\" + subnet.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\n\t\tfor _, replicationGroup := range g.Resources {\n\t\t\tif replicationGroup.InstanceInfo.Type != \"aws_elasticache_replication_group\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif replicationGroup.InstanceState.Attributes[\"replication_group_id\"] == r.InstanceState.Attributes[\"replication_group_id\"] {\n\t\t\t\tg.Resources[i].Item[\"replication_group_id\"] = \"${aws_elasticache_replication_group.\" + replicationGroup.ResourceName + \".replication_group_id}\"\n\t\t\t}\n\t\t}\n\t}\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_elasticache_replication_group\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, subnet := range g.Resources {\n\t\t\tif subnet.InstanceInfo.Type != \"aws_elasticache_subnet_group\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif subnet.InstanceState.Attributes[\"name\"] == r.InstanceState.Attributes[\"subnet_group_name\"] {\n\t\t\t\tg.Resources[i].Item[\"subnet_group_name\"] = \"${aws_elasticache_subnet_group.\" + subnet.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/elb.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing\"\n)\n\nvar ElbAllowEmptyValues = []string{\"tags.\"}\n\ntype ElbGenerator struct {\n\tAWSService\n}\n\n// Generate TerraformResources from AWS API,\n// from each ELB create 1 TerraformResource.\n// Need only ELB name as ID for terraform resource\n// AWS api support paging\nfunc (g *ElbGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := elasticloadbalancing.NewFromConfig(config)\n\tp := elasticloadbalancing.NewDescribeLoadBalancersPaginator(svc, &elasticloadbalancing.DescribeLoadBalancersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tfor _, loadBalancer := range page.LoadBalancerDescriptions {\n\t\t\tresourceName := StringValue(loadBalancer.LoadBalancerName)\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_elb\",\n\t\t\t\t\"aws\",\n\t\t\t\tElbAllowEmptyValues,\n\t\t\t)\n\t\t\tresource.IgnoreKeys = append(resource.IgnoreKeys, \"^instances\\\\.(.*)\") // don't import current connect instances to ELB\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/emr.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/emr\"\n)\n\nvar emrAllowEmptyValues = []string{\"tags.\"}\n\ntype EmrGenerator struct {\n\tAWSService\n}\n\nfunc (g *EmrGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tclient := emr.NewFromConfig(config)\n\n\terr := g.addClusters(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.addSecurityConfigurations(client)\n\treturn err\n}\n\nfunc (g *EmrGenerator) addClusters(client *emr.Client) error {\n\tp := emr.NewListClustersPaginator(client, &emr.ListClustersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, cluster := range page.Clusters {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*cluster.Id,\n\t\t\t\t*cluster.Name,\n\t\t\t\t\"aws_emr_cluster\",\n\t\t\t\t\"aws\",\n\t\t\t\temrAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *EmrGenerator) addSecurityConfigurations(client *emr.Client) error {\n\tp := emr.NewListSecurityConfigurationsPaginator(client, &emr.ListSecurityConfigurationsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, securityConfiguration := range page.SecurityConfigurations {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*securityConfiguration.Name,\n\t\t\t\t*securityConfiguration.Name,\n\t\t\t\t\"aws_emr_security_configuration\",\n\t\t\t\t\"aws\",\n\t\t\t\temrAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/eni.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar EniAllowEmptyValues = []string{\"tags.\"}\n\ntype EniGenerator struct {\n\tAWSService\n}\n\nfunc (EniGenerator) createResources(enis *ec2.DescribeNetworkInterfacesOutput) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, eni := range enis.NetworkInterfaces {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(eni.NetworkInterfaceId),\n\t\t\tStringValue(eni.NetworkInterfaceId),\n\t\t\t\"aws_network_interface\",\n\t\t\t\"aws\",\n\t\t\tEniAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// from each ENI creates 1 TerraformResource.\nfunc (g *EniGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tp := ec2.NewDescribeNetworkInterfacesPaginator(svc, &ec2.DescribeNetworkInterfacesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, e := p.NextPage(context.TODO())\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createResources(page)...)\n\t}\n\treturn nil\n}\n\nfunc (g *EniGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_network_interface\" {\n\t\t\tcontinue\n\t\t}\n\t\tif _, hasAttachment := r.Item[\"attachment\"]; hasAttachment {\n\t\t\tif attInstance, hasAttachment := r.InstanceState.Attributes[\"attachment.0.instance\"]; !hasAttachment || attInstance == \"\" {\n\t\t\t\tdelete(r.Item, \"attachment\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/es.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tes \"github.com/aws/aws-sdk-go-v2/service/elasticsearchservice\"\n)\n\nvar esAllowEmptyValues = []string{\"tags.\"}\n\ntype EsGenerator struct {\n\tAWSService\n}\n\nfunc (g *EsGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := es.NewFromConfig(config)\n\n\tdomainNames, err := svc.ListDomainNames(context.TODO(), &es.ListDomainNamesInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, domainName := range domainNames.DomainNames {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tStringValue(domainName.DomainName),\n\t\t\tStringValue(domainName.DomainName),\n\t\t\t\"aws_elasticsearch_domain\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"domain_name\": StringValue(domainName.DomainName),\n\t\t\t},\n\t\t\tesAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn nil\n}\n\nfunc (g *EsGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_elasticsearch_domain\" {\n\t\t\tcontinue\n\t\t}\n\t\tif r.InstanceState.Attributes[\"cognito_options.0.enabled\"] == \"false\" {\n\t\t\tdelete(r.Item, \"cognito_options\")\n\t\t}\n\t\tif r.InstanceState.Attributes[\"cluster_config.0.warm_count\"] == \"0\" {\n\t\t\tdelete(r.Item[\"cluster_config\"].([]interface{})[0].(map[string]interface{}), \"warm_count\")\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/firehose.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/firehose\"\n)\n\ntype FirehoseGenerator struct {\n\tAWSService\n}\n\nfunc (g *FirehoseGenerator) createResources(streamNames []string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, resourceName := range streamNames {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tresourceName,\n\t\t\tresourceName,\n\t\t\t\"aws_kinesis_firehose_delivery_stream\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\"name\": resourceName},\n\t\t\t[]string{\".tags\"},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// Need deliver stream name for terraform resource\nfunc (g *FirehoseGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := firehose.NewFromConfig(config)\n\tvar streamNames []string\n\tvar lastStreamName *string\n\tfor {\n\t\toutput, err := svc.ListDeliveryStreams(context.TODO(), &firehose.ListDeliveryStreamsInput{\n\t\t\tExclusiveStartDeliveryStreamName: lastStreamName,\n\t\t\tLimit:                            aws.Int32(100),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tstreamNames = append(streamNames, output.DeliveryStreamNames...)\n\t\tif !*output.HasMoreDeliveryStreams {\n\t\t\tbreak\n\t\t}\n\n\t\tlastStreamName = aws.String(streamNames[len(streamNames)-1])\n\t}\n\n\tg.Resources = g.createResources(streamNames)\n\n\treturn nil\n}\n\nfunc (g *FirehoseGenerator) PostConvertHook() error {\n\tfor _, resource := range g.Resources {\n\t\t_, hasExtendedS3Configuration := resource.Item[\"extended_s3_configuration\"]\n\t\t_, hasS3Configuration := resource.Item[\"s3_configuration\"]\n\t\tif hasExtendedS3Configuration && hasS3Configuration {\n\t\t\tdelete(resource.Item, \"s3_configuration\")\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/glue.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/glue\"\n)\n\ntype GlueGenerator struct {\n\tAWSService\n}\n\nfunc (g *GlueGenerator) loadGlueCrawlers(svc *glue.Client) error {\n\tvar GlueCrawlerAllowEmptyValues = []string{\"tags.\"}\n\tp := glue.NewGetCrawlersPaginator(svc, &glue.GetCrawlersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, crawler := range page.Crawlers {\n\t\t\tresource := terraformutils.NewSimpleResource(*crawler.Name, *crawler.Name,\n\t\t\t\t\"aws_glue_crawler\",\n\t\t\t\t\"aws\",\n\t\t\t\tGlueCrawlerAllowEmptyValues)\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *GlueGenerator) loadGlueCatalogDatabase(svc *glue.Client, account *string) (databaseNames []*string, error error) {\n\tvar GlueCatalogDatabaseAllowEmptyValues = []string{\"tags.\"}\n\tp := glue.NewGetDatabasesPaginator(svc, &glue.GetDatabasesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, error := p.NextPage(context.TODO())\n\t\tif error != nil {\n\t\t\treturn databaseNames, error\n\t\t}\n\t\tfor _, catalogDatabase := range page.DatabaseList {\n\t\t\t// format of ID is \"CATALOG-ID:DATABASE-NAME\".\n\t\t\t// CATALOG-ID is AWS Account ID\n\t\t\t// https://docs.aws.amazon.com/cli/latest/reference/glue/create-database.html#options\n\t\t\tid := *account + \":\" + *catalogDatabase.Name\n\t\t\tresource := terraformutils.NewSimpleResource(id, *catalogDatabase.Name,\n\t\t\t\t\"aws_glue_catalog_database\",\n\t\t\t\t\"aws\",\n\t\t\t\tGlueCatalogDatabaseAllowEmptyValues)\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t\tdatabaseNames = append(databaseNames, catalogDatabase.Name)\n\t\t}\n\t}\n\treturn databaseNames, nil\n}\n\nfunc (g *GlueGenerator) loadGlueCatalogTable(svc *glue.Client, account *string, databaseName *string) error {\n\t// format of ID is \"CATALOG-ID:DATABASE-NAME:TABLE-NAME\".\n\t// CATALOG-ID is AWS Account ID\n\t// https://docs.aws.amazon.com/cli/latest/reference/glue/create-database.html#options\n\tvar GlueCatalogTableAllowEmptyValues = []string{\"tags.\"}\n\tp := glue.NewGetTablesPaginator(svc, &glue.GetTablesInput{DatabaseName: databaseName})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, catalogTable := range page.TableList {\n\t\t\tdatabaseTable := *databaseName + \":\" + *catalogTable.Name\n\t\t\tid := *account + \":\" + databaseTable\n\t\t\tresource := terraformutils.NewSimpleResource(id, databaseTable,\n\t\t\t\t\"aws_glue_catalog_table\",\n\t\t\t\t\"aws\",\n\t\t\t\tGlueCatalogTableAllowEmptyValues)\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *GlueGenerator) loadGlueJobs(svc *glue.Client) error {\n\tvar GlueJobAllowEmptyValues = []string{\"tags.\"}\n\tp := glue.NewGetJobsPaginator(svc, &glue.GetJobsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, job := range page.Jobs {\n\t\t\tresource := terraformutils.NewSimpleResource(*job.Name, *job.Name,\n\t\t\t\t\"aws_glue_job\",\n\t\t\t\t\"aws\",\n\t\t\t\tGlueJobAllowEmptyValues)\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *GlueGenerator) loadGlueTriggers(svc *glue.Client) error {\n\tvar GlueTriggerAllowEmptyValues = []string{\"tags.\"}\n\tp := glue.NewGetTriggersPaginator(svc, &glue.GetTriggersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, trigger := range page.Triggers {\n\t\t\tresource := terraformutils.NewSimpleResource(*trigger.Name, *trigger.Name,\n\t\t\t\t\"aws_glue_trigger\",\n\t\t\t\t\"aws\",\n\t\t\t\tGlueTriggerAllowEmptyValues)\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t}\n\t}\n\treturn nil\n}\n\n// Generate TerraformResources from AWS API,\n// from each database create 1 TerraformResource.\n// Need only database name as ID for terraform resource\n// AWS api support paging\nfunc (g *GlueGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := glue.NewFromConfig(config)\n\n\taccount, err := g.getAccountNumber(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadGlueCrawlers(svc); err != nil {\n\t\treturn err\n\t}\n\tvar DatabaseNames []*string\n\tif DatabaseNames, err = g.loadGlueCatalogDatabase(svc, account); err != nil {\n\t\treturn err\n\t}\n\tfor _, DatabaseName := range DatabaseNames {\n\t\tif err := g.loadGlueCatalogTable(svc, account, DatabaseName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := g.loadGlueJobs(svc); err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadGlueTriggers(svc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/iam.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/iam\"\n\t\"github.com/aws/aws-sdk-go-v2/service/iam/types\"\n)\n\nvar IamAllowEmptyValues = []string{\"tags.\"}\n\nvar IamAdditionalFields = map[string]interface{}{}\n\ntype IamGenerator struct {\n\tAWSService\n}\n\nfunc (g *IamGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := iam.NewFromConfig(config)\n\tg.Resources = []terraformutils.Resource{}\n\terr := g.getUsers(svc)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\terr = g.getGroups(svc)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\terr = g.getPolicies(svc)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\terr = g.getRoles(svc)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\terr = g.getInstanceProfiles(svc)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn nil\n}\n\nfunc (g *IamGenerator) getRoles(svc *iam.Client) error {\n\tp := iam.NewListRolesPaginator(svc, &iam.ListRolesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, role := range page.Roles {\n\t\t\troleName := StringValue(role.RoleName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\troleName,\n\t\t\t\troleName,\n\t\t\t\t\"aws_iam_role\",\n\t\t\t\t\"aws\",\n\t\t\t\tIamAllowEmptyValues))\n\t\t\trolePoliciesPage := iam.NewListRolePoliciesPaginator(svc, &iam.ListRolePoliciesInput{RoleName: role.RoleName})\n\t\t\tfor rolePoliciesPage.HasMorePages() {\n\t\t\t\trolePoliciesNextPage, err := rolePoliciesPage.NextPage(context.TODO())\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor _, policyName := range rolePoliciesNextPage.PolicyNames {\n\t\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\t\troleName+\":\"+policyName,\n\t\t\t\t\t\troleName+\"_\"+policyName,\n\t\t\t\t\t\t\"aws_iam_role_policy\",\n\t\t\t\t\t\t\"aws\",\n\t\t\t\t\t\tIamAllowEmptyValues))\n\t\t\t\t}\n\t\t\t}\n\t\t\troleAttachedPoliciesPage := iam.NewListAttachedRolePoliciesPaginator(svc, &iam.ListAttachedRolePoliciesInput{\n\t\t\t\tRoleName: &roleName,\n\t\t\t})\n\t\t\tfor roleAttachedPoliciesPage.HasMorePages() {\n\t\t\t\troleAttachedPoliciesNextPage, err := roleAttachedPoliciesPage.NextPage(context.TODO())\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor _, attachedPolicy := range roleAttachedPoliciesNextPage.AttachedPolicies {\n\t\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\t\troleName+\"/\"+*attachedPolicy.PolicyArn,\n\t\t\t\t\t\troleName+\"_\"+*attachedPolicy.PolicyName,\n\t\t\t\t\t\t\"aws_iam_role_policy_attachment\",\n\t\t\t\t\t\t\"aws\",\n\t\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\t\"role\":       roleName,\n\t\t\t\t\t\t\t\"policy_arn\": *attachedPolicy.PolicyArn,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tIamAllowEmptyValues,\n\t\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *IamGenerator) getUsers(svc *iam.Client) error {\n\tp := iam.NewListUsersPaginator(svc, &iam.ListUsersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, user := range page.Users {\n\t\t\tresourceName := StringValue(user.UserName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tresourceName,\n\t\t\t\tStringValue(user.UserId),\n\t\t\t\t\"aws_iam_user\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"force_destroy\": \"false\",\n\t\t\t\t},\n\t\t\t\tIamAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{}))\n\t\t\terr := g.getUserPolices(svc, user.UserName)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\terr = g.getUserPolicyAttachment(svc, user.UserName)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\terr = g.getUserGroup(svc, user.UserName)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\terr = g.getUserAccessKey(svc, user.UserName, StringValue(user.UserId))\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *IamGenerator) getUserGroup(svc *iam.Client, userName *string) error {\n\tp := iam.NewListGroupsForUserPaginator(svc, &iam.ListGroupsForUserInput{UserName: userName})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, group := range page.Groups {\n\t\t\tuserGroupMembership := *userName + \"/\" + *group.GroupName\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tuserGroupMembership,\n\t\t\t\tuserGroupMembership,\n\t\t\t\t\"aws_iam_user_group_membership\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"user\":     *userName,\n\t\t\t\t\t\"groups.#\": \"1\",\n\t\t\t\t\t\"groups.0\": *group.GroupName,\n\t\t\t\t},\n\t\t\t\tIamAllowEmptyValues,\n\t\t\t\tIamAdditionalFields,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *IamGenerator) getUserPolices(svc *iam.Client, userName *string) error {\n\tp := iam.NewListUserPoliciesPaginator(svc, &iam.ListUserPoliciesInput{UserName: userName})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, policy := range page.PolicyNames {\n\t\t\tresourceName := StringValue(userName) + \"_\" + policy\n\t\t\tresourceName = strings.ReplaceAll(resourceName, \"@\", \"\")\n\t\t\tpolicyID := StringValue(userName) + \":\" + policy\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tpolicyID,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_iam_user_policy\",\n\t\t\t\t\"aws\",\n\t\t\t\tIamAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *IamGenerator) getUserPolicyAttachment(svc *iam.Client, userName *string) error {\n\tp := iam.NewListAttachedUserPoliciesPaginator(svc, &iam.ListAttachedUserPoliciesInput{\n\t\tUserName: userName,\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, attachedPolicy := range page.AttachedPolicies {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*userName+\"/\"+*attachedPolicy.PolicyArn,\n\t\t\t\t*userName+\"_\"+*attachedPolicy.PolicyName,\n\t\t\t\t\"aws_iam_user_policy_attachment\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"user\":       *userName,\n\t\t\t\t\t\"policy_arn\": *attachedPolicy.PolicyArn,\n\t\t\t\t},\n\t\t\t\tIamAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *IamGenerator) getPolicies(svc *iam.Client) error {\n\tp := iam.NewListPoliciesPaginator(svc, &iam.ListPoliciesInput{Scope: types.PolicyScopeTypeLocal})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, policy := range page.Policies {\n\t\t\tresourceName := StringValue(policy.PolicyName)\n\t\t\tpolicyARN := StringValue(policy.Arn)\n\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tpolicyARN,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_iam_policy\",\n\t\t\t\t\"aws\",\n\t\t\t\tIamAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *IamGenerator) getGroups(svc *iam.Client) error {\n\tp := iam.NewListGroupsPaginator(svc, &iam.ListGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, group := range page.Groups {\n\t\t\tresourceName := StringValue(group.GroupName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_iam_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tIamAllowEmptyValues))\n\t\t\tg.getGroupPolicies(svc, group)\n\t\t\tg.getAttachedGroupPolicies(svc, group)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *IamGenerator) getGroupPolicies(svc *iam.Client, group types.Group) {\n\tgroupPoliciesPage := iam.NewListGroupPoliciesPaginator(svc, &iam.ListGroupPoliciesInput{GroupName: group.GroupName})\n\tfor groupPoliciesPage.HasMorePages() {\n\t\tgroupPoliciesNextPage, err := groupPoliciesPage.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, policy := range groupPoliciesNextPage.PolicyNames {\n\t\t\tid := *group.GroupName + \":\" + policy\n\t\t\tgroupPolicyName := *group.GroupName + \"_\" + policy\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tid,\n\t\t\t\tgroupPolicyName,\n\t\t\t\t\"aws_iam_group_policy\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{},\n\t\t\t\tIamAllowEmptyValues,\n\t\t\t\tIamAdditionalFields))\n\t\t}\n\t}\n}\n\nfunc (g *IamGenerator) getAttachedGroupPolicies(svc *iam.Client, group types.Group) {\n\tgroupAttachedPoliciesPage := iam.NewListAttachedGroupPoliciesPaginator(svc,\n\t\t&iam.ListAttachedGroupPoliciesInput{GroupName: group.GroupName})\n\tfor groupAttachedPoliciesPage.HasMorePages() {\n\t\tgroupAttachedPoliciesNextPage, err := groupAttachedPoliciesPage.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, attachedPolicy := range groupAttachedPoliciesNextPage.AttachedPolicies {\n\t\t\tif !strings.Contains(*attachedPolicy.PolicyArn, \"arn:aws:iam::aws\") {\n\t\t\t\tcontinue // map only AWS managed policies since others should be managed by\n\t\t\t}\n\t\t\tid := *group.GroupName + \"/\" + *attachedPolicy.PolicyArn\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tid,\n\t\t\t\t*group.GroupName+\"_\"+*attachedPolicy.PolicyName,\n\t\t\t\t\"aws_iam_group_policy_attachment\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"group\":      *group.GroupName,\n\t\t\t\t\t\"policy_arn\": *attachedPolicy.PolicyArn,\n\t\t\t\t},\n\t\t\t\tIamAllowEmptyValues,\n\t\t\t\tIamAdditionalFields))\n\t\t}\n\t}\n}\n\nfunc (g *IamGenerator) getInstanceProfiles(svc *iam.Client) error {\n\tp := iam.NewListInstanceProfilesPaginator(svc, &iam.ListInstanceProfilesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, instanceProfile := range page.InstanceProfiles {\n\t\t\tresourceName := *instanceProfile.InstanceProfileName\n\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_iam_instance_profile\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\": resourceName,\n\t\t\t\t},\n\t\t\t\tIamAllowEmptyValues,\n\t\t\t\tIamAdditionalFields))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *IamGenerator) getUserAccessKey(svc *iam.Client, userName *string, userID string) error {\n\tp := iam.NewListAccessKeysPaginator(svc, &iam.ListAccessKeysInput{UserName: userName})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, key := range page.AccessKeyMetadata {\n\t\t\taccessKeyID := StringValue(key.AccessKeyId)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\taccessKeyID,\n\t\t\t\taccessKeyID,\n\t\t\t\t\"aws_iam_access_key\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"user\": *userName,\n\t\t\t\t},\n\t\t\t\tIamAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"depends_on\": []string{\"aws_iam_user.tfer--\" + userID},\n\t\t\t\t}))\n\t\t}\n\t}\n\treturn nil\n}\n\n// PostGenerateHook for add policy json as heredoc\nfunc (g *IamGenerator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tswitch {\n\t\tcase resource.InstanceInfo.Type == \"aws_iam_policy\" ||\n\t\t\tresource.InstanceInfo.Type == \"aws_iam_user_policy\" ||\n\t\t\tresource.InstanceInfo.Type == \"aws_iam_group_policy\" ||\n\t\t\tresource.InstanceInfo.Type == \"aws_iam_role_policy\":\n\t\t\tpolicy := g.escapeAwsInterpolation(resource.Item[\"policy\"].(string))\n\t\t\tresource.Item[\"policy\"] = fmt.Sprintf(`<<POLICY\n%s\nPOLICY`, policy)\n\t\tcase resource.InstanceInfo.Type == \"aws_iam_role\":\n\t\t\tpolicy := g.escapeAwsInterpolation(resource.Item[\"assume_role_policy\"].(string))\n\t\t\tg.Resources[i].Item[\"assume_role_policy\"] = fmt.Sprintf(`<<POLICY\n%s\nPOLICY`, policy)\n\t\tcase resource.InstanceInfo.Type == \"aws_iam_instance_profile\":\n\t\t\tdelete(resource.Item, \"roles\")\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/identitystore.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/identitystore\"\n\t\"github.com/aws/aws-sdk-go-v2/service/identitystore/types\"\n\t\"github.com/aws/aws-sdk-go-v2/service/ssoadmin\"\n)\n\nvar identityStoreAllowEmptyValues = []string{\"tags.\"}\n\ntype IdentityStoreGenerator struct {\n\tAWSService\n}\n\nfunc (g *IdentityStoreGenerator) GetIdentityStoreId() (*string, error) {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\tsvc := ssoadmin.NewFromConfig(config)\n\tinstances, err := svc.ListInstances(context.TODO(), &ssoadmin.ListInstancesInput{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(instances.Instances) == 0 {\n\t\treturn nil, nil\n\t}\n\tidentityStoreId := StringValue(instances.Instances[0].IdentityStoreId)\n\treturn &identityStoreId, nil\n\n}\n\nfunc (g *IdentityStoreGenerator) InitGroupResources(identityStoreId string) error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := identitystore.NewFromConfig(config)\n\tp := identitystore.NewListGroupsPaginator(svc, &identitystore.ListGroupsInput{\n\t\tIdentityStoreId: aws.String(identityStoreId),\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, group := range page.Groups {\n\t\t\tgroupId := StringValue(group.GroupId)\n\t\t\tdisplayName := StringValue(group.DisplayName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tidentityStoreId+\"/\"+groupId,\n\t\t\t\tdisplayName,\n\t\t\t\t\"aws_identitystore_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"identity_store_id\": identityStoreId,\n\t\t\t\t\t\"description\":       StringValue(group.Description),\n\t\t\t\t},\n\t\t\t\tidentityStoreAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t\terr = g.InitGroupMembershipResources(identityStoreId, groupId)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *IdentityStoreGenerator) InitGroupMembershipResources(identityStoreId string, groupId string) error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := identitystore.NewFromConfig(config)\n\tp := identitystore.NewListGroupMembershipsPaginator(svc, &identitystore.ListGroupMembershipsInput{\n\t\tGroupId:         aws.String(groupId),\n\t\tIdentityStoreId: aws.String(identityStoreId),\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, user := range page.GroupMemberships {\n\t\t\tvar memberId string\n\t\t\tswitch v := user.MemberId.(type) {\n\t\t\tcase *types.MemberIdMemberUserId:\n\t\t\t\tmemberId = v.Value // Value is string\n\t\t\tcase *types.UnknownUnionMember:\n\t\t\t\tmemberId = v.Tag\n\t\t\tdefault:\n\t\t\t\tmemberId = \"\"\n\t\t\t}\n\t\t\tmembershipId := StringValue(user.MembershipId)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tidentityStoreId+\"/\"+membershipId,\n\t\t\t\t\"m-\"+groupId+\"-\"+memberId,\n\t\t\t\t\"aws_identitystore_group_membership\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"identity_store_id\": identityStoreId,\n\t\t\t\t\t\"group_id\":          groupId,\n\t\t\t\t\t\"member_id\":         memberId,\n\t\t\t\t},\n\t\t\t\tidentityStoreAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *IdentityStoreGenerator) InitUserResources(identityStoreId string) error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := identitystore.NewFromConfig(config)\n\tp := identitystore.NewListUsersPaginator(svc, &identitystore.ListUsersInput{\n\t\tIdentityStoreId: aws.String(identityStoreId),\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, user := range page.Users {\n\t\t\tuserId := StringValue(user.UserId)\n\t\t\tdisplayName := StringValue(user.DisplayName)\n\t\t\t//\t\t\tname := StringValue(user.Name)\n\t\t\tuserName := StringValue(user.UserName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tidentityStoreId+\"/\"+userId,\n\t\t\t\tuserName,\n\t\t\t\t\"aws_identitystore_user\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"identity_store_id\": identityStoreId,\n\t\t\t\t\t\"display_name\":      displayName,\n\t\t\t\t\t\"use_name\":          userName,\n\t\t\t\t},\n\t\t\t\tidentityStoreAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *IdentityStoreGenerator) InitResources() error {\n\tidentityStoreId, e := g.GetIdentityStoreId()\n\tif e != nil {\n\t\treturn e\n\t}\n\tif identityStoreId == nil {\n\t\treturn nil\n\t}\n\n\te = g.InitUserResources(*identityStoreId)\n\tif e != nil {\n\t\treturn e\n\t}\n\n\te = g.InitGroupResources(*identityStoreId)\n\tif e != nil {\n\t\treturn e\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/igw.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar IgwAllowEmptyValues = []string{\"tags.\"}\n\ntype IgwGenerator struct {\n\tAWSService\n}\n\n// Generate TerraformResources from AWS API,\n// from each Internet gateway create 1 TerraformResource.\n// Need InternetGatewayId as ID for terraform resource\nfunc (g *IgwGenerator) createResources(igws *ec2.DescribeInternetGatewaysOutput) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, internetGateway := range igws.InternetGateways {\n\t\tif len(internetGateway.Attachments) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(internetGateway.InternetGatewayId),\n\t\t\tStringValue(internetGateway.InternetGatewayId),\n\t\t\t\"aws_internet_gateway\",\n\t\t\t\"aws\",\n\t\t\tIgwAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *IgwGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tp := ec2.NewDescribeInternetGatewaysPaginator(svc, &ec2.DescribeInternetGatewaysInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createResources(page)...)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/iot.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/iot\"\n)\n\nvar iotAllowEmptyValues = []string{\"tags.\"}\n\ntype IotGenerator struct {\n\tAWSService\n}\n\nfunc (g *IotGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := iot.NewFromConfig(config)\n\n\tif err := g.loadThingTypes(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadThings(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadTopicRules(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadRoleAliases(svc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *IotGenerator) loadThingTypes(svc *iot.Client) error {\n\toutput, err := svc.ListThingTypes(context.TODO(), &iot.ListThingTypesInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, thingType := range output.ThingTypes {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*thingType.ThingTypeName,\n\t\t\t*thingType.ThingTypeName,\n\t\t\t\"aws_iot_thing_type\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\": *thingType.ThingTypeName,\n\t\t\t},\n\t\t\tiotAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *IotGenerator) loadThings(svc *iot.Client) error {\n\toutput, err := svc.ListThings(context.TODO(), &iot.ListThingsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, thing := range output.Things {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*thing.ThingName,\n\t\t\t*thing.ThingName,\n\t\t\t\"aws_iot_thing\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\": *thing.ThingName,\n\t\t\t},\n\t\t\tiotAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *IotGenerator) loadTopicRules(svc *iot.Client) error {\n\toutput, err := svc.ListTopicRules(context.TODO(), &iot.ListTopicRulesInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, rule := range output.Rules {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*rule.RuleName,\n\t\t\t*rule.RuleName,\n\t\t\t\"aws_iot_topic_rule\",\n\t\t\t\"aws\",\n\t\t\tiotAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *IotGenerator) loadRoleAliases(svc *iot.Client) error {\n\toutput, err := svc.ListRoleAliases(context.TODO(), &iot.ListRoleAliasesInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, roleAlias := range output.RoleAliases {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\troleAlias,\n\t\t\troleAlias,\n\t\t\t\"aws_iot_role_alias\",\n\t\t\t\"aws\",\n\t\t\tiotAllowEmptyValues))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/kinesis.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/kinesis\"\n)\n\nvar kinesisAllowEmptyValues = []string{\"tags.\"}\n\ntype KinesisGenerator struct {\n\tAWSService\n}\n\nfunc (g *KinesisGenerator) createResources(streamNames []string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, resourceName := range streamNames {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tresourceName,\n\t\t\tresourceName,\n\t\t\t\"aws_kinesis_stream\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\"name\": resourceName},\n\t\t\tkinesisAllowEmptyValues,\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn resources\n}\n\nfunc (g *KinesisGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := kinesis.NewFromConfig(config)\n\n\tvar results *kinesis.ListStreamsOutput\n\tvar request = kinesis.ListStreamsInput{}\n\tvar err error\n\n\tfor results == nil || *results.HasMoreStreams {\n\t\tresults, err = svc.ListStreams(context.TODO(), &request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tg.Resources = append(g.Resources, g.createResources(results.StreamNames)...)\n\n\t\tif len(results.StreamNames) > 0 {\n\t\t\trequest = kinesis.ListStreamsInput{\n\t\t\t\tExclusiveStartStreamName: &results.StreamNames[len(results.StreamNames)-1],\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/kms.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/kms\"\n\t\"github.com/aws/aws-sdk-go-v2/service/kms/types\"\n)\n\nvar kmsAllowEmptyValues = []string{\"tags.\"}\n\ntype KmsGenerator struct {\n\tAWSService\n}\n\nfunc (g *KmsGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tclient := kms.NewFromConfig(config)\n\n\terr := g.addKeys(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.addAliases(client)\n\treturn err\n}\n\nfunc (g *KmsGenerator) addKeys(client *kms.Client) error {\n\tp := kms.NewListKeysPaginator(client, &kms.ListKeysInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, key := range page.Keys {\n\t\t\tkeyDescription, err := client.DescribeKey(context.TODO(), &kms.DescribeKeyInput{\n\t\t\t\tKeyId: key.KeyId,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif keyDescription.KeyMetadata.KeyManager == types.KeyManagerTypeCustomer {\n\t\t\t\tresource := terraformutils.NewResource(\n\t\t\t\t\t*key.KeyId,\n\t\t\t\t\t*key.KeyId,\n\t\t\t\t\t\"aws_kms_key\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"key_id\": *key.KeyId,\n\t\t\t\t\t},\n\t\t\t\t\tkmsAllowEmptyValues,\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t)\n\t\t\t\tresource.SlowQueryRequired = true\n\t\t\t\tg.Resources = append(g.Resources, resource)\n\n\t\t\t\tg.addGrants(key.KeyId, client)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *KmsGenerator) addAliases(client *kms.Client) error {\n\tp := kms.NewListAliasesPaginator(client, &kms.ListAliasesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, alias := range page.Aliases {\n\t\t\tif alias.TargetKeyId == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tkeyDescription, err := client.DescribeKey(context.TODO(), &kms.DescribeKeyInput{\n\t\t\t\tKeyId: alias.TargetKeyId,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif keyDescription.KeyMetadata.KeyManager == types.KeyManagerTypeCustomer {\n\t\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\t\t*alias.AliasName,\n\t\t\t\t\t*alias.AliasName,\n\t\t\t\t\t\"aws_kms_alias\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tkmsAllowEmptyValues,\n\t\t\t\t)\n\t\t\t\tresource.SlowQueryRequired = true\n\t\t\t\tg.Resources = append(g.Resources, resource)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *KmsGenerator) addGrants(keyID *string, client *kms.Client) {\n\tp := kms.NewListGrantsPaginator(client, &kms.ListGrantsInput{\n\t\tKeyId: keyID,\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t\tfor _, grant := range page.Grants {\n\t\t\tgrantID := *grant.KeyId + \":\" + *grant.GrantId\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tgrantID,\n\t\t\t\tgrantID,\n\t\t\t\t\"aws_kms_grant\",\n\t\t\t\t\"aws\",\n\t\t\t\tkmsAllowEmptyValues,\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "providers/aws/lambda.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"errors\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/lambda\"\n\t\"github.com/aws/smithy-go\"\n)\n\nvar lambdaAllowEmptyValues = []string{\"tags.\"}\n\ntype LambdaGenerator struct {\n\tAWSService\n}\n\ntype Statement struct {\n\tSid string `json:\"Sid\"`\n}\n\ntype Policy struct {\n\tVersion   string       `json:\"Version\"`\n\tID        string       `json:\"Id\"`\n\tStatement []*Statement `json:\"Statement\"`\n}\n\nfunc (g *LambdaGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := lambda.NewFromConfig(config)\n\n\terr := g.addFunctions(svc)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.addEventSourceMappings(svc)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.addLayerVersions(svc)\n\treturn err\n}\n\nfunc (g *LambdaGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif _, exist := r.Item[\"environment\"]; !exist {\n\t\t\tcontinue\n\t\t}\n\t\tvariables := g.Resources[i].Item[\"environment\"].([]interface{})[0].(map[string]interface{})[\"variables\"]\n\t\tg.Resources[i].Item[\"environment\"] = []interface{}{\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"variables\": []map[string]interface{}{variables.(map[string]interface{})},\n\t\t\t},\n\t\t}\n\t}\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_lambda_function_event_invoke_config\" {\n\t\t\tcontinue\n\t\t}\n\t\tif r.InstanceState.Attributes[\"maximum_event_age_in_seconds\"] == \"0\" {\n\t\t\tdelete(r.Item, \"maximum_event_age_in_seconds\")\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *LambdaGenerator) addFunctions(svc *lambda.Client) error {\n\tp := lambda.NewListFunctionsPaginator(svc, &lambda.ListFunctionsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, function := range page.Functions {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*function.FunctionArn,\n\t\t\t\t*function.FunctionName,\n\t\t\t\t\"aws_lambda_function\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"function_name\": *function.FunctionName,\n\t\t\t\t},\n\t\t\t\tlambdaAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\n\t\t\tgp, err := svc.GetPolicy(context.TODO(), &lambda.GetPolicyInput{\n\t\t\t\tFunctionName: aws.String(*function.FunctionArn),\n\t\t\t})\n\n\t\t\tif err != nil {\n\t\t\t\t// skip ResourceNotFoundException, because there may be only inline policy defined\n\t\t\t\tvar apiErr smithy.APIError\n\t\t\t\tif !errors.As(err, &apiErr) || apiErr.ErrorCode() != \"ResourceNotFoundException\" {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif gp != nil {\n\t\t\t\toutputPolicy := *gp.Policy\n\t\t\t\tvar policy Policy\n\t\t\t\terr = json.Unmarshal([]byte(outputPolicy), &policy)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tfor _, statement := range policy.Statement {\n\t\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\t\tstatement.Sid,\n\t\t\t\t\t\tstatement.Sid,\n\t\t\t\t\t\t\"aws_lambda_permission\",\n\t\t\t\t\t\t\"aws\",\n\t\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\t\"statement_id\":  statement.Sid,\n\t\t\t\t\t\t\t\"function_name\": *function.FunctionArn,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlambdaAllowEmptyValues,\n\t\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t\t))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpi := lambda.NewListFunctionEventInvokeConfigsPaginator(svc,\n\t\t\t\t&lambda.ListFunctionEventInvokeConfigsInput{\n\t\t\t\t\tFunctionName: function.FunctionName,\n\t\t\t\t})\n\t\t\tfor pi.HasMorePages() {\n\t\t\t\tpiage, err := pi.NextPage(context.TODO())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfor _, functionEventInvokeConfig := range piage.FunctionEventInvokeConfigs {\n\t\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\t\t*function.FunctionArn,\n\t\t\t\t\t\t\"feic_\"+*functionEventInvokeConfig.FunctionArn,\n\t\t\t\t\t\t\"aws_lambda_function_event_invoke_config\",\n\t\t\t\t\t\t\"aws\",\n\t\t\t\t\t\tlambdaAllowEmptyValues,\n\t\t\t\t\t))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *LambdaGenerator) addEventSourceMappings(svc *lambda.Client) error {\n\tp := lambda.NewListEventSourceMappingsPaginator(svc, &lambda.ListEventSourceMappingsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, mapping := range page.EventSourceMappings {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*mapping.UUID,\n\t\t\t\t*mapping.UUID,\n\t\t\t\t\"aws_lambda_event_source_mapping\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"event_source_arn\": *mapping.EventSourceArn,\n\t\t\t\t\t\"function_name\":    *mapping.FunctionArn,\n\t\t\t\t},\n\t\t\t\tlambdaAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *LambdaGenerator) addLayerVersions(svc *lambda.Client) error {\n\tpl := lambda.NewListLayersPaginator(svc, &lambda.ListLayersInput{})\n\tfor pl.HasMorePages() {\n\t\tplage, err := pl.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, layer := range plage.Layers {\n\t\t\tpv := lambda.NewListLayerVersionsPaginator(svc, &lambda.ListLayerVersionsInput{\n\t\t\t\tLayerName: layer.LayerName,\n\t\t\t})\n\t\t\tfor pv.HasMorePages() {\n\t\t\t\tpvage, err := pv.NextPage(context.TODO())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfor _, layerVersion := range pvage.LayerVersions {\n\t\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\t\t*layerVersion.LayerVersionArn,\n\t\t\t\t\t\t*layerVersion.LayerVersionArn,\n\t\t\t\t\t\t\"aws_lambda_layer_version\",\n\t\t\t\t\t\t\"aws\",\n\t\t\t\t\t\tlambdaAllowEmptyValues,\n\t\t\t\t\t))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/logs.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs\"\n)\n\nvar logsAllowEmptyValues = []string{\"tags.\"}\n\ntype LogsGenerator struct {\n\tAWSService\n}\n\nfunc (g *LogsGenerator) createResources(logGroups *cloudwatchlogs.DescribeLogGroupsOutput) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, logGroup := range logGroups.LogGroups {\n\t\tresourceName := StringValue(logGroup.LogGroupName)\n\n\t\tattributes := map[string]string{}\n\n\t\tif logGroup.RetentionInDays != nil {\n\t\t\tattributes[\"retention_in_days\"] = strconv.FormatInt(int64(*logGroup.RetentionInDays), 10)\n\t\t}\n\n\t\tif logGroup.KmsKeyId != nil {\n\t\t\tattributes[\"kms_key_id\"] = *logGroup.KmsKeyId\n\t\t}\n\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tresourceName,\n\t\t\tresourceName,\n\t\t\t\"aws_cloudwatch_log_group\",\n\t\t\t\"aws\",\n\t\t\tattributes,\n\t\t\tlogsAllowEmptyValues,\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API\nfunc (g *LogsGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := cloudwatchlogs.NewFromConfig(config)\n\n\tp := cloudwatchlogs.NewDescribeLogGroupsPaginator(svc, &cloudwatchlogs.DescribeLogGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createResources(page)...)\n\t}\n\treturn nil\n}\n\n// remove retention_in_days if it is 0 (it gets added by the \"refresh\" stage)\nfunc (g *LogsGenerator) PostConvertHook() error {\n\tfor _, resource := range g.Resources {\n\t\tif resource.Item[\"retention_in_days\"] == \"0\" {\n\t\t\tdelete(resource.Item, \"retention_in_days\")\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/media_package.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/mediapackage\"\n)\n\nvar mediapackageAllowEmptyValues = []string{\"tags.\"}\n\ntype MediaPackageGenerator struct {\n\tAWSService\n}\n\nfunc (g *MediaPackageGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := mediapackage.NewFromConfig(config)\n\tp := mediapackage.NewListChannelsPaginator(svc, &mediapackage.ListChannelsInput{})\n\tvar resources []terraformutils.Resource\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, channel := range page.Channels {\n\t\t\tchannelID := StringValue(channel.Id)\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tchannelID,\n\t\t\t\tchannelID,\n\t\t\t\t\"aws_media_package_channel\",\n\t\t\t\t\"aws\",\n\t\t\t\tmediapackageAllowEmptyValues))\n\t\t}\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/media_store.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/mediastore\"\n)\n\nvar mediastoreAllowEmptyValues = []string{\"tags.\"}\n\ntype MediaStoreGenerator struct {\n\tAWSService\n}\n\nfunc (g *MediaStoreGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := mediastore.NewFromConfig(config)\n\tp := mediastore.NewListContainersPaginator(svc, &mediastore.ListContainersInput{})\n\tvar resources []terraformutils.Resource\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, container := range page.Containers {\n\t\t\tcontainerName := StringValue(container.Name)\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tcontainerName,\n\t\t\t\tcontainerName,\n\t\t\t\t\"aws_media_store_container\",\n\t\t\t\t\"aws\",\n\t\t\t\tmediastoreAllowEmptyValues))\n\t\t}\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/medialive.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/medialive\"\n)\n\nvar medialiveAllowEmptyValues = []string{\"tags.\"}\n\ntype MediaLiveGenerator struct {\n\tAWSService\n}\n\nfunc (g *MediaLiveGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := medialive.NewFromConfig(config)\n\tg.Resources = []terraformutils.Resource{}\n\n\tif err := g.GetChannels(svc); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tif err := g.GetInputs(svc); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\tif err := g.GetInputSecurityGroups(svc); err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn nil\n}\n\nfunc (g *MediaLiveGenerator) GetChannels(svc *medialive.Client) error {\n\tp := medialive.NewListChannelsPaginator(svc, &medialive.ListChannelsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, channel := range page.Channels {\n\t\t\tchannelID := StringValue(channel.Id)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tchannelID,\n\t\t\t\tchannelID,\n\t\t\t\t\"aws_medialive_channel\",\n\t\t\t\t\"aws\",\n\t\t\t\tmedialiveAllowEmptyValues))\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *MediaLiveGenerator) GetInputs(svc *medialive.Client) error {\n\tp := medialive.NewListInputsPaginator(svc, &medialive.ListInputsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, input := range page.Inputs {\n\t\t\tinputID := StringValue(input.Id)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tinputID,\n\t\t\t\tinputID,\n\t\t\t\t\"aws_medialive_input\",\n\t\t\t\t\"aws\",\n\t\t\t\tmedialiveAllowEmptyValues))\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *MediaLiveGenerator) GetInputSecurityGroups(svc *medialive.Client) error {\n\tp := medialive.NewListInputSecurityGroupsPaginator(svc, &medialive.ListInputSecurityGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, inputSecurityGroup := range page.InputSecurityGroups {\n\t\t\tinputSecurityGroupID := StringValue(inputSecurityGroup.Id)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tinputSecurityGroupID,\n\t\t\t\tinputSecurityGroupID,\n\t\t\t\t\"aws_medialive_input_security_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tmedialiveAllowEmptyValues))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/mq.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/mq\"\n)\n\nvar mqAllowEmptyValues = []string{\"tags.\"}\n\ntype MQGenerator struct {\n\tAWSService\n}\n\nfunc (g *MQGenerator) loadBrokers(svc *mq.Client) error {\n\tp := mq.NewListBrokersPaginator(svc, &mq.ListBrokersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, broker := range page.BrokerSummaries {\n\t\t\tresourceName := StringValue(broker.BrokerName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_mq_broker\",\n\t\t\t\t\"aws\",\n\t\t\t\tmqAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *MQGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := mq.NewFromConfig(config)\n\n\terr := g.loadBrokers(svc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/msk.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/kafka\"\n)\n\nvar mskAllowEmptyValues = []string{\"tags.\"}\n\ntype MskGenerator struct {\n\tAWSService\n}\n\nfunc (g *MskGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := kafka.NewFromConfig(config)\n\tp := kafka.NewListClustersPaginator(svc, &kafka.ListClustersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, clusterInfo := range page.ClusterInfoList {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(clusterInfo.ClusterArn),\n\t\t\t\tStringValue(clusterInfo.ClusterName),\n\t\t\t\t\"aws_msk_cluster\",\n\t\t\t\t\"aws\",\n\t\t\t\tmskAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *MskGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_msk_cluster\" {\n\t\t\tcontinue\n\t\t}\n\t\tif r.InstanceState.Attributes[\"configuration_info.0.revision\"] == \"0\" {\n\t\t\tdelete(r.Item, \"configuration_info\")\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/nacl.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar NaclAllowEmptyValues = []string{\"tags.\"}\n\ntype NaclGenerator struct {\n\tAWSService\n}\n\nfunc (NaclGenerator) createResources(nacls *ec2.DescribeNetworkAclsOutput) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tvar resourceType string\n\tfor _, nacl := range nacls.NetworkAcls {\n\t\tif nacl.IsDefault != nil && *nacl.IsDefault {\n\t\t\tresourceType = \"aws_default_network_acl\"\n\t\t} else {\n\t\t\tresourceType = \"aws_network_acl\"\n\t\t}\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(nacl.NetworkAclId),\n\t\t\tStringValue(nacl.NetworkAclId),\n\t\t\tresourceType,\n\t\t\t\"aws\",\n\t\t\tNaclAllowEmptyValues))\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// from each network ACL create 1 TerraformResource.\n// Need NetworkAclId as ID for terraform resource\nfunc (g *NaclGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tp := ec2.NewDescribeNetworkAclsPaginator(svc, &ec2.DescribeNetworkAclsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createResources(page)...)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/nat_gateway.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar ngwAllowEmptyValues = []string{\"tags.\"}\n\ntype NatGatewayGenerator struct {\n\tAWSService\n}\n\nfunc (g *NatGatewayGenerator) createResources(ngws *ec2.DescribeNatGatewaysOutput) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, ngw := range ngws.NatGateways {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(ngw.NatGatewayId),\n\t\t\tStringValue(ngw.NatGatewayId),\n\t\t\t\"aws_nat_gateway\",\n\t\t\t\"aws\",\n\t\t\tngwAllowEmptyValues,\n\t\t))\n\t}\n\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// create terraform resource for each NAT Gateways\nfunc (g *NatGatewayGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tp := ec2.NewDescribeNatGatewaysPaginator(svc, &ec2.DescribeNatGatewaysInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createResources(page)...)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/opsworks.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"github.com/aws/aws-sdk-go-v2/service/opsworks\"\n\t\"github.com/aws/aws-sdk-go-v2/service/opsworks/types\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype OpsworksGenerator struct {\n\tAWSService\n}\n\nfunc (g *OpsworksGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := opsworks.NewFromConfig(config)\n\n\te = g.fetchStacks(svc)\n\tif e != nil {\n\t\treturn e\n\t}\n\n\te = g.fetchUserProfile(svc)\n\tif e != nil {\n\t\treturn e\n\t}\n\n\treturn nil\n}\n\nfunc (g *OpsworksGenerator) fetchApps(stackID *string, svc *opsworks.Client) error {\n\tapps, err := svc.DescribeApps(context.TODO(), &opsworks.DescribeAppsInput{\n\t\tStackId: stackID,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, app := range apps.Apps {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(app.AppId),\n\t\t\tStringValue(app.AppId),\n\t\t\t\"aws_opsworks_application\",\n\t\t\t\"aws\",\n\t\t\t[]string{\"tags.\"},\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *OpsworksGenerator) fetchLayers(stackID *string, svc *opsworks.Client) error {\n\tapps, err := svc.DescribeLayers(context.TODO(), &opsworks.DescribeLayersInput{\n\t\tStackId: stackID,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, layer := range apps.Layers {\n\t\tswitch layer.Type {\n\t\tcase types.LayerTypeCustom:\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(layer.LayerId),\n\t\t\t\tStringValue(layer.LayerId),\n\t\t\t\t\"aws_opsworks_custom_layer\",\n\t\t\t\t\"aws\",\n\t\t\t\t[]string{\"tags.\"},\n\t\t\t))\n\t\tcase types.LayerTypePhpApp:\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(layer.LayerId),\n\t\t\t\tStringValue(layer.LayerId),\n\t\t\t\t\"aws_opsworks_php_app_layer\",\n\t\t\t\t\"aws\",\n\t\t\t\t[]string{\"tags.\"},\n\t\t\t))\n\t\tcase types.LayerTypeJavaApp:\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(layer.LayerId),\n\t\t\t\tStringValue(layer.LayerId),\n\t\t\t\t\"aws_opsworks_java_app_layer\",\n\t\t\t\t\"aws\",\n\t\t\t\t[]string{\"tags.\"},\n\t\t\t))\n\t\tcase types.LayerTypeWeb:\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(layer.LayerId),\n\t\t\t\tStringValue(layer.LayerId),\n\t\t\t\t\"aws_opsworks_static_web_layer\",\n\t\t\t\t\"aws\",\n\t\t\t\t[]string{\"tags.\"},\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *OpsworksGenerator) fetchInstances(stackID *string, svc *opsworks.Client) error {\n\tapps, err := svc.DescribeInstances(context.TODO(), &opsworks.DescribeInstancesInput{\n\t\tStackId: stackID,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, instances := range apps.Instances {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(instances.InstanceId),\n\t\t\tStringValue(instances.InstanceId),\n\t\t\t\"aws_opsworks_instance\",\n\t\t\t\"aws\",\n\t\t\t[]string{\"tags.\"},\n\t\t))\n\t}\n\treturn nil\n}\nfunc (g *OpsworksGenerator) fetchRdsInstances(stackID *string, svc *opsworks.Client) error {\n\tapps, err := svc.DescribeRdsDbInstances(context.TODO(), &opsworks.DescribeRdsDbInstancesInput{\n\t\tStackId: stackID,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, rdsDbInstance := range apps.RdsDbInstances {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tStringValue(rdsDbInstance.RdsDbInstanceArn),\n\t\t\tStringValue(rdsDbInstance.RdsDbInstanceArn),\n\t\t\t\"aws_opsworks_instance\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"rds_db_instance_arn\": StringValue(rdsDbInstance.RdsDbInstanceArn),\n\t\t\t\t\"stack_id\":            StringValue(stackID),\n\t\t\t},\n\t\t\t[]string{\"tags.\"},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *OpsworksGenerator) fetchStacks(svc *opsworks.Client) error {\n\tapps, err := svc.DescribeStacks(context.TODO(), &opsworks.DescribeStacksInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, stack := range apps.Stacks {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(stack.StackId),\n\t\t\tStringValue(stack.StackId),\n\t\t\t\"aws_opsworks_stack\",\n\t\t\t\"aws\",\n\t\t\t[]string{\"tags.\"},\n\t\t))\n\n\t\te := g.fetchApps(stack.StackId, svc)\n\t\tif e != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\n\t\te = g.fetchInstances(stack.StackId, svc)\n\t\tif e != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\n\t\te = g.fetchRdsInstances(stack.StackId, svc)\n\t\tif e != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\n\t\te = g.fetchLayers(stack.StackId, svc)\n\t\tif e != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *OpsworksGenerator) fetchUserProfile(svc *opsworks.Client) error {\n\tapps, err := svc.DescribeUserProfiles(context.TODO(), &opsworks.DescribeUserProfilesInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, userProfile := range apps.UserProfiles {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(userProfile.IamUserArn),\n\t\t\tStringValue(userProfile.IamUserArn),\n\t\t\t\"aws_opsworks_user_profile\",\n\t\t\t\"aws\",\n\t\t\t[]string{\"tags.\"},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/organization.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/organizations\"\n\t\"github.com/aws/aws-sdk-go-v2/service/organizations/types\"\n)\n\nvar organizationAllowEmptyValues = []string{\"tags.\"}\n\ntype OrganizationGenerator struct {\n\tAWSService\n}\n\nfunc (g *OrganizationGenerator) traverseNode(svc *organizations.Client, parentID string) {\n\taccountsForParent, err := svc.ListAccountsForParent(context.TODO(),\n\t\t&organizations.ListAccountsForParentInput{ParentId: aws.String(parentID)})\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, account := range accountsForParent.Accounts {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tStringValue(account.Id),\n\t\t\tStringValue(account.Name),\n\t\t\t\"aws_organizations_organization\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"id\":  StringValue(account.Id),\n\t\t\t\t\"arn\": StringValue(account.Arn),\n\t\t\t},\n\t\t\torganizationAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tStringValue(account.Id),\n\t\t\tStringValue(account.Name),\n\t\t\t\"aws_organizations_account\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"id\":  StringValue(account.Id),\n\t\t\t\t\"arn\": StringValue(account.Arn),\n\t\t\t},\n\t\t\torganizationAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\tunitsForParent, err := svc.ListOrganizationalUnitsForParent(context.TODO(),\n\t\t&organizations.ListOrganizationalUnitsForParentInput{ParentId: aws.String(parentID)})\n\tif err != nil {\n\t\treturn\n\t}\n\tfor _, unit := range unitsForParent.OrganizationalUnits {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tStringValue(unit.Id),\n\t\t\tStringValue(unit.Name),\n\t\t\t\"aws_organizations_organizational_unit\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"id\":  StringValue(unit.Id),\n\t\t\t\t\"arn\": StringValue(unit.Arn),\n\t\t\t},\n\t\t\torganizationAllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t\tg.traverseNode(svc, StringValue(unit.Id))\n\t}\n}\n\nfunc (g *OrganizationGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := organizations.NewFromConfig(config)\n\n\troots, err := svc.ListRoots(context.TODO(), &organizations.ListRootsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, root := range roots.Roots {\n\t\tnodeID := StringValue(root.Id)\n\t\tg.traverseNode(svc, nodeID)\n\t}\n\n\tp := organizations.NewListPoliciesPaginator(svc, &organizations.ListPoliciesInput{\n\t\tFilter: types.PolicyTypeServiceControlPolicy,\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, policy := range page.Policies {\n\t\t\tpolicyID := StringValue(policy.Id)\n\t\t\tpolicyName := StringValue(policy.Name)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tpolicyID,\n\t\t\t\tpolicyName,\n\t\t\t\t\"aws_organizations_policy\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"id\":  policyID,\n\t\t\t\t\t\"arn\": StringValue(policy.Arn),\n\t\t\t\t},\n\t\t\t\torganizationAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\n\t\t\ttargetsForPolicy, err := svc.ListTargetsForPolicy(context.TODO(),\n\t\t\t\t&organizations.ListTargetsForPolicyInput{PolicyId: policy.Id})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, target := range targetsForPolicy.Targets {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\tStringValue(target.TargetId)+\":\"+policyID,\n\t\t\t\t\t\"pa-\"+StringValue(target.TargetId)+\":\"+policyName,\n\t\t\t\t\t\"aws_organizations_policy_attachment\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"policy_id\": policyID,\n\t\t\t\t\t\t\"target_id\": StringValue(target.TargetId),\n\t\t\t\t\t},\n\t\t\t\t\torganizationAllowEmptyValues,\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/qldb.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/qldb\"\n)\n\nvar qldbAllowEmptyValues = []string{\"tags.\"}\n\ntype QLDBGenerator struct {\n\tAWSService\n}\n\nfunc (g *QLDBGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := qldb.NewFromConfig(config)\n\tp := qldb.NewListLedgersPaginator(svc, &qldb.ListLedgersInput{})\n\tvar resources []terraformutils.Resource\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, ledger := range page.Ledgers {\n\t\t\tledgerName := StringValue(ledger.Name)\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tledgerName,\n\t\t\t\tledgerName,\n\t\t\t\t\"aws_qldb_ledger\",\n\t\t\t\t\"aws\",\n\t\t\t\tqldbAllowEmptyValues))\n\t\t}\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/rds.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/rds\"\n)\n\nvar RDSAllowEmptyValues = []string{\"tags.\"}\n\ntype RDSGenerator struct {\n\tAWSService\n}\n\nfunc (g *RDSGenerator) loadDBClusters(svc *rds.Client) error {\n\tp := rds.NewDescribeDBClustersPaginator(svc, &rds.DescribeDBClustersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, cluster := range page.DBClusters {\n\t\t\tresourceName := StringValue(cluster.DBClusterIdentifier)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_rds_cluster\",\n\t\t\t\t\"aws\",\n\t\t\t\tRDSAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *RDSGenerator) loadDBClusterSnapshots(svc *rds.Client) error {\n\tp := rds.NewDescribeDBClusterSnapshotsPaginator(svc, &rds.DescribeDBClusterSnapshotsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, snapshot := range page.DBClusterSnapshots {\n\t\t\tresourceName := StringValue(snapshot.DBClusterSnapshotIdentifier)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_db_cluster_snapshot\",\n\t\t\t\t\"aws\",\n\t\t\t\tRDSAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *RDSGenerator) loadDBProxies(svc *rds.Client) error {\n\tp := rds.NewDescribeDBProxiesPaginator(svc, &rds.DescribeDBProxiesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, db := range page.DBProxies {\n\t\t\tresourceName := StringValue(db.DBProxyName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_db_proxy\",\n\t\t\t\t\"aws\",\n\t\t\t\tRDSAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n\n}\nfunc (g *RDSGenerator) loadDBInstances(svc *rds.Client) error {\n\tp := rds.NewDescribeDBInstancesPaginator(svc, &rds.DescribeDBInstancesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, db := range page.DBInstances {\n\t\t\tresourceName := StringValue(db.DBInstanceIdentifier)\n\t\t\tr := terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_db_instance\",\n\t\t\t\t\"aws\",\n\t\t\t\tRDSAllowEmptyValues,\n\t\t\t)\n\t\t\tr.IgnoreKeys = append(r.IgnoreKeys, \"^name$\")\n\t\t\tg.Resources = append(g.Resources, r)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *RDSGenerator) loadDBInstanceSnapshots(svc *rds.Client) error {\n\tp := rds.NewDescribeDBSnapshotsPaginator(svc, &rds.DescribeDBSnapshotsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, snapshot := range page.DBSnapshots {\n\t\t\tresourceName := StringValue(snapshot.DBSnapshotIdentifier)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_db_snapshot\",\n\t\t\t\t\"aws\",\n\t\t\t\tRDSAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *RDSGenerator) loadDBParameterGroups(svc *rds.Client) error {\n\tp := rds.NewDescribeDBParameterGroupsPaginator(svc, &rds.DescribeDBParameterGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, parameterGroup := range page.DBParameterGroups {\n\t\t\tresourceName := StringValue(parameterGroup.DBParameterGroupName)\n\t\t\tif strings.Contains(resourceName, \".\") {\n\t\t\t\tcontinue // skip default Default ParameterGroups like default.mysql5.6\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_db_parameter_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tRDSAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *RDSGenerator) loadDBSubnetGroups(svc *rds.Client) error {\n\tp := rds.NewDescribeDBSubnetGroupsPaginator(svc, &rds.DescribeDBSubnetGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, subnet := range page.DBSubnetGroups {\n\t\t\tresourceName := StringValue(subnet.DBSubnetGroupName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_db_subnet_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tRDSAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *RDSGenerator) loadOptionGroups(svc *rds.Client) error {\n\tp := rds.NewDescribeOptionGroupsPaginator(svc, &rds.DescribeOptionGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, optionGroup := range page.OptionGroupsList {\n\t\t\tresourceName := StringValue(optionGroup.OptionGroupName)\n\t\t\tif strings.Contains(resourceName, \".\") || strings.Contains(resourceName, \":\") {\n\t\t\t\tcontinue // skip default Default OptionGroups like default.mysql5.6\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_db_option_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tRDSAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *RDSGenerator) loadEventSubscription(svc *rds.Client) error {\n\tp := rds.NewDescribeEventSubscriptionsPaginator(svc, &rds.DescribeEventSubscriptionsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, eventSubscription := range page.EventSubscriptionsList {\n\t\t\tresourceName := StringValue(eventSubscription.CustomerAwsId)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_db_event_subscription\",\n\t\t\t\t\"aws\",\n\t\t\t\tRDSAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *RDSGenerator) loadRDSGlobalClusters(svc *rds.Client) error {\n\tp := rds.NewDescribeGlobalClustersPaginator(svc, &rds.DescribeGlobalClustersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, cluster := range page.GlobalClusters {\n\t\t\tresourceName := StringValue(cluster.GlobalClusterIdentifier)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_rds_global_cluster\",\n\t\t\t\t\"aws\",\n\t\t\t\tRDSAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\n// Generate TerraformResources from AWS API,\n// from each database create 1 TerraformResource.\n// Need only database name as ID for terraform resource\n// AWS api support paging\nfunc (g *RDSGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := rds.NewFromConfig(config)\n\n\tif err := g.loadDBClusters(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadDBClusterSnapshots(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadDBInstances(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadDBInstanceSnapshots(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadDBProxies(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadDBParameterGroups(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadDBSubnetGroups(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadOptionGroups(svc); err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadEventSubscription(svc); err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadRDSGlobalClusters(svc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *RDSGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"aws_db_instance\" || r.InstanceInfo.Type == \"aws_rds_cluster\" {\n\t\t\tfor _, dbInstance := range g.Resources {\n\t\t\t\tif dbInstance.InstanceInfo.Type != \"aws_db_instance\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif g.Resources[i].Item[\"replicate_source_db\"] != nil {\n\t\t\t\t\tdelete(g.Resources[i].Item, \"username\")\n\t\t\t\t\tdelete(g.Resources[i].Item, \"engine_version\")\n\t\t\t\t\tdelete(g.Resources[i].Item, \"engine\")\n\t\t\t\t\tdelete(g.Resources[i].Item, \"db_name\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, parameterGroup := range g.Resources {\n\t\t\t\tif parameterGroup.InstanceInfo.Type != \"aws_db_parameter_group\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif parameterGroup.InstanceState.Attributes[\"name\"] == r.InstanceState.Attributes[\"parameter_group_name\"] {\n\t\t\t\t\tg.Resources[i].Item[\"parameter_group_name\"] = \"${aws_db_parameter_group.\" + parameterGroup.ResourceName + \".name}\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, subnet := range g.Resources {\n\t\t\t\tif subnet.InstanceInfo.Type != \"aws_db_subnet_group\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif subnet.InstanceState.Attributes[\"name\"] == r.InstanceState.Attributes[\"db_subnet_group_name\"] {\n\t\t\t\t\tg.Resources[i].Item[\"db_subnet_group_name\"] = \"${aws_db_subnet_group.\" + subnet.ResourceName + \".name}\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, optionGroup := range g.Resources {\n\t\t\t\tif optionGroup.InstanceInfo.Type != \"aws_db_option_group\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif optionGroup.InstanceState.Attributes[\"name\"] == r.InstanceState.Attributes[\"option_group_name\"] {\n\t\t\t\t\tg.Resources[i].Item[\"option_group_name\"] = \"${aws_db_option_group.\" + optionGroup.ResourceName + \".name}\"\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/redshift.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"strings\"\n\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/redshift\"\n)\n\nvar RedshiftAllowEmptyValues = []string{\"tags.\"}\n\ntype RedshiftGenerator struct {\n\tAWSService\n}\n\nfunc (g *RedshiftGenerator) loadClusters(svc *redshift.Client) error {\n\tp := redshift.NewDescribeClustersPaginator(svc, &redshift.DescribeClustersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, db := range page.Clusters {\n\t\t\tresourceName := StringValue(db.ClusterIdentifier)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_redshift_cluster\",\n\t\t\t\t\"aws\",\n\t\t\t\tRedshiftAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *RedshiftGenerator) loadParameterGroups(svc *redshift.Client) error {\n\tp := redshift.NewDescribeClusterParameterGroupsPaginator(svc, &redshift.DescribeClusterParameterGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, parameterGroup := range page.ParameterGroups {\n\t\t\tresourceName := StringValue(parameterGroup.ParameterGroupName)\n\t\t\tif strings.Contains(resourceName, \".\") {\n\t\t\t\tcontinue // skip default Default ParameterGroups like default.mysql5.6\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_redshift_parameter_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tRedshiftAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *RedshiftGenerator) loadSubnetGroups(svc *redshift.Client) error {\n\tp := redshift.NewDescribeClusterSubnetGroupsPaginator(svc, &redshift.DescribeClusterSubnetGroupsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, subnet := range page.ClusterSubnetGroups {\n\t\t\tresourceName := StringValue(subnet.ClusterSubnetGroupName)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_redshift_subnet_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tRedshiftAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *RedshiftGenerator) loadEventSubscription(svc *redshift.Client) error {\n\tp := redshift.NewDescribeEventSubscriptionsPaginator(svc, &redshift.DescribeEventSubscriptionsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, eventSubscription := range page.EventSubscriptionsList {\n\t\t\tresourceName := StringValue(eventSubscription.CustomerAwsId)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_redshift_event_subscription\",\n\t\t\t\t\"aws\",\n\t\t\t\tRedshiftAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *RedshiftGenerator) loadSnapshotSchedules(svc *redshift.Client) error {\n\tp := redshift.NewDescribeSnapshotSchedulesPaginator(svc, &redshift.DescribeSnapshotSchedulesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, snapshotSchedule := range page.SnapshotSchedules {\n\t\t\tresourceName := StringValue(snapshotSchedule.ScheduleIdentifier)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_redshift_snapshot_schedule\",\n\t\t\t\t\"aws\",\n\t\t\t\tRedshiftAllowEmptyValues,\n\t\t\t))\n\n\t\t\tfor _, associatedCluster := range snapshotSchedule.AssociatedClusters {\n\t\t\t\tclusterName := StringValue(associatedCluster.ClusterIdentifier)\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\tclusterName+\"/\"+resourceName,\n\t\t\t\t\tclusterName+\"_\"+resourceName,\n\t\t\t\t\t\"aws_redshift_snapshot_schedule_association\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tRedshiftAllowEmptyValues,\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// Generate TerraformResources from AWS API,\n// from each database create 1 TerraformResource.\n// Need only database name as ID for terraform resource\n// AWS api support paging\nfunc (g *RedshiftGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := redshift.NewFromConfig(config)\n\n\tif err := g.loadClusters(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadParameterGroups(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadSubnetGroups(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadEventSubscription(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadSnapshotSchedules(svc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *RedshiftGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"aws_redshift_cluster\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, parameterGroup := range g.Resources {\n\t\t\tlog.Print(parameterGroup.InstanceInfo.Type)\n\t\t\tif parameterGroup.InstanceInfo.Type != \"aws_redshift_parameter_group\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif parameterGroup.InstanceState.Attributes[\"name\"] == r.InstanceState.Attributes[\"cluster_parameter_group_name\"] {\n\t\t\t\tg.Resources[i].Item[\"cluster_parameter_group_name\"] = \"${aws_redshift_parameter_group.\" + parameterGroup.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\n\t\tfor _, subnet := range g.Resources {\n\t\t\tif subnet.InstanceInfo.Type != \"aws_redshift_subnet_group\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif subnet.InstanceState.Attributes[\"name\"] == r.InstanceState.Attributes[\"cluster_subnet_group_name\"] {\n\t\t\t\tg.Resources[i].Item[\"cluster_subnet_group_name\"] = \"${aws_redshift_subnet_group.\" + subnet.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/resourcegroups.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/resourcegroups\"\n)\n\nvar resourcegroupsAllowEmptyValues = []string{\"tags.\"}\n\ntype ResourceGroupsGenerator struct {\n\tAWSService\n}\n\nfunc (g *ResourceGroupsGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := resourcegroups.NewFromConfig(config)\n\tp := resourcegroups.NewListGroupsPaginator(svc, &resourcegroups.ListGroupsInput{})\n\tvar resources []terraformutils.Resource\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, groupIdentifier := range page.GroupIdentifiers {\n\t\t\tgroupName := StringValue(groupIdentifier.GroupName)\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tgroupName,\n\t\t\t\tgroupName,\n\t\t\t\t\"aws_resourcegroups_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tresourcegroupsAllowEmptyValues))\n\t\t}\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/route53.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/route53\"\n)\n\nvar route53AllowEmptyValues = []string{}\n\nvar route53AdditionalFields = map[string]interface{}{}\n\ntype Route53Generator struct {\n\tAWSService\n}\n\nfunc (g *Route53Generator) createZonesResources(svc *route53.Client) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tp := route53.NewListHostedZonesPaginator(svc, &route53.ListHostedZonesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources\n\t\t}\n\t\tfor _, zone := range page.HostedZones {\n\t\t\tzoneID := cleanZoneID(StringValue(zone.Id))\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tzoneID,\n\t\t\t\tzoneID+\"_\"+strings.TrimSuffix(StringValue(zone.Name), \".\"),\n\t\t\t\t\"aws_route53_zone\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":          StringValue(zone.Name),\n\t\t\t\t\t\"force_destroy\": \"false\",\n\t\t\t\t},\n\t\t\t\troute53AllowEmptyValues,\n\t\t\t\troute53AdditionalFields,\n\t\t\t))\n\t\t\trecords := g.createRecordsResources(svc, zoneID)\n\t\t\tresources = append(resources, records...)\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (Route53Generator) createRecordsResources(svc *route53.Client, zoneID string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tvar sets *route53.ListResourceRecordSetsOutput\n\tvar err error\n\tlistParams := &route53.ListResourceRecordSetsInput{\n\t\tHostedZoneId: aws.String(zoneID),\n\t}\n\n\tfor {\n\t\tsets, err = svc.ListResourceRecordSets(context.TODO(), listParams)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources\n\t\t}\n\t\tfor _, record := range sets.ResourceRecordSets {\n\t\t\trecordName := wildcardUnescape(StringValue(record.Name))\n\t\t\ttypeString := string(record.Type)\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tfmt.Sprintf(\"%s_%s_%s_%s\", zoneID, recordName, typeString, StringValue(record.SetIdentifier)),\n\t\t\t\tfmt.Sprintf(\"%s_%s_%s_%s\", zoneID, recordName, typeString, StringValue(record.SetIdentifier)),\n\t\t\t\t\"aws_route53_record\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":           strings.TrimSuffix(recordName, \".\"),\n\t\t\t\t\t\"zone_id\":        zoneID,\n\t\t\t\t\t\"type\":           typeString,\n\t\t\t\t\t\"set_identifier\": StringValue(record.SetIdentifier),\n\t\t\t\t},\n\t\t\t\troute53AllowEmptyValues,\n\t\t\t\troute53AdditionalFields,\n\t\t\t))\n\t\t}\n\n\t\tif sets.IsTruncated {\n\t\t\tlistParams.StartRecordName = sets.NextRecordName\n\t\t\tlistParams.StartRecordType = sets.NextRecordType\n\t\t\tlistParams.StartRecordIdentifier = sets.NextRecordIdentifier\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (Route53Generator) createHealthChecksResources(svc *route53.Client) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tp := route53.NewListHealthChecksPaginator(svc, &route53.ListHealthChecksInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources\n\t\t}\n\t\tfor _, healthCheck := range page.HealthChecks {\n\t\t\thealthCheckStringType := string(healthCheck.HealthCheckConfig.Type)\n\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(healthCheck.Id),\n\t\t\t\tfmt.Sprintf(\"%s_%s\", StringValue(healthCheck.Id), healthCheckStringType),\n\t\t\t\t\"aws_route53_health_check\",\n\t\t\t\t\"aws\",\n\t\t\t\troute53AllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// create terraform resource for each zone + each record\nfunc (g *Route53Generator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := route53.NewFromConfig(config)\n\n\tg.Resources = g.createZonesResources(svc)\n\thealthCheckResources := g.createHealthChecksResources(svc)\n\tg.Resources = append(g.Resources, healthCheckResources...)\n\n\treturn nil\n}\n\nfunc (g *Route53Generator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tresourceType := resource.InstanceInfo.Type\n\t\tif resourceType == \"aws_route53_zone\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif resourceType == \"aws_route53_health_check\" {\n\t\t\tif _, childHealthChecksExist := resource.Item[\"child_healthchecks\"]; !childHealthChecksExist {\n\t\t\t\tif _, childHealthCheckThreshholdExist := resource.Item[\"child_health_threshold\"]; childHealthCheckThreshholdExist {\n\t\t\t\t\tdelete(g.Resources[i].Item, \"child_health_threshold\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\titem := resource.Item\n\t\tzoneID := item[\"zone_id\"].(string)\n\t\tfor _, resourceZone := range g.Resources {\n\t\t\tif resourceZone.InstanceInfo.Type != \"aws_route53_zone\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif zoneID == resourceZone.InstanceState.ID {\n\t\t\t\tg.Resources[i].Item[\"zone_id\"] = \"${aws_route53_zone.\" + resourceZone.ResourceName + \".zone_id}\"\n\t\t\t}\n\t\t}\n\t\tif _, aliasExist := resource.Item[\"alias\"]; aliasExist {\n\t\t\tif _, ttlExist := resource.Item[\"ttl\"]; ttlExist {\n\t\t\t\tdelete(g.Resources[i].Item, \"ttl\")\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc wildcardUnescape(s string) string {\n\tif strings.Contains(s, \"\\\\052\") {\n\t\ts = strings.Replace(s, \"\\\\052\", \"*\", 1)\n\t}\n\treturn s\n}\n\n// cleanZoneID is used to remove the leading /hostedzone/\nfunc cleanZoneID(id string) string {\n\treturn cleanPrefix(id, \"/hostedzone/\")\n}\n\n// cleanPrefix removes a string prefix from an ID\nfunc cleanPrefix(id, prefix string) string {\n\treturn strings.TrimPrefix(id, prefix)\n}\n"
  },
  {
    "path": "providers/aws/route_table.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar rtbAllowEmptyValues = []string{\"tags.\"}\n\ntype RouteTableGenerator struct {\n\tAWSService\n}\n\nfunc (g *RouteTableGenerator) createRouteTablesResources(svc *ec2.Client) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tp := ec2.NewDescribeRouteTablesPaginator(svc, &ec2.DescribeRouteTablesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources\n\t\t}\n\t\tfor _, table := range page.RouteTables {\n\t\t\t// route table\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(table.RouteTableId),\n\t\t\t\tStringValue(table.RouteTableId),\n\t\t\t\t\"aws_route_table\",\n\t\t\t\t\"aws\",\n\t\t\t\trtbAllowEmptyValues,\n\t\t\t))\n\n\t\t\tfor _, assoc := range table.Associations {\n\t\t\t\tif *assoc.Main {\n\t\t\t\t\t// main route table association\n\t\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\t\tStringValue(assoc.RouteTableAssociationId),\n\t\t\t\t\t\tStringValue(table.VpcId),\n\t\t\t\t\t\t\"aws_main_route_table_association\",\n\t\t\t\t\t\t\"aws\",\n\t\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\t\"vpc_id\":         StringValue(table.VpcId),\n\t\t\t\t\t\t\t\"route_table_id\": StringValue(table.RouteTableId),\n\t\t\t\t\t\t},\n\t\t\t\t\t\trtbAllowEmptyValues,\n\t\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t\t))\n\t\t\t\t} else if v := assoc.SubnetId; v != nil {\n\t\t\t\t\t// subnet-specific route table association\n\t\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\t\tStringValue(assoc.RouteTableAssociationId),\n\t\t\t\t\t\tStringValue(v),\n\t\t\t\t\t\t\"aws_route_table_association\",\n\t\t\t\t\t\t\"aws\",\n\t\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\t\"subnet_id\":      StringValue(v),\n\t\t\t\t\t\t\t\"route_table_id\": StringValue(table.RouteTableId),\n\t\t\t\t\t\t},\n\t\t\t\t\t\trtbAllowEmptyValues,\n\t\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t\t))\n\t\t\t\t} else if v := assoc.GatewayId; v != nil {\n\t\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\t\tStringValue(assoc.RouteTableAssociationId),\n\t\t\t\t\t\tStringValue(v),\n\t\t\t\t\t\t\"aws_route_table_association\",\n\t\t\t\t\t\t\"aws\",\n\t\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\t\"gateway_id\":     StringValue(v),\n\t\t\t\t\t\t\t\"route_table_id\": StringValue(table.RouteTableId),\n\t\t\t\t\t\t},\n\t\t\t\t\t\trtbAllowEmptyValues,\n\t\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t\t))\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// create terraform resource for each route tables\nfunc (g *RouteTableGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\n\tg.Resources = g.createRouteTablesResources(svc)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/s3.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/s3\"\n)\n\nvar S3AllowEmptyValues = []string{\"tags.\"}\n\nvar S3AdditionalFields = map[string]interface{}{}\n\ntype S3Generator struct {\n\tAWSService\n}\n\n// createResources iterate on all buckets\n// for each bucket we check region and choose only bucket from set region\n// for each bucket try get bucket policy, if policy exist create additional NewTerraformResource for policy\nfunc (g *S3Generator) createResources(config aws.Config, buckets *s3.ListBucketsOutput, region string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tsvc := s3.NewFromConfig(config)\n\tfor _, bucket := range buckets.Buckets {\n\t\tresourceName := StringValue(bucket.Name)\n\t\tlocation, err := svc.GetBucketLocation(context.TODO(), &s3.GetBucketLocationInput{Bucket: bucket.Name})\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tcontinue\n\t\t}\n\t\t// check if bucket in region\n\t\tconstraintString := string(location.LocationConstraint)\n\t\tif constraintString == region || (constraintString == \"\" && region == \"us-east-1\") {\n\t\t\tattributes := map[string]string{\n\t\t\t\t\"force_destroy\": \"false\",\n\t\t\t\t\"acl\":           \"private\",\n\t\t\t}\n\t\t\t// try get policy\n\t\t\tvar policy *s3.GetBucketPolicyOutput\n\t\t\tpolicy, err = svc.GetBucketPolicy(context.TODO(), &s3.GetBucketPolicyInput{\n\t\t\t\tBucket: bucket.Name,\n\t\t\t})\n\n\t\t\tif err == nil && policy.Policy != nil {\n\t\t\t\tattributes[\"policy\"] = *policy.Policy\n\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\tresourceName,\n\t\t\t\t\tresourceName,\n\t\t\t\t\t\"aws_s3_bucket_policy\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\tnil,\n\t\t\t\t\tS3AllowEmptyValues,\n\t\t\t\t\tS3AdditionalFields))\n\t\t\t}\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tresourceName,\n\t\t\t\tresourceName,\n\t\t\t\t\"aws_s3_bucket\",\n\t\t\t\t\"aws\",\n\t\t\t\tattributes,\n\t\t\t\tS3AllowEmptyValues,\n\t\t\t\tS3AdditionalFields))\n\t\t}\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// Need bucket name as ID for terraform resource\nfunc (g *S3Generator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := s3.NewFromConfig(config)\n\n\tbuckets, err := svc.ListBuckets(context.TODO(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(config, buckets, g.GetArgs()[\"region\"].(string))\n\treturn nil\n}\n\n// PostGenerateHook for add bucket policy json as heredoc\n// support only bucket with policy\nfunc (g *S3Generator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"aws_s3_bucket\" {\n\t\t\tif val, ok := g.Resources[i].Item[\"acl\"]; ok && val == \"private\" {\n\t\t\t\tdelete(g.Resources[i].Item, \"acl\")\n\t\t\t}\n\t\t\tif val, ok := g.Resources[i].Item[\"policy\"]; ok {\n\t\t\t\tg.Resources[i].Item[\"policy\"] = fmt.Sprintf(`<<POLICY\n%s\nPOLICY`, g.escapeAwsInterpolation(val.(string)))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/secretsmanager.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/secretsmanager\"\n)\n\nvar secretsmanagerAllowEmptyValues = []string{\"tags.\"}\n\ntype SecretsManagerGenerator struct {\n\tAWSService\n}\n\nfunc (g *SecretsManagerGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := secretsmanager.NewFromConfig(config)\n\tp := secretsmanager.NewListSecretsPaginator(svc, &secretsmanager.ListSecretsInput{})\n\tvar resources []terraformutils.Resource\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, secret := range page.SecretList {\n\t\t\tsecretArn := StringValue(secret.ARN)\n\t\t\tsecretName := StringValue(secret.Name)\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tsecretArn,\n\t\t\t\tsecretName,\n\t\t\t\t\"aws_secretsmanager_secret\",\n\t\t\t\t\"aws\",\n\t\t\t\tsecretsmanagerAllowEmptyValues))\n\t\t}\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/securityhub.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/securityhub\"\n)\n\nvar securityhubAllowEmptyValues = []string{\"tags.\"}\n\ntype SecurityhubGenerator struct {\n\tAWSService\n}\n\nfunc (g *SecurityhubGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tclient := securityhub.NewFromConfig(config)\n\n\taccount, err := g.getAccountNumber(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\taccountDisabled, err := g.addAccount(client, *account)\n\tif accountDisabled {\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.addMembers(client, *account)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = g.addStandardsSubscription(client, *account)\n\treturn err\n}\n\nfunc (g *SecurityhubGenerator) addAccount(client *securityhub.Client, accountNumber string) (bool, error) {\n\t_, err := client.GetEnabledStandards(context.TODO(), &securityhub.GetEnabledStandardsInput{})\n\n\tif err != nil {\n\t\terrorMsg := err.Error()\n\t\tif !strings.Contains(errorMsg, \"not subscribed to AWS Security Hub\") {\n\t\t\treturn false, err\n\t\t}\n\t\treturn true, nil\n\t}\n\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\taccountNumber,\n\t\taccountNumber,\n\t\t\"aws_securityhub_account\",\n\t\t\"aws\",\n\t\tsecurityhubAllowEmptyValues,\n\t))\n\treturn false, nil\n}\n\nfunc (g *SecurityhubGenerator) addMembers(svc *securityhub.Client, accountNumber string) error {\n\tp := securityhub.NewListMembersPaginator(svc, &securityhub.ListMembersInput{})\n\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, member := range page.Members {\n\t\t\tid := *member.AccountId\n\t\t\tattributes := map[string]string{\n\t\t\t\t\"account_id\": id,\n\t\t\t}\n\t\t\tif member.Email != nil {\n\t\t\t\tattributes[\"email\"] = *member.Email\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tid,\n\t\t\t\t\"securityhub_member_\"+id,\n\t\t\t\t\"aws_securityhub_member\",\n\t\t\t\t\"aws\",\n\t\t\t\tattributes,\n\t\t\t\tsecurityhubAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"depends_on\": []string{\"${aws_securityhub_account.tfer--\" + accountNumber + \"}\"},\n\t\t\t\t},\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *SecurityhubGenerator) addStandardsSubscription(svc *securityhub.Client, accountNumber string) error {\n\tp := securityhub.NewGetEnabledStandardsPaginator(svc, &securityhub.GetEnabledStandardsInput{})\n\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, standardsSubscription := range page.StandardsSubscriptions {\n\t\t\tid := *standardsSubscription.StandardsSubscriptionArn\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tid,\n\t\t\t\tid,\n\t\t\t\t\"aws_securityhub_standards_subscription\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"standards_arn\": id,\n\t\t\t\t},\n\t\t\t\tsecurityhubAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"depends_on\": []string{\"aws_securityhub_account.tfer--\" + accountNumber},\n\t\t\t\t},\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/servicecatalog.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/servicecatalog\"\n)\n\nvar servicecatalogAllowEmptyValues = []string{\"tags.\"}\n\ntype ServiceCatalogGenerator struct {\n\tAWSService\n}\n\nfunc (g *ServiceCatalogGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := servicecatalog.NewFromConfig(config)\n\tp := servicecatalog.NewListPortfoliosPaginator(svc, &servicecatalog.ListPortfoliosInput{})\n\tvar resources []terraformutils.Resource\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, portfolio := range page.PortfolioDetails {\n\t\t\tportfolioID := StringValue(portfolio.Id)\n\t\t\tportfolioName := StringValue(portfolio.DisplayName)\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tportfolioID,\n\t\t\t\tportfolioName,\n\t\t\t\t\"aws_servicecatalog_portfolio\",\n\t\t\t\t\"aws\",\n\t\t\t\tservicecatalogAllowEmptyValues))\n\t\t}\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/ses.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/ses\"\n)\n\nvar sesAllowEmptyValues = []string{\"tags.\"}\n\ntype SesGenerator struct {\n\tAWSService\n}\n\nfunc (g *SesGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ses.NewFromConfig(config)\n\n\tif err := g.loadDomainIdentities(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadMailIdentities(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadTemplates(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadConfigurationSets(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadRuleSets(svc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *SesGenerator) loadDomainIdentities(svc *ses.Client) error {\n\tp := ses.NewListIdentitiesPaginator(svc, &ses.ListIdentitiesInput{\n\t\tIdentityType: \"Domain\",\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, identity := range page.Identities {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tidentity,\n\t\t\t\tidentity,\n\t\t\t\t\"aws_ses_domain_identity\",\n\t\t\t\t\"aws\",\n\t\t\t\tsesAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *SesGenerator) loadMailIdentities(svc *ses.Client) error {\n\tp := ses.NewListIdentitiesPaginator(svc, &ses.ListIdentitiesInput{\n\t\tIdentityType: \"EmailAddress\",\n\t})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, identity := range page.Identities {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tidentity,\n\t\t\t\tidentity,\n\t\t\t\t\"aws_ses_email_identity\",\n\t\t\t\t\"aws\",\n\t\t\t\tsesAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *SesGenerator) loadTemplates(svc *ses.Client) error {\n\ttemplates, err := svc.ListTemplates(context.TODO(), &ses.ListTemplatesInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, templateMetadata := range templates.TemplatesMetadata {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(templateMetadata.Name),\n\t\t\tStringValue(templateMetadata.Name),\n\t\t\t\"aws_ses_template\",\n\t\t\t\"aws\",\n\t\t\tsesAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *SesGenerator) loadConfigurationSets(svc *ses.Client) error {\n\tconfigurationSets, err := svc.ListConfigurationSets(context.TODO(), &ses.ListConfigurationSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, configurationSet := range configurationSets.ConfigurationSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(configurationSet.Name),\n\t\t\tStringValue(configurationSet.Name),\n\t\t\t\"aws_ses_configuration_set\",\n\t\t\t\"aws\",\n\t\t\tsesAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *SesGenerator) loadRuleSets(svc *ses.Client) error {\n\truleSets, err := svc.ListReceiptRuleSets(context.TODO(), &ses.ListReceiptRuleSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, ruleSet := range ruleSets.RuleSets {\n\t\truleSetName := StringValue(ruleSet.Name)\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\truleSetName,\n\t\t\truleSetName,\n\t\t\t\"aws_ses_receipt_rule_set\",\n\t\t\t\"aws\",\n\t\t\tsesAllowEmptyValues))\n\t\trules, err := svc.DescribeReceiptRuleSet(context.TODO(), &ses.DescribeReceiptRuleSetInput{\n\t\t\tRuleSetName: ruleSet.Name,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, rule := range rules.Rules {\n\t\t\truleID := ruleSetName + \":\" + *rule.Name\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*rule.Name,\n\t\t\t\truleID,\n\t\t\t\t\"aws_ses_receipt_rule\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":          *rule.Name,\n\t\t\t\t\t\"rule_set_name\": ruleSetName,\n\t\t\t\t},\n\t\t\t\tsesAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/sfn.go",
    "content": "package aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/sfn\"\n)\n\nvar sfnAllowEmptyValues = []string{\"tags.\"}\n\ntype SfnGenerator struct {\n\tAWSService\n}\n\nfunc (g *SfnGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := sfn.NewFromConfig(config)\n\n\tp := sfn.NewListStateMachinesPaginator(svc, &sfn.ListStateMachinesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, stateMachine := range page.StateMachines {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*stateMachine.StateMachineArn,\n\t\t\t\t*stateMachine.Name,\n\t\t\t\t\"aws_sfn_state_machine\",\n\t\t\t\t\"aws\",\n\t\t\t\tsfnAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\n\tpActivity := sfn.NewListActivitiesPaginator(svc, &sfn.ListActivitiesInput{})\n\tfor pActivity.HasMorePages() {\n\t\tpActivityNextPage, err := pActivity.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, stateMachine := range pActivityNextPage.Activities {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t*stateMachine.ActivityArn,\n\t\t\t\t*stateMachine.Name,\n\t\t\t\t\"aws_sfn_activity\",\n\t\t\t\t\"aws\",\n\t\t\t\tsfnAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/sg.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\t\"sort\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2/types\"\n\t\"github.com/hashicorp/terraform/flatmap\"\n\t\"gonum.org/v1/gonum/graph\"\n\tsimplegraph \"gonum.org/v1/gonum/graph/simple\"\n\t\"gonum.org/v1/gonum/graph/topo\"\n)\n\nvar SgAllowEmptyValues = []string{\"tags.\"}\n\ntype void struct{}\n\nvar member void\n\ntype SecurityGenerator struct {\n\tAWSService\n}\n\ntype ByGroupPair []types.UserIdGroupPair\n\nfunc (b ByGroupPair) Len() int      { return len(b) }\nfunc (b ByGroupPair) Swap(i, j int) { b[i], b[j] = b[j], b[i] }\nfunc (b ByGroupPair) Less(i, j int) bool {\n\tif b[i].GroupId != nil && b[j].GroupId != nil {\n\t\treturn *b[i].GroupId < *b[j].GroupId\n\t}\n\tif b[i].GroupName != nil && b[j].GroupName != nil {\n\t\treturn *b[i].GroupName < *b[j].GroupName\n\t}\n\n\tpanic(\"mismatched security group rules, may be a terraform bug\")\n}\n\nfunc (SecurityGenerator) createResources(securityGroups []types.SecurityGroup) []terraformutils.Resource {\n\tvar sgIDsToMoveOut []string\n\t_, shouldSplitRules := os.LookupEnv(\"SPLIT_SG_RULES\")\n\tif shouldSplitRules {\n\t\tfor _, sg := range securityGroups {\n\t\t\tsgIDsToMoveOut = append(sgIDsToMoveOut, *sg.GroupId)\n\t\t}\n\t} else {\n\t\tsgIDsToMoveOut = findSgsToMoveOut(securityGroups)\n\t}\n\n\tvar resources []terraformutils.Resource\n\tfor _, sg := range securityGroups {\n\t\tif sg.VpcId == nil {\n\t\t\tcontinue\n\t\t}\n\t\truleAttributes := map[string]interface{}{}\n\t\t// we must move out all of the rules - https://github.com/hashicorp/terraform/issues/11011#issuecomment-283076580\n\t\tfor _, groupIDToMoveOut := range sgIDsToMoveOut {\n\t\t\tif groupIDToMoveOut == *sg.GroupId {\n\t\t\t\truleAttributes[\"clearRules\"] = true\n\t\t\t\tfor _, rule := range sg.IpPermissions {\n\t\t\t\t\tresources = processRule(rule, \"ingress\", sg, resources)\n\t\t\t\t}\n\t\t\t\tfor _, rule := range sg.IpPermissionsEgress {\n\t\t\t\t\tresources = processRule(rule, \"egress\", sg, resources)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tStringValue(sg.GroupId),\n\t\t\tstrings.Trim(StringValue(sg.GroupName)+\"_\"+StringValue(sg.GroupId), \" \"),\n\t\t\t\"aws_security_group\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{},\n\t\t\tSgAllowEmptyValues,\n\t\t\truleAttributes))\n\t}\n\treturn resources\n}\n\nfunc processRule(rule types.IpPermission, ruleType string, sg types.SecurityGroup, resources []terraformutils.Resource) []terraformutils.Resource {\n\tif rule.UserIdGroupPairs != nil && len(rule.UserIdGroupPairs) > 0 {\n\t\tif len(rule.IpRanges) > 0 { // we must unwind coupled CIDR IPv4 range + security group rules\n\t\t\tattributes := baseRuleAttributes(ruleType, rule, sg)\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tpermissionID(*sg.GroupId, ruleType, \"\", rule),\n\t\t\t\tpermissionID(*sg.GroupId, ruleType, \"\", rule),\n\t\t\t\t\"aws_security_group_rule\",\n\t\t\t\t\"aws\",\n\t\t\t\tflatmap.Flatten(attributes),\n\t\t\t\tSgAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t\tif len(rule.Ipv6Ranges) > 0 { // we must unwind coupled CIDR IPv6 range + security group rules\n\t\t\tattributes := baseRuleAttributes(ruleType, rule, sg)\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tpermissionID(*sg.GroupId, ruleType, \"\", rule),\n\t\t\t\tpermissionID(*sg.GroupId, ruleType, \"\", rule),\n\t\t\t\t\"aws_security_group_rule\",\n\t\t\t\t\"aws\",\n\t\t\t\tflatmap.Flatten(attributes),\n\t\t\t\tSgAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t\tfor _, groupPair := range rule.UserIdGroupPairs {\n\t\t\tattributes := baseRuleAttributes(ruleType, rule, sg)\n\t\t\tdelete(attributes, \"cidr_blocks\")\n\t\t\tdelete(attributes, \"ipv6_cidr_blocks\")\n\t\t\tif *groupPair.GroupId == *sg.GroupId { // Solution to C1\n\t\t\t\tattributes[\"self\"] = true\n\t\t\t} else {\n\t\t\t\tattributes[\"source_security_group_id\"] = *groupPair.GroupId\n\t\t\t}\n\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tpermissionID(*sg.GroupId, ruleType, *groupPair.GroupId, rule),\n\t\t\t\tpermissionID(*sg.GroupId, ruleType, *groupPair.GroupId, rule),\n\t\t\t\t\"aws_security_group_rule\",\n\t\t\t\t\"aws\",\n\t\t\t\tflatmap.Flatten(attributes),\n\t\t\t\tSgAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t} else {\n\t\tattributes := baseRuleAttributes(ruleType, rule, sg)\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tpermissionID(*sg.GroupId, ruleType, \"\", rule),\n\t\t\tpermissionID(*sg.GroupId, ruleType, \"\", rule),\n\t\t\t\"aws_security_group_rule\",\n\t\t\t\"aws\",\n\t\t\tflatmap.Flatten(attributes),\n\t\t\tSgAllowEmptyValues,\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn resources\n}\n\nfunc baseRuleAttributes(ruleType string, rule types.IpPermission, sg types.SecurityGroup) map[string]interface{} {\n\tattributes := map[string]interface{}{\n\t\t\"type\":              ruleType,\n\t\t\"cidr_blocks\":       ipRange(rule),\n\t\t\"ipv6_cidr_blocks\":  ip6Range(rule),\n\t\t\"prefix_list_ids\":   prefixes(rule),\n\t\t\"from_port\":         fromPort(rule),\n\t\t\"protocol\":          *rule.IpProtocol,\n\t\t\"security_group_id\": *sg.GroupId,\n\t\t\"to_port\":           toPort(rule),\n\t}\n\treturn attributes\n}\n\n// Let's try to find all cycles by applying Johnson's method on the directed graph\n// We cannot build a line graph and move out only rules because of hashicorp/terraform#11011\nfunc findSgsToMoveOut(securityGroups []types.SecurityGroup) []string {\n\t// Vertexes are security groups, edges are rules. The task is to find correct set of rule definitions, so that we\n\t// won't have cycles\n\tsourceGraph := simplegraph.NewDirectedGraph()\n\tidToSg := make(map[int]types.SecurityGroup)\n\tsgToIdx := make(map[string]int64)\n\tfor idx, sg := range securityGroups {\n\t\tidToSg[idx] = sg\n\t\tsgToIdx[StringValue(sg.GroupId)] = int64(idx)\n\t\tsourceGraph.AddNode(sourceGraph.NewNode())\n\t}\n\tfor idx, sg := range securityGroups {\n\t\tfor _, rule := range sg.IpPermissions {\n\t\t\tpairs := rule.UserIdGroupPairs\n\t\t\tfor _, pair := range pairs {\n\t\t\t\tif pair.GroupId != nil {\n\t\t\t\t\tfromNode := sourceGraph.Node(int64(idx))\n\t\t\t\t\ttoNode := sourceGraph.Node(sgToIdx[StringValue(pair.GroupId)])\n\t\t\t\t\tif fromNode.ID() != toNode.ID() {\n\t\t\t\t\t\tsourceGraph.SetEdge(sourceGraph.NewEdge(fromNode, toNode))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tcyclesInLineGraph := topo.DirectedCyclesIn(sourceGraph) // C1 cycles won't be found but Terraform solves that issue\n\tresultingSet := make(map[string]void)\n\n\tfor _, v := range cyclesInLineGraph {\n\t\tif elementAlreadyFound(resultingSet, v, idToSg) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Try to move out node with lowest number of rules\n\t\tgroup := idToSg[int(v[0].ID())]\n\t\tfor _, vi := range v {\n\t\t\tviGroup := idToSg[int(vi.ID())]\n\t\t\tif len(viGroup.IpPermissions) < len(group.IpPermissions) {\n\t\t\t\tgroup = viGroup\n\t\t\t}\n\t\t}\n\n\t\tresultingSet[*group.GroupId] = member\n\t}\n\n\tresult := make([]string, len(resultingSet))\n\ti := 0\n\tfor k := range resultingSet {\n\t\tresult[i] = k\n\t\ti++\n\t}\n\n\treturn result\n}\n\nfunc elementAlreadyFound(resultingSet map[string]void, v []graph.Node, idToSg map[int]types.SecurityGroup) bool {\n\tfor k := range resultingSet {\n\t\tfor _, vi := range v {\n\t\t\tviGroupID := *idToSg[int(vi.ID())].GroupId\n\t\t\tif k == viGroupID {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}\n\nfunc (g *SecurityGenerator) InitResources() error {\n\tconfig, err := g.generateConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tp := ec2.NewDescribeSecurityGroupsPaginator(svc, &ec2.DescribeSecurityGroupsInput{})\n\tvar resourcesToFilter []types.SecurityGroup\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tresourcesToFilter = append(resourcesToFilter, page.SecurityGroups...)\n\t}\n\tsort.Slice(resourcesToFilter, func(i, j int) bool {\n\t\treturn *resourcesToFilter[i].GroupId < *resourcesToFilter[j].GroupId\n\t})\n\tg.Resources = g.createResources(resourcesToFilter)\n\n\treturn nil\n}\n\nfunc (g *SecurityGenerator) PostConvertHook() error {\n\tfor _, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"aws_security_group_rule\" {\n\t\t\tif resource.Item[\"self\"] == \"true\" {\n\t\t\t\tdelete(resource.Item, \"source_security_group_id\")\n\t\t\t}\n\t\t} else if resource.InstanceInfo.Type == \"aws_security_group\" {\n\t\t\tif resource.Item[\"clearRules\"] == true {\n\t\t\t\tdelete(resource.Item, \"ingress\")\n\t\t\t\tdelete(resource.Item, \"egress\")\n\t\t\t\tdelete(resource.Item, \"clearRules\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif val, ok := resource.Item[\"ingress\"]; ok {\n\t\t\t\tg.sortRules(val.([]interface{}))\n\t\t\t}\n\t\t\tif val, ok := resource.Item[\"egress\"]; ok {\n\t\t\t\tg.sortRules(val.([]interface{}))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *SecurityGenerator) sortRules(rules []interface{}) {\n\tfor _, rule := range rules {\n\t\truleMap := rule.(map[string]interface{})\n\t\tg.sortIfExist(\"cidr_blocks\", ruleMap)\n\t\tg.sortIfExist(\"ipv6_cidr_blocks\", ruleMap)\n\t\tg.sortIfExist(\"security_groups\", ruleMap)\n\t}\n\tsort.Slice(rules, func(i, j int) bool {\n\t\treturn fmt.Sprintf(\"%v\", rules[i]) < fmt.Sprintf(\"%v\", rules[j])\n\t})\n}\n\nfunc (g *SecurityGenerator) sortIfExist(attribute string, ruleMap map[string]interface{}) {\n\tif val, ok := ruleMap[attribute]; ok {\n\t\tsort.Slice(val.([]interface{}), func(i, j int) bool {\n\t\t\treturn val.([]interface{})[i].(string) < val.([]interface{})[j].(string)\n\t\t})\n\t}\n}\n\nfunc permissionID(sgID, ruleType, groupID string, ip types.IpPermission) string {\n\tvar buf bytes.Buffer\n\tbuf.WriteString(fmt.Sprintf(\"%s_%s_%s_%d_%d_\", sgID, ruleType, *ip.IpProtocol, fromPort(ip), toPort(ip)))\n\n\tif len(ip.IpRanges) > 0 {\n\t\ts := make([]string, len(ip.IpRanges))\n\t\tfor i, r := range ip.IpRanges {\n\t\t\ts[i] = *r.CidrIp\n\t\t}\n\t\tsort.Strings(s)\n\n\t\tfor _, v := range s {\n\t\t\tbuf.WriteString(fmt.Sprintf(\"%s_\", v))\n\t\t}\n\t}\n\n\tif len(ip.Ipv6Ranges) > 0 {\n\t\ts := make([]string, len(ip.Ipv6Ranges))\n\t\tfor i, r := range ip.Ipv6Ranges {\n\t\t\ts[i] = *r.CidrIpv6\n\t\t}\n\t\tsort.Strings(s)\n\n\t\tfor _, v := range s {\n\t\t\tbuf.WriteString(fmt.Sprintf(\"%s_\", v))\n\t\t}\n\t}\n\n\tif len(ip.PrefixListIds) > 0 {\n\t\ts := make([]string, len(ip.PrefixListIds))\n\t\tfor i, pl := range ip.PrefixListIds {\n\t\t\ts[i] = *pl.PrefixListId\n\t\t}\n\t\tsort.Strings(s)\n\n\t\tfor _, v := range s {\n\t\t\tbuf.WriteString(fmt.Sprintf(\"%s_\", v))\n\t\t}\n\t}\n\n\tif groupID != \"\" {\n\t\tbuf.WriteString(fmt.Sprintf(\"%s_\", groupID))\n\t}\n\n\tidPreformatted := buf.String()\n\treturn idPreformatted[:len(idPreformatted)-1]\n}\n\nfunc fromPort(ip types.IpPermission) int {\n\tswitch {\n\tcase *ip.IpProtocol == \"icmp\":\n\t\treturn -1\n\tcase *ip.IpProtocol == \"-1\":\n\t\treturn -1\n\tcase ip.FromPort != nil && *ip.FromPort > 0:\n\t\treturn int(*ip.FromPort)\n\tdefault:\n\t\treturn 0\n\t}\n}\n\nfunc toPort(ip types.IpPermission) int {\n\tswitch {\n\tcase *ip.IpProtocol == \"icmp\":\n\t\treturn -1\n\tcase *ip.IpProtocol == \"-1\":\n\t\treturn -1\n\tcase ip.ToPort != nil && *ip.ToPort > 0:\n\t\treturn int(*ip.ToPort)\n\tdefault:\n\t\treturn 65536\n\t}\n}\n\nfunc ipRange(rule types.IpPermission) []string {\n\tresult := make([]string, len(rule.IpRanges))\n\tfor idx, rule := range rule.IpRanges {\n\t\tresult[idx] = *rule.CidrIp\n\t}\n\treturn result\n}\n\nfunc ip6Range(rule types.IpPermission) []string {\n\tresult := make([]string, len(rule.Ipv6Ranges))\n\tfor idx, rule := range rule.Ipv6Ranges {\n\t\tresult[idx] = *rule.CidrIpv6\n\t}\n\treturn result\n}\n\nfunc prefixes(rule types.IpPermission) []string {\n\tresult := make([]string, len(rule.PrefixListIds))\n\tfor idx, rule := range rule.PrefixListIds {\n\t\tresult[idx] = *rule.PrefixListId\n\t}\n\treturn result\n}\n"
  },
  {
    "path": "providers/aws/sg_test.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"reflect\"\n\t\"testing\"\n\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2/types\"\n)\n\nfunc TestEmptySgs(t *testing.T) {\n\tvar securityGroups []types.SecurityGroup\n\n\trulesToMoveOut := findSgsToMoveOut(securityGroups)\n\n\tif !reflect.DeepEqual(rulesToMoveOut, []string{}) {\n\t\tt.Errorf(\"failed to calculate rules to move out %v\", rulesToMoveOut)\n\t}\n}\n\nfunc Test1CycleReference(t *testing.T) {\n\tsgA := types.SecurityGroup{\n\t\tGroupId: aws.String(\"aaaa\"),\n\t\tIpPermissions: []types.IpPermission{\n\t\t\t{\n\t\t\t\tUserIdGroupPairs: []types.UserIdGroupPair{\n\t\t\t\t\t{\n\t\t\t\t\t\tGroupId: aws.String(\"aaaa\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{},\n\t\t},\n\t}\n\tsecurityGroups := []types.SecurityGroup{\n\t\tsgA,\n\t}\n\n\trulesToMoveOut := findSgsToMoveOut(securityGroups)\n\n\tif !reflect.DeepEqual(rulesToMoveOut, []string{}) {\n\t\tt.Errorf(\"failed to calculate rules to move out %v\", rulesToMoveOut)\n\t}\n}\n\nfunc Test2CycleReference(t *testing.T) {\n\tsgA := types.SecurityGroup{\n\t\tGroupId: aws.String(\"aaaa\"),\n\t\tIpPermissions: []types.IpPermission{\n\t\t\t{\n\t\t\t\tUserIdGroupPairs: []types.UserIdGroupPair{\n\t\t\t\t\t{\n\t\t\t\t\t\tGroupId: aws.String(\"bbbb\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tsecurityGroups := []types.SecurityGroup{\n\t\t{\n\t\t\tGroupId: aws.String(\"bbbb\"),\n\t\t\tIpPermissions: []types.IpPermission{\n\t\t\t\t{\n\t\t\t\t\tUserIdGroupPairs: []types.UserIdGroupPair{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tGroupId: aws.String(\"aaaa\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{},\n\t\t\t},\n\t\t},\n\t\tsgA,\n\t}\n\n\trulesToMoveOut := findSgsToMoveOut(securityGroups)\n\n\tif !reflect.DeepEqual(rulesToMoveOut[0], *sgA.GroupId) {\n\t\tt.Errorf(\"failed to calculate rules to move out %v\", rulesToMoveOut)\n\t}\n}\n\nfunc TestNoCycleReference(t *testing.T) {\n\tsgA := types.SecurityGroup{\n\t\tGroupId: aws.String(\"aaaa\"),\n\t\tIpPermissions: []types.IpPermission{\n\t\t\t{\n\t\t\t\tUserIdGroupPairs: []types.UserIdGroupPair{\n\t\t\t\t\t{\n\t\t\t\t\t\tGroupId: aws.String(\"bbbb\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tsecurityGroups := []types.SecurityGroup{\n\t\t{\n\t\t\tGroupId: aws.String(\"bbbb\"),\n\t\t\tIpPermissions: []types.IpPermission{\n\t\t\t\t{},\n\t\t\t\t{},\n\t\t\t},\n\t\t},\n\t\tsgA,\n\t}\n\n\trulesToMoveOut := findSgsToMoveOut(securityGroups)\n\n\tif len(rulesToMoveOut) != 0 {\n\t\tt.Errorf(\"failed to calculate rules to move out %v\", rulesToMoveOut)\n\t}\n}\n\nfunc Test3Cycle1CycleReference(t *testing.T) {\n\tsgA := types.SecurityGroup{\n\t\tGroupId: aws.String(\"aaaa\"),\n\t\tIpPermissions: []types.IpPermission{\n\t\t\t{\n\t\t\t\tUserIdGroupPairs: []types.UserIdGroupPair{\n\t\t\t\t\t{\n\t\t\t\t\t\tGroupId: aws.String(\"aaaa\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tUserIdGroupPairs: []types.UserIdGroupPair{\n\t\t\t\t\t{\n\t\t\t\t\t\tGroupId: aws.String(\"bbbb\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tsecurityGroups := []types.SecurityGroup{\n\t\tsgA,\n\t\t{\n\t\t\tGroupId: aws.String(\"bbbb\"),\n\t\t\tIpPermissions: []types.IpPermission{\n\t\t\t\t{\n\t\t\t\t\tUserIdGroupPairs: []types.UserIdGroupPair{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tGroupId: aws.String(\"cccc\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tGroupId: aws.String(\"cccc\"),\n\t\t\tIpPermissions: []types.IpPermission{\n\t\t\t\t{\n\t\t\t\t\tUserIdGroupPairs: []types.UserIdGroupPair{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tGroupId: aws.String(\"aaaa\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tGroupId: aws.String(\"dddd\"),\n\t\t\tIpPermissions: []types.IpPermission{\n\t\t\t\t{\n\t\t\t\t\tUserIdGroupPairs: []types.UserIdGroupPair{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tGroupId: aws.String(\"aaaa\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{},\n\t\t\t},\n\t\t},\n\t}\n\n\trulesToMoveOut := findSgsToMoveOut(securityGroups)\n\n\tif !reflect.DeepEqual(rulesToMoveOut[0], *sgA.GroupId) {\n\t\tt.Errorf(\"failed to calculate rules to move out %v\", rulesToMoveOut)\n\t}\n}\n"
  },
  {
    "path": "providers/aws/sns.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/sns\"\n)\n\nvar snsAllowEmptyValues = []string{\"tags.\"}\n\ntype SnsGenerator struct {\n\tAWSService\n}\n\n// TF currently doesn't support email subscriptions + subscriptions with pending confirmations\nfunc (g *SnsGenerator) isSupportedSubscription(protocol, subscriptionID string) bool {\n\treturn protocol != \"email\" && protocol != \"email-json\" && subscriptionID != \"PendingConfirmation\"\n}\n\nfunc (g *SnsGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := sns.NewFromConfig(config)\n\tp := sns.NewListTopicsPaginator(svc, &sns.ListTopicsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, topic := range page.Topics {\n\t\t\tarnParts := strings.Split(StringValue(topic.TopicArn), \":\")\n\t\t\ttopicName := arnParts[len(arnParts)-1]\n\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(topic.TopicArn),\n\t\t\t\ttopicName,\n\t\t\t\t\"aws_sns_topic\",\n\t\t\t\t\"aws\",\n\t\t\t\tsnsAllowEmptyValues,\n\t\t\t))\n\n\t\t\ttopicSubsPage := sns.NewListSubscriptionsByTopicPaginator(svc, &sns.ListSubscriptionsByTopicInput{\n\t\t\t\tTopicArn: topic.TopicArn,\n\t\t\t})\n\t\t\tfor topicSubsPage.HasMorePages() {\n\t\t\t\ttopicSubsNextPage, err := topicSubsPage.NextPage(context.TODO())\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Println(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor _, subscription := range topicSubsNextPage.Subscriptions {\n\t\t\t\t\tsubscriptionArnParts := strings.Split(StringValue(subscription.SubscriptionArn), \":\")\n\t\t\t\t\tsubscriptionID := subscriptionArnParts[len(subscriptionArnParts)-1]\n\n\t\t\t\t\tif g.isSupportedSubscription(StringValue(subscription.Protocol), subscriptionID) {\n\t\t\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\t\t\tStringValue(subscription.SubscriptionArn),\n\t\t\t\t\t\t\t\"subscription-\"+subscriptionID,\n\t\t\t\t\t\t\t\"aws_sns_topic_subscription\",\n\t\t\t\t\t\t\t\"aws\",\n\t\t\t\t\t\t\tsnsAllowEmptyValues,\n\t\t\t\t\t\t))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\n// PostConvertHook for add policy json as heredoc\nfunc (g *SnsGenerator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"aws_sns_topic\" {\n\t\t\tif val, ok := g.Resources[i].Item[\"policy\"]; ok {\n\t\t\t\tpolicy := g.escapeAwsInterpolation(val.(string))\n\t\t\t\tg.Resources[i].Item[\"policy\"] = fmt.Sprintf(`<<POLICY\n%s\nPOLICY`, policy)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/sqs.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/aws\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/sqs\"\n)\n\nvar sqsAllowEmptyValues = []string{\"tags.\"}\n\ntype SqsGenerator struct {\n\tAWSService\n}\n\nfunc (g *SqsGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := sqs.NewFromConfig(config)\n\n\tlistQueuesInput := sqs.ListQueuesInput{}\n\n\tsqsPrefix, hasPrefix := os.LookupEnv(\"SQS_PREFIX\")\n\tif hasPrefix {\n\t\tlistQueuesInput.QueueNamePrefix = aws.String(sqsPrefix)\n\t}\n\n\tqueuesList, err := svc.ListQueues(context.TODO(), &listQueuesInput)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, queueURL := range queuesList.QueueUrls {\n\t\turlParts := strings.Split(queueURL, \"/\")\n\t\tqueueName := urlParts[len(urlParts)-1]\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tqueueURL,\n\t\t\tqueueName,\n\t\t\t\"aws_sqs_queue\",\n\t\t\t\"aws\",\n\t\t\tsqsAllowEmptyValues,\n\t\t))\n\t}\n\n\treturn nil\n}\n\n// PostConvertHook for add policy json as heredoc\nfunc (g *SqsGenerator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"aws_sqs_queue\" {\n\t\t\tif val, ok := g.Resources[i].Item[\"policy\"]; ok {\n\t\t\t\tpolicy := g.escapeAwsInterpolation(val.(string))\n\t\t\t\tg.Resources[i].Item[\"policy\"] = fmt.Sprintf(`<<POLICY\n%s\nPOLICY`, policy)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/ssm.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ssm\"\n)\n\nvar ssmAllowEmptyValues = []string{\"tags.\"}\n\ntype SsmGenerator struct {\n\tAWSService\n}\n\nfunc (g *SsmGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ssm.NewFromConfig(config)\n\tp := ssm.NewDescribeParametersPaginator(svc, &ssm.DescribeParametersInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, parameter := range page.Parameters {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(parameter.Name),\n\t\t\t\tStringValue(parameter.Name),\n\t\t\t\t\"aws_ssm_parameter\",\n\t\t\t\t\"aws\",\n\t\t\t\tssmAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/subnet.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar SubnetAllowEmptyValues = []string{\"tags.\"}\n\ntype SubnetGenerator struct {\n\tAWSService\n}\n\nfunc (SubnetGenerator) createResources(subnets *ec2.DescribeSubnetsOutput) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, subnet := range subnets.Subnets {\n\t\tresource := terraformutils.NewSimpleResource(\n\t\t\tStringValue(subnet.SubnetId),\n\t\t\tStringValue(subnet.SubnetId),\n\t\t\t\"aws_subnet\",\n\t\t\t\"aws\",\n\t\t\tSubnetAllowEmptyValues,\n\t\t)\n\t\tresource.IgnoreKeys = append(resource.IgnoreKeys, \"availability_zone\")\n\t\tresources = append(resources, resource)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// from each subnet create 1 TerraformResource.\n// Need SubnetId as ID for terraform resource\nfunc (g *SubnetGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tp := ec2.NewDescribeSubnetsPaginator(svc, &ec2.DescribeSubnetsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createResources(page)...)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/swf.go",
    "content": "package aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/swf\"\n\t\"github.com/aws/aws-sdk-go-v2/service/swf/types\"\n)\n\ntype SWFGenerator struct {\n\tAWSService\n}\n\nfunc (g *SWFGenerator) InitResources() error {\n\tregStatuses := []types.RegistrationStatus{types.RegistrationStatusRegistered, types.RegistrationStatusDeprecated}\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := swf.NewFromConfig(config)\n\tfor _, status := range regStatuses {\n\t\tp := swf.NewListDomainsPaginator(svc, &swf.ListDomainsInput{RegistrationStatus: status})\n\t\tfor p.HasMorePages() {\n\t\t\tpage, err := p.NextPage(context.TODO())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, domain := range page.DomainInfos {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\t*domain.Name,\n\t\t\t\t\t*domain.Name,\n\t\t\t\t\t\"aws_swf_domain\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\t[]string{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/transit_gateway.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar tgwAllowEmptyValues = []string{\"tags.\"}\n\ntype TransitGatewayGenerator struct {\n\tAWSService\n}\n\nfunc (g *TransitGatewayGenerator) getTransitGateways(svc *ec2.Client) error {\n\tp := ec2.NewDescribeTransitGatewaysPaginator(svc, &ec2.DescribeTransitGatewaysInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, tgw := range page.TransitGateways {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(tgw.TransitGatewayId),\n\t\t\t\tStringValue(tgw.TransitGatewayId),\n\t\t\t\t\"aws_ec2_transit_gateway\",\n\t\t\t\t\"aws\",\n\t\t\t\ttgwAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *TransitGatewayGenerator) getTransitGatewayRouteTables(svc *ec2.Client) error {\n\tp := ec2.NewDescribeTransitGatewayRouteTablesPaginator(svc, &ec2.DescribeTransitGatewayRouteTablesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, tgwrt := range page.TransitGatewayRouteTables {\n\t\t\t// Default route table are automatically created on the tgw creation\n\t\t\tif *tgwrt.DefaultAssociationRouteTable {\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\tStringValue(tgwrt.TransitGatewayRouteTableId),\n\t\t\t\t\tStringValue(tgwrt.TransitGatewayRouteTableId),\n\t\t\t\t\t\"aws_ec2_transit_gateway_route_table\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\ttgwAllowEmptyValues,\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *TransitGatewayGenerator) getTransitGatewayVpcAttachments(svc *ec2.Client) error {\n\tp := ec2.NewDescribeTransitGatewayVpcAttachmentsPaginator(svc, &ec2.DescribeTransitGatewayVpcAttachmentsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, tgwa := range page.TransitGatewayVpcAttachments {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tStringValue(tgwa.TransitGatewayAttachmentId),\n\t\t\t\tStringValue(tgwa.TransitGatewayAttachmentId),\n\t\t\t\t\"aws_ec2_transit_gateway_vpc_attachment\",\n\t\t\t\t\"aws\",\n\t\t\t\ttgwAllowEmptyValues,\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\n// Generate TerraformResources from AWS API,\n// from each customer gateway create 1 TerraformResource.\n// Need CustomerGatewayId as ID for terraform resource\nfunc (g *TransitGatewayGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tg.Resources = []terraformutils.Resource{}\n\terr := g.getTransitGateways(svc)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\terr = g.getTransitGatewayRouteTables(svc)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\terr = g.getTransitGatewayVpcAttachments(svc)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/vgw.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar VpnAllowEmptyValues = []string{\"tags.\"}\n\ntype VpnGatewayGenerator struct {\n\tAWSService\n}\n\nfunc (VpnGatewayGenerator) createResources(vpnGws *ec2.DescribeVpnGatewaysOutput) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, vpnGw := range vpnGws.VpnGateways {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(vpnGw.VpnGatewayId),\n\t\t\tStringValue(vpnGw.VpnGatewayId),\n\t\t\t\"aws_vpn_gateway\",\n\t\t\t\"aws\",\n\t\t\tVpnAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// from each vpn gateway create 1 TerraformResource.\n// Need VpnGatewayId as ID for terraform resource\nfunc (g *VpnGatewayGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tvpnGws, err := svc.DescribeVpnGateways(context.TODO(), &ec2.DescribeVpnGatewaysInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(vpnGws)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/vpc.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar VpcAllowEmptyValues = []string{\"tags.\"}\n\ntype VpcGenerator struct {\n\tAWSService\n}\n\nfunc (VpcGenerator) createResources(vpcs *ec2.DescribeVpcsOutput) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, vpc := range vpcs.Vpcs {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(vpc.VpcId),\n\t\t\tStringValue(vpc.VpcId),\n\t\t\t\"aws_vpc\",\n\t\t\t\"aws\",\n\t\t\tVpcAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// from each vpc create 1 TerraformResource.\n// Need VpcId as ID for terraform resource\nfunc (g *VpcGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tp := ec2.NewDescribeVpcsPaginator(svc, &ec2.DescribeVpcsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createResources(page)...)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/vpc_endpoint.go",
    "content": "// Copyright 2023 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar VpcEndpointAllowEmptyValues = []string{\"tags.\"}\n\ntype VpcEndpointGenerator struct {\n\tAWSService\n}\n\nfunc (g *VpcEndpointGenerator) createResources(vpceps *ec2.DescribeVpcEndpointsOutput) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, vpcEndpoint := range vpceps.VpcEndpoints {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(vpcEndpoint.VpcEndpointId),\n\t\t\tStringValue(vpcEndpoint.VpcEndpointId),\n\t\t\t\"aws_vpc_endpoint\",\n\t\t\t\"aws\",\n\t\t\tVpcAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// from each vpc endpoint create 1 TerraformResource.\n// Need VpcEndpointId as ID for terraform resource\nfunc (g *VpcEndpointGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tvpceps, err := svc.DescribeVpcEndpoints(context.TODO(), &ec2.DescribeVpcEndpointsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(vpceps)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/vpc_peering.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar peeringAllowEmptyValues = []string{\"tags.\"}\n\ntype VpcPeeringConnectionGenerator struct {\n\tAWSService\n}\n\nfunc (g *VpcPeeringConnectionGenerator) createResources(peerings *ec2.DescribeVpcPeeringConnectionsOutput) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, peering := range peerings.VpcPeeringConnections {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(peering.VpcPeeringConnectionId),\n\t\t\tStringValue(peering.VpcPeeringConnectionId),\n\t\t\t\"aws_vpc_peering_connection\",\n\t\t\t\"aws\",\n\t\t\tpeeringAllowEmptyValues,\n\t\t))\n\t}\n\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// create terraform resource for each VPC Peering Connection\nfunc (g *VpcPeeringConnectionGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tp := ec2.NewDescribeVpcPeeringConnectionsPaginator(svc, &ec2.DescribeVpcPeeringConnectionsInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createResources(page)...)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/vpn_connection.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/aws/aws-sdk-go-v2/service/ec2\"\n)\n\nvar VpnConnectionAllowEmptyValues = []string{\"tags.\"}\n\ntype VpnConnectionGenerator struct {\n\tAWSService\n}\n\nfunc (VpnConnectionGenerator) createResources(vpncs *ec2.DescribeVpnConnectionsOutput) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, vpnc := range vpncs.VpnConnections {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tStringValue(vpnc.VpnConnectionId),\n\t\t\tStringValue(vpnc.VpnConnectionId),\n\t\t\t\"aws_vpn_connection\",\n\t\t\t\"aws\",\n\t\t\tVpnConnectionAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from AWS API,\n// from each vpn connection create 1 TerraformResource.\n// Need VpnConnectionId as ID for terraform resource\nfunc (g *VpnConnectionGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := ec2.NewFromConfig(config)\n\tvpncs, err := svc.DescribeVpnConnections(context.TODO(), &ec2.DescribeVpnConnectionsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(vpncs)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/waf.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/waf\"\n)\n\nvar wafAllowEmptyValues = []string{\"tags.\"}\n\ntype WafGenerator struct {\n\tAWSService\n}\n\nfunc (g *WafGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := waf.NewFromConfig(config)\n\n\tif err := g.loadWebACL(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadByteMatchSet(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadGeoMatchSet(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadIPSet(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadRateBasedRules(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadRegexMatchSets(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadRegexPatternSets(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadWafRules(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadWafRuleGroups(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadSizeConstraintSets(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadSQLInjectionMatchSets(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadXSSMatchSet(svc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *WafGenerator) loadWebACL(svc *waf.Client) error {\n\toutput, err := svc.ListWebACLs(context.TODO(), &waf.ListWebACLsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, acl := range output.WebACLs {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*acl.WebACLId,\n\t\t\t*acl.Name+\"_\"+(*acl.WebACLId)[0:8],\n\t\t\t\"aws_waf_web_acl\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafGenerator) loadByteMatchSet(svc *waf.Client) error {\n\toutput, err := svc.ListByteMatchSets(context.TODO(), &waf.ListByteMatchSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, byteMatchSet := range output.ByteMatchSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*byteMatchSet.ByteMatchSetId,\n\t\t\t*byteMatchSet.Name+\"_\"+(*byteMatchSet.ByteMatchSetId)[0:8],\n\t\t\t\"aws_waf_byte_match_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafGenerator) loadGeoMatchSet(svc *waf.Client) error {\n\toutput, err := svc.ListGeoMatchSets(context.TODO(), &waf.ListGeoMatchSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, matchSet := range output.GeoMatchSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*matchSet.GeoMatchSetId,\n\t\t\t*matchSet.Name+\"_\"+(*matchSet.GeoMatchSetId)[0:8],\n\t\t\t\"aws_waf_geo_match_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafGenerator) loadIPSet(svc *waf.Client) error {\n\toutput, err := svc.ListIPSets(context.TODO(), &waf.ListIPSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, IPSet := range output.IPSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*IPSet.IPSetId,\n\t\t\t*IPSet.Name+\"_\"+(*IPSet.IPSetId)[0:8],\n\t\t\t\"aws_waf_ipset\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafGenerator) loadRateBasedRules(svc *waf.Client) error {\n\toutput, err := svc.ListRateBasedRules(context.TODO(), &waf.ListRateBasedRulesInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, rule := range output.Rules {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*rule.RuleId,\n\t\t\t*rule.Name+\"_\"+(*rule.RuleId)[0:8],\n\t\t\t\"aws_waf_rate_based_rule\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafGenerator) loadRegexMatchSets(svc *waf.Client) error {\n\toutput, err := svc.ListRegexMatchSets(context.TODO(), &waf.ListRegexMatchSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, regexMatchSet := range output.RegexMatchSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*regexMatchSet.RegexMatchSetId,\n\t\t\t*regexMatchSet.Name+\"_\"+(*regexMatchSet.RegexMatchSetId)[0:8],\n\t\t\t\"aws_waf_regex_match_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafGenerator) loadRegexPatternSets(svc *waf.Client) error {\n\toutput, err := svc.ListRegexPatternSets(context.TODO(), &waf.ListRegexPatternSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, regexPatternSet := range output.RegexPatternSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*regexPatternSet.RegexPatternSetId,\n\t\t\t*regexPatternSet.Name+\"_\"+(*regexPatternSet.RegexPatternSetId)[0:8],\n\t\t\t\"aws_waf_regex_pattern_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafGenerator) loadWafRules(svc *waf.Client) error {\n\toutput, err := svc.ListRules(context.TODO(), &waf.ListRulesInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, rule := range output.Rules {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*rule.RuleId,\n\t\t\t*rule.Name+\"_\"+(*rule.RuleId)[0:8],\n\t\t\t\"aws_waf_rule\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafGenerator) loadWafRuleGroups(svc *waf.Client) error {\n\toutput, err := svc.ListRuleGroups(context.TODO(), &waf.ListRuleGroupsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, ruleGroup := range output.RuleGroups {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*ruleGroup.RuleGroupId,\n\t\t\t*ruleGroup.Name+\"_\"+(*ruleGroup.RuleGroupId)[0:8],\n\t\t\t\"aws_waf_rule_group\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafGenerator) loadSizeConstraintSets(svc *waf.Client) error {\n\toutput, err := svc.ListSizeConstraintSets(context.TODO(), &waf.ListSizeConstraintSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, sizeConstraintSet := range output.SizeConstraintSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*sizeConstraintSet.SizeConstraintSetId,\n\t\t\t*sizeConstraintSet.Name+\"_\"+(*sizeConstraintSet.SizeConstraintSetId)[0:8],\n\t\t\t\"aws_waf_size_constraint_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafGenerator) loadSQLInjectionMatchSets(svc *waf.Client) error {\n\toutput, err := svc.ListSqlInjectionMatchSets(context.TODO(), &waf.ListSqlInjectionMatchSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, sqlInjectionMatchSet := range output.SqlInjectionMatchSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*sqlInjectionMatchSet.SqlInjectionMatchSetId,\n\t\t\t*sqlInjectionMatchSet.Name+\"_\"+(*sqlInjectionMatchSet.SqlInjectionMatchSetId)[0:8],\n\t\t\t\"aws_waf_sql_injection_match_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafGenerator) loadXSSMatchSet(svc *waf.Client) error {\n\toutput, err := svc.ListXssMatchSets(context.TODO(), &waf.ListXssMatchSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, xssMatchSet := range output.XssMatchSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*xssMatchSet.XssMatchSetId,\n\t\t\t*xssMatchSet.Name+\"_\"+(*xssMatchSet.XssMatchSetId)[0:8],\n\t\t\t\"aws_waf_xss_match_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/waf_regional.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/wafregional\"\n)\n\ntype WafRegionalGenerator struct {\n\tAWSService\n}\n\nfunc (g *WafRegionalGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := wafregional.NewFromConfig(config)\n\n\tif err := g.loadWebACL(svc); err != nil {\n\t\treturn err\n\t}\n\t// AWS WAF Regional API doesn't provide API to build aws_wafregional_web_acl_association resources\n\tif err := g.loadByteMatchSet(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadGeoMatchSet(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadIPSet(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadRateBasedRules(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadRegexMatchSets(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadRegexPatternSets(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadWafRules(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadWafRuleGroups(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadSizeConstraintSets(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadSQLInjectionMatchSets(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadXSSMatchSet(svc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *WafRegionalGenerator) loadWebACL(svc *wafregional.Client) error {\n\toutput, err := svc.ListWebACLs(context.TODO(), &wafregional.ListWebACLsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, acl := range output.WebACLs {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*acl.WebACLId,\n\t\t\t*acl.Name+\"_\"+(*acl.WebACLId)[0:8],\n\t\t\t\"aws_wafregional_web_acl\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafRegionalGenerator) loadByteMatchSet(svc *wafregional.Client) error {\n\toutput, err := svc.ListByteMatchSets(context.TODO(), &wafregional.ListByteMatchSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, byteMatchSet := range output.ByteMatchSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*byteMatchSet.ByteMatchSetId,\n\t\t\t*byteMatchSet.Name+\"_\"+(*byteMatchSet.ByteMatchSetId)[0:8],\n\t\t\t\"aws_wafregional_byte_match_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafRegionalGenerator) loadGeoMatchSet(svc *wafregional.Client) error {\n\toutput, err := svc.ListGeoMatchSets(context.TODO(), &wafregional.ListGeoMatchSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, matchSet := range output.GeoMatchSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*matchSet.GeoMatchSetId,\n\t\t\t*matchSet.Name+\"_\"+(*matchSet.GeoMatchSetId)[0:8],\n\t\t\t\"aws_wafregional_geo_match_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafRegionalGenerator) loadIPSet(svc *wafregional.Client) error {\n\toutput, err := svc.ListIPSets(context.TODO(), &wafregional.ListIPSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, IPSet := range output.IPSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*IPSet.IPSetId,\n\t\t\t*IPSet.Name+\"_\"+(*IPSet.IPSetId)[0:8],\n\t\t\t\"aws_wafregional_ipset\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafRegionalGenerator) loadRateBasedRules(svc *wafregional.Client) error {\n\toutput, err := svc.ListRateBasedRules(context.TODO(), &wafregional.ListRateBasedRulesInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, rule := range output.Rules {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*rule.RuleId,\n\t\t\t*rule.Name+\"_\"+(*rule.RuleId)[0:8],\n\t\t\t\"aws_wafregional_rate_based_rule\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafRegionalGenerator) loadRegexMatchSets(svc *wafregional.Client) error {\n\toutput, err := svc.ListRegexMatchSets(context.TODO(), &wafregional.ListRegexMatchSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, regexMatchSet := range output.RegexMatchSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*regexMatchSet.RegexMatchSetId,\n\t\t\t*regexMatchSet.Name+\"_\"+(*regexMatchSet.RegexMatchSetId)[0:8],\n\t\t\t\"aws_wafregional_regex_match_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafRegionalGenerator) loadRegexPatternSets(svc *wafregional.Client) error {\n\toutput, err := svc.ListRegexPatternSets(context.TODO(), &wafregional.ListRegexPatternSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, regexPatternSet := range output.RegexPatternSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*regexPatternSet.RegexPatternSetId,\n\t\t\t*regexPatternSet.Name+\"_\"+(*regexPatternSet.RegexPatternSetId)[0:8],\n\t\t\t\"aws_wafregional_regex_pattern_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafRegionalGenerator) loadWafRules(svc *wafregional.Client) error {\n\toutput, err := svc.ListRules(context.TODO(), &wafregional.ListRulesInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, rule := range output.Rules {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*rule.RuleId,\n\t\t\t*rule.Name+\"_\"+(*rule.RuleId)[0:8],\n\t\t\t\"aws_wafregional_rule\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafRegionalGenerator) loadWafRuleGroups(svc *wafregional.Client) error {\n\toutput, err := svc.ListRuleGroups(context.TODO(), &wafregional.ListRuleGroupsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, ruleGroup := range output.RuleGroups {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*ruleGroup.RuleGroupId,\n\t\t\t*ruleGroup.Name+\"_\"+(*ruleGroup.RuleGroupId)[0:8],\n\t\t\t\"aws_wafregional_rule_group\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafRegionalGenerator) loadSizeConstraintSets(svc *wafregional.Client) error {\n\toutput, err := svc.ListSizeConstraintSets(context.TODO(), &wafregional.ListSizeConstraintSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, sizeConstraintSet := range output.SizeConstraintSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*sizeConstraintSet.SizeConstraintSetId,\n\t\t\t*sizeConstraintSet.Name+\"_\"+(*sizeConstraintSet.SizeConstraintSetId)[0:8],\n\t\t\t\"aws_wafregional_size_constraint_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafRegionalGenerator) loadSQLInjectionMatchSets(svc *wafregional.Client) error {\n\toutput, err := svc.ListSqlInjectionMatchSets(context.TODO(), &wafregional.ListSqlInjectionMatchSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, sqlInjectionMatchSet := range output.SqlInjectionMatchSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*sqlInjectionMatchSet.SqlInjectionMatchSetId,\n\t\t\t*sqlInjectionMatchSet.Name+\"_\"+(*sqlInjectionMatchSet.SqlInjectionMatchSetId)[0:8],\n\t\t\t\"aws_wafregional_sql_injection_match_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n\nfunc (g *WafRegionalGenerator) loadXSSMatchSet(svc *wafregional.Client) error {\n\toutput, err := svc.ListXssMatchSets(context.TODO(), &wafregional.ListXssMatchSetsInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, xssMatchSet := range output.XssMatchSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*xssMatchSet.XssMatchSetId,\n\t\t\t*xssMatchSet.Name+\"_\"+(*xssMatchSet.XssMatchSetId)[0:8],\n\t\t\t\"aws_wafregional_xss_match_set\",\n\t\t\t\"aws\",\n\t\t\twafAllowEmptyValues))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/wafv2.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/wafv2\"\n\t\"github.com/aws/aws-sdk-go-v2/service/wafv2/types\"\n)\n\nvar wafv2AllowEmptyValues = []string{\"tags.\"}\n\ntype Wafv2Generator struct {\n\tAWSService\n\tscope types.Scope\n}\n\nfunc NewWafv2CloudfrontGenerator() *Wafv2Generator {\n\treturn &Wafv2Generator{scope: types.ScopeCloudfront}\n}\n\nfunc NewWafv2RegionalGenerator() *Wafv2Generator {\n\treturn &Wafv2Generator{scope: types.ScopeRegional}\n}\n\nfunc (g *Wafv2Generator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := wafv2.NewFromConfig(config)\n\n\tif err := g.loadWebACL(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadIPSet(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadRegexPatternSets(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadWafRuleGroups(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadWebACLLoggingConfiguration(svc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *Wafv2Generator) loadWebACL(svc *wafv2.Client) error {\n\toutput, err := svc.ListWebACLs(context.TODO(), &wafv2.ListWebACLsInput{Scope: g.scope})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, acl := range output.WebACLs {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*acl.Id,\n\t\t\t*acl.Name+\"_\"+(*acl.Id)[0:8],\n\t\t\t\"aws_wafv2_web_acl\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":  *acl.Name,\n\t\t\t\t\"scope\": string(g.scope),\n\t\t\t},\n\t\t\twafv2AllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t\tif g.scope == types.ScopeRegional {\n\t\t\t// cloudfront associations are not listed here since they should to defined in\n\t\t\t// aws_cloudfront_distribution resource instead\n\t\t\terr = g.loadWebACLAssociations(svc, acl.ARN)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *Wafv2Generator) loadWebACLAssociations(svc *wafv2.Client, webACLArn *string) error {\n\tfor _, resourceType := range types.ResourceTypeApplicationLoadBalancer.Values() {\n\t\toutput, err := svc.ListResourcesForWebACL(context.TODO(),\n\t\t\t&wafv2.ListResourcesForWebACLInput{WebACLArn: webACLArn, ResourceType: resourceType})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, resource := range output.ResourceArns {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tresource,\n\t\t\t\tresource,\n\t\t\t\t\"aws_wafv2_web_acl_association\",\n\t\t\t\t\"aws\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"resource_arn\": resource,\n\t\t\t\t\t\"web_acl_arn\":  *webACLArn,\n\t\t\t\t},\n\t\t\t\twafv2AllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *Wafv2Generator) loadIPSet(svc *wafv2.Client) error {\n\toutput, err := svc.ListIPSets(context.TODO(), &wafv2.ListIPSetsInput{Scope: g.scope})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, IPSet := range output.IPSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*IPSet.Id,\n\t\t\t*IPSet.Name+\"_\"+(*IPSet.Id)[0:8],\n\t\t\t\"aws_wafv2_ip_set\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":  *IPSet.Name,\n\t\t\t\t\"scope\": string(g.scope),\n\t\t\t},\n\t\t\twafv2AllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *Wafv2Generator) loadRegexPatternSets(svc *wafv2.Client) error {\n\toutput, err := svc.ListRegexPatternSets(context.TODO(), &wafv2.ListRegexPatternSetsInput{Scope: g.scope})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, regexPatternSet := range output.RegexPatternSets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*regexPatternSet.Id,\n\t\t\t*regexPatternSet.Name+\"_\"+(*regexPatternSet.Id)[0:8],\n\t\t\t\"aws_wafv2_regex_pattern_set\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":  *regexPatternSet.Name,\n\t\t\t\t\"scope\": string(g.scope),\n\t\t\t},\n\t\t\twafv2AllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *Wafv2Generator) loadWafRuleGroups(svc *wafv2.Client) error {\n\toutput, err := svc.ListRuleGroups(context.TODO(), &wafv2.ListRuleGroupsInput{Scope: g.scope})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, ruleGroup := range output.RuleGroups {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*ruleGroup.Id,\n\t\t\t*ruleGroup.Name+\"_\"+(*ruleGroup.Id)[0:8],\n\t\t\t\"aws_wafv2_rule_group\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"arn\":   *ruleGroup.ARN,\n\t\t\t\t\"name\":  *ruleGroup.Name,\n\t\t\t\t\"scope\": string(g.scope),\n\t\t\t},\n\t\t\twafv2AllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *Wafv2Generator) loadWebACLLoggingConfiguration(svc *wafv2.Client) error {\n\toutput, err := svc.ListLoggingConfigurations(context.TODO(), &wafv2.ListLoggingConfigurationsInput{Scope: g.scope})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, logConfig := range output.LoggingConfigurations {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*logConfig.ResourceArn,\n\t\t\t*logConfig.ResourceArn,\n\t\t\t\"aws_wafv2_web_acl_logging_configuration\",\n\t\t\t\"aws\",\n\t\t\tmap[string]string{\n\t\t\t\t\"resource_arn\": *logConfig.ResourceArn,\n\t\t\t},\n\t\t\twafv2AllowEmptyValues,\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/workspaces.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/workspaces\"\n)\n\nvar workspacesAllowEmptyValues = []string{\"tags.\"}\n\ntype WorkspacesGenerator struct {\n\tAWSService\n}\n\nfunc (g *WorkspacesGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := workspaces.NewFromConfig(config)\n\tif err := g.loadWorkspaces(svc); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadWorkspacesIPGroup(svc); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (g *WorkspacesGenerator) loadWorkspaces(svc *workspaces.Client) error {\n\tp := workspaces.NewDescribeWorkspacesPaginator(svc, &workspaces.DescribeWorkspacesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, workspace := range page.Workspaces {\n\t\t\tdirectoryID := StringValue(workspace.DirectoryId)\n\t\t\tworkspaceID := StringValue(workspace.WorkspaceId)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tdirectoryID,\n\t\t\t\tdirectoryID,\n\t\t\t\t\"aws_workspaces_directory\",\n\t\t\t\t\"aws\",\n\t\t\t\tworkspacesAllowEmptyValues))\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tworkspaceID,\n\t\t\t\tworkspaceID,\n\t\t\t\t\"aws_workspaces_workspace\",\n\t\t\t\t\"aws\",\n\t\t\t\tworkspacesAllowEmptyValues))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *WorkspacesGenerator) loadWorkspacesIPGroup(svc *workspaces.Client) error {\n\tvar nextToken *string\n\tfor {\n\t\tresponse, err := svc.DescribeIpGroups(context.TODO(), &workspaces.DescribeIpGroupsInput{NextToken: nextToken})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, ipGroup := range response.Result {\n\t\t\tgroupID := StringValue(ipGroup.GroupId)\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tgroupID,\n\t\t\t\tgroupID,\n\t\t\t\t\"aws_workspaces_ip_group\",\n\t\t\t\t\"aws\",\n\t\t\t\tworkspacesAllowEmptyValues))\n\t\t}\n\t\tnextToken = response.NextToken\n\t\tif nextToken == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/aws/xray.go",
    "content": "package aws\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/aws/aws-sdk-go-v2/service/xray\"\n)\n\nvar xrayAllowEmptyValues = []string{\"tags.\"}\n\ntype XrayGenerator struct {\n\tAWSService\n}\n\nfunc (g *XrayGenerator) InitResources() error {\n\tconfig, e := g.generateConfig()\n\tif e != nil {\n\t\treturn e\n\t}\n\tsvc := xray.NewFromConfig(config)\n\n\tp := xray.NewGetSamplingRulesPaginator(svc, &xray.GetSamplingRulesInput{})\n\tfor p.HasMorePages() {\n\t\tpage, err := p.NextPage(context.TODO())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, samplingRule := range page.SamplingRuleRecords {\n\t\t\t// NOTE: Builtin rule with unmodifiable name and 10000 prirority (lowest)\n\t\t\tif *samplingRule.SamplingRule.RuleName != \"Default\" {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\t*samplingRule.SamplingRule.RuleName,\n\t\t\t\t\t*samplingRule.SamplingRule.RuleName,\n\t\t\t\t\t\"aws_xray_sampling_rule\",\n\t\t\t\t\t\"aws\",\n\t\t\t\t\txrayAllowEmptyValues))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/analysis.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/analysisservices/mgmt/2017-08-01/analysisservices\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype AnalysisGenerator struct {\n\tAzureService\n}\n\nfunc (g *AnalysisGenerator) listServiceServers() ([]terraformutils.Resource, error) {\n\tlog.Println(\"\\tImporting Service Servers\")\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAnalysisClient := analysisservices.NewServersClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tAnalysisClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar (\n\t\tservers analysisservices.Servers\n\t\terr     error\n\t)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tservers, err = AnalysisClient.ListByResourceGroup(ctx, rg)\n\t} else {\n\t\tservers, err = AnalysisClient.List(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, svr := range *servers.Value {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*svr.ID,\n\t\t\t*svr.Name,\n\t\t\t\"azurerm_analysis_services_server\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *AnalysisGenerator) InitResources() error {\n\tfunctions := []func() ([]terraformutils.Resource, error){\n\t\tg.listServiceServers,\n\t}\n\n\tfor _, f := range functions {\n\t\tresources, err := f()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/app_service.go",
    "content": "package azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/web/mgmt/2019-08-01/web\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype AppServiceGenerator struct {\n\tAzureService\n}\n\nfunc (g AppServiceGenerator) listApps() ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tappServiceClient := web.NewAppsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tappServiceClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\tvar (\n\t\tappsIterator web.AppCollectionIterator\n\t\terr          error\n\t)\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tappsIterator, err = appServiceClient.ListByResourceGroupComplete(ctx, rg, nil)\n\t} else {\n\t\tappsIterator, err = appServiceClient.ListComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor appsIterator.NotDone() {\n\t\tsite := appsIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*site.ID,\n\t\t\t*site.Name,\n\t\t\t\"azurerm_app_service\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tif err := appsIterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *AppServiceGenerator) InitResources() error {\n\tresources, err := g.listApps()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = append(g.Resources, resources...)\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/application_gateway.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype ApplicationGatewayGenerator struct {\n\tAzureService\n}\n\nfunc (g ApplicationGatewayGenerator) createResources(ctx context.Context, iterator network.ApplicationGatewayListResultIterator) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tfor iterator.NotDone() {\n\t\tapplicationGateways := iterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*applicationGateways.ID,\n\t\t\t*applicationGateways.Name,\n\t\t\t\"azurerm_application_gateway\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *ApplicationGatewayGenerator) InitResources() error {\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tapplicationGatewaysClient := network.NewApplicationGatewaysClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\n\tapplicationGatewaysClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar (\n\t\toutput network.ApplicationGatewayListResultIterator\n\t\terr    error\n\t)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\toutput, err = applicationGatewaysClient.ListComplete(ctx, rg)\n\t} else {\n\t\toutput, err = applicationGatewaysClient.ListAllComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources, err = g.createResources(ctx, output)\n\treturn err\n}\n"
  },
  {
    "path": "providers/azure/azure_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n\t\"github.com/hashicorp/go-azure-helpers/sender\"\n\t\"github.com/manicminer/hamilton/environments\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/providerwrapper\"\n)\n\ntype AzureProvider struct { //nolint\n\tterraformutils.Provider\n\tconfig        authentication.Config\n\tauthorizer    autorest.Authorizer\n\tresourceGroup string\n}\n\nfunc (p *AzureProvider) setEnvConfig() error {\n\tsubscriptionID := os.Getenv(\"ARM_SUBSCRIPTION_ID\")\n\tif subscriptionID == \"\" {\n\t\treturn errors.New(\"set ARM_SUBSCRIPTION_ID env var\")\n\t}\n\tvar auxTenants []string\n\tif v := os.Getenv(\"ARM_AUXILIARY_TENANT_IDS\"); v != \"\" {\n\t\tauxTenants = strings.Split(v, \";\")\n\t\tif len(auxTenants) > 3 {\n\t\t\treturn fmt.Errorf(\"the provider only supports 3 auxiliary tenant IDs for ARM_AUXILIARY_TENANT_IDS\")\n\t\t}\n\t}\n\tbuilder := &authentication.Builder{\n\t\tClientID:            os.Getenv(\"ARM_CLIENT_ID\"),\n\t\tSubscriptionID:      subscriptionID,\n\t\tTenantID:            os.Getenv(\"ARM_TENANT_ID\"),\n\t\tAuxiliaryTenantIDs:  auxTenants,\n\t\tEnvironment:         os.Getenv(\"ARM_ENVIRONMENT\"),\n\t\tMetadataHost:        os.Getenv(\"ARM_METADATA_HOSTNAME\"),\n\t\tMsiEndpoint:         os.Getenv(\"ARM_MSI_ENDPOINT\"),\n\t\tClientSecret:        os.Getenv(\"ARM_CLIENT_SECRET\"),\n\t\tClientCertPath:      os.Getenv(\"ARM_CLIENT_CERTIFICATE_PATH\"),\n\t\tClientCertPassword:  os.Getenv(\"ARM_CLIENT_CERTIFICATE_PASSWORD\"),\n\t\tIDTokenRequestToken: os.Getenv(\"ARM_OIDC_REQUEST_TOKEN\"),\n\t\tIDTokenRequestURL:   os.Getenv(\"ARM_OIDC_REQUEST_URL\"),\n\n\t\t// Feature Toggles\n\t\tSupportsAzureCliToken:          true,\n\t\tSupportsClientSecretAuth:       true,\n\t\tSupportsClientCertAuth:         true,\n\t\tSupportsManagedServiceIdentity: os.Getenv(\"ARM_USE_MSI\") != \"\",\n\t\tSupportsOIDCAuth:               os.Getenv(\"ARM_USE_OIDC\") != \"\",\n\t\tUseMicrosoftGraph:              os.Getenv(\"ARM_USE_ADAL\") == \"\",\n\t}\n\n\tif builder.Environment == \"\" {\n\t\tbuilder.Environment = \"public\"\n\t}\n\tconfig, err := builder.Build()\n\tif err != nil {\n\t\treturn nil\n\t}\n\tp.config = *config\n\n\treturn nil\n}\n\nfunc (p *AzureProvider) getAuthorizer() (autorest.Authorizer, error) {\n\tenv, err := authentication.DetermineEnvironment(p.config.Environment)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tp.config.CustomResourceManagerEndpoint = env.ResourceManagerEndpoint\n\toauthConfig, err := p.config.BuildOAuthConfig(env.ActiveDirectoryEndpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif oauthConfig == nil {\n\t\treturn nil, fmt.Errorf(\"unable to configure OAuthConfig for tenant %s\", p.config.TenantID)\n\t}\n\tsender := sender.BuildSender(\"terraformer\")\n\tctx := context.Background()\n\tvar auth autorest.Authorizer\n\n\tif p.config.UseMicrosoftGraph {\n\t\thamiltonEnv, ero := environments.EnvironmentFromString(p.config.Environment)\n\t\tif ero != nil {\n\t\t\treturn nil, ero\n\t\t}\n\t\tauth, err = p.config.GetMSALToken(ctx, hamiltonEnv.ResourceManager, sender, oauthConfig, env.TokenAudience)\n\t} else {\n\t\t// Deprecated\n\t\tauth, err = p.config.GetADALToken(ctx, sender, oauthConfig, env.ResourceManagerEndpoint)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn auth, nil\n}\n\nfunc (p *AzureProvider) Init(args []string) error {\n\terr := p.setEnvConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tauthorizer, err := p.getAuthorizer()\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.authorizer = authorizer\n\tp.resourceGroup = args[0]\n\n\treturn nil\n}\n\nfunc (p *AzureProvider) GetName() string {\n\treturn \"azurerm\"\n}\n\nfunc (p *AzureProvider) GetProviderData(arg ...string) map[string]interface{} {\n\tversion := providerwrapper.GetProviderVersion(p.GetName())\n\tif strings.Contains(version, \"v2.\") {\n\t\treturn map[string]interface{}{\n\t\t\t\"provider\": map[string]interface{}{\n\t\t\t\t\"azurerm\": map[string]interface{}{\n\t\t\t\t\t// NOTE:\n\t\t\t\t\t// Workaround for azurerm v2 provider changes\n\t\t\t\t\t// Tested with azurerm_resource_group under v2.17.0\n\t\t\t\t\t// https://github.com/terraform-providers/terraform-provider-azurerm/issues/5866#issuecomment-594239342\n\t\t\t\t\t// https://github.com/hashicorp/terraform/issues/24200#issuecomment-594745861\n\t\t\t\t\t\"features\": map[string]interface{}{},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"azurerm\": map[string]interface{}{\n\t\t\t\t\"version\": version,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (AzureProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"analysis\": {\n\t\t\t\"resource_group\": []string{\"resource_group_name\", \"name\"},\n\t\t},\n\t\t\"app_service\": {\n\t\t\t\"resource_group\": []string{\"resource_group_name\", \"name\"},\n\t\t},\n\t\t\"application_gateway\": {\n\t\t\t\"resource_group\": []string{\"resource_group_name\", \"name\"},\n\t\t},\n\t\t\"cosmosdb\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t},\n\t\t\"container\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t},\n\t\t\"database\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t},\n\t\t\"databricks\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"managed_resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t\t\"storage_account\": []string{\"storage_account_name\", \"name\"},\n\t\t\t\"subnet\": []string{\n\t\t\t\t\"public_subnet_name\", \"name\",\n\t\t\t\t\"private_subnet_name\", \"name\",\n\t\t\t},\n\t\t\t\"virtual_network\": []string{\"virtual_network_id\", \"id\"},\n\t\t},\n\t\t\"data_factory\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t\t\"data_factory\": []string{\n\t\t\t\t\"data_factory_name\", \"name\",\n\t\t\t\t\"data_factory_id\", \"id\",\n\t\t\t\t\"linked_service_name\", \"name\",\n\t\t\t\t\"integration_runtime_name\", \"name\",\n\t\t\t},\n\t\t\t\"databricks\":      []string{\"existing_cluster_id\", \"id\"},\n\t\t\t\"keyvault\":        []string{\"keyvault_id\", \"id\"},\n\t\t\t\"storage_account\": []string{\"storage_account_id\", \"id\"},\n\t\t},\n\t\t\"disk\": {\n\t\t\t\"resource_group\": []string{\"resource_group_name\", \"name\"},\n\t\t},\n\t\t\"dns\": {\n\t\t\t\"resource_group\": []string{\"resource_group_name\", \"name\"},\n\t\t},\n\t\t\"eventhub\": {\n\t\t\t\"resource_group\": []string{\"resource_group_name\", \"name\"},\n\t\t\t\"eventhub\": []string{\n\t\t\t\t\"eventhub_name\", \"name\",\n\t\t\t\t\"namespace_name\", \"name\",\n\t\t\t},\n\t\t},\n\t\t\"keyvault\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t},\n\t\t\"load_balancer\": {\n\t\t\t\"resource_group\": []string{\"resource_group_name\", \"name\"},\n\t\t},\n\t\t\"network_interface\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t\t\"subnet\": []string{\"subnet_id\", \"id\"},\n\t\t},\n\t\t\"network_security_group\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t\t\"network_security_group\": []string{\"network_security_group_name\", \"name\"},\n\t\t},\n\t\t\"network_watcher\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t\t\"network_watcher\": []string{\"network_watcher_name\", \"name\"},\n\t\t\t\"storage_account\": []string{\"storage_account_id\", \"id\"},\n\t\t},\n\t\t\"private_dns\": {\n\t\t\t\"resource_group\":  []string{\"resource_group_name\", \"name\"},\n\t\t\t\"virtual_network\": []string{\"virtual_network_id\", \"id\"},\n\t\t\t\"private_dns\": []string{\n\t\t\t\t\"zone_name\", \"name\",\n\t\t\t\t\"private_dns_zone_name\", \"name\",\n\t\t\t},\n\t\t},\n\t\t\"private_endpoint\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t\t\"subnet\": []string{\"subnet_id\", \"id\"},\n\t\t},\n\t\t\"public_ip\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t},\n\t\t\"purview\": {\n\t\t\t\"resource_group\": []string{\"resource_group_name\", \"name\"},\n\t\t},\n\t\t\"redis\": {\n\t\t\t\"resource_group\": []string{\"resource_group_name\", \"name\"},\n\t\t},\n\t\t\"route_table\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t\t\"route_table\": []string{\"route_table_name\", \"name\"},\n\t\t},\n\t\t\"scaleset\": {\n\t\t\t\"resource_group\": []string{\"resource_group_name\", \"name\"},\n\t\t},\n\t\t\"ssh_public_key\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t},\n\t\t\"storage_account\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t\t\"virtual_network\": []string{\"virtual_network_subnet_ids\", \"id\"},\n\t\t},\n\t\t\"storage_blob\": {\n\t\t\t\"storage_account\":   []string{\"storage_account_name\", \"name\"},\n\t\t\t\"storage_container\": []string{\"storage_container_name\", \"name\"},\n\t\t},\n\t\t\"storage_container\": {\n\t\t\t\"storage_account\": []string{\"storage_account_name\", \"name\"},\n\t\t},\n\t\t\"synapse\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"managed_resource_group_name\", \"name\",\n\t\t\t},\n\t\t\t\"synapse\": []string{\"synapse_workspace_id\", \"id\"},\n\t\t},\n\t\t\"subnet\": {\n\t\t\t\"resource_group\":         []string{\"resource_group_name\", \"name\"},\n\t\t\t\"virtual_network\":        []string{\"virtual_network_name\", \"name\"},\n\t\t\t\"network_security_group\": []string{\"network_security_group_id\", \"id\"},\n\t\t\t\"route_table\":            []string{\"route_table_id\", \"id\"},\n\t\t\t\"subnet\":                 []string{\"subnet_id\", \"id\"},\n\t\t},\n\t\t\"virtual_machine\": {\n\t\t\t\"resource_group\": []string{\n\t\t\t\t\"resource_group_name\", \"name\",\n\t\t\t\t\"location\", \"location\",\n\t\t\t},\n\t\t\t\"network_interface\": []string{\"network_interface_ids\", \"id\"},\n\t\t},\n\t\t\"virtual_network\": {\n\t\t\t\"resource_group\": []string{\"resource_group_name\", \"name\"},\n\t\t},\n\t}\n}\n\nfunc (p *AzureProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"analysis\":                             &AnalysisGenerator{},\n\t\t\"app_service\":                          &AppServiceGenerator{},\n\t\t\"application_gateway\":                  &ApplicationGatewayGenerator{},\n\t\t\"cosmosdb\":                             &CosmosDBGenerator{},\n\t\t\"container\":                            &ContainerGenerator{},\n\t\t\"database\":                             &DatabasesGenerator{},\n\t\t\"databricks\":                           &DatabricksGenerator{},\n\t\t\"data_factory\":                         &DataFactoryGenerator{},\n\t\t\"disk\":                                 &DiskGenerator{},\n\t\t\"dns\":                                  &DNSGenerator{},\n\t\t\"eventhub\":                             &EventHubGenerator{},\n\t\t\"keyvault\":                             &KeyVaultGenerator{},\n\t\t\"load_balancer\":                        &LoadBalancerGenerator{},\n\t\t\"management_lock\":                      &ManagementLockGenerator{},\n\t\t\"network_interface\":                    &NetworkInterfaceGenerator{},\n\t\t\"network_security_group\":               &NetworkSecurityGroupGenerator{},\n\t\t\"network_watcher\":                      &NetworkWatcherGenerator{},\n\t\t\"private_dns\":                          &PrivateDNSGenerator{},\n\t\t\"private_endpoint\":                     &PrivateEndpointGenerator{},\n\t\t\"public_ip\":                            &PublicIPGenerator{},\n\t\t\"purview\":                              &PurviewGenerator{},\n\t\t\"redis\":                                &RedisGenerator{},\n\t\t\"resource_group\":                       &ResourceGroupGenerator{},\n\t\t\"route_table\":                          &RouteTableGenerator{},\n\t\t\"scaleset\":                             &ScaleSetGenerator{},\n\t\t\"security_center_contact\":              &SecurityCenterContactGenerator{},\n\t\t\"security_center_subscription_pricing\": &SecurityCenterSubscriptionPricingGenerator{},\n\t\t\"ssh_public_key\":                       &SSHPublicKeyGenerator{},\n\t\t\"storage_account\":                      &StorageAccountGenerator{},\n\t\t\"storage_blob\":                         &StorageBlobGenerator{},\n\t\t\"storage_container\":                    &StorageContainerGenerator{},\n\t\t\"synapse\":                              &SynapseGenerator{},\n\t\t\"subnet\":                               &SubnetGenerator{},\n\t\t\"virtual_machine\":                      &VirtualMachineGenerator{},\n\t\t\"virtual_network\":                      &VirtualNetworkGenerator{},\n\t}\n}\n\nfunc (p *AzureProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"azurerm: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"config\":         p.config,\n\t\t\"authorizer\":     p.authorizer,\n\t\t\"resource_group\": p.resourceGroup,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/azure_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"strings\"\n\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype AzureService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (az *AzureService) getClientArgs() (subscriptionID string, resourceGroup string, authorizer autorest.Authorizer, resourceManagerEndpoint string) {\n\tsubs := az.Args[\"config\"].(authentication.Config).SubscriptionID\n\tauth := az.Args[\"authorizer\"].(autorest.Authorizer)\n\tresg := az.Args[\"resource_group\"].(string)\n\trEndpoint := az.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\treturn subs, resg, auth, rEndpoint\n}\n\nfunc (az *AzureService) AppendSimpleResource(id string, resourceName string, resourceType string) {\n\tnewResource := terraformutils.NewSimpleResource(id, resourceName, resourceType, az.ProviderName, []string{})\n\taz.Resources = append(az.Resources, newResource)\n}\n\nfunc (az *AzureService) AppendSimpleResourceWithDuplicateCheck(id string, resourceName string, resourceType string) {\n\ttferexist, _ := az.DuplicateCheck(id, resourceName, resourceType)\n\tif !tferexist {\n\t\tresourceName = resourceName + \"_\" + id\n\t}\n\tnewResource := terraformutils.NewSimpleResource(id, resourceName, resourceType, az.ProviderName, []string{})\n\taz.Resources = append(az.Resources, newResource)\n}\n\n// This method checks if same resource name(tfer) exists with\n// same id\nfunc (az *AzureService) DuplicateCheck(id string, resourceName string, resourceType string) (bool, bool) {\n\tvar tferexist, idexist bool\n\ttferName := terraformutils.TfSanitize(resourceName)\n\tfor _, resource := range az.Resources {\n\t\tif tferName == resource.ResourceName {\n\t\t\tif id == resource.InstanceState.ID {\n\t\t\t\ttferexist = true\n\t\t\t\tidexist = true\n\t\t\t} else {\n\t\t\t\ttferexist = true\n\t\t\t\tidexist = false\n\t\t\t}\n\t\t}\n\t}\n\treturn tferexist, idexist\n}\n\nfunc (az *AzureService) appendSimpleAssociation(id string, linkedResourceName string, resourceName *string, resourceType string, attributes map[string]string) {\n\tvar resourceName2 string\n\tif resourceName != nil {\n\t\tresourceName2 = *resourceName\n\t} else {\n\t\tresourceName0 := strings.ReplaceAll(resourceType, \"azurerm_\", \"\")\n\t\tresourceName1 := resourceName0[strings.IndexByte(resourceName0, '_'):]\n\t\tresourceName2 = linkedResourceName + resourceName1\n\t}\n\tnewResource := terraformutils.NewResource(\n\t\tid, resourceName2, resourceType, az.ProviderName, attributes,\n\t\t[]string{\"name\"},\n\t\tmap[string]interface{}{},\n\t)\n\taz.Resources = append(az.Resources, newResource)\n}\n"
  },
  {
    "path": "providers/azure/container.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/containerinstance/mgmt/2018-10-01/containerinstance\"\n\t\"github.com/Azure/azure-sdk-for-go/services/containerregistry/mgmt/2019-05-01/containerregistry\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype ContainerGenerator struct {\n\tAzureService\n}\n\nfunc (g *ContainerGenerator) listAndAddForContainerGroup() ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tContainerGroupsClient := containerinstance.NewContainerGroupsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tContainerGroupsClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar (\n\t\tcontainerGroupIterator containerinstance.ContainerGroupListResultIterator\n\t\terr                    error\n\t)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tcontainerGroupIterator, err = ContainerGroupsClient.ListByResourceGroupComplete(ctx, rg)\n\t} else {\n\t\tcontainerGroupIterator, err = ContainerGroupsClient.ListComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor containerGroupIterator.NotDone() {\n\t\tcontainerGroup := containerGroupIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*containerGroup.ID,\n\t\t\t*containerGroup.Name,\n\t\t\t\"azurerm_container_group\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tif err := containerGroupIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *ContainerGenerator) listRegistryWebhooks(resourceGroupName string, registryName string) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tWebhooksClient := containerregistry.NewWebhooksClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tWebhooksClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\twebhookIterator, err := WebhooksClient.ListComplete(ctx, resourceGroupName, registryName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor webhookIterator.NotDone() {\n\t\twebhook := webhookIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*webhook.ID,\n\t\t\t*webhook.Name,\n\t\t\t\"azurerm_container_registry_webhook\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\t\tif err := webhookIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\n\t}\n\treturn resources, nil\n}\n\nfunc (g *ContainerGenerator) listAndAddForContainerRegistry() ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tContainerRegistriesClient := containerregistry.NewRegistriesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tContainerRegistriesClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar (\n\t\tcontainerRegistryIterator containerregistry.RegistryListResultIterator\n\t\terr                       error\n\t)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tcontainerRegistryIterator, err = ContainerRegistriesClient.ListByResourceGroupComplete(ctx, rg)\n\t} else {\n\t\tcontainerRegistryIterator, err = ContainerRegistriesClient.ListComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor containerRegistryIterator.NotDone() {\n\t\tcontainerRegistry := containerRegistryIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*containerRegistry.ID,\n\t\t\t*containerRegistry.Name,\n\t\t\t\"azurerm_container_registry\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tid, err := ParseAzureResourceID(*containerRegistry.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\twebhooks, err := g.listRegistryWebhooks(id.ResourceGroup, *containerRegistry.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresources = append(resources, webhooks...)\n\n\t\tif err := containerRegistryIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *ContainerGenerator) InitResources() error {\n\tfunctions := []func() ([]terraformutils.Resource, error){\n\t\tg.listAndAddForContainerGroup,\n\t\tg.listAndAddForContainerRegistry,\n\t}\n\n\tfor _, f := range functions {\n\t\tresources, err := f()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/cosmosdb.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"strings\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-06-15/documentdb\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype CosmosDBGenerator struct {\n\tAzureService\n}\n\nfunc (g *CosmosDBGenerator) listSQLDatabasesAndContainersBehind(resourceGroupName string, accountName string) ([]terraformutils.Resource, []terraformutils.Resource, error) {\n\tvar resourcesDatabase []terraformutils.Resource\n\tvar resourcesContainer []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tSQLResourcesClient := documentdb.NewSQLResourcesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tSQLResourcesClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tsqlDatabases, err := SQLResourcesClient.ListSQLDatabases(ctx, resourceGroupName, accountName)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tfor _, sqlDatabase := range *sqlDatabases.Value {\n\t\t// NOTE:\n\t\t// For a similar reason as\n\t\t// https://github.com/terraform-providers/terraform-provider-azurerm/issues/7472#issuecomment-650684349\n\t\t// The cosmosdb resource format change is NOT yet addressed in terraform provider\n\t\t// This line is a workaround to convert to old format, and might be removed if they deprecate the old format\n\t\tsqlDatabaseIDInOldFormat := strings.Replace(*sqlDatabase.ID, \"sqlDatabases\", \"databases\", 1)\n\t\tresourcesDatabase = append(resourcesDatabase, terraformutils.NewSimpleResource(\n\t\t\tsqlDatabaseIDInOldFormat,\n\t\t\t*sqlDatabase.Name,\n\t\t\t\"azurerm_cosmosdb_sql_database\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tsqlContainers, err := SQLResourcesClient.ListSQLContainers(ctx, resourceGroupName, accountName, *sqlDatabase.Name)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tfor _, sqlContainer := range *sqlContainers.Value {\n\t\t\t// NOTE:\n\t\t\t// For a similar reason as\n\t\t\t// https://github.com/terraform-providers/terraform-provider-azurerm/issues/7472#issuecomment-650684349\n\t\t\t// The cosmosdb resource format change is NOT yet addressed in terraform provider\n\t\t\t// This line is a workaround to convert to old format, and might be removed if they deprecate the old format\n\t\t\tsqlContainerIDInOldFormat := strings.Replace(*sqlContainer.ID, \"sqlDatabases\", \"databases\", 1)\n\t\t\tresourcesContainer = append(resourcesContainer, terraformutils.NewSimpleResource(\n\t\t\t\tsqlContainerIDInOldFormat,\n\t\t\t\t*sqlContainer.Name,\n\t\t\t\t\"azurerm_cosmosdb_sql_container\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\n\treturn resourcesDatabase, resourcesContainer, nil\n}\n\nfunc (g *CosmosDBGenerator) listTables(resourceGroupName string, accountName string) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tTableResourcesClient := documentdb.NewTableResourcesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tTableResourcesClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\ttables, err := TableResourcesClient.ListTables(ctx, resourceGroupName, accountName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, table := range *tables.Value {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*table.ID,\n\t\t\t*table.Name,\n\t\t\t\"azurerm_cosmosdb_table\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *CosmosDBGenerator) listAndAddForDatabaseAccounts() ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tDatabaseAccountsClient := documentdb.NewDatabaseAccountsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tDatabaseAccountsClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar (\n\t\taccounts documentdb.DatabaseAccountsListResult\n\t\terr      error\n\t)\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\taccounts, err = DatabaseAccountsClient.ListByResourceGroup(ctx, rg)\n\t} else {\n\t\taccounts, err = DatabaseAccountsClient.List(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, account := range *accounts.Value {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*account.ID,\n\t\t\t*account.Name,\n\t\t\t\"azurerm_cosmosdb_account\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tid, err := ParseAzureResourceID(*account.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttables, err := g.listTables(id.ResourceGroup, *account.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresources = append(resources, tables...)\n\n\t\tsqlDatabases, sqlContainers, err := g.listSQLDatabasesAndContainersBehind(id.ResourceGroup, *account.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresources = append(resources, sqlDatabases...)\n\t\tresources = append(resources, sqlContainers...)\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *CosmosDBGenerator) InitResources() error {\n\tfunctions := []func() ([]terraformutils.Resource, error){\n\t\tg.listAndAddForDatabaseAccounts,\n\t}\n\n\tfor _, f := range functions {\n\t\tresources, err := f()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/data_factory.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"reflect\"\n\t\"strings\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype DataFactoryGenerator struct {\n\tAzureService\n}\n\n// Maps item.Properties.Type -> terraform.ResoruceType\n// Information extracted from\n//   SupportedResources are in:\n//   @ github.com/azure/azure-sdk-for-go@v42.3.0+incompatible/services/datafactory/mgmt/2018-06-01/datafactory/models.go\n//   PossibleTypeBasicDatasetValues, PossibleTypeBasicIntegrationRuntimeValues, PossibleTypeBasicLinkedServiceValues, PossibleTypeBasicTriggerValues\n//   TypeBasicDataset,TypeBasicIntegrationRuntime, TypeBasicLinkedService, TypeBasicTrigger, TypeBasicDataFlow\n\nvar (\n\tSupportedResources = map[string]string{\n\t\t\"AzureBlob\":                \"azurerm_data_factory_dataset_azure_blob\",\n\t\t\"Binary\":                   \"azurerm_data_factory_dataset_binary\",\n\t\t\"CosmosDbSqlApiCollection\": \"azurerm_data_factory_dataset_cosmosdb_sqlapi\",\n\t\t\"CustomDataset\":            \"azurerm_data_factory_custom_dataset\",\n\t\t\"DelimitedText\":            \"azurerm_data_factory_dataset_delimited_text\",\n\t\t\"HttpFile\":                 \"azurerm_data_factory_dataset_http\",\n\t\t\"Json\":                     \"azurerm_data_factory_dataset_json\",\n\t\t\"MySqlTable\":               \"azurerm_data_factory_dataset_mysql\",\n\t\t\"Parquet\":                  \"azurerm_data_factory_dataset_parquet\",\n\t\t\"PostgreSqlTable\":          \"azurerm_data_factory_dataset_postgresql\",\n\t\t\"SnowflakeTable\":           \"azurerm_data_factory_dataset_snowflake\",\n\t\t\"SqlServerTable\":           \"azurerm_data_factory_dataset_sql_server_table\",\n\t\t\"IntegrationRuntime\":       \"azurerm_data_factory_integration_runtime_azure\",\n\t\t\"Managed\":                  \"azurerm_data_factory_integration_runtime_azure_ssis\",\n\t\t\"SelfHosted\":               \"azurerm_data_factory_integration_runtime_self_hosted\",\n\t\t\"AzureBlobStorage\":         \"azurerm_data_factory_linked_service_azure_blob_storage\",\n\t\t\"AzureDatabricks\":          \"azurerm_data_factory_linked_service_azure_databricks\",\n\t\t\"AzureFileStorage\":         \"azurerm_data_factory_linked_service_azure_file_storage\",\n\t\t\"AzureFunction\":            \"azurerm_data_factory_linked_service_azure_function\",\n\t\t\"AzureSearch\":              \"azurerm_data_factory_linked_service_azure_search\",\n\t\t\"AzureSqlDatabase\":         \"azurerm_data_factory_linked_service_azure_sql_database\",\n\t\t\"AzureTableStorage\":        \"azurerm_data_factory_linked_service_azure_table_storage\",\n\t\t\"CosmosDb\":                 \"azurerm_data_factory_linked_service_cosmosdb\",\n\t\t\"CustomDataSource\":         \"azurerm_data_factory_linked_custom_service\",\n\t\t\"AzureBlobFS\":              \"azurerm_data_factory_linked_service_data_lake_storage_gen2\",\n\t\t\"AzureKeyVault\":            \"azurerm_data_factory_linked_service_key_vault\",\n\t\t\"AzureDataExplore\":         \"azurerm_data_factory_linked_service_kusto\",\n\t\t\"MySql\":                    \"azurerm_data_factory_linked_service_mysql\",\n\t\t\"OData\":                    \"azurerm_data_factory_linked_service_odata\",\n\t\t\"PostgreSql\":               \"azurerm_data_factory_linked_service_postgresql\",\n\t\t\"Sftp\":                     \"azurerm_data_factory_linked_service_sftp\",\n\t\t\"Snowflake\":                \"azurerm_data_factory_linked_service_snowflake\",\n\t\t\"SqlServer\":                \"azurerm_data_factory_linked_service_sql_server\",\n\t\t\"AzureSqlDW\":               \"azurerm_data_factory_linked_service_synapse\",\n\t\t\"Web\":                      \"azurerm_data_factory_linked_service_web\",\n\t\t\"BlobEventsTrigger\":        \"azurerm_data_factory_trigger_blob_event\",\n\t\t\"ScheduleTrigger\":          \"azurerm_data_factory_trigger_schedule\",\n\t\t\"TumblingWindowTrigger\":    \"azurerm_data_factory_trigger_tumbling_window\",\n\t}\n)\n\nfunc getResourceTypeFrom(azureResourceName string) string {\n\treturn SupportedResources[azureResourceName]\n}\n\nfunc getFieldFrom(v interface{}, field string) reflect.Value {\n\treflected := reflect.ValueOf(v)\n\tif reflected.IsValid() {\n\t\tindirected := reflect.Indirect(reflected)\n\t\tif indirected.Kind() == reflect.Struct {\n\t\t\tfieldValue := indirected.FieldByName(field)\n\t\t\treturn fieldValue\n\t\t}\n\t}\n\treturn reflect.Value{}\n}\n\nfunc getFieldAsString(v interface{}, field string) string {\n\tfieldValue := getFieldFrom(v, field)\n\tif fieldValue.IsValid() {\n\t\treturn fieldValue.String()\n\t}\n\treturn \"\"\n}\n\nfunc (az *AzureService) appendResourceAs(resources []terraformutils.Resource, itemID string, itemName string, resourceType string, abbreviation string) []terraformutils.Resource {\n\tprefix := strings.ReplaceAll(resourceType, resourceType, abbreviation)\n\tsuffix := strings.ReplaceAll(itemName, \"-\", \"_\")\n\tresourceName := prefix + \"_\" + suffix\n\tres := terraformutils.NewSimpleResource(itemID, resourceName, resourceType, az.ProviderName, []string{})\n\tresources = append(resources, res)\n\treturn resources\n}\n\nfunc (az *DataFactoryGenerator) appendResourceFrom(resources []terraformutils.Resource, id string, name string, properties interface{}) []terraformutils.Resource {\n\tazureType := getFieldAsString(properties, \"Type\")\n\tif azureType != \"\" {\n\t\tresourceType := getResourceTypeFrom(azureType)\n\t\tif resourceType == \"\" {\n\t\t\tmsg := fmt.Sprintf(`azurerm_data_factory: resource \"%s\" id: %s type: %s not handled yet by terraform or terraformer`, name, id, azureType)\n\t\t\tlog.Println(msg)\n\t\t} else {\n\t\t\tresources = az.appendResourceAs(resources, id, name, resourceType, \"adf\")\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (az *DataFactoryGenerator) listFactories() ([]datafactory.Factory, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := datafactory.NewFactoriesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator datafactory.FactoryListResponseIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListByResourceGroupComplete(ctx, resourceGroup)\n\t} else {\n\t\titerator, err = client.ListComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []datafactory.Factory\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *DataFactoryGenerator) createDataFactoryResources(dataFactories []datafactory.Factory) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tfor _, item := range dataFactories {\n\t\tresources = az.appendResourceAs(resources, *item.ID, *item.Name, \"azurerm_data_factory\", \"adf\")\n\t}\n\treturn resources, nil\n}\n\nfunc getIntegrationRuntimeType(properties interface{}) string {\n\tazureType := getFieldAsString(properties, \"Type\")\n\tif azureType == \"SelfHosted\" {\n\t\treturn \"azurerm_data_factory_integration_runtime_self_hosted\"\n\t}\n\t// item.Properties.ManagedIntegrationRuntimeTypeProperties.SsisProperties\n\tif typeProperties := getFieldFrom(properties, \"ManagedIntegrationRuntimeTypeProperties\"); typeProperties.IsValid() {\n\t\tmanagedRuntime := typeProperties.Interface()\n\t\tSsisProperties := getFieldFrom(managedRuntime, \"SsisProperties\")\n\t\tif SsisProperties.IsNil() {\n\t\t\treturn \"azurerm_data_factory_integration_runtime_azure\"\n\t\t}\n\t}\n\treturn \"azurerm_data_factory_integration_runtime_azure_ssis\"\n}\n\nfunc (az *DataFactoryGenerator) createIntegrationRuntimesResources(dataFactories []datafactory.Factory) ([]terraformutils.Resource, error) {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := datafactory.NewIntegrationRuntimesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\tvar resources []terraformutils.Resource\n\tfor _, factory := range dataFactories {\n\t\tid, err := ParseAzureResourceID(*factory.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\titerator, err := client.ListByFactoryComplete(ctx, id.ResourceGroup, *factory.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor iterator.NotDone() {\n\t\t\titem := iterator.Value()\n\t\t\tresourceType := getIntegrationRuntimeType(item.Properties)\n\t\t\tresources = az.appendResourceAs(resources, *item.ID, *item.Name, resourceType, \"adfr\")\n\t\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn resources, err\n\t\t\t}\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *DataFactoryGenerator) createLinkedServiceResources(dataFactories []datafactory.Factory) ([]terraformutils.Resource, error) {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := datafactory.NewLinkedServicesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\tvar resources []terraformutils.Resource\n\tfor _, factory := range dataFactories {\n\t\tid, err := ParseAzureResourceID(*factory.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\titerator, err := client.ListByFactoryComplete(ctx, id.ResourceGroup, *factory.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor iterator.NotDone() {\n\t\t\titem := iterator.Value()\n\t\t\tresources = az.appendResourceFrom(resources, *item.ID, *item.Name, item.Properties)\n\t\t\tif err = iterator.NextWithContext(ctx); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn resources, err\n\t\t\t}\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *DataFactoryGenerator) createPipelineResources(dataFactories []datafactory.Factory) ([]terraformutils.Resource, error) {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := datafactory.NewPipelinesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\tvar resources []terraformutils.Resource\n\tfor _, factory := range dataFactories {\n\t\tid, err := ParseAzureResourceID(*factory.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\titerator, err := client.ListByFactoryComplete(ctx, id.ResourceGroup, *factory.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor iterator.NotDone() {\n\t\t\titem := iterator.Value()\n\t\t\tresources = az.appendResourceAs(resources, *item.ID, *item.Name, \"azurerm_data_factory_pipeline\", \"adfp\")\n\t\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn resources, err\n\t\t\t}\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *DataFactoryGenerator) createPipelineTriggerScheduleResources(dataFactories []datafactory.Factory) ([]terraformutils.Resource, error) {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := datafactory.NewTriggersClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\tvar resources []terraformutils.Resource\n\tfor _, factory := range dataFactories {\n\t\tid, err := ParseAzureResourceID(*factory.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\titerator, err := client.ListByFactoryComplete(ctx, id.ResourceGroup, *factory.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor iterator.NotDone() {\n\t\t\titem := iterator.Value()\n\t\t\tresources = az.appendResourceFrom(resources, *item.ID, *item.Name, item.Properties)\n\t\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn resources, err\n\t\t\t}\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *DataFactoryGenerator) createDataFlowResources(dataFactories []datafactory.Factory) ([]terraformutils.Resource, error) {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := datafactory.NewDataFlowsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\tvar resources []terraformutils.Resource\n\tfor _, factory := range dataFactories {\n\t\tid, err := ParseAzureResourceID(*factory.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\titerator, err := client.ListByFactoryComplete(ctx, id.ResourceGroup, *factory.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor iterator.NotDone() {\n\t\t\titem := iterator.Value()\n\t\t\tresources = az.appendResourceAs(resources, *item.ID, *item.Name, \"azurerm_data_factory_data_flow\", \"adfl\")\n\t\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn resources, err\n\t\t\t}\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *DataFactoryGenerator) createPipelineDatasetResources(dataFactories []datafactory.Factory) ([]terraformutils.Resource, error) {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := datafactory.NewDatasetsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\tvar resources []terraformutils.Resource\n\tfor _, factory := range dataFactories {\n\t\tid, err := ParseAzureResourceID(*factory.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\titerator, err := client.ListByFactoryComplete(ctx, id.ResourceGroup, *factory.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor iterator.NotDone() {\n\t\t\titem := iterator.Value()\n\t\t\tresources = az.appendResourceFrom(resources, *item.ID, *item.Name, item.Properties)\n\t\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn resources, err\n\t\t\t}\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *DataFactoryGenerator) InitResources() error {\n\n\tdataFactories, err := az.listFactories()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfactoriesFunctions := []func([]datafactory.Factory) ([]terraformutils.Resource, error){\n\t\taz.createDataFactoryResources,\n\t\taz.createIntegrationRuntimesResources,\n\t\taz.createLinkedServiceResources,\n\t\taz.createPipelineResources,\n\t\taz.createPipelineTriggerScheduleResources,\n\t\taz.createPipelineDatasetResources,\n\t\taz.createDataFlowResources,\n\t}\n\n\tfor _, f := range factoriesFunctions {\n\t\tresources, ero := f(dataFactories)\n\t\tif ero != nil {\n\t\t\treturn ero\n\t\t}\n\t\taz.Resources = append(az.Resources, resources...)\n\t}\n\treturn nil\n}\n\n// PostGenerateHook for formatting json properties as heredoc\n// - azurerm_data_factory_pipeline property activities_json\nfunc (az *DataFactoryGenerator) PostConvertHook() error {\n\tfor i, resource := range az.Resources {\n\t\tif resource.InstanceInfo.Type == \"azurerm_data_factory_pipeline\" {\n\t\t\tif val, ok := az.Resources[i].Item[\"activities_json\"]; ok {\n\t\t\t\tif val != nil {\n\t\t\t\t\tjson := val.(string)\n\t\t\t\t\t// json := asJson(val)\n\t\t\t\t\thereDoc := asHereDoc(json)\n\t\t\t\t\taz.Resources[i].Item[\"activities_json\"] = hereDoc\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/database.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/mariadb/mgmt/2018-06-01/mariadb\"\n\t\"github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2017-12-01/mysql\"\n\t\"github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2017-12-01/postgresql\"\n\t\"github.com/Azure/azure-sdk-for-go/services/preview/sql/mgmt/2017-03-01-preview/sql\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype DatabasesGenerator struct {\n\tAzureService\n}\n\nfunc (g *DatabasesGenerator) getMariaDBServers() ([]mariadb.Server, error) {\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := mariadb.NewServersClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tvar (\n\t\tServers mariadb.ServerListResult\n\t\terr     error\n\t)\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tServers, err = Client.ListByResourceGroup(ctx, rg)\n\t} else {\n\t\tServers, err = Client.List(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn *Servers.Value, nil\n}\n\nfunc (g *DatabasesGenerator) createMariaDBServerResources(servers []mariadb.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\n\tfor _, server := range servers {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t*server.ID,\n\t\t\t*server.Name,\n\t\t\t\"azurerm_mariadb_server\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"administrator_login_password\": \"\",\n\t\t\t}))\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createMariaDBConfigurationResources(servers []mariadb.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := mariadb.NewConfigurationsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconfigs, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, config := range *configs.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*config.ID,\n\t\t\t\t*config.Name+\"-\"+*server.Name,\n\t\t\t\t\"azurerm_mariadb_configuration\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{\"value\"}))\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createMariaDBDatabaseResources(servers []mariadb.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := mariadb.NewDatabasesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdatabases, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, database := range *databases.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*database.ID,\n\t\t\t\t*database.Name+\"-\"+*server.Name,\n\t\t\t\t\"azurerm_mariadb_database\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createMariaDBFirewallRuleResources(servers []mariadb.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := mariadb.NewFirewallRulesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trules, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, rule := range *rules.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*rule.ID,\n\t\t\t\t*rule.Name,\n\t\t\t\t\"azurerm_mariadb_firewall_rule\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createMariaDBVirtualNetworkRuleResources(servers []mariadb.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := mariadb.NewVirtualNetworkRulesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\titer, err := Client.ListByServerComplete(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor iter.NotDone() {\n\t\t\trule := iter.Value()\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*rule.ID,\n\t\t\t\t*rule.Name,\n\t\t\t\t\"azurerm_mariadb_virtual_network_rule\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\n\t\t\tif err := iter.NextWithContext(ctx); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) getMySQLServers() ([]mysql.Server, error) {\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := mysql.NewServersClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tvar (\n\t\tServers mysql.ServerListResult\n\t\terr     error\n\t)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tServers, err = Client.ListByResourceGroup(ctx, rg)\n\t} else {\n\t\tServers, err = Client.List(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn *Servers.Value, nil\n}\n\nfunc (g *DatabasesGenerator) createMySQLServerResources(servers []mysql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\n\tfor _, server := range servers {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t*server.ID,\n\t\t\t*server.Name,\n\t\t\t\"azurerm_mysql_server\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"administrator_login_password\": \"\",\n\t\t\t}))\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createMySQLConfigurationResources(servers []mysql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := mysql.NewConfigurationsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tconfigs, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, config := range *configs.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*config.ID,\n\t\t\t\t*config.Name+\"-\"+*server.Name,\n\t\t\t\t\"azurerm_mysql_configuration\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{\"value\"}))\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createMySQLDatabaseResources(servers []mysql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := mysql.NewDatabasesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdatabases, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, database := range *databases.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*database.ID,\n\t\t\t\t*database.Name+\"-\"+*server.Name,\n\t\t\t\t\"azurerm_mysql_database\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createMySQLFirewallRuleResources(servers []mysql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := mysql.NewFirewallRulesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trules, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, rule := range *rules.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*rule.ID,\n\t\t\t\t*rule.Name,\n\t\t\t\t\"azurerm_mysql_firewall_rule\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createMySQLVirtualNetworkRuleResources(servers []mysql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := mysql.NewVirtualNetworkRulesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\titer, err := Client.ListByServerComplete(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor iter.NotDone() {\n\t\t\trule := iter.Value()\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*rule.ID,\n\t\t\t\t*rule.Name,\n\t\t\t\t\"azurerm_mysql_virtual_network_rule\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\n\t\t\tif err := iter.NextWithContext(ctx); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) getPostgreSQLServers() ([]postgresql.Server, error) {\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := postgresql.NewServersClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tvar (\n\t\tServers postgresql.ServerListResult\n\t\terr     error\n\t)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tServers, err = Client.ListByResourceGroup(ctx, rg)\n\t} else {\n\t\tServers, err = Client.List(ctx)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn *Servers.Value, nil\n}\n\nfunc (g *DatabasesGenerator) createPostgreSQLServerResources(servers []postgresql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\n\tfor _, server := range servers {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t*server.ID,\n\t\t\t*server.Name,\n\t\t\t\"azurerm_postgresql_server\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"administrator_login_password\": \"\",\n\t\t\t}))\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createPostgreSQLDatabaseResources(servers []postgresql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := postgresql.NewDatabasesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdatabases, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, database := range *databases.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*database.ID,\n\t\t\t\t*database.Name+\"-\"+*server.Name,\n\t\t\t\t\"azurerm_postgresql_database\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createPostgreSQLConfigurationResources(servers []postgresql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\tClient := postgresql.NewConfigurationsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tconfigs, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, config := range *configs.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*config.ID,\n\t\t\t\t*config.Name+\"-\"+*server.Name,\n\t\t\t\t\"azurerm_postgresql_configuration\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{\"value\"}))\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createPostgreSQLFirewallRuleResources(servers []postgresql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := postgresql.NewFirewallRulesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trules, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, rule := range *rules.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*rule.ID,\n\t\t\t\t*rule.Name,\n\t\t\t\t\"azurerm_postgresql_firewall_rule\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createPostgreSQLVirtualNetworkRuleResources(servers []postgresql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := postgresql.NewVirtualNetworkRulesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trulePages, err := Client.ListByServerComplete(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor rulePages.NotDone() {\n\t\t\trule := rulePages.Value()\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*rule.ID,\n\t\t\t\t*rule.Name,\n\t\t\t\t\"azurerm_postgresql_virtual_network_rule\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\n\t\t\tif err := rulePages.NextWithContext(ctx); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) getSQLServers() ([]sql.Server, error) {\n\tvar servers []sql.Server\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := sql.NewServersClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tvar (\n\t\tServerPages sql.ServerListResultPage\n\t\terr         error\n\t)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tServerPages, err = Client.ListByResourceGroup(ctx, rg)\n\t} else {\n\t\tServerPages, err = Client.List(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor ServerPages.NotDone() {\n\t\tservers = append(servers, ServerPages.Values()...)\n\t\tif err := ServerPages.NextWithContext(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn servers, nil\n}\n\nfunc (g *DatabasesGenerator) createSQLServerResources(servers []sql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\n\tfor _, server := range servers {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t*server.ID,\n\t\t\t*server.Name,\n\t\t\t\"azurerm_mssql_server\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"administrator_login_password\": \"\",\n\t\t\t}))\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createSQLDatabaseResources(servers []sql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := sql.NewDatabasesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdatabases, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name, \"\", \"\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, database := range *databases.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*database.ID,\n\t\t\t\t*database.Name+\"-\"+*server.Name,\n\t\t\t\t\"azurerm_mssql_database\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createSQLFirewallRuleResources(servers []sql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := sql.NewFirewallRulesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\trules, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, rule := range *rules.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*rule.ID,\n\t\t\t\t*rule.Name,\n\t\t\t\t\"azurerm_mssql_firewall_rule\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createSQLVirtualNetworkRuleResources(servers []sql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := sql.NewVirtualNetworkRulesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\truleIter, err := Client.ListByServerComplete(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor ruleIter.NotDone() {\n\t\t\trule := ruleIter.Value()\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*rule.ID,\n\t\t\t\t*rule.Name,\n\t\t\t\t\"azurerm_sql_virtual_network_rule\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\n\t\t\tif err := ruleIter.NextWithContext(ctx); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createSQLElasticPoolResources(servers []sql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := sql.NewElasticPoolsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpools, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, pool := range *pools.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*pool.ID,\n\t\t\t\t*pool.Name,\n\t\t\t\t\"azurerm_sql_elasticpool\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createSQLFailoverResources(servers []sql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := sql.NewFailoverGroupsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\titer, err := Client.ListByServerComplete(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor iter.NotDone() {\n\t\t\tfailoverGroup := iter.Value()\n\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*failoverGroup.ID,\n\t\t\t\t*failoverGroup.Name,\n\t\t\t\t\"azurerm_sql_failover_group\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\n\t\t\tif err := iter.NextWithContext(ctx); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) createSQLADAdministratorResources(servers []sql.Server) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tAuthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tClient := sql.NewServerAzureADAdministratorsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tClient.Authorizer = Authorizer\n\n\tfor _, server := range servers {\n\t\tid, err := ParseAzureResourceID(*server.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tadministrators, err := Client.ListByServer(ctx, id.ResourceGroup, *server.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, administrator := range *administrators.Value {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*administrator.ID,\n\t\t\t\t*administrator.Name,\n\t\t\t\t\"azurerm_sql_active_directory_administrator\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DatabasesGenerator) InitResources() error {\n\tmariadbServers, err := g.getMariaDBServers()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmysqlServers, err := g.getMySQLServers()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpostgresqlServers, err := g.getPostgreSQLServers()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsqlServers, err := g.getSQLServers()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmariadbFunctions := []func([]mariadb.Server) ([]terraformutils.Resource, error){\n\t\tg.createMariaDBServerResources,\n\t\tg.createMariaDBDatabaseResources,\n\t\tg.createMariaDBConfigurationResources,\n\t\tg.createMariaDBFirewallRuleResources,\n\t\tg.createMariaDBVirtualNetworkRuleResources,\n\t}\n\n\tmysqlFunctions := []func([]mysql.Server) ([]terraformutils.Resource, error){\n\t\tg.createMySQLServerResources,\n\t\tg.createMySQLDatabaseResources,\n\t\tg.createMySQLConfigurationResources,\n\t\tg.createMySQLFirewallRuleResources,\n\t\tg.createMySQLVirtualNetworkRuleResources,\n\t}\n\n\tpostgresqlFunctions := []func([]postgresql.Server) ([]terraformutils.Resource, error){\n\t\tg.createPostgreSQLServerResources,\n\t\tg.createPostgreSQLDatabaseResources,\n\t\tg.createPostgreSQLConfigurationResources,\n\t\tg.createPostgreSQLFirewallRuleResources,\n\t\tg.createPostgreSQLVirtualNetworkRuleResources,\n\t}\n\n\tsqlFunctions := []func([]sql.Server) ([]terraformutils.Resource, error){\n\t\tg.createSQLServerResources,\n\t\tg.createSQLDatabaseResources,\n\t\tg.createSQLADAdministratorResources,\n\t\tg.createSQLElasticPoolResources,\n\t\tg.createSQLFailoverResources,\n\t\tg.createSQLFirewallRuleResources,\n\t\tg.createSQLVirtualNetworkRuleResources,\n\t}\n\n\tfor _, f := range mariadbFunctions {\n\t\tresources, err := f(mariadbServers)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\tfor _, f := range mysqlFunctions {\n\t\tresources, err := f(mysqlServers)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\tfor _, f := range postgresqlFunctions {\n\t\tresources, err := f(postgresqlServers)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\tfor _, f := range sqlFunctions {\n\t\tresources, err := f(sqlServers)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\treturn nil\n}\n\nfunc (g *DatabasesGenerator) PostConvertHook() error {\n\tdbEngines := []string{\n\t\t\"mariadb\",\n\t\t\"mysql\",\n\t\t\"postgresql\",\n\t\t\"sql\",\n\t}\n\n\tfor _, engineName := range dbEngines {\n\t\tfor _, resource := range g.Resources {\n\t\t\tdbServerResourceType := fmt.Sprintf(\"azurerm_%s_server\", engineName)\n\t\t\tif resource.InstanceInfo.Type == dbServerResourceType {\n\t\t\t\tdbName := resource.Item[\"name\"]\n\t\t\t\tfor rIdx, r := range g.Resources {\n\t\t\t\t\tif r.InstanceInfo.Type != dbServerResourceType &&\n\t\t\t\t\t\tstrings.Contains(r.InstanceInfo.Type, engineName) &&\n\t\t\t\t\t\tr.Item[\"server_name\"] == dbName {\n\t\t\t\t\t\tg.Resources[rIdx].Item[\"server_name\"] = fmt.Sprintf(\"${%s.%s}\", resource.InstanceInfo.Id, \"name\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/databricks.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/databricks/mgmt/2018-04-01/databricks\"\n)\n\ntype DatabricksGenerator struct {\n\tAzureService\n}\n\nfunc (az *DatabricksGenerator) listWorkspaces() ([]databricks.Workspace, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := databricks.NewWorkspacesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator databricks.WorkspaceListResultIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListByResourceGroupComplete(ctx, resourceGroup)\n\t} else {\n\t\titerator, err = client.ListBySubscriptionComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []databricks.Workspace\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *DatabricksGenerator) AppendWorkspace(workspace *databricks.Workspace) {\n\taz.AppendSimpleResource(*workspace.ID, *workspace.Name, \"azurerm_databricks_workspace\")\n}\n\nfunc (az *DatabricksGenerator) InitResources() error {\n\n\tworkspaces, err := az.listWorkspaces()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, workspace := range workspaces {\n\t\taz.AppendWorkspace(&workspace)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/disk.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype DiskGenerator struct {\n\tAzureService\n}\n\nfunc (g DiskGenerator) createResources(diskListIterator compute.DiskListIterator) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tfor diskListIterator.NotDone() {\n\t\tdisk := diskListIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*disk.ID,\n\t\t\t*disk.Name,\n\t\t\t\"azurerm_managed_disk\",\n\t\t\t\"azurerm\",\n\t\t\t[]string{}))\n\t\tif err := diskListIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DiskGenerator) InitResources() error {\n\tctx := context.Background()\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tdisksClient := compute.NewDisksClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\n\tdisksClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar (\n\t\toutput compute.DiskListIterator\n\t\terr    error\n\t)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\toutput, err = disksClient.ListByResourceGroupComplete(ctx, rg)\n\t} else {\n\t\toutput, err = disksClient.ListComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources, err = g.createResources(output)\n\treturn err\n}\n"
  },
  {
    "path": "providers/azure/dns.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype DNSGenerator struct {\n\tAzureService\n}\n\nfunc (g *DNSGenerator) listRecordSets(resourceGroupName string, zoneName string, top *int32) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tRecordSetsClient := dns.NewRecordSetsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tRecordSetsClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\trecordSetIterator, err := RecordSetsClient.ListAllByDNSZoneComplete(ctx, resourceGroupName, zoneName, top, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor recordSetIterator.NotDone() {\n\t\trecordSet := recordSetIterator.Value()\n\t\t// NOTE:\n\t\t// Format example: \"Microsoft.Network/dnszones/AAAA\"\n\t\trecordTypeSplitted := strings.Split(*recordSet.Type, \"/\")\n\t\trecordType := recordTypeSplitted[len(recordTypeSplitted)-1]\n\t\ttypeResourceNameMap := map[string]string{\n\t\t\t\"A\":     \"azurerm_dns_a_record\",\n\t\t\t\"AAAA\":  \"azurerm_dns_aaaa_record\",\n\t\t\t\"CAA\":   \"azurerm_dns_caa_record\",\n\t\t\t\"CNAME\": \"azurerm_dns_cname_record\",\n\t\t\t\"MX\":    \"azurerm_dns_mx_record\",\n\t\t\t\"NS\":    \"azurerm_dns_ns_record\",\n\t\t\t\"PTR\":   \"azurerm_dns_ptr_record\",\n\t\t\t\"SRV\":   \"azurerm_dns_srv_record\",\n\t\t\t\"TXT\":   \"azurerm_dns_txt_record\",\n\t\t}\n\t\tif resName, exist := typeResourceNameMap[recordType]; exist {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*recordSet.ID,\n\t\t\t\t*recordSet.Name,\n\t\t\t\tresName,\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\n\t\tif err := recordSetIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\n\t}\n\treturn resources, nil\n}\n\nfunc (g *DNSGenerator) listAndAddForDNSZone() ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tDNSZonesClient := dns.NewZonesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tDNSZonesClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar pageSize int32 = 50\n\n\tvar (\n\t\tdnsZoneIterator dns.ZoneListResultIterator\n\t\terr             error\n\t)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tdnsZoneIterator, err = DNSZonesClient.ListByResourceGroupComplete(ctx, rg, &pageSize)\n\t} else {\n\t\tdnsZoneIterator, err = DNSZonesClient.ListComplete(ctx, &pageSize)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor dnsZoneIterator.NotDone() {\n\t\tzone := dnsZoneIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*zone.ID,\n\t\t\t*zone.Name,\n\t\t\t\"azurerm_dns_zone\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tid, err := ParseAzureResourceID(*zone.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trecords, err := g.listRecordSets(id.ResourceGroup, *zone.Name, &pageSize)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresources = append(resources, records...)\n\n\t\tif err := dnsZoneIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *DNSGenerator) InitResources() error {\n\tfunctions := []func() ([]terraformutils.Resource, error){\n\t\tg.listAndAddForDNSZone,\n\t}\n\n\tfor _, f := range functions {\n\t\tresources, err := f()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/eventhub.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/eventhub/mgmt/2017-04-01/eventhub\"\n)\n\ntype EventHubGenerator struct {\n\tAzureService\n}\n\nfunc (az *EventHubGenerator) listNamespaces() ([]eventhub.EHNamespace, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := eventhub.NewNamespacesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator eventhub.EHNamespaceListResultIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListByResourceGroupComplete(ctx, resourceGroup)\n\t} else {\n\t\titerator, err = client.ListComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []eventhub.EHNamespace\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *EventHubGenerator) AppendNamespace(namespace *eventhub.EHNamespace) {\n\taz.AppendSimpleResource(*namespace.ID, *namespace.Name, \"azurerm_eventhub_namespace\")\n}\n\nfunc (az *EventHubGenerator) appendEventHubs(namespace *eventhub.EHNamespace, namespaceRg *ResourceID) error {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := eventhub.NewEventHubsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\titerator, err := client.ListByNamespaceComplete(ctx, namespaceRg.ResourceGroup, *namespace.Name, nil, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\n\t\taz.AppendSimpleResource(*item.ID, *item.Name, \"azurerm_eventhub\")\n\t\terr = az.appendConsumerGroups(namespace, namespaceRg, *item.Name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (az *EventHubGenerator) appendConsumerGroups(namespace *eventhub.EHNamespace, namespaceRg *ResourceID, eventHubName string) error {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := eventhub.NewConsumerGroupsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\titerator, err := client.ListByEventHubComplete(ctx, namespaceRg.ResourceGroup, *namespace.Name, eventHubName, nil, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\taz.AppendSimpleResource(*item.ID, *item.Name, \"azurerm_eventhub_consumer_group\")\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (az *EventHubGenerator) appendAuthorizationRules(namespace *eventhub.EHNamespace, namespaceRg *ResourceID) error {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := eventhub.NewNamespacesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\titerator, err := client.ListAuthorizationRulesComplete(ctx, namespaceRg.ResourceGroup, *namespace.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\n\t\taz.AppendSimpleResource(*item.ID, *item.Name, \"azurerm_eventhub_namespace_authorization_rule\")\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (az *EventHubGenerator) InitResources() error {\n\n\tnamespaces, err := az.listNamespaces()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, namespace := range namespaces {\n\t\taz.AppendNamespace(&namespace)\n\t\tnamespaceRg, err := ParseAzureResourceID(*namespace.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = az.appendEventHubs(&namespace, namespaceRg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = az.appendAuthorizationRules(&namespace, namespaceRg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/helper.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"fmt\"\n\t\"math/rand\"\n\t\"net/url\"\n\t\"strings\"\n)\n\n// FROM https://github.com/terraform-providers/terraform-provider-azurerm/blob/6e006ff4e5d1fb200a6b37eb2743ff0ec8b11e0d/azurerm/helpers/azure/resourceid.go#L24\n\n// ResourceID represents a parsed long-form Azure Resource Manager ID\n// with the Subscription ID, Resource Group and the Provider as top-\n// level fields, and other key-value pairs available via a map in the\n// Path field.\ntype ResourceID struct {\n\tSubscriptionID string\n\tResourceGroup  string\n\tProvider       string\n\tPath           map[string]string\n}\n\n// ParseAzureResourceID converts a long-form Azure Resource Manager ID\n// into a ResourceID. We make assumptions about the structure of URLs,\n// which is obviously not good, but the best thing available given the\n// SDK.\nfunc ParseAzureResourceID(id string) (*ResourceID, error) {\n\tidURL, err := url.ParseRequestURI(id)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Cannot parse Azure ID: %s\", err)\n\t}\n\n\tpath := idURL.Path\n\n\tpath = strings.TrimPrefix(path, \"/\")\n\tpath = strings.TrimSuffix(path, \"/\")\n\n\tcomponents := strings.Split(path, \"/\")\n\n\t// We should have an even number of key-value pairs.\n\tif len(components)%2 != 0 {\n\t\treturn nil, fmt.Errorf(\"The number of path segments is not divisible by 2 in %q\", path)\n\t}\n\n\tvar subscriptionID string\n\n\t// Put the constituent key-value pairs into a map\n\tcomponentMap := make(map[string]string, len(components)/2)\n\tfor current := 0; current < len(components); current += 2 {\n\t\tkey := components[current]\n\t\tvalue := components[current+1]\n\n\t\t// Check key/value for empty strings.\n\t\tif key == \"\" || value == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"Key/Value cannot be empty strings. Key: '%s', Value: '%s'\", key, value)\n\t\t}\n\n\t\t// Catch the subscriptionID before it can be overwritten by another \"subscriptions\"\n\t\t// value in the ID which is the case for the Service Bus subscription resource\n\t\tif key == \"subscriptions\" && subscriptionID == \"\" {\n\t\t\tsubscriptionID = value\n\t\t} else {\n\t\t\tcomponentMap[key] = value\n\t\t}\n\t}\n\n\t// Build up a TargetResourceID from the map\n\tidObj := &ResourceID{}\n\tidObj.Path = componentMap\n\n\tif subscriptionID != \"\" {\n\t\tidObj.SubscriptionID = subscriptionID\n\t} else {\n\t\treturn nil, fmt.Errorf(\"No subscription ID found in: %q\", path)\n\t}\n\n\tif resourceGroup, ok := componentMap[\"resourceGroups\"]; ok {\n\t\tidObj.ResourceGroup = resourceGroup\n\t\tdelete(componentMap, \"resourceGroups\")\n\t} else if resourceGroup, ok := componentMap[\"resourcegroups\"]; ok {\n\t\t// Some Azure APIs are weird and provide things in lower case...\n\t\t// However it's not clear whether the casing of other elements in the URI\n\t\t// matter, so we explicitly look for that case here.\n\t\tidObj.ResourceGroup = resourceGroup\n\t\tdelete(componentMap, \"resourcegroups\")\n\t}\n\n\t// It is OK not to have a provider in the case of a resource group\n\tif provider, ok := componentMap[\"providers\"]; ok {\n\t\tidObj.Provider = provider\n\t\tdelete(componentMap, \"providers\")\n\t}\n\n\treturn idObj, nil\n}\n\nfunc GenerateRandomString(strlen int) string {\n\tvar lettersToUsed = []rune(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\")\n\tRandomSlice := make([]rune, strlen)\n\tfor index := range RandomSlice {\n\t\tRandomSlice[index] = lettersToUsed[rand.Intn(len(lettersToUsed))]\n\t}\n\treturn string(RandomSlice)\n}\n\nfunc asHereDoc(json string) string {\n\treturn fmt.Sprintf(`<<JSON\n%s\nJSON`, json)\n}\n"
  },
  {
    "path": "providers/azure/keyvault.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/keyvault/mgmt/2018-02-14/keyvault\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype KeyVaultGenerator struct {\n\tAzureService\n}\n\nfunc (g KeyVaultGenerator) createResources(ctx context.Context, client keyvault.VaultsClient) ([]terraformutils.Resource, error) {\n\tresourceListResultIterator, err := client.ListComplete(ctx, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []terraformutils.Resource\n\tfor resourceListResultIterator.NotDone() {\n\t\tvault := resourceListResultIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*vault.ID,\n\t\t\t*vault.Name,\n\t\t\t\"azurerm_key_vault\",\n\t\t\t\"azurerm\",\n\t\t\t[]string{}))\n\t\tif err := resourceListResultIterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g KeyVaultGenerator) createResourcesByResourceGroup(ctx context.Context, rg string, client keyvault.VaultsClient) ([]terraformutils.Resource, error) {\n\titerator, err := client.ListByResourceGroupComplete(ctx, rg, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []terraformutils.Resource\n\tfor iterator.NotDone() {\n\t\tvault := iterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*vault.ID,\n\t\t\t*vault.Name,\n\t\t\t\"azurerm_key_vault\",\n\t\t\t\"azurerm\",\n\t\t\t[]string{}))\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *KeyVaultGenerator) InitResources() error {\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tvaultsClient := keyvault.NewVaultsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\n\tvaultsClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar err error\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tg.Resources, err = g.createResourcesByResourceGroup(ctx, rg, vaultsClient)\n\t\treturn err\n\t}\n\tg.Resources, err = g.createResources(ctx, vaultsClient)\n\treturn err\n}\n"
  },
  {
    "path": "providers/azure/load_balancer.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"regexp\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-03-01/network\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype LoadBalancerGenerator struct {\n\tAzureService\n}\n\nfunc (g *LoadBalancerGenerator) listLoadBalancerProbes(resourceGroupName string, loadBalancerName string) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\n\tLoadBalancerProbesClient := network.NewLoadBalancerProbesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tLoadBalancerProbesClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\tloadBalancerProbeIterator, err := LoadBalancerProbesClient.ListComplete(ctx, resourceGroupName, loadBalancerName)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor loadBalancerProbeIterator.NotDone() {\n\t\tloadBalancerProbe := loadBalancerProbeIterator.Value()\n\t\t// NOTE:\n\t\t// This works out the loadBalancer resource id from current probe\n\t\t// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/loadBalancers/lb1\n\t\t// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/loadBalancers/lb1/probes/probe1\n\t\t//\n\t\t// As the related data_source in azurerm provider works by starting to look up with loadbalancer_id\n\t\t// https://github.com/terraform-providers/terraform-provider-azurerm/blob/v2.18.0/azurerm/internal/services/network/lb_probe_resource.go#L186\n\t\tre := regexp.MustCompile(`/probes/.*$`)\n\t\tloadBalancerID := re.ReplaceAllLiteralString(*loadBalancerProbe.ID, \"\")\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t*loadBalancerProbe.ID,\n\t\t\t*loadBalancerProbe.Name,\n\t\t\t\"azurerm_lb_probe\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"loadbalancer_id\": loadBalancerID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\n\t\tif err := loadBalancerProbeIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *LoadBalancerGenerator) listInboundNatRules(resourceGroupName string, loadBalancerName string) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\n\tInboundNatRulesClient := network.NewInboundNatRulesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tInboundNatRulesClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\tInboundNatRuleIterator, err := InboundNatRulesClient.ListComplete(ctx, resourceGroupName, loadBalancerName)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor InboundNatRuleIterator.NotDone() {\n\t\tInboundNatRule := InboundNatRuleIterator.Value()\n\t\t// NOTE:\n\t\t// Similar to above explanation, work out loadbalancer_id for azurerm datasource impl\n\t\tre := regexp.MustCompile(`/inboundNatRules/.*$`)\n\t\tloadBalancerID := re.ReplaceAllLiteralString(*InboundNatRule.ID, \"\")\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t*InboundNatRule.ID,\n\t\t\t*InboundNatRule.Name,\n\t\t\t\"azurerm_lb_nat_rule\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"loadbalancer_id\": loadBalancerID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\n\t\tif err := InboundNatRuleIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *LoadBalancerGenerator) listLoadBalancerBackendAddressPools(resourceGroupName string, loadBalancerName string) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\n\tLoadBalancerBackendAddressPoolsClient := network.NewLoadBalancerBackendAddressPoolsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tLoadBalancerBackendAddressPoolsClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\tloadBalancerBackendAddressPoolIterator, err := LoadBalancerBackendAddressPoolsClient.ListComplete(ctx, resourceGroupName, loadBalancerName)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor loadBalancerBackendAddressPoolIterator.NotDone() {\n\t\tloadBalancerBackendAddressPool := loadBalancerBackendAddressPoolIterator.Value()\n\t\t// NOTE:\n\t\t// Similar to above explanation, work out loadbalancer_id for azurerm datasource impl\n\t\tre := regexp.MustCompile(`/backendAddressPools/.*$`)\n\t\tloadBalancerID := re.ReplaceAllLiteralString(*loadBalancerBackendAddressPool.ID, \"\")\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t*loadBalancerBackendAddressPool.ID,\n\t\t\t*loadBalancerBackendAddressPool.Name,\n\t\t\t\"azurerm_lb_backend_address_pool\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"loadbalancer_id\": loadBalancerID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t\tif err := loadBalancerBackendAddressPoolIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *LoadBalancerGenerator) listAndAddForLoadBalancers() ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\n\tLoadBalancersClient := network.NewLoadBalancersClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tLoadBalancersClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar (\n\t\tloadBalancerIterator network.LoadBalancerListResultIterator\n\t\terr                  error\n\t)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tloadBalancerIterator, err = LoadBalancersClient.ListComplete(ctx, rg)\n\t} else {\n\t\tloadBalancerIterator, err = LoadBalancersClient.ListAllComplete(ctx)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor loadBalancerIterator.NotDone() {\n\t\tloadBalancer := loadBalancerIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*loadBalancer.ID,\n\t\t\t*loadBalancer.Name,\n\t\t\t\"azurerm_lb\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tid, err := ParseAzureResourceID(*loadBalancer.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tprobes, err := g.listLoadBalancerProbes(id.ResourceGroup, *loadBalancer.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresources = append(resources, probes...)\n\n\t\tinboundNatRules, err := g.listInboundNatRules(id.ResourceGroup, *loadBalancer.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresources = append(resources, inboundNatRules...)\n\n\t\tbackendAddressPools, err := g.listLoadBalancerBackendAddressPools(id.ResourceGroup, *loadBalancer.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresources = append(resources, backendAddressPools...)\n\n\t\tif err := loadBalancerIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *LoadBalancerGenerator) InitResources() error {\n\tfunctions := []func() ([]terraformutils.Resource, error){\n\t\tg.listAndAddForLoadBalancers,\n\t}\n\n\tfor _, f := range functions {\n\t\tresources, err := f()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/management_lock.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-09-01/locks\"\n)\n\ntype ManagementLockGenerator struct {\n\tAzureService\n}\n\nfunc (az *ManagementLockGenerator) listResources() ([]locks.ManagementLockObject, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := locks.NewManagementLocksClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator locks.ManagementLockListResultIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListAtResourceGroupLevelComplete(ctx, resourceGroup, \"\")\n\t} else {\n\t\titerator, err = client.ListAtSubscriptionLevelComplete(ctx, \"\")\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []locks.ManagementLockObject\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *ManagementLockGenerator) appendResource(resource *locks.ManagementLockObject) {\n\taz.AppendSimpleResource(*resource.ID, *resource.Name, \"azurerm_management_lock\")\n}\n\nfunc (az *ManagementLockGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\taz.appendResource(&resource)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/network_interface.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-08-01/network\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype NetworkInterfaceGenerator struct {\n\tAzureService\n}\n\nfunc (g NetworkInterfaceGenerator) createResources(interfaceListResult network.InterfaceListResultIterator) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tfor interfaceListResult.NotDone() {\n\t\tnetworkInterface := interfaceListResult.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*networkInterface.ID,\n\t\t\t*networkInterface.Name,\n\t\t\t\"azurerm_network_interface\",\n\t\t\t\"azurerm\",\n\t\t\t[]string{}))\n\t\tif err := interfaceListResult.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *NetworkInterfaceGenerator) InitResources() error {\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tinterfacesClient := network.NewInterfacesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\n\tinterfacesClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\tvar (\n\t\toutput network.InterfaceListResultIterator\n\t\terr    error\n\t)\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\toutput, err = interfacesClient.ListComplete(ctx, rg)\n\t} else {\n\t\toutput, err = interfacesClient.ListAllComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources, err = g.createResources(output)\n\treturn err\n}\n"
  },
  {
    "path": "providers/azure/network_security_group.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-03-01/network\"\n)\n\ntype NetworkSecurityGroupGenerator struct {\n\tAzureService\n}\n\nfunc (az *NetworkSecurityGroupGenerator) listResources() ([]network.SecurityGroup, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := network.NewSecurityGroupsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator network.SecurityGroupListResultIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListComplete(ctx, resourceGroup)\n\t} else {\n\t\titerator, err = client.ListAllComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []network.SecurityGroup\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *NetworkSecurityGroupGenerator) appendResource(resource *network.SecurityGroup) {\n\taz.AppendSimpleResourceWithDuplicateCheck(*resource.ID, *resource.Name, \"azurerm_network_security_group\")\n}\n\nfunc (az *NetworkSecurityGroupGenerator) appendRules(parent *network.SecurityGroup, resourceGroupID *ResourceID) error {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := network.NewSecurityRulesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\titerator, err := client.ListComplete(ctx, resourceGroupID.ResourceGroup, *parent.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\taz.AppendSimpleResourceWithDuplicateCheck(*item.ID, *item.Name, \"azurerm_network_security_rule\")\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (az *NetworkSecurityGroupGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\taz.appendResource(&resource)\n\t\tresourceGroupID, err := ParseAzureResourceID(*resource.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = az.appendRules(&resource, resourceGroupID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/network_watcher.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-03-01/network\"\n)\n\ntype NetworkWatcherGenerator struct {\n\tAzureService\n}\n\nfunc (az *NetworkWatcherGenerator) listResources() ([]network.Watcher, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := network.NewWatchersClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\tresources network.WatcherListResult\n\t\terr       error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\tresources, err = client.List(ctx, resourceGroup)\n\t} else {\n\t\tresources, err = client.ListAll(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn *resources.Value, nil\n}\n\nfunc (az *NetworkWatcherGenerator) appendResource(resource *network.Watcher) {\n\taz.AppendSimpleResource(*resource.ID, *resource.Name, \"azurerm_network_watcher\")\n}\n\nfunc (az *NetworkWatcherGenerator) appendFlowLogs(parent *network.Watcher, resourceGroupID *ResourceID) error {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := network.NewFlowLogsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\titerator, err := client.ListComplete(ctx, resourceGroupID.ResourceGroup, *parent.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\taz.AppendSimpleResource(*item.ID, *item.Name, \"azurerm_network_watcher_flow_log\")\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (az *NetworkWatcherGenerator) appendPacketCaptures(parent *network.Watcher, resourceGroupID *ResourceID) error {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := network.NewPacketCapturesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\tresources, err := client.List(ctx, resourceGroupID.ResourceGroup, *parent.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, item := range *resources.Value {\n\t\taz.AppendSimpleResource(*item.ID, *item.Name, \"azurerm_network_packet_capture\")\n\t}\n\treturn nil\n}\n\nfunc (az *NetworkWatcherGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\taz.appendResource(&resource)\n\t\tresourceGroupID, err := ParseAzureResourceID(*resource.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = az.appendFlowLogs(&resource, resourceGroupID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = az.appendPacketCaptures(&resource, resourceGroupID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/private_dns.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/privatedns/mgmt/2018-09-01/privatedns\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype PrivateDNSGenerator struct {\n\tAzureService\n}\n\nfunc (g *PrivateDNSGenerator) listRecordSets(resourceGroupName string, privateZoneName string, top *int32) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tRecordSetsClient := privatedns.NewRecordSetsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tRecordSetsClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\trecordSetIterator, err := RecordSetsClient.ListComplete(ctx, resourceGroupName, privateZoneName, top, \"\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor recordSetIterator.NotDone() {\n\t\trecordSet := recordSetIterator.Value()\n\t\t// NOTE:\n\t\t// Format example: \"Microsoft.Network/privateDnsZones/CNAME\"\n\t\trecordTypeSplitted := strings.Split(*recordSet.Type, \"/\")\n\t\trecordType := recordTypeSplitted[len(recordTypeSplitted)-1]\n\t\ttypeResourceNameMap := map[string]string{\n\t\t\t\"A\":     \"azurerm_private_dns_a_record\",\n\t\t\t\"AAAA\":  \"azurerm_private_dns_aaaa_record\",\n\t\t\t\"CNAME\": \"azurerm_private_dns_cname_record\",\n\t\t\t\"MX\":    \"azurerm_private_dns_mx_record\",\n\t\t\t\"PTR\":   \"azurerm_private_dns_ptr_record\",\n\t\t\t\"SRV\":   \"azurerm_private_dns_srv_record\",\n\t\t\t\"TXT\":   \"azurerm_private_dns_txt_record\",\n\t\t}\n\t\tif resName, exist := typeResourceNameMap[recordType]; exist {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*recordSet.ID,\n\t\t\t\t*recordSet.Name,\n\t\t\t\tresName,\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\n\t\tif err := recordSetIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\n\t}\n\treturn resources, nil\n}\n\nfunc (g *PrivateDNSGenerator) listVirtualNetworkLinks(resourceGroupName string, privateZoneName string, pageSize *int32) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tVirtualNetworkLinksClient := privatedns.NewVirtualNetworkLinksClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tVirtualNetworkLinksClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvirtualNetworkLinkIterator, err := VirtualNetworkLinksClient.ListComplete(ctx, resourceGroupName, privateZoneName, pageSize)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor virtualNetworkLinkIterator.NotDone() {\n\t\tvirtualNetworkLink := virtualNetworkLinkIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*virtualNetworkLink.ID,\n\t\t\t*virtualNetworkLink.Name,\n\t\t\t\"azurerm_private_dns_zone_virtual_network_link\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tif err := virtualNetworkLinkIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *PrivateDNSGenerator) listAndAddForPrivateDNSZone() ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tPrivateDNSZonesClient := privatedns.NewPrivateZonesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tPrivateDNSZonesClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar pageSize int32 = 50\n\n\tvar (\n\t\tdnsZoneIterator privatedns.PrivateZoneListResultIterator\n\t\terr             error\n\t)\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tdnsZoneIterator, err = PrivateDNSZonesClient.ListByResourceGroupComplete(ctx, rg, &pageSize)\n\t} else {\n\t\tdnsZoneIterator, err = PrivateDNSZonesClient.ListComplete(ctx, &pageSize)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor dnsZoneIterator.NotDone() {\n\t\tzone := dnsZoneIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*zone.ID,\n\t\t\t*zone.Name,\n\t\t\t\"azurerm_private_dns_zone\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tid, err := ParseAzureResourceID(*zone.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trecords, err := g.listRecordSets(id.ResourceGroup, *zone.Name, &pageSize)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresources = append(resources, records...)\n\n\t\tnetworkLinks, err := g.listVirtualNetworkLinks(id.ResourceGroup, *zone.Name, &pageSize)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresources = append(resources, networkLinks...)\n\n\t\tif err := dnsZoneIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *PrivateDNSGenerator) InitResources() error {\n\tfunctions := []func() ([]terraformutils.Resource, error){\n\t\tg.listAndAddForPrivateDNSZone,\n\t}\n\n\tfor _, f := range functions {\n\t\tresources, err := f()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/private_endpoint.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network\"\n)\n\ntype PrivateEndpointGenerator struct {\n\tAzureService\n}\n\nfunc (az *PrivateEndpointGenerator) listServices() ([]network.PrivateLinkService, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := network.NewPrivateLinkServicesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator network.PrivateLinkServiceListResultIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListComplete(ctx, resourceGroup)\n\t} else {\n\t\titerator, err = client.ListBySubscriptionComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []network.PrivateLinkService\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *PrivateEndpointGenerator) AppendServices(link *network.PrivateLinkService) {\n\taz.AppendSimpleResource(*link.ID, *link.Name, \"azurerm_private_link_service\")\n}\n\nfunc (az *PrivateEndpointGenerator) listEndpoints() ([]network.PrivateEndpoint, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := network.NewPrivateEndpointsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator network.PrivateEndpointListResultIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListComplete(ctx, resourceGroup)\n\t} else {\n\t\titerator, err = client.ListBySubscriptionComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []network.PrivateEndpoint\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *PrivateEndpointGenerator) AppendEndpoint(link *network.PrivateEndpoint) {\n\taz.AppendSimpleResource(*link.ID, *link.Name, \"azurerm_private_endpoint\")\n}\n\nfunc (az *PrivateEndpointGenerator) InitResources() error {\n\n\tservices, err := az.listServices()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, link := range services {\n\t\taz.AppendServices(&link)\n\t}\n\tendpoints, err := az.listEndpoints()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, endpoint := range endpoints {\n\t\taz.AppendEndpoint(&endpoint)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/public_ip.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-03-01/network\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype PublicIPGenerator struct {\n\tAzureService\n}\n\nfunc (g *PublicIPGenerator) listAndAddForPublicIPAddress() ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tPublicIPAddressesClient := network.NewPublicIPAddressesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tPublicIPAddressesClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar (\n\t\tpublicIPAddressIterator network.PublicIPAddressListResultIterator\n\t\terr                     error\n\t)\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tpublicIPAddressIterator, err = PublicIPAddressesClient.ListComplete(ctx, rg)\n\t} else {\n\t\tpublicIPAddressIterator, err = PublicIPAddressesClient.ListAllComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor publicIPAddressIterator.NotDone() {\n\t\tpublicIP := publicIPAddressIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*publicIP.ID,\n\t\t\t*publicIP.Name,\n\t\t\t\"azurerm_public_ip\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tif err := publicIPAddressIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *PublicIPGenerator) listAndAddForPublicIPPrefix() ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tPublicIPPrefixesClient := network.NewPublicIPPrefixesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tPublicIPPrefixesClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar (\n\t\tpublicIPPrefixIterator network.PublicIPPrefixListResultIterator\n\t\terr                    error\n\t)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tpublicIPPrefixIterator, err = PublicIPPrefixesClient.ListComplete(ctx, rg)\n\t} else {\n\t\tpublicIPPrefixIterator, err = PublicIPPrefixesClient.ListAllComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor publicIPPrefixIterator.NotDone() {\n\t\tpublicIPPrefix := publicIPPrefixIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*publicIPPrefix.ID,\n\t\t\t*publicIPPrefix.Name,\n\t\t\t\"azurerm_public_ip_prefix\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tif err := publicIPPrefixIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *PublicIPGenerator) InitResources() error {\n\tfunctions := []func() ([]terraformutils.Resource, error){\n\t\tg.listAndAddForPublicIPAddress,\n\t\tg.listAndAddForPublicIPPrefix,\n\t}\n\n\tfor _, f := range functions {\n\t\tresources, err := f()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/purview.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/purview/mgmt/2021-07-01/purview\"\n)\n\ntype PurviewGenerator struct {\n\tAzureService\n}\n\nfunc (az *PurviewGenerator) listAccounts() ([]purview.Account, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := purview.NewAccountsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator purview.AccountListIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListByResourceGroupComplete(ctx, resourceGroup, \"\")\n\t} else {\n\t\titerator, err = client.ListBySubscriptionComplete(ctx, \"\")\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []purview.Account\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *PurviewGenerator) AppendAccount(account *purview.Account) {\n\taz.AppendSimpleResource(*account.ID, *account.Name, \"azurerm_purview_account\")\n}\n\nfunc (az *PurviewGenerator) InitResources() error {\n\n\taccounts, err := az.listAccounts()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, account := range accounts {\n\t\taz.AppendAccount(&account)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/redis.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/redis/mgmt/2018-03-01/redis\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype RedisGenerator struct {\n\tAzureService\n}\n\nfunc (g *RedisGenerator) listRedisServers() ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tRedisClient := redis.NewClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\n\tredisServersIterator, err := RedisClient.ListComplete(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor redisServersIterator.NotDone() {\n\t\tredisServer := redisServersIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*redisServer.ID,\n\t\t\t*redisServer.Name,\n\t\t\t\"azurerm_redis_cache\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tif err := redisServersIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *RedisGenerator) InitResources() error {\n\tfunctions := []func() ([]terraformutils.Resource, error){\n\t\tg.listRedisServers,\n\t}\n\n\tfor _, f := range functions {\n\t\tresources, err := f()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/resource_group.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-05-01/resources\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype ResourceGroupGenerator struct {\n\tAzureService\n}\n\nfunc (g ResourceGroupGenerator) createResources(groupListResultIterator resources.GroupListResultIterator) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor groupListResultIterator.NotDone() {\n\t\tgroup := groupListResultIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*group.ID,\n\t\t\t*group.Name,\n\t\t\t\"azurerm_resource_group\",\n\t\t\t\"azurerm\",\n\t\t\t[]string{}))\n\t\tif err := groupListResultIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tbreak\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *ResourceGroupGenerator) InitResources() error {\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tgroupsClient := resources.NewGroupsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\n\tgroupsClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tgroup, err := groupsClient.Get(ctx, rg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = []terraformutils.Resource{\n\t\t\tterraformutils.NewSimpleResource(\n\t\t\t\t*group.ID,\n\t\t\t\t*group.Name,\n\t\t\t\t\"azurerm_resource_group\",\n\t\t\t\t\"azurerm\",\n\t\t\t\t[]string{}),\n\t\t}\n\t\treturn nil\n\t}\n\toutput, err := groupsClient.ListComplete(ctx, \"\", nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/route_table.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2020-03-01/network\"\n)\n\ntype RouteTableGenerator struct {\n\tAzureService\n}\n\nfunc (az *RouteTableGenerator) listResources() ([]network.RouteTable, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := network.NewRouteTablesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator network.RouteTableListResultIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListComplete(ctx, resourceGroup)\n\t} else {\n\t\titerator, err = client.ListAllComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []network.RouteTable\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *RouteTableGenerator) appendResource(resource *network.RouteTable) {\n\taz.AppendSimpleResourceWithDuplicateCheck(*resource.ID, *resource.Name, \"azurerm_route_table\")\n}\n\nfunc (az *RouteTableGenerator) appendRoutes(parent *network.RouteTable, resourceGroupID *ResourceID) error {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := network.NewRoutesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\titerator, err := client.ListComplete(ctx, resourceGroupID.ResourceGroup, *parent.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\taz.AppendSimpleResourceWithDuplicateCheck(*item.ID, *item.Name, \"azurerm_route\")\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (az *RouteTableGenerator) listRouteFilters() ([]network.RouteFilter, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := network.NewRouteFiltersClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator network.RouteFilterListResultIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListByResourceGroupComplete(ctx, resourceGroup)\n\t} else {\n\t\titerator, err = client.ListComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []network.RouteFilter\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *RouteTableGenerator) appendRouteFilters(resource *network.RouteFilter) {\n\taz.AppendSimpleResource(*resource.ID, *resource.Name, \"azurerm_route_filter\")\n}\n\nfunc (az *RouteTableGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\taz.appendResource(&resource)\n\t\tresourceGroupID, err := ParseAzureResourceID(*resource.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = az.appendRoutes(&resource, resourceGroupID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfilters, err := az.listRouteFilters()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range filters {\n\t\taz.appendRouteFilters(&resource)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/scaleset.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype ScaleSetGenerator struct {\n\tAzureService\n}\n\nfunc (g ScaleSetGenerator) createResourcesByResourceGroup(ctx context.Context, client compute.VirtualMachineScaleSetsClient, rg string) ([]terraformutils.Resource, error) {\n\tscaleSetIterator, err := client.ListComplete(ctx, rg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []terraformutils.Resource\n\tfor scaleSetIterator.NotDone() {\n\t\tscaleSet := scaleSetIterator.Value()\n\t\tnewResource := terraformutils.NewSimpleResource(\n\t\t\t*scaleSet.ID,\n\t\t\t*scaleSet.Name,\n\t\t\t\"azurerm_virtual_machine_scale_set\",\n\t\t\t\"azurerm\",\n\t\t\t[]string{})\n\t\tresources = append(resources, newResource)\n\t\tif err := scaleSetIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g ScaleSetGenerator) createResources(ctx context.Context, client compute.VirtualMachineScaleSetsClient) ([]terraformutils.Resource, error) {\n\tscaleSetIterator, err := client.ListAllComplete(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []terraformutils.Resource\n\tfor scaleSetIterator.NotDone() {\n\t\tscaleSet := scaleSetIterator.Value()\n\t\tnewResource := terraformutils.NewSimpleResource(\n\t\t\t*scaleSet.ID,\n\t\t\t*scaleSet.Name,\n\t\t\t\"azurerm_virtual_machine_scale_set\",\n\t\t\t\"azurerm\",\n\t\t\t[]string{})\n\t\tresources = append(resources, newResource)\n\t\tif err := scaleSetIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *ScaleSetGenerator) InitResources() error {\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tScaleSetClient := compute.NewVirtualMachineScaleSetsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\n\tScaleSetClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\tvar err error\n\t\tg.Resources, err = g.createResourcesByResourceGroup(ctx, ScaleSetClient, rg)\n\t\treturn err\n\t}\n\tvar err error\n\tg.Resources, err = g.createResources(ctx, ScaleSetClient)\n\treturn err\n}\n"
  },
  {
    "path": "providers/azure/security_center_contact.go",
    "content": "package azure\n\nimport (\n\t\"context\"\n\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype SecurityCenterContactGenerator struct {\n\tAzureService\n}\n\nfunc (g SecurityCenterContactGenerator) listContacts() ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\n\tsecurityCenterContactClient := security.NewContactsClientWithBaseURI(resourceManagerEndpoint, subscriptionID, \"\")\n\tsecurityCenterContactClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\treturn resources, nil\n\t}\n\tcontactsIterator, err := securityCenterContactClient.ListComplete(ctx)\n\tif err != nil {\n\t\treturn resources, err\n\t}\n\n\tfor contactsIterator.NotDone() {\n\t\tcontact := contactsIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*contact.ID,\n\t\t\t*contact.Name,\n\t\t\t\"azurerm_security_center_contact\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\n\t\tif err := contactsIterator.NextWithContext(ctx); err != nil {\n\t\t\treturn resources, err\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *SecurityCenterContactGenerator) InitResources() error {\n\tresources, err := g.listContacts()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = append(g.Resources, resources...)\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/security_center_subscription_pricing.go",
    "content": "package azure\n\nimport (\n\t\"context\"\n\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/preview/security/mgmt/v3.0/security\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype SecurityCenterSubscriptionPricingGenerator struct {\n\tAzureService\n}\n\nfunc (g SecurityCenterSubscriptionPricingGenerator) listSubscriptionPricing() ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\n\tsecurityCenterPricingClient := security.NewPricingsClientWithBaseURI(resourceManagerEndpoint, subscriptionID, \"\")\n\tsecurityCenterPricingClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\treturn resources, nil\n\t}\n\tpricingList, err := securityCenterPricingClient.List(ctx)\n\tif err != nil {\n\t\treturn resources, err\n\t}\n\n\tfor _, pricing := range *pricingList.Value {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*pricing.ID,\n\t\t\t*pricing.Name,\n\t\t\t\"azurerm_security_center_subscription_pricing\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *SecurityCenterSubscriptionPricingGenerator) InitResources() error {\n\tresources, err := g.listSubscriptionPricing()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = append(g.Resources, resources...)\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/ssh_public_key.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-12-01/compute\"\n)\n\ntype SSHPublicKeyGenerator struct {\n\tAzureService\n}\n\nfunc (az *SSHPublicKeyGenerator) listResources() ([]compute.SSHPublicKeyResource, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := compute.NewSSHPublicKeysClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator compute.SSHPublicKeysGroupListResultIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListByResourceGroupComplete(ctx, resourceGroup)\n\t} else {\n\t\titerator, err = client.ListBySubscriptionComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []compute.SSHPublicKeyResource\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *SSHPublicKeyGenerator) appendResource(resource *compute.SSHPublicKeyResource) {\n\taz.AppendSimpleResource(*resource.ID, *resource.Name, \"azurerm_ssh_public_key\")\n}\n\nfunc (az *SSHPublicKeyGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\taz.appendResource(&resource)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/storage_account.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-04-01/storage\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype StorageAccountGenerator struct {\n\tAzureService\n}\n\nfunc (g StorageAccountGenerator) createResourcesByResourceGroup(ctx context.Context, client storage.AccountsClient, rg string) ([]terraformutils.Resource, error) {\n\taccountListResult, err := client.ListByResourceGroup(ctx, rg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []terraformutils.Resource\n\tif accounts := accountListResult.Value; accounts != nil {\n\t\tfor _, account := range *accounts {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*account.ID,\n\t\t\t\t*account.Name,\n\t\t\t\t\"azurerm_storage_account\",\n\t\t\t\t\"azurerm\",\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn resources, nil\n}\nfunc (g StorageAccountGenerator) createResources(ctx context.Context, client storage.AccountsClient) ([]terraformutils.Resource, error) {\n\taccountListResultIterator, err := client.ListComplete(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []terraformutils.Resource\n\tfor accountListResultIterator.NotDone() {\n\t\taccount := accountListResultIterator.Value()\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*account.ID,\n\t\t\t*account.Name,\n\t\t\t\"azurerm_storage_account\",\n\t\t\t\"azurerm\",\n\t\t\t[]string{}))\n\t\tif err := accountListResultIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *StorageAccountGenerator) InitResources() error {\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\taccountsClient := storage.NewAccountsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\taccountsClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\toutput, err := g.createResourcesByResourceGroup(ctx, accountsClient, rg)\n\t\tg.Resources = output\n\t\treturn err\n\t}\n\toutput, err := g.createResources(ctx, accountsClient)\n\tg.Resources = output\n\treturn err\n}\n"
  },
  {
    "path": "providers/azure/storage_blob.go",
    "content": "package azure\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"log\"\n\t\"net/url\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage\"\n\t\"github.com/Azure/azure-storage-blob-go/azblob\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\nconst (\n\tblobFormatString = `https://%s.blob.core.windows.net`\n\tblobIDFormat     = `https://%s.blob.core.windows.net/%s/%s`\n)\n\ntype StorageBlobGenerator struct {\n\tAzureService\n}\n\nfunc (g StorageBlobGenerator) getAccountPrimaryKey(ctx context.Context, accountName, accountGroupName string) string {\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tstorageAccountsClient := storage.NewAccountsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tstorageAccountsClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tresponse, err := storageAccountsClient.ListKeys(ctx, accountGroupName, accountName, \"kerb\")\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to list keys: %v\", err)\n\t}\n\treturn *(((*response.Keys)[0]).Value)\n}\n\nfunc (g StorageBlobGenerator) getContainerURL(ctx context.Context, accountName, accountGroupName, containerName string) (azblob.ContainerURL, error) {\n\taccountPrimaryKey := g.getAccountPrimaryKey(ctx, accountName, accountGroupName)\n\tsharedKeyCredential, err := azblob.NewSharedKeyCredential(accountName, accountPrimaryKey)\n\tif err != nil {\n\t\treturn azblob.ContainerURL{}, err\n\t}\n\n\tp := azblob.NewPipeline(sharedKeyCredential, azblob.PipelineOptions{})\n\taccountURL, err := url.Parse(fmt.Sprintf(blobFormatString, accountName))\n\tif err != nil {\n\t\treturn azblob.ContainerURL{}, err\n\t}\n\n\tserviceURL := azblob.NewServiceURL(*accountURL, p)\n\tcontainerURL := serviceURL.NewContainerURL(containerName)\n\n\treturn containerURL, nil\n}\n\nfunc (g StorageBlobGenerator) getBlobsFromContainer(ctx context.Context, accountName, accountGroupName, containerName string) ([]azblob.BlobItem, error) {\n\tcontainerURL, err := g.getContainerURL(ctx, accountName, accountGroupName, containerName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tblobListResponse, err := containerURL.ListBlobsFlatSegment(\n\t\tctx,\n\t\tazblob.Marker{},\n\t\tazblob.ListBlobsSegmentOptions{\n\t\t\tDetails: azblob.BlobListingDetails{\n\t\t\t\tSnapshots: true,\n\t\t\t},\n\t\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn blobListResponse.Segment.BlobItems, nil\n}\n\nfunc (g StorageBlobGenerator) listStorageBlobs() ([]terraformutils.Resource, error) {\n\tvar storageBlobsResources []terraformutils.Resource\n\tctx := context.Background()\n\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tauthorizer := g.Args[\"authorizer\"].(autorest.Authorizer)\n\tresourceGroup := g.Args[\"resource_group\"].(string)\n\tblobContainerGenerator := NewStorageContainerGenerator(resourceManagerEndpoint, subscriptionID, authorizer, resourceGroup)\n\tblobContainersResources, err := blobContainerGenerator.ListBlobContainers()\n\tif err != nil {\n\t\treturn storageBlobsResources, err\n\t}\n\n\tfor _, blobContainerResource := range blobContainersResources {\n\t\tcontainerID := blobContainerResource.InstanceState.ID\n\t\tparsedContainerID, err := ParseAzureResourceID(containerID)\n\t\tif err != nil {\n\t\t\treturn storageBlobsResources, err\n\t\t}\n\n\t\tstorageAccountName := blobContainerResource.InstanceState.Attributes[\"storage_account_name\"]\n\t\tcontainerName := blobContainerResource.InstanceState.Attributes[\"name\"]\n\t\tblobsList, err := g.getBlobsFromContainer(ctx, storageAccountName, parsedContainerID.ResourceGroup, containerName)\n\t\tif err != nil {\n\t\t\treturn storageBlobsResources, err\n\t\t}\n\n\t\tfor _, blobItem := range blobsList {\n\t\t\tstorageBlobsResources = append(storageBlobsResources, terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(blobIDFormat, storageAccountName, containerName, blobItem.Name),\n\t\t\t\tblobItem.Name,\n\t\t\t\t\"azurerm_storage_blob\",\n\t\t\t\t\"azurerm\",\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\n\treturn storageBlobsResources, err\n}\n\nfunc (g *StorageBlobGenerator) InitResources() error {\n\tresources, err := g.listStorageBlobs()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = append(g.Resources, resources...)\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/storage_container.go",
    "content": "package azure\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-04-01/storage\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\nconst (\n\tcontainerIDFormat = \"https://%s.blob.core.windows.net/%s\"\n)\n\ntype StorageContainerGenerator struct {\n\tAzureService\n}\n\nfunc NewStorageContainerGenerator(resourceManagerEndpoint string, subscriptionID string, authorizer autorest.Authorizer, rg string) *StorageContainerGenerator {\n\tstorageContainerGenerator := new(StorageContainerGenerator)\n\tstorageContainerGenerator.Args = map[string]interface{}{}\n\tstorageContainerGenerator.Args[\"config\"] = authentication.Config{CustomResourceManagerEndpoint: resourceManagerEndpoint, SubscriptionID: subscriptionID}\n\tstorageContainerGenerator.Args[\"authorizer\"] = authorizer\n\tstorageContainerGenerator.Args[\"resource_group\"] = rg\n\n\treturn storageContainerGenerator\n}\n\nfunc (g StorageContainerGenerator) ListBlobContainers() ([]terraformutils.Resource, error) {\n\tvar containerResources []terraformutils.Resource\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tblobContainersClient := storage.NewBlobContainersClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tblobContainersClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\tctx := context.Background()\n\n\taccounts, err := g.getStorageAccounts()\n\tif err != nil {\n\t\treturn containerResources, err\n\t}\n\n\tfor _, storageAccount := range accounts {\n\t\tparsedStorageAccountResourceID, err := ParseAzureResourceID(*storageAccount.ID)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tcontainerItemsIterator, err := blobContainersClient.ListComplete(ctx, parsedStorageAccountResourceID.ResourceGroup, *storageAccount.Name, \"\", \"\", \"\")\n\t\tif err != nil {\n\t\t\treturn containerResources, err\n\t\t}\n\n\t\tfor containerItemsIterator.NotDone() {\n\t\t\tcontainerItem := containerItemsIterator.Value()\n\t\t\tcontainerResources = append(containerResources,\n\t\t\t\tterraformutils.NewResource(\n\t\t\t\t\tfmt.Sprintf(containerIDFormat, *storageAccount.Name, *containerItem.Name),\n\t\t\t\t\t*containerItem.Name,\n\t\t\t\t\t\"azurerm_storage_container\",\n\t\t\t\t\t\"azurerm\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"storage_account_name\": *storageAccount.Name,\n\t\t\t\t\t\t\"name\":                 *containerItem.Name,\n\t\t\t\t\t},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{}))\n\n\t\t\tif err := containerItemsIterator.NextWithContext(ctx); err != nil {\n\t\t\t\treturn containerResources, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn containerResources, nil\n}\n\nfunc (g *StorageContainerGenerator) getStorageAccounts() ([]storage.Account, error) {\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\taccountsClient := storage.NewAccountsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\n\taccountsClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\tvar accounts []storage.Account\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\taccountsResult, err := accountsClient.ListByResourceGroup(ctx, rg)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif paccounts := accountsResult.Value; paccounts != nil {\n\t\t\taccounts = append(accounts, *paccounts...)\n\t\t}\n\t} else {\n\t\taccountsIterator, err := accountsClient.ListComplete(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor accountsIterator.NotDone() {\n\t\t\taccount := accountsIterator.Value()\n\t\t\taccounts = append(accounts, account)\n\t\t\tif err := accountsIterator.NextWithContext(ctx); err != nil {\n\t\t\t\treturn accounts, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn accounts, nil\n}\n\nfunc (g *StorageContainerGenerator) InitResources() error {\n\tstorageAccounts, err := g.ListBlobContainers()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = storageAccounts\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/subnet.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network\"\n)\n\ntype SubnetGenerator struct {\n\tAzureService\n}\n\nfunc (az *SubnetGenerator) lisSubnets() ([]network.Subnet, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tsubnetClient := network.NewSubnetsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tsubnetClient.Authorizer = authorizer\n\tvnetClient := network.NewVirtualNetworksClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tvnetClient.Authorizer = authorizer\n\tvar (\n\t\tvnetIter   network.VirtualNetworkListResultIterator\n\t\tsubnetIter network.SubnetListResultIterator\n\t\terr        error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\tvnetIter, err = vnetClient.ListComplete(ctx, resourceGroup)\n\t} else {\n\t\tvnetIter, err = vnetClient.ListAllComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []network.Subnet\n\tfor vnetIter.NotDone() {\n\t\tvnet := vnetIter.Value()\n\t\tvnetID, err := ParseAzureResourceID(*vnet.ID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsubnetIter, err = subnetClient.ListComplete(ctx, vnetID.ResourceGroup, *vnet.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor subnetIter.NotDone() {\n\t\t\titem := subnetIter.Value()\n\t\t\tresources = append(resources, item)\n\t\t\tif err := subnetIter.NextWithContext(ctx); err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn resources, err\n\t\t\t}\n\t\t}\n\t\tif err := vnetIter.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *SubnetGenerator) AppendSubnet(subnet *network.Subnet) {\n\taz.AppendSimpleResource(*subnet.ID, *subnet.Name, \"azurerm_subnet\")\n}\n\nfunc (az *SubnetGenerator) appendRouteTable(subnet *network.Subnet) {\n\tif props := subnet.SubnetPropertiesFormat; props != nil {\n\t\tif prop := props.RouteTable; prop != nil {\n\t\t\taz.appendSimpleAssociation(\n\t\t\t\t*subnet.ID, *subnet.Name, prop.Name,\n\t\t\t\t\"azurerm_subnet_route_table_association\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"subnet_id\":      *subnet.ID,\n\t\t\t\t\t\"route_table_id\": *prop.ID,\n\t\t\t\t})\n\t\t}\n\t}\n}\n\nfunc (az *SubnetGenerator) appendNetworkSecurityGroupAssociation(subnet *network.Subnet) {\n\tif props := subnet.SubnetPropertiesFormat; props != nil {\n\t\tif prop := props.NetworkSecurityGroup; prop != nil {\n\t\t\taz.appendSimpleAssociation(\n\t\t\t\t*subnet.ID, *subnet.Name, prop.Name,\n\t\t\t\t\"azurerm_subnet_network_security_group_association\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"subnet_id\":                 *subnet.ID,\n\t\t\t\t\t\"network_security_group_id\": *prop.ID,\n\t\t\t\t})\n\t\t}\n\t}\n}\n\nfunc (az *SubnetGenerator) appendNatGateway(subnet *network.Subnet) {\n\tif props := subnet.SubnetPropertiesFormat; props != nil {\n\t\tif prop := props.NatGateway; prop != nil {\n\t\t\taz.appendSimpleAssociation(\n\t\t\t\t*subnet.ID, *subnet.Name, nil,\n\t\t\t\t\"azurerm_subnet_nat_gateway_association\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"subnet_id\":      *subnet.ID,\n\t\t\t\t\t\"nat_gateway_id\": *prop.ID,\n\t\t\t\t})\n\t\t}\n\t}\n}\n\nfunc (az *SubnetGenerator) appendServiceEndpointPolicies() error {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := network.NewServiceEndpointPoliciesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator network.ServiceEndpointPolicyListResultIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListByResourceGroupComplete(ctx, resourceGroup)\n\t} else {\n\t\titerator, err = client.ListComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\taz.AppendSimpleResource(*item.ID, *item.Name, \"azurerm_subnet_service_endpoint_storage_policy\")\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (az *SubnetGenerator) InitResources() error {\n\n\tsubnets, err := az.lisSubnets()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, subnet := range subnets {\n\t\taz.AppendSubnet(&subnet)\n\t\taz.appendRouteTable(&subnet)\n\t\taz.appendNetworkSecurityGroupAssociation(&subnet)\n\t\taz.appendNatGateway(&subnet)\n\t}\n\tif err := az.appendServiceEndpointPolicies(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (az *SubnetGenerator) PostConvertHook() error {\n\tfor _, resource := range az.Resources {\n\t\tif resource.InstanceInfo.Type != \"azurerm_subnet\" {\n\t\t\tcontinue\n\t\t}\n\t\tdelete(resource.Item, \"address_prefix\")\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/synapse.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/preview/synapse/2019-06-01-preview/managedvirtualnetwork\"\n\t\"github.com/Azure/azure-sdk-for-go/services/synapse/mgmt/2020-12-01/synapse\"\n\t// \"github.com/Azure/azure-sdk-for-go/services/preview/synapse/2020-08-01-preview/accesscontrol\"\n)\n\ntype SynapseGenerator struct {\n\tAzureService\n}\n\nfunc (az *SynapseGenerator) listWorkspaces() ([]synapse.Workspace, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := synapse.NewWorkspacesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator synapse.WorkspaceInfoListResultIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListByResourceGroupComplete(ctx, resourceGroup)\n\t} else {\n\t\titerator, err = client.ListComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []synapse.Workspace\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *SynapseGenerator) appendWorkspace(workspace *synapse.Workspace) {\n\taz.AppendSimpleResource(*workspace.ID, *workspace.Name, \"azurerm_synapse_workspace\")\n}\n\nfunc (az *SynapseGenerator) appendSQLPools(workspace *synapse.Workspace, workspaceRg *ResourceID) error {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := synapse.NewSQLPoolsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\titerator, err := client.ListByWorkspaceComplete(ctx, workspaceRg.ResourceGroup, *workspace.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\taz.AppendSimpleResource(*item.ID, *item.Name, \"azurerm_synapse_sql_pool\")\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (az *SynapseGenerator) appendSparkPools(workspace *synapse.Workspace, workspaceRg *ResourceID) error {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := synapse.NewBigDataPoolsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\titerator, err := client.ListByWorkspaceComplete(ctx, workspaceRg.ResourceGroup, *workspace.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\taz.AppendSimpleResource(*item.ID, *item.Name, \"azurerm_synapse_spark_pool\")\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (az *SynapseGenerator) appendFirewallRule(workspace *synapse.Workspace, workspaceRg *ResourceID) error {\n\tsubscriptionID, _, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := synapse.NewIPFirewallRulesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\titerator, err := client.ListByWorkspaceComplete(ctx, workspaceRg.ResourceGroup, *workspace.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\taz.AppendSimpleResource(*item.ID, *item.Name, \"azurerm_synapse_firewall_rule\")\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (az *SynapseGenerator) appendManagedPrivateEndpoint(workspace *synapse.Workspace) error {\n\n\tif workspace.WorkspaceProperties == nil || workspace.WorkspaceProperties.ManagedVirtualNetwork == nil {\n\t\treturn nil\n\t}\n\tvirtualNetworkName := *workspace.WorkspaceProperties.ManagedVirtualNetwork\n\tif virtualNetworkName == \"\" || virtualNetworkName == \"default\" {\n\t\treturn nil\n\t}\n\tsubscriptionID, _, authorizer, _ := az.getClientArgs()\n\t// ManagedPrivateEndpointsClient does not have a ...WithBaseURI function, why is this different?\n\tclient := managedvirtualnetwork.NewManagedPrivateEndpointsClient(subscriptionID)\n\tclient.Authorizer = authorizer\n\tctx := context.Background()\n\titerator, err := client.ListComplete(ctx, virtualNetworkName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\taz.AppendSimpleResource(*item.ID, *item.Name, \"azurerm_synapse_managed_private_endpoint\")\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (az *SynapseGenerator) listPrivateLinkHubs() ([]synapse.PrivateLinkHub, error) {\n\tsubscriptionID, resourceGroup, authorizer, resourceManagerEndpoint := az.getClientArgs()\n\tclient := synapse.NewPrivateLinkHubsClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\tvar (\n\t\titerator synapse.PrivateLinkHubInfoListResultIterator\n\t\terr      error\n\t)\n\tctx := context.Background()\n\tif resourceGroup != \"\" {\n\t\titerator, err = client.ListByResourceGroupComplete(ctx, resourceGroup)\n\t} else {\n\t\titerator, err = client.ListComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar resources []synapse.PrivateLinkHub\n\tfor iterator.NotDone() {\n\t\titem := iterator.Value()\n\t\tresources = append(resources, item)\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (az *SynapseGenerator) appendtPrivateLinkHubs(workspace *synapse.PrivateLinkHub) {\n\taz.AppendSimpleResource(*workspace.ID, *workspace.Name, \"azurerm_synapse_private_link_hub\")\n}\n\nfunc (az *SynapseGenerator) InitResources() error {\n\n\tworkspaces, err := az.listWorkspaces()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, workspace := range workspaces {\n\t\taz.appendWorkspace(&workspace)\n\t\tworkspaceRg, err := ParseAzureResourceID(*workspace.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = az.appendSQLPools(&workspace, workspaceRg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = az.appendSparkPools(&workspace, workspaceRg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = az.appendFirewallRule(&workspace, workspaceRg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = az.appendManagedPrivateEndpoint(&workspace)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\thubs, err := az.listPrivateLinkHubs()\n\tif err == nil {\n\t\tfor _, hub := range hubs {\n\t\t\taz.appendtPrivateLinkHubs(&hub)\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azure/virtual_machine.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype VirtualMachineGenerator struct {\n\tAzureService\n}\n\nfunc (g VirtualMachineGenerator) createResources(virtualMachineListResultIterator compute.VirtualMachineListResultIterator) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tfor virtualMachineListResultIterator.NotDone() {\n\t\tvm := virtualMachineListResultIterator.Value()\n\t\tvar newResource terraformutils.Resource\n\t\tif vm.VirtualMachineProperties.OsProfile == nil {\n\t\t\tif vm.VirtualMachineProperties.StorageProfile.OsDisk.OsType == \"Windows\" {\n\t\t\t\tnewResource = terraformutils.NewSimpleResource(\n\t\t\t\t\t*vm.ID,\n\t\t\t\t\t*vm.Name,\n\t\t\t\t\t\"azurerm_windows_virtual_machine\",\n\t\t\t\t\t\"azurerm\",\n\t\t\t\t\t[]string{})\n\t\t\t} else {\n\t\t\t\tnewResource = terraformutils.NewSimpleResource(\n\t\t\t\t\t*vm.ID,\n\t\t\t\t\t*vm.Name,\n\t\t\t\t\t\"azurerm_linux_virtual_machine\",\n\t\t\t\t\t\"azurerm\",\n\t\t\t\t\t[]string{})\n\t\t\t}\n\t\t} else {\n\t\t\tif vm.VirtualMachineProperties.OsProfile.WindowsConfiguration != nil {\n\t\t\t\tnewResource = terraformutils.NewSimpleResource(\n\t\t\t\t\t*vm.ID,\n\t\t\t\t\t*vm.Name,\n\t\t\t\t\t\"azurerm_windows_virtual_machine\",\n\t\t\t\t\t\"azurerm\",\n\t\t\t\t\t[]string{})\n\t\t\t} else {\n\t\t\t\tnewResource = terraformutils.NewSimpleResource(\n\t\t\t\t\t*vm.ID,\n\t\t\t\t\t*vm.Name,\n\t\t\t\t\t\"azurerm_linux_virtual_machine\",\n\t\t\t\t\t\"azurerm\",\n\t\t\t\t\t[]string{})\n\t\t\t}\n\t\t}\n\n\t\tresources = append(resources, newResource)\n\t\tif err := virtualMachineListResultIterator.Next(); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *VirtualMachineGenerator) InitResources() error {\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tvmClient := compute.NewVirtualMachinesClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\n\tvmClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar (\n\t\toutput compute.VirtualMachineListResultIterator\n\t\terr    error\n\t)\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\toutput, err = vmClient.ListComplete(ctx, rg)\n\t} else {\n\t\toutput, err = vmClient.ListAllComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources, err = g.createResources(output)\n\treturn err\n}\n"
  },
  {
    "path": "providers/azure/virtual_network.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azure\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network\"\n\t\"github.com/Azure/go-autorest/autorest\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/go-azure-helpers/authentication\"\n)\n\ntype VirtualNetworkGenerator struct {\n\tAzureService\n}\n\nfunc (g VirtualNetworkGenerator) createResources(ctx context.Context, iterator network.VirtualNetworkListResultIterator) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tfor iterator.NotDone() {\n\t\tvirtualNetwork := iterator.Value()\n\t\ttferName := terraformutils.TfSanitize(*virtualNetwork.Name)\n\t\tfor _, resource := range resources {\n\t\t\tif tferName == resource.ResourceName {\n\t\t\t\t*virtualNetwork.Name = *virtualNetwork.Name + \"_\" + *virtualNetwork.ID\n\t\t\t}\n\t\t}\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t*virtualNetwork.ID,\n\t\t\t*virtualNetwork.Name,\n\t\t\t\"azurerm_virtual_network\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\t\tif err := iterator.NextWithContext(ctx); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn resources, err\n\t\t}\n\t}\n\treturn resources, nil\n}\n\nfunc (g *VirtualNetworkGenerator) InitResources() error {\n\tctx := context.Background()\n\tsubscriptionID := g.Args[\"config\"].(authentication.Config).SubscriptionID\n\tresourceManagerEndpoint := g.Args[\"config\"].(authentication.Config).CustomResourceManagerEndpoint\n\tvirtualNetworkClient := network.NewVirtualNetworksClientWithBaseURI(resourceManagerEndpoint, subscriptionID)\n\n\tvirtualNetworkClient.Authorizer = g.Args[\"authorizer\"].(autorest.Authorizer)\n\n\tvar (\n\t\toutput network.VirtualNetworkListResultIterator\n\t\terr    error\n\t)\n\n\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\toutput, err = virtualNetworkClient.ListComplete(ctx, rg)\n\t} else {\n\t\toutput, err = virtualNetworkClient.ListAllComplete(ctx)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources, err = g.createResources(ctx, output)\n\treturn err\n}\n\n// NOTE on Virtual Networks and Subnet's:\n// Terraform currently provides both a standalone Subnet resource, and allows for Subnets to be defined in-line within the Virtual Network\n// resource. At this time you cannot use a Virtual Network with in-line Subnets in conjunction with any Subnet resources.\n// Doing so will cause a conflict of Subnet configurations and will overwrite Subnet's.\nfunc (g *VirtualNetworkGenerator) PostConvertHook() error {\n\tfor _, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type != \"azurerm_virtual_network\" {\n\t\t\tcontinue\n\t\t}\n\t\tdelete(resource.Item, \"subnet\")\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azuread/app_role_assignment.go",
    "content": "// AppRoleAssignmentServiceGenerator\npackage azuread\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/manicminer/hamilton/msgraph\"\n\t\"github.com/manicminer/hamilton/odata\"\n)\n\ntype AppRoleAssignmentServiceGenerator struct {\n\tAzureADService\n}\n\nfunc (az *AppRoleAssignmentServiceGenerator) listResources() ([]msgraph.AppRoleAssignment, error) {\n\tclient, fail := az.getAppRoleAssignmentsClient()\n\tservicePrincipalsClient, err := az.getServicePrincipalsClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient.BaseClient.DisableRetries = true\n\n\tvar resources []msgraph.AppRoleAssignment\n\n\tif fail != nil {\n\t\treturn nil, fail\n\t}\n\tctx := context.Background()\n\n\tservicePrincipals, _, spErr := servicePrincipalsClient.List(ctx, odata.Query{})\n\tif spErr != nil {\n\t\treturn nil, spErr\n\t}\n\n\tfor _, sp := range *servicePrincipals {\n\t\tappRoleAssignments, _, araErr := client.List(ctx, *sp.ID, odata.Query{})\n\t\tif araErr != nil {\n\t\t\treturn nil, araErr\n\t\t}\n\t\tif appRoleAssignments == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, assignment := range *appRoleAssignments {\n\t\t\tif *assignment.PrincipalType != \"ServicePrincipal\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif assignment.Id != nil {\n\t\t\t\tresources = append(resources, assignment)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (az *AppRoleAssignmentServiceGenerator) appendResource(resource *msgraph.AppRoleAssignment) {\n\t// {objectId}/{type}/{subId}\n\tid := fmt.Sprintf(\"%s/appRoleAssignment/%s\", *resource.PrincipalId, *resource.Id)\n\taz.appendSimpleResource(id, *resource.PrincipalDisplayName+\"-\"+id, \"azuread_app_role_assignment\")\n}\n\nfunc (az *AppRoleAssignmentServiceGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\tlog.Println(*resource.PrincipalDisplayName)\n\t\taz.appendResource(&resource)\n\t}\n\treturn nil\n}\n\nfunc (az *AppRoleAssignmentServiceGenerator) GetResourceConnections() map[string][]string {\n\n\treturn map[string][]string{\n\t\t\"app_role_assignment\": {\"id\"},\n\t}\n}\n"
  },
  {
    "path": "providers/azuread/application.go",
    "content": "// ApplicationServiceGenerator\npackage azuread\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/manicminer/hamilton/msgraph\"\n\t\"github.com/manicminer/hamilton/odata\"\n)\n\ntype ApplicationServiceGenerator struct {\n\tAzureADService\n}\n\nfunc (az *ApplicationServiceGenerator) listResources() ([]msgraph.Application, error) {\n\tclient, fail := az.getApplicationsClient()\n\tclient.BaseClient.DisableRetries = true\n\n\tvar resources []msgraph.Application\n\n\tif fail != nil {\n\t\treturn nil, fail\n\t}\n\tctx := context.Background()\n\n\tapplications, _, err := client.List(ctx, odata.Query{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, application := range *applications {\n\t\tresources = append(resources, application)\n\t}\n\n\treturn resources, nil\n}\n\nfunc (az *ApplicationServiceGenerator) appendResource(resource *msgraph.Application) {\n\tid := resource.ID\n\taz.appendSimpleResource(*id, *resource.DisplayName, \"azuread_application\")\n}\n\nfunc (az *ApplicationServiceGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\tlog.Println(*resource.DisplayName)\n\t\taz.appendResource(&resource)\n\t}\n\treturn nil\n}\n\nfunc (az *ApplicationServiceGenerator) GetResourceConnections() map[string][]string {\n\n\treturn map[string][]string{\n\t\t\"application\": {\"id\"},\n\t}\n}\n"
  },
  {
    "path": "providers/azuread/azuread_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azuread\n\nimport (\n\t\"errors\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype AzureADProvider struct { //nolint\n\tterraformutils.Provider\n\ttenantID     string\n\tclientID     string\n\tclientSecret string\n}\n\nfunc (p *AzureADProvider) setEnvConfig() error {\n\n\ttenantID := os.Getenv(\"ARM_TENANT_ID\")\n\tif tenantID == \"\" {\n\t\treturn errors.New(\"please set ARM_TENANT_ID in your environment\")\n\t}\n\tclientID := os.Getenv(\"ARM_CLIENT_ID\")\n\tif clientID == \"\" {\n\t\treturn errors.New(\"please set ARM_CLIENT_ID in your environment\")\n\t}\n\tclientSecret := os.Getenv(\"ARM_CLIENT_SECRET\")\n\tif clientSecret == \"\" {\n\t\treturn errors.New(\"please set ARM_CLIENT_SECRET in your environment\")\n\t}\n\tp.tenantID = tenantID\n\tp.clientID = clientID\n\tp.clientSecret = clientSecret\n\treturn nil\n}\n\nfunc (p *AzureADProvider) Init(args []string) error {\n\terr := p.setEnvConfig()\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (p *AzureADProvider) GetName() string {\n\treturn \"azuread\"\n}\n\nfunc (p *AzureADProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (AzureADProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *AzureADProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"user\":                &UserServiceGenerator{},\n\t\t\"application\":         &ApplicationServiceGenerator{},\n\t\t\"group\":               &GroupServiceGenerator{},\n\t\t\"service_principal\":   &ServicePrincipalServiceGenerator{},\n\t\t\"app_role_assignment\": &AppRoleAssignmentServiceGenerator{},\n\t}\n}\n\nfunc (p *AzureADProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"azuread: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"tenant_id\":     p.tenantID,\n\t\t\"client_id\":     p.clientID,\n\t\t\"client_secret\": p.clientSecret,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azuread/azuread_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azuread\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/manicminer/hamilton/auth\"\n\t\"github.com/manicminer/hamilton/environments\"\n\t\"github.com/manicminer/hamilton/msgraph\"\n)\n\ntype AzureADService struct { //nolint\n\tterraformutils.Service\n}\n\ntype ServiceGenerator interface {\n\tterraformutils.ServiceGenerator\n\tGetResourceConnections() map[string][]string\n}\n\nfunc (az *AzureADService) getAuthorizer() (auth.Authorizer, error) {\n\tenvironment := environments.Global\n\tctx := context.Background()\n\ttenantID := az.Args[\"tenant_id\"].(string)\n\tclientID := az.Args[\"client_id\"].(string)\n\tclientSecret := az.Args[\"client_secret\"].(string)\n\n\tconfig := &auth.Config{\n\t\tEnvironment:            environment,\n\t\tTenantID:               tenantID,\n\t\tClientID:               clientID,\n\t\tClientSecret:           clientSecret,\n\t\tEnableClientSecretAuth: true,\n\t}\n\tauthorizer, err := config.NewAuthorizer(ctx, config.Environment.MsGraph)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tlog.Println(err.Error())\n\t\treturn nil, err\n\t}\n\treturn authorizer, nil\n}\n\nfunc (az *AzureADService) getUserClient() (*msgraph.UsersClient, error) {\n\tauthorizer, err := az.getAuthorizer()\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tlog.Println(err.Error())\n\t\treturn nil, err\n\t}\n\n\ttenantID := az.Args[\"tenant_id\"].(string)\n\tclient := msgraph.NewUsersClient(tenantID)\n\tclient.BaseClient.Authorizer = authorizer\n\n\treturn client, nil\n}\n\nfunc (az *AzureADService) getApplicationsClient() (*msgraph.ApplicationsClient, error) {\n\tauthorizer, err := az.getAuthorizer()\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tlog.Println(err.Error())\n\t\treturn nil, err\n\t}\n\n\ttenantID := az.Args[\"tenant_id\"].(string)\n\tclient := msgraph.NewApplicationsClient(tenantID)\n\tclient.BaseClient.Authorizer = authorizer\n\n\treturn client, nil\n}\n\nfunc (az *AzureADService) getGroupsClient() (*msgraph.GroupsClient, error) {\n\tauthorizer, err := az.getAuthorizer()\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tlog.Println(err.Error())\n\t\treturn nil, err\n\t}\n\n\ttenantID := az.Args[\"tenant_id\"].(string)\n\tclient := msgraph.NewGroupsClient(tenantID)\n\tclient.BaseClient.Authorizer = authorizer\n\n\treturn client, nil\n}\n\nfunc (az *AzureADService) getServicePrincipalsClient() (*msgraph.ServicePrincipalsClient, error) {\n\tauthorizer, err := az.getAuthorizer()\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tlog.Println(err.Error())\n\t\treturn nil, err\n\t}\n\n\ttenantID := az.Args[\"tenant_id\"].(string)\n\tclient := msgraph.NewServicePrincipalsClient(tenantID)\n\tclient.BaseClient.Authorizer = authorizer\n\n\treturn client, nil\n}\n\nfunc (az *AzureADService) getAppRoleAssignmentsClient() (*msgraph.AppRoleAssignedToClient, error) {\n\tauthorizer, err := az.getAuthorizer()\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tlog.Println(err.Error())\n\t\treturn nil, err\n\t}\n\n\ttenantID := az.Args[\"tenant_id\"].(string)\n\tclient := msgraph.NewAppRoleAssignedToClient(tenantID)\n\tclient.BaseClient.Authorizer = authorizer\n\n\treturn client, nil\n}\n\nfunc (az *AzureADService) GetResourceConnections() map[string][]string {\n\treturn nil\n}\n\nfunc (az *AzureADService) appendSimpleResource(id string, resourceName string, resourceType string) {\n\tnewResource := terraformutils.NewResource(id, resourceName, resourceType, az.ProviderName, map[string]string{\n\t\t\"id\": id,\n\t}, []string{}, map[string]interface{}{})\n\taz.Resources = append(az.Resources, newResource)\n}\n"
  },
  {
    "path": "providers/azuread/group.go",
    "content": "// UserServiceGenerator\npackage azuread\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/manicminer/hamilton/msgraph\"\n\t\"github.com/manicminer/hamilton/odata\"\n)\n\ntype GroupServiceGenerator struct {\n\tAzureADService\n}\n\nfunc (az *GroupServiceGenerator) listResources() ([]msgraph.Group, error) {\n\tclient, fail := az.getGroupsClient()\n\tclient.BaseClient.DisableRetries = true\n\n\tvar resources []msgraph.Group\n\n\tif fail != nil {\n\t\treturn nil, fail\n\t}\n\tctx := context.Background()\n\n\tgroups, _, err := client.List(ctx, odata.Query{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, group := range *groups {\n\t\tresources = append(resources, group)\n\t}\n\n\treturn resources, nil\n}\n\nfunc (az *GroupServiceGenerator) appendResource(resource *msgraph.Group) {\n\tid := resource.ID\n\taz.appendSimpleResource(*id, *resource.DisplayName+\"-\"+*id, \"azuread_group\")\n}\n\nfunc (az *GroupServiceGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\tlog.Println(*resource.DisplayName)\n\t\taz.appendResource(&resource)\n\t}\n\treturn nil\n}\n\nfunc (az *GroupServiceGenerator) GetResourceConnections() map[string][]string {\n\n\treturn map[string][]string{\n\t\t\"group\": {\"id\"},\n\t}\n}\n"
  },
  {
    "path": "providers/azuread/service_principal.go",
    "content": "// ServicePrincipalServiceGenerator\npackage azuread\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/manicminer/hamilton/msgraph\"\n\t\"github.com/manicminer/hamilton/odata\"\n)\n\ntype ServicePrincipalServiceGenerator struct {\n\tAzureADService\n}\n\nfunc (az *ServicePrincipalServiceGenerator) listResources() ([]msgraph.ServicePrincipal, error) {\n\tclient, fail := az.getServicePrincipalsClient()\n\tclient.BaseClient.DisableRetries = true\n\n\tvar resources []msgraph.ServicePrincipal\n\n\tif fail != nil {\n\t\treturn nil, fail\n\t}\n\tctx := context.Background()\n\n\tservicePrincipal, _, err := client.List(ctx, odata.Query{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, sp := range *servicePrincipal {\n\t\tresources = append(resources, sp)\n\t}\n\n\treturn resources, nil\n}\n\nfunc (az *ServicePrincipalServiceGenerator) appendResource(resource *msgraph.ServicePrincipal) {\n\tid := resource.ID\n\taz.appendSimpleResource(*id, *resource.DisplayName+\"-\"+*id, \"azuread_service_principal\")\n}\n\nfunc (az *ServicePrincipalServiceGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\tlog.Println(*resource.DisplayName)\n\t\taz.appendResource(&resource)\n\t}\n\treturn nil\n}\n\nfunc (az *ServicePrincipalServiceGenerator) GetResourceConnections() map[string][]string {\n\n\treturn map[string][]string{\n\t\t\"servicePrincipal\": {\"id\"},\n\t}\n}\n"
  },
  {
    "path": "providers/azuread/user.go",
    "content": "// UserServiceGenerator\npackage azuread\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/manicminer/hamilton/msgraph\"\n\t\"github.com/manicminer/hamilton/odata\"\n)\n\ntype UserServiceGenerator struct {\n\tAzureADService\n}\n\nfunc (az *UserServiceGenerator) listResources() ([]msgraph.User, error) {\n\tclient, fail := az.getUserClient()\n\tclient.BaseClient.DisableRetries = true\n\n\tvar resources []msgraph.User\n\n\tif fail != nil {\n\t\treturn nil, fail\n\t}\n\tctx := context.Background()\n\n\tusers, _, err := client.List(ctx, odata.Query{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, user := range *users {\n\t\tresources = append(resources, user)\n\t}\n\n\treturn resources, nil\n}\n\nfunc (az *UserServiceGenerator) appendResource(resource *msgraph.User) {\n\tid := resource.ID\n\taz.appendSimpleResource(*id, *resource.DisplayName, \"azuread_user\")\n}\n\nfunc (az *UserServiceGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\tlog.Println(*resource.DisplayName)\n\t\taz.appendResource(&resource)\n\t}\n\treturn nil\n}\n\nfunc (az *UserServiceGenerator) GetResourceConnections() map[string][]string {\n\n\treturn map[string][]string{\n\t\t\"user\": {\"id\"},\n\t}\n}\n"
  },
  {
    "path": "providers/azuredevops/azuredevops_provider.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azuredevops\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype AzureDevOpsProvider struct { //nolint\n\tterraformutils.Provider\n\torganizationURL     string\n\tpersonalAccessToken string\n}\n\nfunc (p *AzureDevOpsProvider) setEnvConfig() error {\n\n\torganizationURL := os.Getenv(\"AZDO_ORG_SERVICE_URL\")\n\tif organizationURL == \"\" {\n\t\treturn errors.New(\"environment variable AZDO_ORG_SERVICE_URL missing\")\n\t}\n\tpersonalAccessToken := os.Getenv(\"AZDO_PERSONAL_ACCESS_TOKEN\")\n\tif personalAccessToken == \"\" {\n\t\treturn errors.New(\"environment variable AZDO_PERSONAL_ACCESS_TOKEN missing\")\n\t}\n\tp.organizationURL = organizationURL\n\tp.personalAccessToken = personalAccessToken\n\treturn nil\n}\n\nfunc (p *AzureDevOpsProvider) Init(args []string) error {\n\terr := p.setEnvConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (p *AzureDevOpsProvider) GetName() string {\n\treturn \"azuredevops\"\n}\n\nfunc (p *AzureDevOpsProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (p AzureDevOpsProvider) GetResourceConnections() map[string]map[string][]string {\n\tsupported := p.GetSupportedService()\n\tconnections := make(map[string]map[string][]string)\n\tfor serviceName, service := range supported {\n\t\tif service2, ok := service.(AzureDevOpsServiceGenerator); ok {\n\t\t\tif conn := service2.GetResourceConnections(); conn != nil {\n\t\t\t\tconnections[serviceName] = conn\n\t\t\t}\n\t\t}\n\t}\n\treturn connections\n}\n\nfunc (p *AzureDevOpsProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"project\":        &ProjectGenerator{},\n\t\t\"group\":          &GroupGenerator{},\n\t\t\"git_repository\": &GitRepositoryGenerator{},\n\t}\n}\n\nfunc (p *AzureDevOpsProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"azuredevops: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"organizationURL\":     p.organizationURL,\n\t\t\"personalAccessToken\": p.personalAccessToken,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azuredevops/azuredevops_service.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage azuredevops\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/microsoft/azure-devops-go-api/azuredevops\"\n\t\"github.com/microsoft/azure-devops-go-api/azuredevops/core\"\n\t\"github.com/microsoft/azure-devops-go-api/azuredevops/git\"\n\t\"github.com/microsoft/azure-devops-go-api/azuredevops/graph\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype AzureDevOpsServiceGenerator interface {\n\tterraformutils.ServiceGenerator\n\tGetResourceConnections() map[string][]string\n}\n\ntype AzureDevOpsService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (az *AzureDevOpsService) GetResourceConnections() map[string][]string {\n\treturn nil\n}\n\nfunc (az *AzureDevOpsService) getConnection() *azuredevops.Connection {\n\n\torganizationURL := az.Args[\"organizationURL\"].(string)\n\tpersonalAccessToken := az.Args[\"personalAccessToken\"].(string)\n\treturn azuredevops.NewPatConnection(organizationURL, personalAccessToken)\n}\n\nfunc (az *AzureDevOpsService) getCoreClient() (core.Client, error) {\n\tctx := context.Background()\n\tclient, err := core.NewClient(ctx, az.getConnection())\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}\n\nfunc (az *AzureDevOpsService) getGraphClient() (graph.Client, error) {\n\tctx := context.Background()\n\tclient, err := graph.NewClient(ctx, az.getConnection())\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}\n\nfunc (az *AzureDevOpsService) getGitClient() (git.Client, error) {\n\tctx := context.Background()\n\tclient, err := git.NewClient(ctx, az.getConnection())\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}\n\nfunc (az *AzureDevOpsService) appendSimpleResource(id string, resourceName string, resourceType string) {\n\tnewResource := terraformutils.NewSimpleResource(id, resourceName, resourceType, az.ProviderName, []string{})\n\taz.Resources = append(az.Resources, newResource)\n}\n"
  },
  {
    "path": "providers/azuredevops/git_repository.go",
    "content": "package azuredevops\n\nimport (\n\t\"context\"\n\n\t\"github.com/microsoft/azure-devops-go-api/azuredevops/git\"\n)\n\ntype GitRepositoryGenerator struct {\n\tAzureDevOpsService\n}\n\nfunc (az *GitRepositoryGenerator) listResources() ([]git.GitRepository, error) {\n\n\tclient, err := az.getGitClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tctx := context.Background()\n\tresources, err := client.GetRepositories(ctx, git.GetRepositoriesArgs{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn *resources, nil\n}\n\nfunc (az *GitRepositoryGenerator) appendResource(resource *git.GitRepository) {\n\n\tid := *resource.Id\n\taz.appendSimpleResource(id.String(), *resource.Name, \"azuredevops_git_repository\")\n}\n\nfunc (az *GitRepositoryGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\taz.appendResource(&resource)\n\t}\n\treturn nil\n}\n\nfunc (az *GitRepositoryGenerator) GetResourceConnections() map[string][]string {\n\n\treturn map[string][]string{\n\t\t\"project\": {\"project_id\", \"id\"},\n\t}\n}\n"
  },
  {
    "path": "providers/azuredevops/group.go",
    "content": "package azuredevops\n\nimport (\n\t\"context\"\n\n\t\"github.com/microsoft/azure-devops-go-api/azuredevops/graph\"\n)\n\ntype GroupGenerator struct {\n\tAzureDevOpsService\n}\n\nfunc (az *GroupGenerator) listResources() ([]graph.GraphGroup, error) {\n\n\tclient, fail := az.getGraphClient()\n\tif fail != nil {\n\t\treturn nil, fail\n\t}\n\tctx := context.Background()\n\tvar resources []graph.GraphGroup\n\tpageArgs := graph.ListGroupsArgs{}\n\tpages, err := client.ListGroups(ctx, pageArgs)\n\tfor ; err == nil; pages, err = client.ListGroups(ctx, pageArgs) {\n\t\tresources = append(resources, *pages.GraphGroups...)\n\t\tif pages.ContinuationToken == nil {\n\t\t\treturn resources, nil\n\t\t}\n\t\tpageArgs = graph.ListGroupsArgs{\n\t\t\tContinuationToken: &(*pages.ContinuationToken)[0],\n\t\t}\n\t}\n\treturn nil, err\n}\n\nfunc (az *GroupGenerator) appendResource(resource *graph.GraphGroup) {\n\n\tresourceName := firstNonEmpty(resource.DisplayName, resource.MailAddress, resource.OriginId)\n\taz.appendSimpleResource(*resource.Descriptor, *resourceName, \"azuredevops_group\")\n}\n\nfunc (az *GroupGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\taz.appendResource(&resource)\n\t}\n\treturn nil\n}\n\nfunc (az *GroupGenerator) GetResourceConnections() map[string][]string {\n\n\treturn map[string][]string{\n\t\t\"project\": {\"scope\", \"id\"},\n\t}\n}\n"
  },
  {
    "path": "providers/azuredevops/helpers.go",
    "content": "package azuredevops\n\nfunc firstNonEmpty(values ...*string) *string {\n\tfor _, val := range values {\n\t\tif val != nil {\n\t\t\tif len(*val) > 0 {\n\t\t\t\treturn val\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/azuredevops/project.go",
    "content": "package azuredevops\n\nimport (\n\t\"context\"\n\n\t\"github.com/microsoft/azure-devops-go-api/azuredevops/core\"\n)\n\ntype ProjectGenerator struct {\n\tAzureDevOpsService\n}\n\nfunc (az *ProjectGenerator) listResources() ([]core.TeamProjectReference, error) {\n\tclient, fail := az.getCoreClient()\n\tif fail != nil {\n\t\treturn nil, fail\n\t}\n\tctx := context.Background()\n\tvar resources []core.TeamProjectReference\n\tpageArgs := core.GetProjectsArgs{}\n\tpages, err := client.GetProjects(ctx, pageArgs)\n\tfor ; err == nil; pages, err = client.GetProjects(ctx, pageArgs) {\n\t\tfetched := *pages\n\t\titems := fetched.Value\n\t\tresources = append(resources, items...)\n\t\tif pages.ContinuationToken == \"\" {\n\t\t\treturn resources, nil\n\t\t}\n\t\tpageArgs = core.GetProjectsArgs{\n\t\t\tContinuationToken: &pages.ContinuationToken,\n\t\t}\n\t}\n\treturn nil, err\n}\n\nfunc (az *ProjectGenerator) appendResource(resource *core.TeamProjectReference) {\n\tid := *resource.Id\n\taz.appendSimpleResource(id.String(), *resource.Name, \"azuredevops_project\")\n}\n\nfunc (az *ProjectGenerator) InitResources() error {\n\n\tresources, err := az.listResources()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, resource := range resources {\n\t\taz.appendResource(&resource)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/cloudflare/access.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cloudflare\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tcf \"github.com/cloudflare/cloudflare-go\"\n)\n\ntype AccessGenerator struct {\n\tCloudflareService\n}\n\nfunc (g *AccessGenerator) createAccessApplications(api *cf.API, zoneID string) ([]terraformutils.Resource, error) {\n\tresources := []terraformutils.Resource{}\n\taccessApplications, _, err := api.AccessApplications(zoneID, cf.PaginationOptions{})\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}, err\n\t}\n\n\tfor _, app := range accessApplications {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tapp.ID,\n\t\t\tfmt.Sprintf(\"%s_%s\", app.Name, app.ID),\n\t\t\t\"cloudflare_access_application\",\n\t\t\t\"cloudflare\",\n\t\t\tmap[string]string{\n\t\t\t\t\"zone_id\": zoneID,\n\t\t\t\t\"name\":    app.Name,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *AccessGenerator) InitResources() error {\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tzones, err := api.ListZones()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, zone := range zones {\n\t\ttmpRes, err := g.createAccessApplications(api, zone.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tg.Resources = append(g.Resources, tmpRes...)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/cloudflare/account_member.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cloudflare\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tcf \"github.com/cloudflare/cloudflare-go\"\n)\n\ntype AccountMemberGenerator struct {\n\tCloudflareService\n}\n\nfunc (g *AccountMemberGenerator) createAccountMemberResources(api *cf.API) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tpageOpt := cf.PaginationOptions{\n\t\tPage:    1,\n\t\tPerPage: 10}\n\n\tfor {\n\t\tmembers, info, err := api.AccountMembers(api.AccountID, pageOpt)\n\t\tif err != nil {\n\t\t\treturn resources, err\n\t\t}\n\n\t\tfor _, member := range members {\n\t\t\tvar roleIDs []string\n\t\t\tfor _, role := range member.Roles {\n\t\t\t\troleIDs = append(roleIDs, role.ID)\n\t\t\t}\n\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tmember.ID,\n\t\t\t\tmember.ID,\n\t\t\t\t\"cloudflare_account_member\",\n\t\t\t\t\"cloudflare\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"email_address\": member.User.Email,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\"role_ids\": roleIDs,\n\t\t\t\t},\n\t\t\t))\n\t\t}\n\n\t\tif pageOpt.Page < info.TotalPages {\n\t\t\tpageOpt.Page++\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *AccountMemberGenerator) InitResources() error {\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\tresources, err := g.createAccountMemberResources(api)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = append(g.Resources, resources...)\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/cloudflare/cloudflare_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cloudflare\n\nimport (\n\t\"errors\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype CloudflareProvider struct { //nolint\n\tterraformutils.Provider\n}\n\nfunc (p *CloudflareProvider) Init(args []string) error {\n\treturn nil\n}\n\nfunc (p *CloudflareProvider) GetName() string {\n\treturn \"cloudflare\"\n}\n\nfunc (p *CloudflareProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (CloudflareProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *CloudflareProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"access\":         &AccessGenerator{},\n\t\t\"dns\":            &DNSGenerator{},\n\t\t\"firewall\":       &FirewallGenerator{},\n\t\t\"page_rule\":      &PageRulesGenerator{},\n\t\t\"account_member\": &AccountMemberGenerator{},\n\t}\n}\n\nfunc (p *CloudflareProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"cloudflare: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/cloudflare/cloudflare_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cloudflare\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tcf \"github.com/cloudflare/cloudflare-go\"\n)\n\ntype CloudflareService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *CloudflareService) initializeAPI() (*cf.API, error) {\n\tapiKey := os.Getenv(\"CLOUDFLARE_API_KEY\")\n\tapiEmail := os.Getenv(\"CLOUDFLARE_EMAIL\")\n\tapiToken := os.Getenv(\"CLOUDFLARE_API_TOKEN\")\n\taccountID := os.Getenv(\"CLOUDFLARE_ACCOUNT_ID\")\n\n\tif apiToken == \"\" && (apiEmail == \"\" || apiKey == \"\") {\n\t\terr := errors.New(\"Either CLOUDFLARE_API_TOKEN or CLOUDFLARE_API_KEY/CLOUDFLARE_EMAIL environment variables must be set\")\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\treturn nil, err\n\t}\n\n\tif apiToken != \"\" {\n\t\treturn cf.NewWithAPIToken(apiToken, cf.UsingAccount(accountID))\n\t}\n\n\treturn cf.New(apiKey, apiEmail, cf.UsingAccount(accountID))\n}\n"
  },
  {
    "path": "providers/cloudflare/dns.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cloudflare\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tcf \"github.com/cloudflare/cloudflare-go\"\n)\n\ntype DNSGenerator struct {\n\tCloudflareService\n}\n\nfunc (*DNSGenerator) createZonesResource(api *cf.API, zoneID string) ([]terraformutils.Resource, error) {\n\tzoneDetails, err := api.ZoneDetails(zoneID)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn []terraformutils.Resource{}, err\n\t}\n\n\tresource := terraformutils.NewResource(\n\t\tzoneDetails.ID,\n\t\tzoneDetails.Name,\n\t\t\"cloudflare_zone\",\n\t\t\"cloudflare\",\n\t\tmap[string]string{\n\t\t\t\"id\": zoneDetails.ID,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n\tresource.IgnoreKeys = append(resource.IgnoreKeys, \"^meta$\")\n\n\treturn []terraformutils.Resource{resource}, nil\n}\n\nfunc (*DNSGenerator) createRecordsResources(api *cf.API, zoneID string) ([]terraformutils.Resource, error) {\n\tresources := []terraformutils.Resource{}\n\trecords, err := api.DNSRecords(zoneID, cf.DNSRecord{})\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn resources, err\n\t}\n\n\tfor _, record := range records {\n\t\tr := terraformutils.NewResource(\n\t\t\trecord.ID,\n\t\t\tfmt.Sprintf(\"%s_%s_%s\", record.Type, record.ZoneName, record.ID),\n\t\t\t\"cloudflare_record\",\n\t\t\t\"cloudflare\",\n\t\t\tmap[string]string{\n\t\t\t\t\"zone_id\": zoneID,\n\t\t\t\t\"domain\":  record.ZoneName,\n\t\t\t\t\"name\":    record.Name,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\n\t\tr.IgnoreKeys = append(r.IgnoreKeys, \"^metadata\")\n\t\tresources = append(resources, r)\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *DNSGenerator) InitResources() error {\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\tzones, err := api.ListZones()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\tfuncs := []func(*cf.API, string) ([]terraformutils.Resource, error){\n\t\tg.createZonesResource,\n\t\tg.createRecordsResources,\n\t}\n\n\tfor _, zone := range zones {\n\t\tfor _, f := range funcs {\n\t\t\ttmpRes, err := f(api, zone.ID)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, tmpRes...)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *DNSGenerator) PostConvertHook() error {\n\t// 'record' resource have 'data' and 'value' is mutual-exclude\n\t// delete which one have empty value\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"cloudflare_record\" {\n\t\t\tif val, ok := resource.Item[\"data\"]; ok && len(val.(map[string]interface{})) == 0 {\n\t\t\t\tdelete(g.Resources[i].Item, \"data\")\n\t\t\t} else if val, ok := resource.Item[\"value\"]; ok && len(val.(string)) == 0 {\n\t\t\t\tdelete(g.Resources[i].Item, \"value\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/cloudflare/firewall.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cloudflare\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tcf \"github.com/cloudflare/cloudflare-go\"\n)\n\ntype FirewallGenerator struct {\n\tCloudflareService\n}\n\nfunc (*FirewallGenerator) createZoneLockdownsResources(api *cf.API, zoneID, zoneName string) ([]terraformutils.Resource, error) {\n\tresources := []terraformutils.Resource{}\n\tpage := 1\n\n\tfor {\n\t\tzonelockdowns, err := api.ListZoneLockdowns(zoneID, page)\n\t\tif err != nil {\n\t\t\treturn resources, err\n\t\t}\n\t\tfor _, zonelockdown := range zonelockdowns.Result {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tzonelockdown.ID,\n\t\t\t\tfmt.Sprintf(\"%s_%s\", zoneName, zonelockdown.ID),\n\t\t\t\t\"cloudflare_zone_lockdown\",\n\t\t\t\t\"cloudflare\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"zone_id\": zoneID,\n\t\t\t\t\t\"zone\":    zoneName,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\n\t\tif zonelockdowns.TotalPages > page {\n\t\t\tpage++\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *FirewallGenerator) createAccountAccessRuleResources(api *cf.API) ([]terraformutils.Resource, error) {\n\tresources := []terraformutils.Resource{}\n\trules, err := api.ListAccountAccessRules(api.AccountID, cf.AccessRule{}, 1)\n\tif err != nil {\n\t\treturn resources, err\n\t}\n\n\ttotalPages := rules.TotalPages\n\tfor _, rule := range rules.Result {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\trule.ID,\n\t\t\trule.ID,\n\t\t\t\"cloudflare_access_rule\",\n\t\t\t\"cloudflare\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\tfor page := 2; page <= totalPages; page++ {\n\t\trules, err := api.ListAccountAccessRules(api.AccountID, cf.AccessRule{}, page)\n\t\tif err != nil {\n\t\t\treturn resources, err\n\t\t}\n\t\tfor _, rule := range rules.Result {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\trule.ID,\n\t\t\t\trule.ID,\n\t\t\t\t\"cloudflare_access_rule\",\n\t\t\t\t\"cloudflare\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (*FirewallGenerator) createZoneAccessRuleResources(api *cf.API, zoneID, zoneName string) ([]terraformutils.Resource, error) {\n\tresources := []terraformutils.Resource{}\n\trules, err := api.ListZoneAccessRules(zoneID, cf.AccessRule{}, 1)\n\tif err != nil {\n\t\treturn resources, err\n\t}\n\n\ttotalPages := rules.TotalPages\n\tfor _, r := range rules.Result {\n\t\tif strings.Compare(r.Scope.Type, \"organization\") != 0 {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tr.ID,\n\t\t\t\tfmt.Sprintf(\"%s_%s\", zoneName, r.ID),\n\t\t\t\t\"cloudflare_access_rule\",\n\t\t\t\t\"cloudflare\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"zone_id\": zoneID,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\n\tfor page := 2; page <= totalPages; page++ {\n\t\trules, err := api.ListZoneAccessRules(zoneID, cf.AccessRule{}, page)\n\t\tif err != nil {\n\t\t\treturn resources, err\n\t\t}\n\t\tfor _, r := range rules.Result {\n\t\t\tif strings.Compare(r.Scope.Type, \"organization\") != 0 {\n\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\tr.ID,\n\t\t\t\t\tfmt.Sprintf(\"%s_%s\", zoneName, r.ID),\n\t\t\t\t\t\"cloudflare_access_rule\",\n\t\t\t\t\t\"cloudflare\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"zone_id\": zoneID,\n\t\t\t\t\t},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resources, nil\n}\n\nfunc (*FirewallGenerator) createFilterResources(api *cf.API, zoneID, zoneName string) ([]terraformutils.Resource, error) {\n\tresources := []terraformutils.Resource{}\n\tfilters, err := api.Filters(zoneID, cf.PaginationOptions{})\n\tif err != nil {\n\t\treturn resources, err\n\t}\n\n\tfor _, filter := range filters {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tfilter.ID,\n\t\t\tfmt.Sprintf(\"%s_%s\", zoneName, filter.ID),\n\t\t\t\"cloudflare_filter\",\n\t\t\t\"cloudflare\",\n\t\t\tmap[string]string{\n\t\t\t\t\"zone_id\": zoneID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources, nil\n}\n\nfunc (*FirewallGenerator) createFirewallRuleResources(api *cf.API, zoneID, zoneName string) ([]terraformutils.Resource, error) {\n\tresources := []terraformutils.Resource{}\n\n\tfwrules, err := api.FirewallRules(zoneID, cf.PaginationOptions{})\n\tif err != nil {\n\t\treturn resources, err\n\t}\n\tfor _, rule := range fwrules {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\trule.ID,\n\t\t\tfmt.Sprintf(\"%s_%s\", zoneName, rule.ID),\n\t\t\t\"cloudflare_firewall_rule\",\n\t\t\t\"cloudflare\",\n\t\t\tmap[string]string{\n\t\t\t\t\"zone_id\": zoneID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *FirewallGenerator) createRateLimitResources(api *cf.API, zoneID, zoneName string) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\n\trateLimits, err := api.ListAllRateLimits(zoneID)\n\tif err != nil {\n\t\treturn resources, err\n\t}\n\tfor _, rateLimit := range rateLimits {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\trateLimit.ID,\n\t\t\tfmt.Sprintf(\"%s_%s\", zoneID, rateLimit.ID),\n\t\t\t\"cloudflare_rate_limit\",\n\t\t\t\"cloudflare\",\n\t\t\t[]string{}))\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *FirewallGenerator) InitResources() error {\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(api.AccountID) > 0 {\n\t\tresources, err := g.createAccountAccessRuleResources(api)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\n\t}\n\n\tzones, err := api.ListZones()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*cf.API, string, string) ([]terraformutils.Resource, error){\n\t\tg.createFirewallRuleResources,\n\t\tg.createFilterResources,\n\t\tg.createZoneAccessRuleResources,\n\t\tg.createZoneLockdownsResources,\n\t\tg.createRateLimitResources,\n\t}\n\n\tfor _, zone := range zones {\n\t\tfor _, f := range funcs {\n\t\t\t// Getting all firewall filters\n\t\t\ttmpRes, err := f(api, zone.ID, zone.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, tmpRes...)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *FirewallGenerator) PostConvertHook() error {\n\tfor i, resourceRecord := range g.Resources {\n\t\t// If Zone Name exists, delete ZoneID\n\t\tif _, zoneIDExist := resourceRecord.Item[\"zone_id\"]; zoneIDExist {\n\t\t\tdelete(g.Resources[i].Item, \"zone\")\n\t\t}\n\n\t\tif resourceRecord.InstanceInfo.Type == \"cloudflare_firewall_rule\" {\n\t\t\tif resourceRecord.Item[\"priority\"].(string) == \"0\" {\n\t\t\t\tdelete(g.Resources[i].Item, \"priority\")\n\t\t\t}\n\t\t}\n\n\t\t// Reference to 'cloudflare_filter' resource in 'cloudflare_firewall_rule'\n\t\tif resourceRecord.InstanceInfo.Type == \"cloudflare_filter\" {\n\t\t\tcontinue\n\t\t}\n\t\tfilterID := resourceRecord.Item[\"filter_id\"]\n\t\tfor _, filterResource := range g.Resources {\n\t\t\tif filterResource.InstanceInfo.Type != \"cloudflare_filter\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif filterID == filterResource.InstanceState.ID {\n\t\t\t\tg.Resources[i].Item[\"filter_id\"] = \"${cloudflare_filter.\" + filterResource.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/cloudflare/page_rule.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage cloudflare\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tcf \"github.com/cloudflare/cloudflare-go\"\n)\n\ntype PageRulesGenerator struct {\n\tCloudflareService\n}\n\nfunc (g *PageRulesGenerator) createPageRules(api *cf.API, zoneID string) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tpageRules, err := api.ListPageRules(zoneID)\n\tif err != nil {\n\t\treturn resources, err\n\t}\n\n\tfor _, pageRule := range pageRules {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tpageRule.ID,\n\t\t\tpageRule.ID,\n\t\t\t\"cloudflare_page_rule\",\n\t\t\t\"cloudflare\",\n\t\t\tmap[string]string{\n\t\t\t\t\"zone_id\": zoneID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources, nil\n}\n\nfunc (g *PageRulesGenerator) InitResources() error {\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tzones, err := api.ListZones()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, zone := range zones {\n\t\tresources, err := g.createPageRules(api, zone.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resources...)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/commercetools/api_extension.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/commercetools/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/labd/commercetools-go-sdk/commercetools\"\n)\n\ntype APIExtensionGenerator struct {\n\tCommercetoolsService\n}\n\n// InitResources generates Terraform Resources from Commercetools API\nfunc (g *APIExtensionGenerator) InitResources() error {\n\tcfg := connectivity.Config{\n\t\tClientID:     g.GetArgs()[\"client_id\"].(string),\n\t\tClientSecret: g.GetArgs()[\"client_secret\"].(string),\n\t\tClientScope:  g.GetArgs()[\"client_scope\"].(string),\n\t\tTokenURL:     g.GetArgs()[\"token_url\"].(string) + \"/oauth/token\",\n\t\tBaseURL:      g.GetArgs()[\"base_url\"].(string),\n\t}\n\n\tclient := cfg.NewClient()\n\n\textensions, err := client.ExtensionQuery(context.Background(), &commercetools.QueryInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, extension := range extensions.Results {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\textension.ID,\n\t\t\textension.Key,\n\t\t\t\"commercetools_api_extension\",\n\t\t\t\"commercetools\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/commercetools/channel.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/commercetools/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/labd/commercetools-go-sdk/commercetools\"\n)\n\ntype ChannelGenerator struct {\n\tCommercetoolsService\n}\n\n// InitResources generates Terraform Resources from Commercetools API\nfunc (g *ChannelGenerator) InitResources() error {\n\tcfg := connectivity.Config{\n\t\tClientID:     g.GetArgs()[\"client_id\"].(string),\n\t\tClientSecret: g.GetArgs()[\"client_secret\"].(string),\n\t\tClientScope:  g.GetArgs()[\"client_scope\"].(string),\n\t\tTokenURL:     g.GetArgs()[\"token_url\"].(string) + \"/oauth/token\",\n\t\tBaseURL:      g.GetArgs()[\"base_url\"].(string),\n\t}\n\n\tclient := cfg.NewClient()\n\n\tchannels, err := client.ChannelQuery(context.Background(), &commercetools.QueryInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, channel := range channels.Results {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tchannel.ID,\n\t\t\tchannel.Key,\n\t\t\t\"commercetools_channel\",\n\t\t\t\"commercetools\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/commercetools/commercetools_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/pkg/errors\"\n)\n\ntype CommercetoolsProvider struct { //nolint\n\tterraformutils.Provider\n\tclientID     string\n\tclientSecret string\n\tclientScope  string\n\tprojectKey   string\n\tbaseURL      string\n\ttokenURL     string\n}\n\nfunc (p CommercetoolsProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p CommercetoolsProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\n// Init CommerectoolsProvider\nfunc (p *CommercetoolsProvider) Init(args []string) error {\n\tp.clientID = args[0]\n\tp.clientScope = args[1]\n\tp.clientSecret = args[2]\n\tp.projectKey = args[3]\n\tp.baseURL = args[4]\n\tp.tokenURL = args[5]\n\treturn nil\n}\n\nfunc (p *CommercetoolsProvider) GetName() string {\n\treturn \"commercetools\"\n}\n\nfunc (p *CommercetoolsProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"client_id\":     p.clientID,\n\t\t\"client_secret\": p.clientSecret,\n\t\t\"client_scope\":  p.clientScope,\n\t\t\"project_key\":   p.projectKey,\n\t\t\"base_url\":      p.baseURL,\n\t\t\"token_url\":     p.tokenURL,\n\t})\n\treturn nil\n}\n\n// GetSupportedService return map of support service for Logzio\nfunc (p *CommercetoolsProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"api_extension\":   &APIExtensionGenerator{},\n\t\t\"channel\":         &ChannelGenerator{},\n\t\t\"custom_object\":   &CustomObjectGenerator{},\n\t\t\"product_type\":    &ProductTypeGenerator{},\n\t\t\"shipping_zone\":   &ShippingZoneGenerator{},\n\t\t\"shipping_method\": &ShippingMethodGenerator{},\n\t\t\"state\":           &StateGenerator{},\n\t\t\"store\":           &StoreGenerator{},\n\t\t\"subscription\":    &SubscriptionGenerator{},\n\t\t\"tax_category\":    &TaxCategoryGenerator{},\n\t\t\"types\":           &TypesGenerator{},\n\t}\n}\n"
  },
  {
    "path": "providers/commercetools/commercetools_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport \"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\ntype CommercetoolsService struct { //nolint\n\tterraformutils.Service\n}\n"
  },
  {
    "path": "providers/commercetools/connectivity/client.go",
    "content": "package connectivity\n\nimport (\n\t\"context\"\n\t\"strings\"\n\n\t\"github.com/labd/commercetools-go-sdk/commercetools\"\n\t\"golang.org/x/oauth2/clientcredentials\"\n)\n\nfunc (c *Config) NewClient() *commercetools.Client {\n\toauth2Config := &clientcredentials.Config{\n\t\tClientID:     c.ClientID,\n\t\tClientSecret: c.ClientSecret,\n\t\tScopes:       strings.Split(c.ClientScope, \" \"),\n\t\tTokenURL:     c.TokenURL,\n\t}\n\n\thttpClient := oauth2Config.Client(context.TODO())\n\n\treturn commercetools.New(&commercetools.Config{\n\t\tProjectKey:  c.ProjectKey,\n\t\tURL:         c.BaseURL,\n\t\tHTTPClient:  httpClient,\n\t\tLibraryName: \"terraformer\",\n\t})\n}\n"
  },
  {
    "path": "providers/commercetools/connectivity/config.go",
    "content": "package connectivity\n\ntype Config struct {\n\tClientID     string\n\tClientSecret string\n\tClientScope  string\n\tProjectKey   string\n\tTokenURL     string\n\tBaseURL      string\n}\n"
  },
  {
    "path": "providers/commercetools/custom_object.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/commercetools/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/labd/commercetools-go-sdk/commercetools\"\n)\n\ntype CustomObjectGenerator struct {\n\tCommercetoolsService\n}\n\n// InitResources generates Terraform Resources from Commercetools API\nfunc (g *CustomObjectGenerator) InitResources() error {\n\tcfg := connectivity.Config{\n\t\tClientID:     g.GetArgs()[\"client_id\"].(string),\n\t\tClientSecret: g.GetArgs()[\"client_secret\"].(string),\n\t\tClientScope:  g.GetArgs()[\"client_scope\"].(string),\n\t\tTokenURL:     g.GetArgs()[\"token_url\"].(string) + \"/oauth/token\",\n\t\tBaseURL:      g.GetArgs()[\"base_url\"].(string),\n\t}\n\n\tclient := cfg.NewClient()\n\n\tcustomObjects, err := client.CustomObjectQuery(context.Background(), &commercetools.QueryInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, customObject := range customObjects.Results {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tcustomObject.ID,\n\t\t\tcustomObject.Key,\n\t\t\t\"commercetools_custom_object\",\n\t\t\t\"commercetools\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/commercetools/helpers.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"regexp\"\n\t\"strings\"\n)\n\n// Making resource's name less ugly\nfunc normalizeResourceName(s string) string {\n\tspecialChars := `<>()*#{}[]|@_ .%'\",&`\n\tfor _, c := range specialChars {\n\t\ts = strings.ReplaceAll(s, string(c), \"-\")\n\t}\n\n\ts = regexp.MustCompile(`^[^a-zA-Z_]+`).ReplaceAllLiteralString(s, \"\")\n\ts = strings.TrimSuffix(s, \"-\")\n\n\treturn strings.ToLower(s)\n}\n"
  },
  {
    "path": "providers/commercetools/product_type.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/commercetools/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/labd/commercetools-go-sdk/commercetools\"\n)\n\ntype ProductTypeGenerator struct {\n\tCommercetoolsService\n}\n\n// InitResources generates Terraform Resources from Commercetools API\nfunc (g *ProductTypeGenerator) InitResources() error {\n\tcfg := connectivity.Config{\n\t\tClientID:     g.GetArgs()[\"client_id\"].(string),\n\t\tClientSecret: g.GetArgs()[\"client_secret\"].(string),\n\t\tClientScope:  g.GetArgs()[\"client_scope\"].(string),\n\t\tTokenURL:     g.GetArgs()[\"token_url\"].(string) + \"/oauth/token\",\n\t\tBaseURL:      g.GetArgs()[\"base_url\"].(string),\n\t}\n\n\tclient := cfg.NewClient()\n\n\tproductTypes, err := client.ProductTypeQuery(context.Background(), &commercetools.QueryInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, productType := range productTypes.Results {\n\t\tresourceName := productType.Key\n\t\tif resourceName == \"\" {\n\t\t\tresourceName = normalizeResourceName(productType.Name)\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tproductType.ID,\n\t\t\tresourceName,\n\t\t\t\"commercetools_product_type\",\n\t\t\t\"commercetools\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/commercetools/shipping_method.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/commercetools/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/labd/commercetools-go-sdk/commercetools\"\n)\n\ntype ShippingMethodGenerator struct {\n\tCommercetoolsService\n}\n\n// InitResources generates Terraform Resources from Commercetools API\nfunc (g *ShippingMethodGenerator) InitResources() error {\n\tcfg := connectivity.Config{\n\t\tClientID:     g.GetArgs()[\"client_id\"].(string),\n\t\tClientSecret: g.GetArgs()[\"client_secret\"].(string),\n\t\tClientScope:  g.GetArgs()[\"client_scope\"].(string),\n\t\tTokenURL:     g.GetArgs()[\"token_url\"].(string) + \"/oauth/token\",\n\t\tBaseURL:      g.GetArgs()[\"base_url\"].(string),\n\t}\n\n\tclient := cfg.NewClient()\n\n\tzones, err := client.ShippingMethodQuery(context.Background(), &commercetools.QueryInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, zone := range zones.Results {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tzone.ID,\n\t\t\tzone.Key,\n\t\t\t\"commercetools_shipping_method\",\n\t\t\t\"commercetools\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/commercetools/shipping_zone.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/commercetools/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/labd/commercetools-go-sdk/commercetools\"\n)\n\ntype ShippingZoneGenerator struct {\n\tCommercetoolsService\n}\n\n// InitResources generates Terraform Resources from Commercetools API\nfunc (g *ShippingZoneGenerator) InitResources() error {\n\tcfg := connectivity.Config{\n\t\tClientID:     g.GetArgs()[\"client_id\"].(string),\n\t\tClientSecret: g.GetArgs()[\"client_secret\"].(string),\n\t\tClientScope:  g.GetArgs()[\"client_scope\"].(string),\n\t\tTokenURL:     g.GetArgs()[\"token_url\"].(string) + \"/oauth/token\",\n\t\tBaseURL:      g.GetArgs()[\"base_url\"].(string),\n\t}\n\n\tclient := cfg.NewClient()\n\n\tzones, err := client.ZoneQuery(context.Background(), &commercetools.QueryInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, zone := range zones.Results {\n\t\tresourceName := zone.Key\n\t\tif resourceName == \"\" {\n\t\t\tresourceName = zone.Name\n\t\t}\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tzone.ID,\n\t\t\tresourceName,\n\t\t\t\"commercetools_shipping_zone\",\n\t\t\t\"commercetools\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/commercetools/state.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/commercetools/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/labd/commercetools-go-sdk/commercetools\"\n)\n\ntype StateGenerator struct {\n\tCommercetoolsService\n}\n\n// InitResources generates Terraform Resources from Commercetools API\nfunc (g *StateGenerator) InitResources() error {\n\tcfg := connectivity.Config{\n\t\tClientID:     g.GetArgs()[\"client_id\"].(string),\n\t\tClientSecret: g.GetArgs()[\"client_secret\"].(string),\n\t\tClientScope:  g.GetArgs()[\"client_scope\"].(string),\n\t\tTokenURL:     g.GetArgs()[\"token_url\"].(string) + \"/oauth/token\",\n\t\tBaseURL:      g.GetArgs()[\"base_url\"].(string),\n\t}\n\n\tclient := cfg.NewClient()\n\n\tstates, err := client.StateQuery(context.Background(), &commercetools.QueryInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, state := range states.Results {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tstate.ID,\n\t\t\tstate.Key,\n\t\t\t\"commercetools_state\",\n\t\t\t\"commercetools\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/commercetools/store.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/commercetools/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/labd/commercetools-go-sdk/commercetools\"\n)\n\ntype StoreGenerator struct {\n\tCommercetoolsService\n}\n\n// InitResources generates Terraform Resources from Commercetools API\nfunc (g *StoreGenerator) InitResources() error {\n\tcfg := connectivity.Config{\n\t\tClientID:     g.GetArgs()[\"client_id\"].(string),\n\t\tClientSecret: g.GetArgs()[\"client_secret\"].(string),\n\t\tClientScope:  g.GetArgs()[\"client_scope\"].(string),\n\t\tTokenURL:     g.GetArgs()[\"token_url\"].(string) + \"/oauth/token\",\n\t\tBaseURL:      g.GetArgs()[\"base_url\"].(string),\n\t}\n\n\tclient := cfg.NewClient()\n\n\tstores, err := client.StoreQuery(context.Background(), &commercetools.QueryInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, store := range stores.Results {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tstore.ID,\n\t\t\tstore.Key,\n\t\t\t\"commercetools_store\",\n\t\t\t\"commercetools\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/commercetools/subscription.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/commercetools/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/labd/commercetools-go-sdk/commercetools\"\n)\n\ntype SubscriptionGenerator struct {\n\tCommercetoolsService\n}\n\n// InitResources generates Terraform Resources from Commercetools API\nfunc (g *SubscriptionGenerator) InitResources() error {\n\tcfg := connectivity.Config{\n\t\tClientID:     g.GetArgs()[\"client_id\"].(string),\n\t\tClientSecret: g.GetArgs()[\"client_secret\"].(string),\n\t\tClientScope:  g.GetArgs()[\"client_scope\"].(string),\n\t\tTokenURL:     g.GetArgs()[\"token_url\"].(string) + \"/oauth/token\",\n\t\tBaseURL:      g.GetArgs()[\"base_url\"].(string),\n\t}\n\n\tclient := cfg.NewClient()\n\n\tsubscriptions, err := client.SubscriptionQuery(context.Background(), &commercetools.QueryInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, subscription := range subscriptions.Results {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tsubscription.ID,\n\t\t\tsubscription.Key,\n\t\t\t\"commercetools_subscription\",\n\t\t\t\"commercetools\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/commercetools/tax_category.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/commercetools/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/labd/commercetools-go-sdk/commercetools\"\n)\n\ntype TaxCategoryGenerator struct {\n\tCommercetoolsService\n}\n\n// InitResources generates Terraform Resources from Commercetools API\nfunc (g *TaxCategoryGenerator) InitResources() error {\n\tcfg := connectivity.Config{\n\t\tClientID:     g.GetArgs()[\"client_id\"].(string),\n\t\tClientSecret: g.GetArgs()[\"client_secret\"].(string),\n\t\tClientScope:  g.GetArgs()[\"client_scope\"].(string),\n\t\tTokenURL:     g.GetArgs()[\"token_url\"].(string) + \"/oauth/token\",\n\t\tBaseURL:      g.GetArgs()[\"base_url\"].(string),\n\t}\n\n\tclient := cfg.NewClient()\n\n\tcategories, err := client.TaxCategoryQuery(context.Background(), &commercetools.QueryInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, category := range categories.Results {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tcategory.ID,\n\t\t\tcategory.Key,\n\t\t\t\"commercetools_tax_category\",\n\t\t\t\"commercetools\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/commercetools/types.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage commercetools\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/commercetools/connectivity\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/labd/commercetools-go-sdk/commercetools\"\n)\n\ntype TypesGenerator struct {\n\tCommercetoolsService\n}\n\n// InitResources generates Terraform Resources from Commercetools API\nfunc (g *TypesGenerator) InitResources() error {\n\tcfg := connectivity.Config{\n\t\tClientID:     g.GetArgs()[\"client_id\"].(string),\n\t\tClientSecret: g.GetArgs()[\"client_secret\"].(string),\n\t\tClientScope:  g.GetArgs()[\"client_scope\"].(string),\n\t\tTokenURL:     g.GetArgs()[\"token_url\"].(string) + \"/oauth/token\",\n\t\tBaseURL:      g.GetArgs()[\"base_url\"].(string),\n\t}\n\n\tclient := cfg.NewClient()\n\n\ttypes, err := client.TypeQuery(context.Background(), &commercetools.QueryInput{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, customType := range types.Results {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tcustomType.ID,\n\t\t\tcustomType.Key,\n\t\t\t\"commercetools_type\",\n\t\t\t\"commercetools\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/dashboard.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// DashboardAllowEmptyValues ...\n\tDashboardAllowEmptyValues = []string{\"tags.\", \"manage_status_definition.*.query\"}\n)\n\n// DashboardGenerator ...\ntype DashboardGenerator struct {\n\tDatadogService\n}\n\nfunc (g *DashboardGenerator) createResources(dashboards []datadogV1.DashboardSummaryDefinition) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, dashboard := range dashboards {\n\t\tresourceName := dashboard.GetId()\n\t\tresources = append(resources, g.createResource(resourceName))\n\t}\n\n\treturn resources\n}\n\nfunc (g *DashboardGenerator) createResource(dashboardID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tdashboardID,\n\t\tfmt.Sprintf(\"dashboard_%s\", dashboardID),\n\t\t\"datadog_dashboard\",\n\t\t\"datadog\",\n\t\tDashboardAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each dashboard create 1 TerraformResource.\n// Need Dashboard ID as ID for terraform resource\nfunc (g *DashboardGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewDashboardsApi(datadogClient)\n\n\tresources := []terraformutils.Resource{}\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"dashboard\") {\n\t\t\tfor _, value := range filter.AcceptableValues {\n\t\t\t\tdashboard, _, err := api.GetDashboard(auth, value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tresources = append(resources, g.createResource(dashboard.GetId()))\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(resources) > 0 {\n\t\tg.Resources = resources\n\t\treturn nil\n\t}\n\n\tsummary, _, err := api.ListDashboards(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(summary.GetDashboards())\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/dashboard_json.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// DashboardJSONAllowEmptyValues ...\n\tDashboardJSONAllowEmptyValues = []string{\"tags.\"}\n)\n\n// DashboardJSONGenerator ...\ntype DashboardJSONGenerator struct {\n\tDatadogService\n}\n\nfunc (g *DashboardJSONGenerator) createResources(dashboards []datadogV1.DashboardSummaryDefinition) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, dashboard := range dashboards {\n\t\tresourceName := dashboard.GetId()\n\t\tresources = append(resources, g.createResource(resourceName))\n\t}\n\n\treturn resources\n}\n\nfunc (g *DashboardJSONGenerator) createResource(dashboardID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tdashboardID,\n\t\tfmt.Sprintf(\"dashboard_json_%s\", dashboardID),\n\t\t\"datadog_dashboard_json\",\n\t\t\"datadog\",\n\t\tDashboardJSONAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each dashboard_json create 1 TerraformResource.\n// Need Dashboard ID as ID for terraform resource\nfunc (g *DashboardJSONGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewDashboardsApi(datadogClient)\n\n\tresources := []terraformutils.Resource{}\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"dashboard_json\") {\n\t\t\tfor _, value := range filter.AcceptableValues {\n\t\t\t\tdashboard, _, err := api.GetDashboard(auth, value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tresources = append(resources, g.createResource(dashboard.GetId()))\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(resources) > 0 {\n\t\tg.Resources = resources\n\t\treturn nil\n\t}\n\n\tsummary, _, err := api.ListDashboards(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(summary.GetDashboards())\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/dashboard_list.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"strconv\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// DashboardListAllowEmptyValues ...\n\tDashboardListAllowEmptyValues = []string{}\n)\n\n// DashboardListGenerator ...\ntype DashboardListGenerator struct {\n\tDatadogService\n}\n\nfunc (g *DashboardListGenerator) createResources(dashboardLists []datadogV1.DashboardList) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, dashboardList := range dashboardLists {\n\t\tresourceID := strconv.FormatInt(dashboardList.GetId(), 10)\n\t\tresources = append(resources, g.createResource(resourceID))\n\t}\n\n\treturn resources\n}\n\nfunc (g *DashboardListGenerator) createResource(dashboardListID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tdashboardListID,\n\t\tfmt.Sprintf(\"dashboard_list_%s\", dashboardListID),\n\t\t\"datadog_dashboard_list\",\n\t\t\"datadog\",\n\t\tDashboardListAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each dashboard_list create 1 TerraformResource.\n// Need DashboardList ID as ID for terraform resource\nfunc (g *DashboardListGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewDashboardListsApi(datadogClient)\n\n\tdlResponse, _, err := api.ListDashboardLists(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(dlResponse.GetDashboardLists())\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/datadog_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"net/url\"\n\t\"os\"\n\t\"strconv\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype DatadogProvider struct { //nolint\n\tterraformutils.Provider\n\tapiKey        string\n\tappKey        string\n\tapiURL        string\n\tvalidate      bool\n\tauth          context.Context\n\tdatadogClient *datadog.APIClient\n}\n\n// Init check env params and initialize API Client\nfunc (p *DatadogProvider) Init(args []string) error {\n\n\tif args[3] != \"\" {\n\t\tvalidate, validateErr := strconv.ParseBool(args[3])\n\t\tif validateErr != nil {\n\t\t\treturn fmt.Errorf(`invalid validate arg : %v`, validateErr)\n\t\t}\n\t\tp.validate = validate\n\t} else if os.Getenv(\"DATADOG_VALIDATE\") != \"\" {\n\t\tvalidate, validateErr := strconv.ParseBool(os.Getenv(\"DATADOG_VALIDATE\"))\n\t\tif validateErr != nil {\n\t\t\treturn fmt.Errorf(`invalid DATADOG_VALIDATE env var : %v`, validateErr)\n\t\t}\n\t\tp.validate = validate\n\t} else {\n\t\tp.validate = true\n\t}\n\n\tif args[0] != \"\" {\n\t\tp.apiKey = args[0]\n\t} else {\n\t\tif apiKey := os.Getenv(\"DATADOG_API_KEY\"); apiKey != \"\" {\n\t\t\tp.apiKey = apiKey\n\t\t} else if p.validate {\n\t\t\treturn errors.New(\"api-key requirement\")\n\t\t}\n\t}\n\n\tif args[1] != \"\" {\n\t\tp.appKey = args[1]\n\t} else {\n\t\tif appKey := os.Getenv(\"DATADOG_APP_KEY\"); appKey != \"\" {\n\t\t\tp.appKey = appKey\n\t\t} else if p.validate {\n\t\t\treturn errors.New(\"app-key requirement\")\n\t\t}\n\t}\n\n\tif args[2] != \"\" {\n\t\tp.apiURL = args[2]\n\t} else if v := os.Getenv(\"DATADOG_HOST\"); v != \"\" {\n\t\tp.apiURL = v\n\t}\n\n\t// Initialize the Datadog V1 API client\n\tauth := context.WithValue(\n\t\tcontext.Background(),\n\t\tdatadog.ContextAPIKeys,\n\t\tmap[string]datadog.APIKey{\n\t\t\t\"apiKeyAuth\": {\n\t\t\t\tKey: p.apiKey,\n\t\t\t},\n\t\t\t\"appKeyAuth\": {\n\t\t\t\tKey: p.appKey,\n\t\t\t},\n\t\t},\n\t)\n\tif p.apiURL != \"\" {\n\t\tparsedAPIURL, parseErr := url.Parse(p.apiURL)\n\t\tif parseErr != nil {\n\t\t\treturn fmt.Errorf(`invalid API Url : %v`, parseErr)\n\t\t}\n\t\tif parsedAPIURL.Host == \"\" || parsedAPIURL.Scheme == \"\" {\n\t\t\treturn fmt.Errorf(`missing protocol or host : %v`, p.apiURL)\n\t\t}\n\t\t// If api url is passed, set and use the api name and protocol on ServerIndex{1}\n\t\tauth = context.WithValue(auth, datadog.ContextServerIndex, 1)\n\t\tauth = context.WithValue(auth, datadog.ContextServerVariables, map[string]string{\n\t\t\t\"name\":     parsedAPIURL.Host,\n\t\t\t\"protocol\": parsedAPIURL.Scheme,\n\t\t})\n\t}\n\tconfigV1 := datadog.NewConfiguration()\n\tdatadogClient := datadog.NewAPIClient(configV1)\n\n\tp.auth = auth\n\tp.datadogClient = datadogClient\n\n\treturn nil\n}\n\n// GetName return string of provider name for Datadog\nfunc (p *DatadogProvider) GetName() string {\n\treturn \"datadog\"\n}\n\n// GetConfig return map of provider config for Datadog\nfunc (p *DatadogProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"api_key\":  cty.StringVal(p.apiKey),\n\t\t\"app_key\":  cty.StringVal(p.appKey),\n\t\t\"api_url\":  cty.StringVal(p.apiURL),\n\t\t\"validate\": cty.BoolVal(p.validate),\n\t})\n}\n\n// InitService ...\nfunc (p *DatadogProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"api-key\":       p.apiKey,\n\t\t\"app-key\":       p.appKey,\n\t\t\"api-url\":       p.apiURL,\n\t\t\"validate\":      p.validate,\n\t\t\"auth\":          p.auth,\n\t\t\"datadogClient\": p.datadogClient,\n\t})\n\treturn nil\n}\n\n// GetSupportedService return map of support service for Datadog\nfunc (p *DatadogProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"dashboard_list\":                       &DashboardListGenerator{},\n\t\t\"dashboard\":                            &DashboardGenerator{},\n\t\t\"dashboard_json\":                       &DashboardJSONGenerator{},\n\t\t\"downtime\":                             &DowntimeGenerator{},\n\t\t\"logs_archive\":                         &LogsArchiveGenerator{},\n\t\t\"logs_archive_order\":                   &LogsArchiveOrderGenerator{},\n\t\t\"logs_custom_pipeline\":                 &LogsCustomPipelineGenerator{},\n\t\t\"logs_index\":                           &LogsIndexGenerator{},\n\t\t\"logs_index_order\":                     &LogsIndexOrderGenerator{},\n\t\t\"logs_integration_pipeline\":            &LogsIntegrationPipelineGenerator{},\n\t\t\"logs_metric\":                          &LogsMetricGenerator{},\n\t\t\"logs_pipeline_order\":                  &LogsPipelineOrderGenerator{},\n\t\t\"integration_aws\":                      &IntegrationAWSGenerator{},\n\t\t\"integration_aws_lambda_arn\":           &IntegrationAWSLambdaARNGenerator{},\n\t\t\"integration_aws_log_collection\":       &IntegrationAWSLogCollectionGenerator{},\n\t\t\"integration_azure\":                    &IntegrationAzureGenerator{},\n\t\t\"integration_gcp\":                      &IntegrationGCPGenerator{},\n\t\t\"integration_pagerduty\":                &IntegrationPagerdutyGenerator{},\n\t\t\"integration_pagerduty_service_object\": &IntegrationPagerdutyServiceObjectGenerator{},\n\t\t\"integration_slack_channel\":            &IntegrationSlackChannelGenerator{},\n\t\t\"metric_metadata\":                      &MetricMetadataGenerator{},\n\t\t\"monitor\":                              &MonitorGenerator{},\n\t\t\"security_monitoring_default_rule\":     &SecurityMonitoringDefaultRuleGenerator{},\n\t\t\"security_monitoring_rule\":             &SecurityMonitoringRuleGenerator{},\n\t\t\"service_level_objective\":              &ServiceLevelObjectiveGenerator{},\n\t\t\"synthetics_test\":                      &SyntheticsTestGenerator{},\n\t\t\"synthetics_global_variable\":           &SyntheticsGlobalVariableGenerator{},\n\t\t\"synthetics_private_location\":          &SyntheticsPrivateLocationGenerator{},\n\t\t\"user\":                                 &UserGenerator{},\n\t\t\"role\":                                 &RoleGenerator{},\n\t}\n}\n\n// GetResourceConnections return map of resource connections for Datadog\nfunc (p DatadogProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"dashboard\": {\n\t\t\t\"monitor\": {\n\t\t\t\t\"widget.alert_graph_definition.alert_id\", \"id\",\n\t\t\t\t\"widget.group_definition.widget.alert_graph_definition.alert_id\", \"id\",\n\t\t\t\t\"widget.alert_value_definition.alert_id\", \"id\",\n\t\t\t\t\"widget.group_definition.widget.alert_value_definition.alert_id\", \"id\",\n\t\t\t},\n\t\t\t\"service_level_objective\": {\n\t\t\t\t\"widget.service_level_objective_definition.slo_id\", \"id\",\n\t\t\t\t\"widget.group_definition.widget.service_level_objective_definition.slo_id\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"dashboard_list\": {\n\t\t\t\"dashboard\": {\n\t\t\t\t\"dash_item.dash_id\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"downtime\": {\n\t\t\t\"monitor\": {\n\t\t\t\t\"monitor_id\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"integration_aws_lambda_arn\": {\n\t\t\t\"integration_aws\": {\n\t\t\t\t\"account_id\", \"account_id\",\n\t\t\t},\n\t\t},\n\t\t\"integration_aws_log_collection\": {\n\t\t\t\"integration_aws\": {\n\t\t\t\t\"account_id\", \"account_id\",\n\t\t\t},\n\t\t},\n\t\t\"logs_archive\": {\n\t\t\t\"integration_aws\": {\n\t\t\t\t\"s3.account_id\", \"account_id\",\n\t\t\t\t\"s3.role_name\", \"role_name\",\n\t\t\t\t\"s3_archive.account_id\", \"account_id\",\n\t\t\t\t\"s3_archive.role_name\", \"role_name\",\n\t\t\t},\n\t\t\t\"integration_gcp\": {\n\t\t\t\t\"gcs.project_id\", \"project_id\",\n\t\t\t\t\"gcs.client_email\", \"client_email\",\n\t\t\t\t\"gcs_archive.project_id\", \"project_id\",\n\t\t\t\t\"gcs_archive.client_email\", \"client_email\",\n\t\t\t},\n\t\t\t\"integration_azure\": {\n\t\t\t\t\"azure.client_id\", \"client_id\",\n\t\t\t\t\"azure.tenant_id\", \"tenant_name\",\n\t\t\t\t\"azure_archive.client_id\", \"client_id\",\n\t\t\t\t\"azure_archive.tenant_id\", \"tenant_name\",\n\t\t\t},\n\t\t},\n\t\t\"logs_archive_order\": {\n\t\t\t\"logs_archive\": {\n\t\t\t\t\"archive_ids\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"logs_index_order\": {\n\t\t\t\"logs_index\": {\n\t\t\t\t\"indexes\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"logs_pipeline_order\": {\n\t\t\t\"logs_integration_pipeline\": {\n\t\t\t\t\"pipelines\", \"id\",\n\t\t\t},\n\t\t\t\"logs_custom_pipeline\": {\n\t\t\t\t\"pipelines\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"monitor\": {\n\t\t\t\"role\": {\n\t\t\t\t\"restricted_roles\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"service_level_objective\": {\n\t\t\t\"monitor\": {\n\t\t\t\t\"monitor_ids\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"synthetics_test\": {\n\t\t\t\"synthetics_private_location\": {\n\t\t\t\t\"locations\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"synthetics_global_variable\": {\n\t\t\t\"synthetics_test\": {\n\t\t\t\t\"parse_test_id\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"user\": {\n\t\t\t\"role\": {\n\t\t\t\t\"roles\", \"id\",\n\t\t\t},\n\t\t},\n\t}\n}\n\n// GetProviderData return map of provider data for Datadog\nfunc (p DatadogProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n"
  },
  {
    "path": "providers/datadog/datadog_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport \"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\ntype DatadogService struct { //nolint\n\tterraformutils.Service\n}\n"
  },
  {
    "path": "providers/datadog/downtime.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"strconv\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// DowntimeAllowEmptyValues ...\n\tDowntimeAllowEmptyValues = []string{}\n)\n\n// DowntimeGenerator ...\ntype DowntimeGenerator struct {\n\tDatadogService\n}\n\nfunc (g *DowntimeGenerator) createResources(downtimes []datadogV1.Downtime) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, downtime := range downtimes {\n\t\tresourceName := strconv.FormatInt(downtime.GetId(), 10)\n\t\tresources = append(resources, g.createResource(resourceName))\n\t}\n\n\treturn resources\n}\n\nfunc (g *DowntimeGenerator) createResource(downtimeID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tdowntimeID,\n\t\tfmt.Sprintf(\"downtime_%s\", downtimeID),\n\t\t\"datadog_downtime\",\n\t\t\"datadog\",\n\t\tDowntimeAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each downtime create 1 TerraformResource.\n// Need Downtime ID as ID for terraform resource\nfunc (g *DowntimeGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewDowntimesApi(datadogClient)\n\n\tresources := []terraformutils.Resource{}\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"downtime\") {\n\t\t\tfor _, value := range filter.AcceptableValues {\n\t\t\t\ti, err := strconv.ParseInt(value, 10, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tmonitor, _, err := api.GetDowntime(auth, i)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tresources = append(resources, g.createResource(strconv.FormatInt(monitor.GetId(), 10)))\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(resources) > 0 {\n\t\tg.Resources = resources\n\t\treturn nil\n\t}\n\n\tdowntimes, _, err := api.ListDowntimes(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(downtimes)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/integration_aws.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// IntegrationAWSAllowEmptyValues ...\n\tIntegrationAWSAllowEmptyValues = []string{}\n)\n\n// IntegrationAWSGenerator ...\ntype IntegrationAWSGenerator struct {\n\tDatadogService\n}\n\nfunc (g *IntegrationAWSGenerator) createResources(awsAccounts []datadogV1.AWSAccount) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, account := range awsAccounts {\n\t\tresourceID := fmt.Sprintf(\"%s:%s\", account.GetAccountId(), account.GetRoleName())\n\t\tresources = append(resources, g.createResource(resourceID))\n\t}\n\n\treturn resources\n}\n\nfunc (g *IntegrationAWSGenerator) createResource(resourceID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tresourceID,\n\t\tfmt.Sprintf(\"integration_aws_%s\", resourceID),\n\t\t\"datadog_integration_aws\",\n\t\t\"datadog\",\n\t\tIntegrationAWSAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each monitor create 1 TerraformResource.\n// Need IntegrationAWS ID formatted as '<account_id>:<role_name>' as ID for terraform resource\nfunc (g *IntegrationAWSGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewAWSIntegrationApi(datadogClient)\n\n\tintegrations, _, err := api.ListAWSAccounts(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(integrations.GetAccounts())\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/integration_aws_lambda_arn.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// IntegrationAWSLambdaARNAllowEmptyValues ...\n\tIntegrationAWSLambdaARNAllowEmptyValues = []string{}\n)\n\n// IntegrationAWSLambdaARNGenerator ...\ntype IntegrationAWSLambdaARNGenerator struct {\n\tDatadogService\n}\n\nfunc (g *IntegrationAWSLambdaARNGenerator) createResources(logCollections []datadogV1.AWSLogsListResponse) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, logCollection := range logCollections {\n\t\tfor _, logCollectionLambdaArn := range logCollection.GetLambdas() {\n\t\t\taccountID := logCollection.GetAccountId()\n\t\t\tif v, ok := logCollectionLambdaArn.GetArnOk(); ok {\n\t\t\t\tresourceID := fmt.Sprintf(\"%s %s\", accountID, *v)\n\t\t\t\tresources = append(resources, g.createResource(resourceID))\n\t\t\t}\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *IntegrationAWSLambdaARNGenerator) createResource(resourceID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tresourceID,\n\t\tfmt.Sprintf(\"integration_aws_lambda_arn_%s\", resourceID),\n\t\t\"datadog_integration_aws_lambda_arn\",\n\t\t\"datadog\",\n\t\tIntegrationAWSLambdaARNAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each monitor create 1 TerraformResource.\n// Need IntegrationAWSLambdaARN ID formatted as '<account_id>:<role_name>' as ID for terraform resource\nfunc (g *IntegrationAWSLambdaARNGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewAWSLogsIntegrationApi(datadogClient)\n\n\tlogCollections, _, err := api.ListAWSLogsIntegrations(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(logCollections)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/integration_aws_log_collection.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// IntegrationAWSLogCollectionAllowEmptyValues ...\n\tIntegrationAWSLogCollectionAllowEmptyValues = []string{\"services\"}\n)\n\n// IntegrationAWSLogCollectionGenerator ...\ntype IntegrationAWSLogCollectionGenerator struct {\n\tDatadogService\n}\n\nfunc (g *IntegrationAWSLogCollectionGenerator) createResources(logCollections []datadogV1.AWSLogsListResponse) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, logCollection := range logCollections {\n\t\tresourceID := logCollection.GetAccountId()\n\t\tresources = append(resources, g.createResource(resourceID))\n\t}\n\treturn resources\n}\n\nfunc (g *IntegrationAWSLogCollectionGenerator) createResource(resourceID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tresourceID,\n\t\tfmt.Sprintf(\"integration_aws_log_collection_%s\", resourceID),\n\t\t\"datadog_integration_aws_log_collection\",\n\t\t\"datadog\",\n\t\tIntegrationAWSLogCollectionAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each monitor create 1 TerraformResource.\n// Need IntegrationAWSLogCollection ID formatted as '<account_id>:<role_name>' as ID for terraform resource\nfunc (g *IntegrationAWSLogCollectionGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewAWSLogsIntegrationApi(datadogClient)\n\n\tlogCollections, _, err := api.ListAWSLogsIntegrations(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(logCollections)\n\treturn nil\n}\n\nfunc (g *IntegrationAWSLogCollectionGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\t// services is a required attribute but can be empty. This ensures we append an empty list\n\t\tif r.Item[\"services\"] == nil {\n\t\t\tr.Item[\"services\"] = []string{}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/integration_azure.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// IntegrationAzureAllowEmptyValues ...\n\tIntegrationAzureAllowEmptyValues = []string{}\n)\n\n// IntegrationAzureGenerator ...\ntype IntegrationAzureGenerator struct {\n\tDatadogService\n}\n\nfunc (g *IntegrationAzureGenerator) createResources(azureAccounts []datadogV1.AzureAccount) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, account := range azureAccounts {\n\t\tresourceID := fmt.Sprintf(\"%s:%s\", account.GetTenantName(), account.GetClientId())\n\t\tresources = append(resources, g.createResource(resourceID))\n\t}\n\n\treturn resources\n}\n\nfunc (g *IntegrationAzureGenerator) createResource(resourceID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tresourceID,\n\t\tfmt.Sprintf(\"integration_azure_%s\", resourceID),\n\t\t\"datadog_integration_azure\",\n\t\t\"datadog\",\n\t\tIntegrationAzureAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each monitor create 1 TerraformResource.\n// Need IntegrationAzure ID formatted as '<tenant_name>:<client_id>' as ID for terraform resource\nfunc (g *IntegrationAzureGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewAzureIntegrationApi(datadogClient)\n\n\tintegrations, _, err := api.ListAzureIntegration(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(integrations)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/integration_gcp.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// IntegrationGCPAllowEmptyValues ...\n\tIntegrationGCPAllowEmptyValues = []string{}\n)\n\n// IntegrationGCPGenerator ...\ntype IntegrationGCPGenerator struct {\n\tDatadogService\n}\n\nfunc (g *IntegrationGCPGenerator) createResources(gcpAccounts []datadogV1.GCPAccount) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, account := range gcpAccounts {\n\t\tresourceID := account.GetProjectId()\n\t\tresources = append(resources, g.createResource(resourceID))\n\t}\n\n\treturn resources\n}\n\nfunc (g *IntegrationGCPGenerator) createResource(resourceID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tresourceID,\n\t\tfmt.Sprintf(\"integration_gcp_%s\", resourceID),\n\t\t\"datadog_integration_gcp\",\n\t\t\"datadog\",\n\t\tIntegrationGCPAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each monitor create 1 TerraformResource.\n// Need IntegrationGCP ID formatted as '<tenant_name>:<client_id>' as ID for terraform resource\nfunc (g *IntegrationGCPGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewGCPIntegrationApi(datadogClient)\n\n\tintegrations, _, err := api.ListGCPIntegration(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(integrations)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/integration_pagerduty.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"fmt\"\n\n\tdatadogCommunity \"github.com/zorkian/go-datadog-api\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// IntegrationPagerdutyAllowEmptyValues ...\n\tIntegrationPagerdutyAllowEmptyValues = []string{\"tags.\"}\n)\n\n// IntegrationPagerdutyGenerator ...\ntype IntegrationPagerdutyGenerator struct {\n\tDatadogService\n}\n\nfunc (g *IntegrationPagerdutyGenerator) createResources(pdSubdomain string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tresources = append(resources, g.createResource(pdSubdomain))\n\n\treturn resources\n}\n\nfunc (g *IntegrationPagerdutyGenerator) createResource(serviceName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tserviceName,\n\t\tfmt.Sprintf(\"integration_pagerduty_%s\", serviceName),\n\t\t\"datadog_integration_pagerduty\",\n\t\t\"datadog\",\n\t\tmap[string]string{\n\t\t\t\"individual_services\": \"true\",\n\t\t},\n\t\tIntegrationPagerdutyAllowEmptyValues,\n\t\tmap[string]interface{}{},\n\t)\n\t// Ignore services in favor of individual_services\n\tresource.IgnoreKeys = append(resource.IgnoreKeys, \"^services$\")\n\n\treturn resource\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from PD Service create 1 TerraformResource.\n// Need IntegrationPagerduty Subdomain as ID for terraform resource\nfunc (g *IntegrationPagerdutyGenerator) InitResources() error {\n\tclient := datadogCommunity.NewClient(g.Args[\"api-key\"].(string), g.Args[\"app-key\"].(string))\n\n\tintegration, err := client.GetIntegrationPD()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(integration.GetSubdomain())\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/integration_pagerduty_service_object.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"fmt\"\n\n\tdatadogCommunity \"github.com/zorkian/go-datadog-api\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// IntegrationPagerdutyServiceObjectAllowEmptyValues ...\n\tIntegrationPagerdutyServiceObjectAllowEmptyValues = []string{\"tags.\"}\n)\n\n// IntegrationPagerdutyServiceObjectGenerator ...\ntype IntegrationPagerdutyServiceObjectGenerator struct {\n\tDatadogService\n}\n\nfunc (g *IntegrationPagerdutyServiceObjectGenerator) createResources(serviceNames []string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, name := range serviceNames {\n\t\tresourceName := name\n\t\tresources = append(resources, g.createResource(resourceName))\n\t}\n\n\treturn resources\n}\n\nfunc (g *IntegrationPagerdutyServiceObjectGenerator) createResource(serviceName string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tserviceName,\n\t\tfmt.Sprintf(\"integration_pagerduty_service_object_%s\", serviceName),\n\t\t\"datadog_integration_pagerduty_service_object\",\n\t\t\"datadog\",\n\t\tIntegrationPagerdutyServiceObjectAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each PD Service create 1 TerraformResource.\n// Need IntegrationPagerdutyServiceObject ServiceName as ID for terraform resource\nfunc (g *IntegrationPagerdutyServiceObjectGenerator) InitResources() error {\n\tclient := datadogCommunity.NewClient(g.Args[\"api-key\"].(string), g.Args[\"app-key\"].(string))\n\n\tpdIntegration, err := client.GetIntegrationPD()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar serviceNames []string\n\tfor _, service := range pdIntegration.Services {\n\t\tserviceNames = append(serviceNames, *service.ServiceName)\n\t}\n\n\tg.Resources = g.createResources(serviceNames)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/integration_slack_channel.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// IntegrationSlackChannelAllowEmptyValues ...\n\tIntegrationSlackChannelAllowEmptyValues = []string{}\n)\n\n// IntegrationSlackChannelGenerator ...\ntype IntegrationSlackChannelGenerator struct {\n\tDatadogService\n}\n\nfunc (g *IntegrationSlackChannelGenerator) createResources(accountID string, slackChannels []datadogV1.SlackIntegrationChannel) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, slackChannel := range slackChannels {\n\t\tid := fmt.Sprintf(\"%s:%s\", accountID, slackChannel.GetName())\n\t\tresources = append(resources, g.createResource(id))\n\t}\n\n\treturn resources\n}\n\nfunc (g *IntegrationSlackChannelGenerator) createResource(id string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tid,\n\t\tfmt.Sprintf(\"integration_slack_channel_%s\", id),\n\t\t\"datadog_integration_slack_channel\",\n\t\t\"datadog\",\n\t\tIntegrationSlackChannelAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each slack channel create 1 TerraformResource.\nfunc (g *IntegrationSlackChannelGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewSlackIntegrationApi(datadogClient)\n\n\tresources := []terraformutils.Resource{}\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"account_name\" && filter.IsApplicable(\"integration_slack_channel\") {\n\t\t\tfor _, value := range filter.AcceptableValues {\n\t\t\t\tslackChannels, _, err := api.GetSlackIntegrationChannels(auth, value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tresources = g.createResources(value, slackChannels)\n\t\t\t}\n\t\t}\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"integration_slack_channel\") {\n\t\t\tfor _, value := range filter.AcceptableValues {\n\t\t\t\tresources = append(resources, g.createResource(value))\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(resources) == 0 {\n\t\tlog.Print(\"Filter(account_name or resource id) is required to import datadog_integration_slack_channel resource\")\n\t\treturn nil\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/logs_archive.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// LogsArchiveAllowEmptyValues ...\n\tLogsArchiveAllowEmptyValues = []string{\"path\", \"query\"}\n)\n\n// LogsArchiveGenerator ...\ntype LogsArchiveGenerator struct {\n\tDatadogService\n}\n\nfunc (g *LogsArchiveGenerator) createResources(logsArchives []datadogV2.LogsArchiveDefinition) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, logsArchive := range logsArchives {\n\t\tlogsArchiveID := logsArchive.GetId()\n\t\tresources = append(resources, g.createResource(logsArchiveID))\n\t}\n\n\treturn resources\n}\n\nfunc (g *LogsArchiveGenerator) createResource(logsArchiveID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tlogsArchiveID,\n\t\tfmt.Sprintf(\"logs_archive_%s\", logsArchiveID),\n\t\t\"datadog_logs_archive\",\n\t\t\"datadog\",\n\t\tLogsArchiveAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each archive create 1 TerraformResource.\n// Need LogsArchive ID as ID for terraform resource\nfunc (g *LogsArchiveGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV2.NewLogsArchivesApi(datadogClient)\n\n\tresources := []terraformutils.Resource{}\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"logs_archive\") {\n\t\t\tfor _, value := range filter.AcceptableValues {\n\t\t\t\tresp, _, err := api.GetLogsArchive(auth, value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tlogsArchiveData := resp.GetData()\n\t\t\t\tresources = append(resources, g.createResource(logsArchiveData.GetId()))\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(resources) > 0 {\n\t\tg.Resources = resources\n\t\treturn nil\n\t}\n\n\tlogsArchiveListResp, _, err := api.ListLogsArchives(auth)\n\tlogsArchiveList := logsArchiveListResp.GetData()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(logsArchiveList)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/logs_archive_order.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// LogsArchiveOrderAllowEmptyValues ...\n\tLogsArchiveOrderAllowEmptyValues = []string{}\n)\n\n// LogsArchiveOrderGenerator ...\ntype LogsArchiveOrderGenerator struct {\n\tDatadogService\n}\n\n// InitResources Generate TerraformResources\nfunc (g *LogsArchiveOrderGenerator) InitResources() error {\n\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\"archiveOrderID\",\n\t\t\"archiveOrderID\",\n\t\t\"datadog_logs_archive_order\",\n\t\t\"datadog\",\n\t\tmap[string]string{},\n\t\tLogsArchiveOrderAllowEmptyValues,\n\t\tmap[string]interface{}{},\n\t))\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/logs_custom_pipeline.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// LogsCustomPipelineAllowEmptyValues ...\n\tLogsCustomPipelineAllowEmptyValues = []string{\"support_rules\", \"filter\"}\n)\n\n// LogsCustomPipelineGenerator ...\ntype LogsCustomPipelineGenerator struct {\n\tDatadogService\n}\n\nfunc (g *LogsCustomPipelineGenerator) createResources(logsCustomPipelines []datadogV1.LogsPipeline) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, logsCustomPipeline := range logsCustomPipelines {\n\t\t// Import logs custom pipelines only\n\t\tif !logsCustomPipeline.GetIsReadOnly() {\n\t\t\tresourceName := logsCustomPipeline.GetId()\n\t\t\tresources = append(resources, g.createResource(resourceName))\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *LogsCustomPipelineGenerator) createResource(logsCustomPipelineID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tlogsCustomPipelineID,\n\t\tfmt.Sprintf(\"logs_custom_pipeline_%s\", logsCustomPipelineID),\n\t\t\"datadog_logs_custom_pipeline\",\n\t\t\"datadog\",\n\t\tLogsCustomPipelineAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each custom pipeline create 1 TerraformResource.\n// Need LogsPipeline ID as ID for terraform resource\nfunc (g *LogsCustomPipelineGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewLogsPipelinesApi(datadogClient)\n\n\tresources := []terraformutils.Resource{}\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"logs_custom_pipeline\") {\n\t\t\tfor _, value := range filter.AcceptableValues {\n\t\t\t\tlogsCustomPipeline, _, err := api.GetLogsPipeline(auth, value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tresources = append(resources, g.createResource(logsCustomPipeline.GetId()))\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(resources) > 0 {\n\t\tg.Resources = resources\n\t\treturn nil\n\t}\n\n\tlogsCustomPipelines, _, err := api.ListLogsPipelines(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(logsCustomPipelines)\n\treturn nil\n}\n\nfunc (g *LogsCustomPipelineGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tfor k, v := range r.Item {\n\t\t\t// Hack to properly escape `%{` used in pipeline processors\n\t\t\tif k == \"processor\" {\n\t\t\t\tvar z interface{}\n\t\t\t\tjsonByte, err := json.Marshal(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tjsonByte = []byte(strings.ReplaceAll(string(jsonByte), \"%{\", \"%%{\"))\n\t\t\t\tif err = json.Unmarshal(jsonByte, &z); err != nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tg.Resources[i].Item[k] = z\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/logs_index.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// LogsIndexAllowEmptyValues ...\n\tLogsIndexAllowEmptyValues = []string{\"filter\"}\n)\n\n// LogsIndexGenerator ...\ntype LogsIndexGenerator struct {\n\tDatadogService\n}\n\nfunc (g *LogsIndexGenerator) createResources(logsIndexes []datadogV1.LogsIndex) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, logsIndex := range logsIndexes {\n\t\tresourceName := logsIndex.GetName()\n\t\tresources = append(resources, g.createResource(resourceName))\n\t}\n\n\treturn resources\n}\n\nfunc (g *LogsIndexGenerator) createResource(logsIndexName string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tlogsIndexName,\n\t\tfmt.Sprintf(\"logs_index_%s\", logsIndexName),\n\t\t\"datadog_logs_index\",\n\t\t\"datadog\",\n\t\tLogsIndexAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each index create 1 TerraformResource.\n// Need LogsIndex Name as ID for terraform resource\nfunc (g *LogsIndexGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewLogsIndexesApi(datadogClient)\n\n\tresources := []terraformutils.Resource{}\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"logs_index\") {\n\t\t\tfor _, value := range filter.AcceptableValues {\n\t\t\t\tlogsIndex, _, err := api.GetLogsIndex(auth, value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tresources = append(resources, g.createResource(logsIndex.GetName()))\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(resources) > 0 {\n\t\tg.Resources = resources\n\t\treturn nil\n\t}\n\n\tlogsIndexList, _, err := api.ListLogIndexes(auth)\n\tlogsIndex := logsIndexList.GetIndexes()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(logsIndex)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/logs_index_order.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// LogsIndexOrderAllowEmptyValues ...\n\tLogsIndexOrderAllowEmptyValues = []string{}\n)\n\n// LogsIndexOrderGenerator ...\ntype LogsIndexOrderGenerator struct {\n\tDatadogService\n}\n\n// InitResources Generate TerraformResources\nfunc (g *LogsIndexOrderGenerator) InitResources() error {\n\tcurrentDate := time.Now().Format(\"20060102150405\")\n\tresourceName := fmt.Sprintf(\"logs_index_order_%s\", currentDate)\n\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\tresourceName,\n\t\tresourceName,\n\t\t\"datadog_logs_index_order\",\n\t\t\"datadog\",\n\t\tmap[string]string{\n\t\t\t\"name\": resourceName,\n\t\t},\n\t\tLogsIndexOrderAllowEmptyValues,\n\t\tmap[string]interface{}{},\n\t))\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/logs_integration_pipeline.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// LogsIntegrationPipelineAllowEmptyValues ...\n\tLogsIntegrationPipelineAllowEmptyValues = []string{}\n)\n\n// LogsIntegrationPipelineGenerator ...\ntype LogsIntegrationPipelineGenerator struct {\n\tDatadogService\n}\n\nfunc (g *LogsIntegrationPipelineGenerator) createResources(logsIntegrationPipelines []datadogV1.LogsPipeline) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, logsIntegrationPipeline := range logsIntegrationPipelines {\n\t\t// Import logs integration pipelines only\n\t\tif logsIntegrationPipeline.GetIsReadOnly() {\n\t\t\tresourceID := logsIntegrationPipeline.GetId()\n\t\t\tresourceName := logsIntegrationPipeline.GetName()\n\t\t\tresources = append(resources, g.createResource(resourceID, resourceName))\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *LogsIntegrationPipelineGenerator) createResource(logsIntegrationPipelineID string, logsIntegrationPipelineName string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tlogsIntegrationPipelineID,\n\t\tlogsIntegrationPipelineName,\n\t\t\"datadog_logs_integration_pipeline\",\n\t\t\"datadog\",\n\t\tLogsIntegrationPipelineAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each integration pipeline create 1 TerraformResource.\n// Need LogsPipeline ID as ID for terraform resource\nfunc (g *LogsIntegrationPipelineGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewLogsPipelinesApi(datadogClient)\n\n\tlogsIntegrationPipelines, _, err := api.ListLogsPipelines(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(logsIntegrationPipelines)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/logs_metric.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// LogsMetricAllowEmptyValues ...\n\tLogsMetricAllowEmptyValues = []string{}\n)\n\n// LogsMetricGenerator ...\ntype LogsMetricGenerator struct {\n\tDatadogService\n}\n\nfunc (g *LogsMetricGenerator) createResources(logsMetrics []datadogV2.LogsMetricResponseData) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, logsMetric := range logsMetrics {\n\t\tresourceName := logsMetric.GetId()\n\t\tresources = append(resources, g.createResource(resourceName))\n\t}\n\n\treturn resources\n}\n\nfunc (g *LogsMetricGenerator) createResource(logsMetricName string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tlogsMetricName,\n\t\tfmt.Sprintf(\"logs_metric_%s\", logsMetricName),\n\t\t\"datadog_logs_metric\",\n\t\t\"datadog\",\n\t\tLogsMetricAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each log's metric create 1 TerraformResource.\n// Need LogsMetric Name as ID for terraform resource\nfunc (g *LogsMetricGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV2.NewLogsMetricsApi(datadogClient)\n\n\tresources := []terraformutils.Resource{}\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"logs_metric\") {\n\t\t\tfor _, value := range filter.AcceptableValues {\n\t\t\t\tlogsMetric, _, err := api.GetLogsMetric(auth, value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tresources = append(resources, g.createResource(logsMetric.Data.GetId()))\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(resources) > 0 {\n\t\tg.Resources = resources\n\t\treturn nil\n\t}\n\n\tlogsMetrics, _, err := api.ListLogsMetrics(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(logsMetrics.GetData())\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/logs_pipeline_order.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// LogsPipelineOrderAllowEmptyValues ...\n\tLogsPipelineOrderAllowEmptyValues = []string{}\n)\n\n// LogsPipelineOrderGenerator ...\ntype LogsPipelineOrderGenerator struct {\n\tDatadogService\n}\n\n// InitResources Generate TerraformResources\nfunc (g *LogsPipelineOrderGenerator) InitResources() error {\n\tcurrentDate := time.Now().Format(\"20060102150405\")\n\tresourceName := fmt.Sprintf(\"logs_pipeline_order_%s\", currentDate)\n\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\tresourceName,\n\t\tresourceName,\n\t\t\"datadog_logs_pipeline_order\",\n\t\t\"datadog\",\n\t\tmap[string]string{\n\t\t\t\"name\": resourceName,\n\t\t},\n\t\tLogsPipelineOrderAllowEmptyValues,\n\t\tmap[string]interface{}{},\n\t))\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/metric_metadata.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// MetricMetadataAllowEmptyValues ...\n\tMetricMetadataAllowEmptyValues = []string{}\n)\n\n// MetricMetadataGenerator ...\ntype MetricMetadataGenerator struct {\n\tDatadogService\n}\n\nfunc (g *MetricMetadataGenerator) createResource(metricName string) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tmetricName,\n\t\tfmt.Sprintf(\"metric_metadata_%s\", metricName),\n\t\t\"datadog_metric_metadata\",\n\t\t\"datadog\",\n\t\tmap[string]string{\n\t\t\t\"metric\": metricName,\n\t\t},\n\t\tMetricMetadataAllowEmptyValues,\n\t\tmap[string]interface{}{},\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each metric create 1 TerraformResource.\n// Need Metric Name as ID for terraform resource\nfunc (g *MetricMetadataGenerator) InitResources() error {\n\tresources := []terraformutils.Resource{}\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"metric_metadata\") {\n\t\t\tfor _, value := range filter.AcceptableValues {\n\t\t\t\tresources = append(resources, g.createResource(value))\n\t\t\t}\n\t\t}\n\t}\n\n\t// Collecting all metrics_metadata can be an expensive task.\n\t// Hence, only allow collections of metrics passed via filter\n\tif len(resources) == 0 {\n\t\tlog.Print(\"Filter(metric names as IDs) is required for importing datadog_metric_metadata resource\")\n\t\treturn nil\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/monitor.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// MonitorAllowEmptyValues ...\n\tMonitorAllowEmptyValues = []string{\"tags.\", \"message\"}\n)\n\n// MonitorGenerator ...\ntype MonitorGenerator struct {\n\tDatadogService\n}\n\nfunc (g *MonitorGenerator) createResources(monitors []datadogV1.Monitor) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, monitor := range monitors {\n\t\tif monitor.GetType() == datadogV1.MONITORTYPE_SYNTHETICS_ALERT {\n\t\t\tcontinue\n\t\t}\n\t\tresourceName := strconv.FormatInt(monitor.GetId(), 10)\n\t\tresources = append(resources, g.createResource(resourceName))\n\t}\n\n\treturn resources\n}\n\nfunc (g *MonitorGenerator) createResource(monitorID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tmonitorID,\n\t\tfmt.Sprintf(\"monitor_%s\", monitorID),\n\t\t\"datadog_monitor\",\n\t\t\"datadog\",\n\t\tMonitorAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each monitor create 1 TerraformResource.\n// Need Monitor ID as ID for terraform resource\nfunc (g *MonitorGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewMonitorsApi(datadogClient)\n\n\toptionalParams := datadogV1.NewListMonitorsOptionalParameters()\n\tresources := []terraformutils.Resource{}\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"monitor\") {\n\t\t\tfor _, value := range filter.AcceptableValues {\n\t\t\t\ti, err := strconv.ParseInt(value, 10, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tmonitor, _, err := api.GetMonitor(auth, i)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tresources = append(resources, g.createResource(strconv.FormatInt(monitor.GetId(), 10)))\n\t\t\t}\n\t\t}\n\t\tif filter.FieldPath == \"tags\" && filter.IsApplicable(\"monitor\") {\n\t\t\toptionalParams.WithMonitorTags(strings.Join(filter.AcceptableValues, \",\"))\n\t\t}\n\t}\n\n\tif len(resources) > 0 {\n\t\tg.Resources = resources\n\t\treturn nil\n\t}\n\n\tvar monitors []datadogV1.Monitor\n\tpageSize := int32(1000)\n\tpageNumber := int64(0)\n\tfor {\n\t\tresp, _, err := api.ListMonitors(auth, *optionalParams.\n\t\t\tWithPageSize(pageSize).\n\t\t\tWithPage(pageNumber))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(resp) == 0 || int32(len(resp)) < pageSize {\n\t\t\tmonitors = append(monitors, resp...)\n\t\t\tbreak\n\t\t}\n\n\t\tmonitors = append(monitors, resp...)\n\t\tpageNumber++\n\t}\n\n\tg.Resources = g.createResources(monitors)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/role.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// RoleAllowEmptyValues ...\n\tRoleAllowEmptyValues = []string{}\n)\n\n// RoleGenerator ...\ntype RoleGenerator struct {\n\tDatadogService\n}\n\nfunc (g *RoleGenerator) createResources(roles []datadogV2.Role) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, role := range roles {\n\t\tresourceName := role.GetId()\n\t\tresource := g.createResource(resourceName)\n\t\tresource.IgnoreKeys = append(resource.IgnoreKeys, \"permission.([0-9]+).name\")\n\t\tresources = append(resources, resource)\n\t}\n\n\treturn resources\n}\n\nfunc (g *RoleGenerator) createResource(roleID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\troleID,\n\t\tfmt.Sprintf(\"role_%s\", roleID),\n\t\t\"datadog_role\",\n\t\t\"datadog\",\n\t\tRoleAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each role create 1 TerraformResource.\n// Need Role ID as ID for terraform resource\nfunc (g *RoleGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV2.NewRolesApi(datadogClient)\n\n\tpageSize := int64(100)\n\tpageNumber := int64(0)\n\tremaining := int64(1)\n\n\tvar roles []datadogV2.Role\n\tfor remaining > int64(0) {\n\t\tresp, _, err := api.ListRoles(auth, *datadogV2.NewListRolesOptionalParameters().\n\t\t\tWithPageSize(pageSize).\n\t\t\tWithPageNumber(pageNumber))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\troles = append(roles, resp.GetData()...)\n\n\t\tremaining = resp.Meta.Page.GetTotalCount() - pageSize*(pageNumber+1)\n\t\tpageNumber++\n\t}\n\n\tg.Resources = g.createResources(roles)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/security_monitoring_default_rule.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// SecurityMonitoringDefaultRuleAllowEmptyValues ...\n\tSecurityMonitoringDefaultRuleAllowEmptyValues = []string{\"tags.\"}\n)\n\n// SecurityMonitoringDefaultRuleGenerator ...\ntype SecurityMonitoringDefaultRuleGenerator struct {\n\tDatadogService\n}\n\nfunc (g *SecurityMonitoringDefaultRuleGenerator) createResources(rulesResponse []datadogV2.SecurityMonitoringRuleResponse) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, rule := range rulesResponse {\n\t\tif rule.SecurityMonitoringSignalRuleResponse != nil {\n\t\t\tif rule.SecurityMonitoringSignalRuleResponse.GetIsDefault() {\n\t\t\t\tresourceName := rule.SecurityMonitoringSignalRuleResponse.GetId()\n\t\t\t\tresources = append(resources, g.createResource(resourceName))\n\t\t\t}\n\t\t}\n\n\t\tif rule.SecurityMonitoringStandardRuleResponse != nil {\n\t\t\tif rule.SecurityMonitoringStandardRuleResponse.GetIsDefault() {\n\t\t\t\tresourceName := rule.SecurityMonitoringStandardRuleResponse.GetId()\n\t\t\t\tresources = append(resources, g.createResource(resourceName))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *SecurityMonitoringDefaultRuleGenerator) createResource(ruleID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\truleID,\n\t\tfmt.Sprintf(\"security_monitoring_default_rule_%s\", ruleID),\n\t\t\"datadog_security_monitoring_default_rule\",\n\t\t\"datadog\",\n\t\tSecurityMonitoringDefaultRuleAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each SecurityMonitoringDefaultRule create 1 TerraformResource.\n// Need SecurityMonitoringDefaultRule ID as ID for terraform resource\nfunc (g *SecurityMonitoringDefaultRuleGenerator) InitResources() error {\n\tvar securityMonitoringRuleResponses []datadogV2.SecurityMonitoringRuleResponse\n\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV2.NewSecurityMonitoringApi(datadogClient)\n\n\tpageSize := int64(1000)\n\tpageNumber := int64(0)\n\tremaining := int64(1)\n\n\tfor remaining > int64(0) {\n\t\tresp, _, err := api.ListSecurityMonitoringRules(auth,\n\t\t\t*datadogV2.NewListSecurityMonitoringRulesOptionalParameters().\n\t\t\t\tWithPageSize(pageSize).\n\t\t\t\tWithPageNumber(pageNumber))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsecurityMonitoringRuleResponses = append(securityMonitoringRuleResponses, resp.GetData()...)\n\n\t\tremaining = resp.Meta.Page.GetTotalCount() - pageSize*(pageNumber+1)\n\t\tpageNumber++\n\t}\n\n\tg.Resources = g.createResources(securityMonitoringRuleResponses)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/security_monitoring_rule.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"strconv\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// SecurityMonitoringRuleAllowEmptyValues ...\n\tSecurityMonitoringRuleAllowEmptyValues = []string{\"tags.\"}\n)\n\n// SecurityMonitoringRuleGenerator ...\ntype SecurityMonitoringRuleGenerator struct {\n\tDatadogService\n}\n\nfunc (g *SecurityMonitoringRuleGenerator) createResources(rulesResponse []datadogV2.SecurityMonitoringRuleResponse) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, rule := range rulesResponse {\n\t\tif rule.SecurityMonitoringSignalRuleResponse != nil {\n\t\t\tif !rule.SecurityMonitoringSignalRuleResponse.GetIsDefault() {\n\t\t\t\tresourceName := rule.SecurityMonitoringSignalRuleResponse.GetId()\n\t\t\t\tresources = append(resources, g.createResource(resourceName, rule.SecurityMonitoringSignalRuleResponse.GetIsEnabled()))\n\t\t\t}\n\t\t}\n\t\tif rule.SecurityMonitoringStandardRuleResponse != nil {\n\t\t\tif !rule.SecurityMonitoringStandardRuleResponse.GetIsDefault() {\n\t\t\t\tresourceName := rule.SecurityMonitoringStandardRuleResponse.GetId()\n\t\t\t\tresources = append(resources, g.createResource(resourceName, rule.SecurityMonitoringStandardRuleResponse.GetIsEnabled()))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *SecurityMonitoringRuleGenerator) createResource(ruleID string, ruleEnabled bool) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\truleID,\n\t\tfmt.Sprintf(\"security_monitoring_rule_%s\", ruleID),\n\t\t\"datadog_security_monitoring_rule\",\n\t\t\"datadog\",\n\t\tmap[string]string{\n\t\t\t\"enabled\": strconv.FormatBool(ruleEnabled),\n\t\t},\n\t\tSecurityMonitoringRuleAllowEmptyValues,\n\t\tmap[string]interface{}{},\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each SecurityMonitoringRule create 1 TerraformResource.\n// Need SecurityMonitoringRule ID as ID for terraform resource\nfunc (g *SecurityMonitoringRuleGenerator) InitResources() error {\n\tvar securityMonitoringRuleResponses []datadogV2.SecurityMonitoringRuleResponse\n\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV2.NewSecurityMonitoringApi(datadogClient)\n\n\tpageSize := int64(1000)\n\tpageNumber := int64(0)\n\tremaining := int64(1)\n\n\tfor remaining > int64(0) {\n\t\tresp, _, err := api.ListSecurityMonitoringRules(auth,\n\t\t\t*datadogV2.NewListSecurityMonitoringRulesOptionalParameters().\n\t\t\t\tWithPageNumber(pageNumber).\n\t\t\t\tWithPageSize(pageSize))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsecurityMonitoringRuleResponses = append(securityMonitoringRuleResponses, resp.GetData()...)\n\n\t\tremaining = resp.Meta.Page.GetTotalCount() - pageSize*(pageNumber+1)\n\t\tpageNumber++\n\t}\n\n\tg.Resources = g.createResources(securityMonitoringRuleResponses)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/service_level_objective.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// ServiceLevelObjectiveAllowEmptyValues ...\n\tServiceLevelObjectiveAllowEmptyValues = []string{\"tags.\"}\n)\n\n// ServiceLevelObjectiveGenerator ...\ntype ServiceLevelObjectiveGenerator struct {\n\tDatadogService\n}\n\nfunc (g *ServiceLevelObjectiveGenerator) createResources(sloList []datadogV1.ServiceLevelObjective) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, slo := range sloList {\n\t\tresourceID := slo.GetId()\n\t\tresources = append(resources, g.createResource(resourceID))\n\t}\n\n\treturn resources\n}\n\nfunc (g *ServiceLevelObjectiveGenerator) createResource(sloID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tsloID,\n\t\tfmt.Sprintf(\"service_level_objective_%s\", sloID),\n\t\t\"datadog_service_level_objective\",\n\t\t\"datadog\",\n\t\tServiceLevelObjectiveAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each service_level_objective create 1 TerraformResource.\n// Need ServiceLevelObjective ID as ID for terraform resource\nfunc (g *ServiceLevelObjectiveGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewServiceLevelObjectivesApi(datadogClient)\n\n\tvar slos []datadogV1.ServiceLevelObjective\n\tresp, _, err := api.ListSLOs(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tslos = append(slos, resp.GetData()...)\n\tg.Resources = g.createResources(slos)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/synthetics_global_variable.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// SyntheticsGlobalVariableAllowEmptyValues ...\n\tSyntheticsGlobalVariableAllowEmptyValues = []string{\"tags.\"}\n)\n\n// SyntheticsGlobalVariableGenerator ...\ntype SyntheticsGlobalVariableGenerator struct {\n\tDatadogService\n}\n\nfunc (g *SyntheticsGlobalVariableGenerator) createResources(globalVariables []datadogV1.SyntheticsGlobalVariable) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, globalVariable := range globalVariables {\n\t\tresourceID := globalVariable.GetId()\n\t\tresources = append(resources, g.createResource(resourceID))\n\t}\n\n\treturn resources\n}\n\nfunc (g *SyntheticsGlobalVariableGenerator) createResource(globalVariableID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tglobalVariableID,\n\t\tfmt.Sprintf(\"synthetics_global_variable_%s\", globalVariableID),\n\t\t\"datadog_synthetics_global_variable\",\n\t\t\"datadog\",\n\t\tSyntheticsGlobalVariableAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each SyntheticsGlobalVariable create 1 TerraformResource.\n// Need SyntheticsGlobalVariable ID as ID for terraform resource\nfunc (g *SyntheticsGlobalVariableGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewSyntheticsApi(datadogClient)\n\n\tvar globalVariableIDs []datadogV1.SyntheticsGlobalVariable\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"synthetics_global_variable\") {\n\t\t\tfor _, v := range filter.AcceptableValues {\n\t\t\t\tresp, _, err := api.GetGlobalVariable(auth, v)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"error retrieving synthetics gloval variable with id:%s - %s\", v, err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tglobalVariableIDs = append(globalVariableIDs, resp)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(globalVariableIDs) == 0 {\n\t\tlog.Print(\"Filter(Synthetics Global Variable IDs) is required for importing datadog_synthetics_global_variable resource\")\n\t\treturn nil\n\t}\n\n\tg.Resources = g.createResources(globalVariableIDs)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/synthetics_private_location.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"regexp\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// SyntheticsPrivateLocationAllowEmptyValues ...\n\tSyntheticsPrivateLocationAllowEmptyValues = []string{\"tags.\"}\n\tplIDRegex                                 = regexp.MustCompile(\"^pl:.*\")\n)\n\n// SyntheticsPrivateLocationGenerator ...\ntype SyntheticsPrivateLocationGenerator struct {\n\tDatadogService\n}\n\nfunc (g *SyntheticsPrivateLocationGenerator) createResources(locations []datadogV1.SyntheticsLocation) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, location := range locations {\n\t\tlocationID := location.GetId()\n\t\tif plIDRegex.MatchString(locationID) {\n\t\t\tresources = append(resources, g.createResource(locationID))\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *SyntheticsPrivateLocationGenerator) createResource(plID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tplID,\n\t\tfmt.Sprintf(\"synthetics_private_location_%s\", plID),\n\t\t\"datadog_synthetics_private_location\",\n\t\t\"datadog\",\n\t\tSyntheticsPrivateLocationAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each SyntheticsPrivateLocation create 1 TerraformResource.\n// Need SyntheticsPrivateLocation ID as ID for terraform resource\nfunc (g *SyntheticsPrivateLocationGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewSyntheticsApi(datadogClient)\n\n\tdata, _, err := api.ListLocations(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(data.GetLocations())\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/synthetics_test_.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar (\n\t// SyntheticsAllowEmptyValues ...\n\tSyntheticsAllowEmptyValues = []string{\"tags.\"}\n)\n\n// SyntheticsTestGenerator ...\ntype SyntheticsTestGenerator struct {\n\tDatadogService\n}\n\nfunc (g *SyntheticsTestGenerator) createResources(syntheticsList []datadogV1.SyntheticsTestDetails) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, synthetics := range syntheticsList {\n\t\tresourceName := synthetics.GetPublicId()\n\t\tresources = append(resources, g.createResource(resourceName))\n\t}\n\n\treturn resources\n}\n\nfunc (g *SyntheticsTestGenerator) createResource(syntheticsID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tsyntheticsID,\n\t\tfmt.Sprintf(\"synthetics_%s\", syntheticsID),\n\t\t\"datadog_synthetics_test\",\n\t\t\"datadog\",\n\t\tSyntheticsAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each synthetics create 1 TerraformResource.\n// Need Synthetics ID as ID for terraform resource\nfunc (g *SyntheticsTestGenerator) InitResources() error {\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV1.NewSyntheticsApi(datadogClient)\n\n\tresources := []terraformutils.Resource{}\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"synthetics_test\") {\n\t\t\tfor _, value := range filter.AcceptableValues {\n\t\t\t\tsyntheticsTest, _, err := api.GetTest(auth, value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tresources = append(resources, g.createResource(syntheticsTest.GetPublicId()))\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(resources) > 0 {\n\t\tg.Resources = resources\n\t\treturn nil\n\t}\n\n\tsyntheticsTests, _, err := api.ListTests(auth)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(syntheticsTests.GetTests())\n\treturn nil\n}\n"
  },
  {
    "path": "providers/datadog/user.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datadog\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadog\"\n\t\"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2\"\n)\n\nvar (\n\t// UserAllowEmptyValues ...\n\tUserAllowEmptyValues = []string{}\n)\n\n// UserGenerator ...\ntype UserGenerator struct {\n\tDatadogService\n}\n\nfunc (g *UserGenerator) createResources(users []datadogV2.User) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, user := range users {\n\t\trelations := user.GetRelationships()\n\t\troles := relations.GetRoles()\n\t\t// If no roles are present, we can assume user was created via the V1 API\n\t\t// Hence, import the user via their handle\n\t\tif len(roles.GetData()) == 0 {\n\t\t\tattr := user.GetAttributes()\n\t\t\tresources = append(resources, g.createResource(attr.GetHandle()))\n\t\t\tcontinue\n\t\t}\n\n\t\tresources = append(resources, g.createResource(user.GetId()))\n\t}\n\treturn resources\n}\n\nfunc (g *UserGenerator) createResource(userID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tuserID,\n\t\tfmt.Sprintf(\"user_%s\", userID),\n\t\t\"datadog_user\",\n\t\t\"datadog\",\n\t\tUserAllowEmptyValues,\n\t)\n}\n\n// InitResources Generate TerraformResources from Datadog API,\n// from each user create 1 TerraformResource.\n// Need User ID as ID for terraform resource\nfunc (g *UserGenerator) InitResources() error {\n\tvar users []datadogV2.User\n\tdatadogClient := g.Args[\"datadogClient\"].(*datadog.APIClient)\n\tauth := g.Args[\"auth\"].(context.Context)\n\tapi := datadogV2.NewUsersApi(datadogClient)\n\n\tpageSize := int64(1000)\n\tpageNumber := int64(0)\n\tremaining := int64(1)\n\toptionalParams := datadogV2.NewListUsersOptionalParameters()\n\tfor _, filter := range g.Filter {\n\t\tif filter.IsApplicable(\"user\") && filter.FieldPath == \"disabled\" {\n\t\t\tif len(filter.AcceptableValues) == 1 && strings.ToLower(filter.AcceptableValues[0]) == \"false\" {\n\t\t\t\toptionalParams = optionalParams.WithFilterStatus(\"Active,Pending\")\n\t\t\t}\n\t\t}\n\t}\n\n\tfor remaining > int64(0) {\n\t\tresp, _, err := api.ListUsers(auth, *optionalParams.\n\t\t\tWithPageSize(pageSize).\n\t\t\tWithPageNumber(pageNumber))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tusers = append(users, resp.GetData()...)\n\n\t\tremaining = resp.Meta.Page.GetTotalCount() - pageSize*(pageNumber+1)\n\t\tpageNumber++\n\t}\n\n\tg.Resources = g.createResources(users)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/cdn.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype CDNGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g CDNGenerator) listCDNs(ctx context.Context, client *godo.Client) ([]godo.CDN, error) {\n\tlist := []godo.CDN{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tcdns, resp, err := client.CDNs.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, cdns...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g CDNGenerator) createResources(cdnList []godo.CDN) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, cdn := range cdnList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tcdn.ID,\n\t\t\tcdn.ID,\n\t\t\t\"digitalocean_cdn\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *CDNGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listCDNs(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/certificate.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype CertificateGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g CertificateGenerator) listCertificates(ctx context.Context, client *godo.Client) ([]godo.Certificate, error) {\n\tlist := []godo.Certificate{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tcertificates, resp, err := client.Certificates.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, certificates...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g CertificateGenerator) createResources(certificateList []godo.Certificate) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, certificate := range certificateList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tcertificate.ID,\n\t\t\tcertificate.Name,\n\t\t\t\"digitalocean_certificate\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *CertificateGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listCertificates(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/database_cluster.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype DatabaseClusterGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g *DatabaseClusterGenerator) loadDatabaseClusters(ctx context.Context, client *godo.Client) ([]godo.Database, error) {\n\tlist := []godo.Database{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tclusters, resp, err := client.Databases.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, cluster := range clusters {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tcluster.ID,\n\t\t\t\tcluster.Name,\n\t\t\t\t\"digitalocean_database_cluster\",\n\t\t\t\t\"digitalocean\",\n\t\t\t\t[]string{}))\n\t\t\tlist = append(list, cluster)\n\t\t}\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g *DatabaseClusterGenerator) loadDatabaseConnectionPools(ctx context.Context, client *godo.Client, clusterID string) error {\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tpools, resp, err := client.Databases.ListPools(ctx, clusterID, opt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, pool := range pools {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%s/%s\", clusterID, pool.Name),\n\t\t\t\tpool.Name,\n\t\t\t\t\"digitalocean_database_connection_pool\",\n\t\t\t\t\"digitalocean\",\n\t\t\t\t[]string{}))\n\t\t}\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn nil\n}\n\nfunc (g *DatabaseClusterGenerator) loadDatabaseDBs(ctx context.Context, client *godo.Client, clusterID string) error {\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tdbs, resp, err := client.Databases.ListDBs(ctx, clusterID, opt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, db := range dbs {\n\t\t\t// skip default database created by the digitalocean database cluster\n\t\t\tif db.Name != \"defaultdb\" {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\tdb.Name,\n\t\t\t\t\tdb.Name,\n\t\t\t\t\t\"digitalocean_database_db\",\n\t\t\t\t\t\"digitalocean\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"cluster_id\": clusterID,\n\t\t\t\t\t\t\"name\":       db.Name,\n\t\t\t\t\t},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t}\n\t\t}\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn nil\n}\n\nfunc (g *DatabaseClusterGenerator) loadDatabaseReplicas(ctx context.Context, client *godo.Client, clusterID string) error {\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\treplicas, resp, err := client.Databases.ListReplicas(ctx, clusterID, opt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, replica := range replicas {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\treplica.Name,\n\t\t\t\treplica.Name,\n\t\t\t\t\"digitalocean_database_replica\",\n\t\t\t\t\"digitalocean\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"cluster_id\": clusterID,\n\t\t\t\t\t\"name\":       replica.Name,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn nil\n}\n\nfunc (g *DatabaseClusterGenerator) loadDatabaseUsers(ctx context.Context, client *godo.Client, clusterID string) error {\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tusers, resp, err := client.Databases.ListUsers(ctx, clusterID, opt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, user := range users {\n\t\t\t// skip default user created by the digitalocean database cluster\n\t\t\tif user.Name != \"doadmin\" {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\tuser.Name,\n\t\t\t\t\tuser.Name,\n\t\t\t\t\t\"digitalocean_database_user\",\n\t\t\t\t\t\"digitalocean\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"cluster_id\": clusterID,\n\t\t\t\t\t\t\"name\":       user.Name,\n\t\t\t\t\t},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t}\n\t\t}\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn nil\n}\n\nfunc (g *DatabaseClusterGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tclusters, err := g.loadDatabaseClusters(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, cluster := range clusters {\n\t\terr := g.loadDatabaseConnectionPools(context.TODO(), client, cluster.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = g.loadDatabaseDBs(context.TODO(), client, cluster.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = g.loadDatabaseReplicas(context.TODO(), client, cluster.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = g.loadDatabaseUsers(context.TODO(), client, cluster.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/digitalocean_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype DigitalOceanProvider struct { //nolint\n\tterraformutils.Provider\n\ttoken string\n}\n\nfunc (p *DigitalOceanProvider) Init(args []string) error {\n\tif os.Getenv(\"DIGITALOCEAN_TOKEN\") == \"\" {\n\t\treturn errors.New(\"set DIGITALOCEAN_TOKEN env var\")\n\t}\n\tp.token = os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n\treturn nil\n}\n\nfunc (p *DigitalOceanProvider) GetName() string {\n\treturn \"digitalocean\"\n}\n\nfunc (p *DigitalOceanProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (DigitalOceanProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *DigitalOceanProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"cdn\":                &CDNGenerator{},\n\t\t\"certificate\":        &CertificateGenerator{},\n\t\t\"database_cluster\":   &DatabaseClusterGenerator{},\n\t\t\"domain\":             &DomainGenerator{},\n\t\t\"droplet\":            &DropletGenerator{},\n\t\t\"droplet_snapshot\":   &DropletSnapshotGenerator{},\n\t\t\"firewall\":           &FirewallGenerator{},\n\t\t\"floating_ip\":        &FloatingIPGenerator{},\n\t\t\"kubernetes_cluster\": &KubernetesClusterGenerator{},\n\t\t\"loadbalancer\":       &LoadBalancerGenerator{},\n\t\t\"project\":            &ProjectGenerator{},\n\t\t\"ssh_key\":            &SSHKeyGenerator{},\n\t\t\"tag\":                &TagGenerator{},\n\t\t\"volume\":             &VolumeGenerator{},\n\t\t\"volume_snapshot\":    &VolumeSnapshotGenerator{},\n\t\t\"vpc\":                &VPCGenerator{},\n\t}\n}\n\nfunc (p *DigitalOceanProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"digitalocean: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"token\": p.token,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/digitalocean_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n\t\"golang.org/x/oauth2\"\n)\n\ntype DigitalOceanService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *DigitalOceanService) generateClient() *godo.Client {\n\ttokenSource := &TokenSource{\n\t\tAccessToken: s.Args[\"token\"].(string),\n\t}\n\toauthClient := oauth2.NewClient(context.Background(), tokenSource)\n\tclient := godo.NewClient(oauthClient)\n\treturn client\n}\n"
  },
  {
    "path": "providers/digitalocean/domain.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype DomainGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g *DomainGenerator) loadDomains(ctx context.Context, client *godo.Client) ([]godo.Domain, error) {\n\tlist := []godo.Domain{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tdomains, resp, err := client.Domains.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, domain := range domains {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tdomain.Name,\n\t\t\t\tdomain.Name,\n\t\t\t\t\"digitalocean_domain\",\n\t\t\t\t\"digitalocean\",\n\t\t\t\t[]string{}))\n\t\t\tlist = append(list, domain)\n\t\t}\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g *DomainGenerator) loadRecords(ctx context.Context, client *godo.Client, domain string) error {\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\trecords, resp, err := client.Domains.Records(ctx, domain, opt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, record := range records {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tstrconv.Itoa(record.ID),\n\t\t\t\tstrconv.Itoa(record.ID),\n\t\t\t\t\"digitalocean_record\",\n\t\t\t\t\"digitalocean\",\n\t\t\t\tmap[string]string{\"domain\": domain},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn nil\n}\n\nfunc (g *DomainGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tdomains, err := g.loadDomains(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, domain := range domains {\n\t\terr := g.loadRecords(context.TODO(), client, domain.Name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/droplet.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype DropletGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g DropletGenerator) listDroplets(ctx context.Context, client *godo.Client) ([]godo.Droplet, error) {\n\tlist := []godo.Droplet{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tdroplets, resp, err := client.Droplets.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, droplets...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g DropletGenerator) createResources(dropletList []godo.Droplet) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, droplet := range dropletList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tstrconv.Itoa(droplet.ID),\n\t\t\tdroplet.Name,\n\t\t\t\"digitalocean_droplet\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *DropletGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listDroplets(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/droplet_snapshot.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype DropletSnapshotGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g DropletSnapshotGenerator) listDropletSnapshots(ctx context.Context, client *godo.Client) ([]godo.Snapshot, error) {\n\tlist := []godo.Snapshot{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tsnapshots, resp, err := client.Snapshots.ListDroplet(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, snapshots...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g DropletSnapshotGenerator) createResources(snapshotList []godo.Snapshot) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, snapshot := range snapshotList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tsnapshot.ID,\n\t\t\tsnapshot.Name,\n\t\t\t\"digitalocean_droplet_snapshot\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *DropletSnapshotGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listDropletSnapshots(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/firewall.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype FirewallGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g FirewallGenerator) listFirewalls(ctx context.Context, client *godo.Client) ([]godo.Firewall, error) {\n\tlist := []godo.Firewall{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tfirewalls, resp, err := client.Firewalls.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, firewalls...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g FirewallGenerator) createResources(firewallList []godo.Firewall) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, firewall := range firewallList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tfirewall.ID,\n\t\t\tfirewall.Name,\n\t\t\t\"digitalocean_firewall\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *FirewallGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listFirewalls(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/floating_ip.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype FloatingIPGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g FloatingIPGenerator) listFloatingIPs(ctx context.Context, client *godo.Client) ([]godo.FloatingIP, error) {\n\tlist := []godo.FloatingIP{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tfloatingIPs, resp, err := client.FloatingIPs.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, floatingIPs...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g FloatingIPGenerator) createResources(floatingIPList []godo.FloatingIP) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, floatingIP := range floatingIPList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tfloatingIP.IP,\n\t\t\tfloatingIP.IP,\n\t\t\t\"digitalocean_floating_ip\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *FloatingIPGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listFloatingIPs(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/kubernetes_cluster.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\n// the default node pool has a custom tag added by terraform\nconst digitaloceanKubernetesDefaultNodePoolTag = \"terraform:default-node-pool\"\n\ntype KubernetesClusterGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g *KubernetesClusterGenerator) loadKubernetesClusters(ctx context.Context, client *godo.Client) ([]*godo.KubernetesCluster, error) {\n\tlist := []*godo.KubernetesCluster{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tclusters, resp, err := client.Kubernetes.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, cluster := range clusters {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tcluster.ID,\n\t\t\t\tcluster.Name,\n\t\t\t\t\"digitalocean_kubernetes_cluster\",\n\t\t\t\t\"digitalocean\",\n\t\t\t\t[]string{}))\n\t\t\tlist = append(list, cluster)\n\t\t}\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g *KubernetesClusterGenerator) loadKubernetesNodePools(cluster *godo.KubernetesCluster) {\n\tfor _, nodePool := range cluster.NodePools {\n\t\tisDefaultPool := false\n\t\tfor _, tag := range nodePool.Tags {\n\t\t\tif tag == digitaloceanKubernetesDefaultNodePoolTag {\n\t\t\t\tisDefaultPool = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// skip default node pool since it is included in the digitalocean_kubernetes_cluster resource\n\t\tif !isDefaultPool {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tnodePool.ID,\n\t\t\t\tnodePool.Name,\n\t\t\t\t\"digitalocean_kubernetes_node_pool\",\n\t\t\t\t\"digitalocean\",\n\t\t\t\tmap[string]string{\"cluster_id\": cluster.ID},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n}\n\nfunc (g *KubernetesClusterGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tclusters, err := g.loadKubernetesClusters(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, cluster := range clusters {\n\t\tg.loadKubernetesNodePools(cluster)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/loadbalancer.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype LoadBalancerGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g LoadBalancerGenerator) listLoadBalancers(ctx context.Context, client *godo.Client) ([]godo.LoadBalancer, error) {\n\tlist := []godo.LoadBalancer{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tloadBalancers, resp, err := client.LoadBalancers.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, loadBalancers...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g LoadBalancerGenerator) createResources(loadBalancerList []godo.LoadBalancer) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, loadBalancer := range loadBalancerList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tloadBalancer.ID,\n\t\t\tloadBalancer.Name,\n\t\t\t\"digitalocean_loadbalancer\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *LoadBalancerGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listLoadBalancers(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/project.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype ProjectGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g ProjectGenerator) listProjects(ctx context.Context, client *godo.Client) ([]godo.Project, error) {\n\tlist := []godo.Project{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tprojects, resp, err := client.Projects.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, projects...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g ProjectGenerator) createResources(projectList []godo.Project) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, project := range projectList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tproject.ID,\n\t\t\tproject.Name,\n\t\t\t\"digitalocean_project\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *ProjectGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listProjects(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/ssh_key.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype SSHKeyGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g SSHKeyGenerator) listKeys(ctx context.Context, client *godo.Client) ([]godo.Key, error) {\n\tlist := []godo.Key{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tkeys, resp, err := client.Keys.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, keys...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g SSHKeyGenerator) createResources(keyList []godo.Key) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, key := range keyList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tstrconv.Itoa(key.ID),\n\t\t\tkey.Name,\n\t\t\t\"digitalocean_ssh_key\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *SSHKeyGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listKeys(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/tag.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype TagGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g TagGenerator) listTags(ctx context.Context, client *godo.Client) ([]godo.Tag, error) {\n\tlist := []godo.Tag{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\ttags, resp, err := client.Tags.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, tags...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g TagGenerator) createResources(tagList []godo.Tag) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, tag := range tagList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\ttag.Name,\n\t\t\ttag.Name,\n\t\t\t\"digitalocean_tag\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *TagGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listTags(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/token_source.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport \"golang.org/x/oauth2\"\n\ntype TokenSource struct {\n\tAccessToken string\n}\n\nfunc (t *TokenSource) Token() (*oauth2.Token, error) {\n\ttoken := &oauth2.Token{\n\t\tAccessToken: t.AccessToken,\n\t}\n\treturn token, nil\n}\n"
  },
  {
    "path": "providers/digitalocean/volume.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype VolumeGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g VolumeGenerator) listVolumes(ctx context.Context, client *godo.Client) ([]godo.Volume, error) {\n\tlist := []godo.Volume{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListVolumeParams{}\n\tfor {\n\t\tvolumes, resp, err := client.Storage.ListVolumes(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, volumes...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.ListOptions.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g VolumeGenerator) createResources(volumeList []godo.Volume) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, volume := range volumeList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tvolume.ID,\n\t\t\tvolume.Name,\n\t\t\t\"digitalocean_volume\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *VolumeGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listVolumes(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/volume_snapshot.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype VolumeSnapshotGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g VolumeSnapshotGenerator) listVolumeSnapshots(ctx context.Context, client *godo.Client) ([]godo.Snapshot, error) {\n\tlist := []godo.Snapshot{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tsnapshots, resp, err := client.Snapshots.ListVolume(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, snapshots...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g VolumeSnapshotGenerator) createResources(snapshotList []godo.Snapshot) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, snapshot := range snapshotList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tsnapshot.ID,\n\t\t\tsnapshot.Name,\n\t\t\t\"digitalocean_volume_snapshot\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *VolumeSnapshotGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listVolumeSnapshots(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/digitalocean/vpc.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage digitalocean\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/digitalocean/godo\"\n)\n\ntype VPCGenerator struct {\n\tDigitalOceanService\n}\n\nfunc (g VPCGenerator) listVPCs(ctx context.Context, client *godo.Client) ([]*godo.VPC, error) {\n\tlist := []*godo.VPC{}\n\n\t// create options. initially, these will be blank\n\topt := &godo.ListOptions{}\n\tfor {\n\t\tvpcs, resp, err := client.VPCs.List(ctx, opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tlist = append(list, vpcs...)\n\n\t\t// if we are at the last page, break out the for loop\n\t\tif resp.Links == nil || resp.Links.IsLastPage() {\n\t\t\tbreak\n\t\t}\n\n\t\tpage, err := resp.Links.CurrentPage()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// set the page we want for the next request\n\t\topt.Page = page + 1\n\t}\n\n\treturn list, nil\n}\n\nfunc (g VPCGenerator) createResources(vpcList []*godo.VPC) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, vpc := range vpcList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tvpc.ID,\n\t\t\tvpc.Name,\n\t\t\t\"digitalocean_vpc\",\n\t\t\t\"digitalocean\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *VPCGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listVPCs(context.TODO(), client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/equinixmetal/device.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage equinixmetal\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/packethost/packngo\"\n)\n\ntype DeviceGenerator struct {\n\tEquinixMetalService\n}\n\nfunc (g DeviceGenerator) listDevices(client *packngo.Client) ([]packngo.Device, error) {\n\tdevices, _, err := client.Devices.List(g.GetArgs()[\"project_id\"].(string), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn devices, nil\n}\n\nfunc (g DeviceGenerator) createResources(deviceList []packngo.Device) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, device := range deviceList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tdevice.ID,\n\t\t\tdevice.Hostname,\n\t\t\t\"metal_device\",\n\t\t\t\"equinixmetal\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *DeviceGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listDevices(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/equinixmetal/equinixmetal_provider.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage equinixmetal\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype EquinixMetalProvider struct { //nolint\n\tterraformutils.Provider\n\tauthToken string\n\tprojectID string\n}\n\nfunc (p *EquinixMetalProvider) Init(args []string) error {\n\tif os.Getenv(\"PACKET_AUTH_TOKEN\") == \"\" {\n\t\treturn errors.New(\"set PACKET_AUTH_TOKEN env var\")\n\t}\n\tp.authToken = os.Getenv(\"PACKET_AUTH_TOKEN\")\n\n\tif os.Getenv(\"METAL_PROJECT_ID\") == \"\" {\n\t\treturn errors.New(\"set METAL_PROJECT_ID env var\")\n\t}\n\tp.projectID = os.Getenv(\"METAL_PROJECT_ID\")\n\n\treturn nil\n}\n\nfunc (p *EquinixMetalProvider) GetName() string {\n\treturn \"metal\"\n}\n\nfunc (p *EquinixMetalProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (EquinixMetalProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *EquinixMetalProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"device\":            &DeviceGenerator{},\n\t\t\"sshkey\":            &SSHKeyGenerator{},\n\t\t\"spotmarketrequest\": &SpotMarketRequestGenerator{},\n\t\t\"volume\":            &VolumeGenerator{},\n\t}\n}\n\nfunc (p *EquinixMetalProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"equinixmetal: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"auth_token\": p.authToken,\n\t\t\"project_id\": p.projectID,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/equinixmetal/equinixmetal_service.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage equinixmetal\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/packethost/packngo\"\n)\n\ntype EquinixMetalService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *EquinixMetalService) generateClient() *packngo.Client {\n\tclient, _ := packngo.NewClient()\n\treturn client\n}\n"
  },
  {
    "path": "providers/equinixmetal/spot_market_request.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage equinixmetal\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/packethost/packngo\"\n)\n\ntype SpotMarketRequestGenerator struct {\n\tEquinixMetalService\n}\n\nfunc (g SpotMarketRequestGenerator) listSpotMarketRequests(client *packngo.Client) ([]packngo.SpotMarketRequest, error) {\n\tspotMarketRequests, _, err := client.SpotMarketRequests.List(g.GetArgs()[\"project_id\"].(string), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn spotMarketRequests, nil\n}\n\nfunc (g SpotMarketRequestGenerator) createResources(spotMarketRequestsList []packngo.SpotMarketRequest) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, spotMarketRequests := range spotMarketRequestsList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tspotMarketRequests.ID,\n\t\t\tspotMarketRequests.ID,\n\t\t\t\"metal_spot_market_request\",\n\t\t\t\"equinixmetal\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *SpotMarketRequestGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listSpotMarketRequests(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/equinixmetal/ssh_key.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage equinixmetal\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/packethost/packngo\"\n)\n\ntype SSHKeyGenerator struct {\n\tEquinixMetalService\n}\n\nfunc (g SSHKeyGenerator) listSSHKeys(client *packngo.Client) ([]packngo.SSHKey, error) {\n\tsshKeys, _, err := client.SSHKeys.List()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn sshKeys, nil\n}\n\nfunc (g SSHKeyGenerator) createResources(sshLeyList []packngo.SSHKey) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, sshKey := range sshLeyList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tsshKey.ID,\n\t\t\tsshKey.Label,\n\t\t\t\"metal_ssh_key\",\n\t\t\t\"equinixmetal\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *SSHKeyGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listSSHKeys(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/equinixmetal/volume.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage equinixmetal\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/packethost/packngo\"\n)\n\ntype VolumeGenerator struct {\n\tEquinixMetalService\n}\n\nfunc (g VolumeGenerator) listVolumes(client *packngo.Client) ([]packngo.Volume, error) {\n\tvolumes, _, err := client.Volumes.List(g.GetArgs()[\"project_id\"].(string), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn volumes, nil\n}\n\nfunc (g VolumeGenerator) createResources(volumeList []packngo.Volume) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, volume := range volumeList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tvolume.ID,\n\t\t\tvolume.Name,\n\t\t\t\"metal_volume\",\n\t\t\t\"equinixmetal\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *VolumeGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := g.listVolumes(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/fastly/fastly_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage fastly\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype FastlyProvider struct { //nolint\n\tterraformutils.Provider\n\tcustomerID string\n\tapiKey     string\n}\n\nfunc (p *FastlyProvider) Init(args []string) error {\n\tif os.Getenv(\"FASTLY_API_KEY\") == \"\" {\n\t\treturn errors.New(\"set FASTLY_API_KEY env var\")\n\t}\n\tp.apiKey = os.Getenv(\"FASTLY_API_KEY\")\n\n\tif os.Getenv(\"FASTLY_CUSTOMER_ID\") == \"\" {\n\t\treturn errors.New(\"set FASTLY_CUSTOMER_ID env var\")\n\t}\n\tp.customerID = os.Getenv(\"FASTLY_CUSTOMER_ID\")\n\n\treturn nil\n}\n\nfunc (p *FastlyProvider) GetName() string {\n\treturn \"fastly\"\n}\n\nfunc (p *FastlyProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"fastly\": map[string]interface{}{\n\t\t\t\t\"customer_id\": p.customerID,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (FastlyProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *FastlyProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"service_v1\":       &ServiceV1Generator{},\n\t\t\"tls_subscription\": &TLSSubscriptionGenerator{},\n\t\t\"user\":             &UserGenerator{},\n\t}\n}\n\nfunc (p *FastlyProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"fastly: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"customer_id\": p.customerID,\n\t\t\"api_key\":     p.apiKey,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/fastly/fastly_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage fastly\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype FastlyService struct { //nolint\n\tterraformutils.Service\n}\n"
  },
  {
    "path": "providers/fastly/service_v1.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage fastly\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/fastly/go-fastly/v7/fastly\"\n)\n\nconst (\n\t// ServiceTypeVCL is the type for VCL services.\n\tServiceTypeVCL = \"vcl\"\n\t// ServiceTypeWasm is the type for Wasm services.\n\tServiceTypeWasm = \"wasm\"\n)\n\ntype ServiceV1Generator struct {\n\tFastlyService\n}\n\nfunc (g *ServiceV1Generator) loadServices(client *fastly.Client) ([]*fastly.Service, error) {\n\tservices, err := client.ListServices(&fastly.ListServicesInput{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, service := range services {\n\t\tif service.Type == ServiceTypeVCL {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tservice.ID,\n\t\t\t\tservice.ID,\n\t\t\t\t\"fastly_service_v1\",\n\t\t\t\t\"fastly\",\n\t\t\t\t[]string{}))\n\t\t} else if service.Type == ServiceTypeWasm {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tservice.ID,\n\t\t\t\tservice.ID,\n\t\t\t\t\"fastly_service_compute\",\n\t\t\t\t\"fastly\",\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn services, nil\n}\n\nfunc (g *ServiceV1Generator) loadDictionaryItems(client *fastly.Client, serviceID string) error {\n\tlatest, err := client.LatestVersion(&fastly.LatestVersionInput{\n\t\tServiceID: serviceID,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tdictionaries, err := client.ListDictionaries(&fastly.ListDictionariesInput{\n\t\tServiceID:      serviceID,\n\t\tServiceVersion: latest.Number,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, dictionary := range dictionaries {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tdictionary.ID,\n\t\t\tdictionary.ID,\n\t\t\t\"fastly_service_dictionary_items_v1\",\n\t\t\t\"fastly\",\n\t\t\tmap[string]string{\n\t\t\t\t\"service_id\":    serviceID,\n\t\t\t\t\"dictionary_id\": dictionary.ID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n\nfunc (g *ServiceV1Generator) loadACLEntries(client *fastly.Client, serviceID string) error {\n\tlatest, err := client.LatestVersion(&fastly.LatestVersionInput{\n\t\tServiceID: serviceID,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tacls, err := client.ListACLs(&fastly.ListACLsInput{\n\t\tServiceID:      serviceID,\n\t\tServiceVersion: latest.Number,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, acl := range acls {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tacl.ID,\n\t\t\tacl.ID,\n\t\t\t\"fastly_service_acl_entries_v1\",\n\t\t\t\"fastly\",\n\t\t\tmap[string]string{\n\t\t\t\t\"service_id\": serviceID,\n\t\t\t\t\"acl_id\":     acl.ID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n\nfunc (g *ServiceV1Generator) loadDynamicSnippetContent(client *fastly.Client, serviceID string) error {\n\tlatest, err := client.LatestVersion(&fastly.LatestVersionInput{\n\t\tServiceID: serviceID,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tsnippets, err := client.ListSnippets(&fastly.ListSnippetsInput{\n\t\tServiceID:      serviceID,\n\t\tServiceVersion: latest.Number,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, snippet := range snippets {\n\t\t// check if dynamic\n\t\tif snippet.Dynamic == 1 {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tsnippet.ID,\n\t\t\t\tsnippet.ID,\n\t\t\t\t\"fastly_service_dynamic_snippet_content_v1\",\n\t\t\t\t\"fastly\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"service_id\": serviceID,\n\t\t\t\t\t\"snippet_id\": snippet.ID,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *ServiceV1Generator) InitResources() error {\n\tclient, err := fastly.NewClient(g.Args[\"api_key\"].(string))\n\tif err != nil {\n\t\treturn err\n\t}\n\tservices, err := g.loadServices(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, service := range services {\n\t\terr := g.loadDictionaryItems(client, service.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = g.loadACLEntries(client, service.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = g.loadDynamicSnippetContent(client, service.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/fastly/tls_subscription.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage fastly\n\nimport (\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/fastly/go-fastly/v7/fastly\"\n)\n\ntype TLSSubscriptionGenerator struct {\n\tFastlyService\n}\n\nfunc (g *TLSSubscriptionGenerator) loadTLSSubscriptions(client *fastly.Client) ([]*fastly.TLSSubscription, error) {\n\tsubscriptions, err := client.ListTLSSubscriptions(&fastly.ListTLSSubscriptionsInput{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, subscription := range subscriptions {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tsubscription.ID,\n\t\t\tsubscription.ID,\n\t\t\t\"fastly_tls_subscription\",\n\t\t\t\"fastly\",\n\t\t\t[]string{}))\n\t}\n\treturn subscriptions, nil\n}\n\nfunc (g *TLSSubscriptionGenerator) loadTLSActivations(client *fastly.Client) ([]*fastly.TLSActivation, error) {\n\tactivations, err := client.ListTLSActivations(&fastly.ListTLSActivationsInput{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, activation := range activations {\n\t\tlog.Println(\"certicate: \", activation.ID)\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tactivation.ID,\n\t\t\tactivation.ID,\n\t\t\t\"fastly_tls_activation\",\n\t\t\t\"fastly\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\treturn activations, nil\n}\n\nfunc (g *TLSSubscriptionGenerator) InitResources() error {\n\tclient, err := fastly.NewClient(g.Args[\"api_key\"].(string))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := g.loadTLSSubscriptions(client); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := g.loadTLSActivations(client); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/fastly/user.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage fastly\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/fastly/go-fastly/v7/fastly\"\n)\n\ntype UserGenerator struct {\n\tFastlyService\n}\n\nfunc (g *UserGenerator) loadUsers(client *fastly.Client, customerID string) error {\n\tusers, err := client.ListCustomerUsers(&fastly.ListCustomerUsersInput{CustomerID: customerID})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, user := range users {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tuser.ID,\n\t\t\tuser.ID,\n\t\t\t\"fastly_user_v1\",\n\t\t\t\"fastly\",\n\t\t\t[]string{}))\n\t}\n\treturn nil\n}\n\nfunc (g *UserGenerator) InitResources() error {\n\tclient, err := fastly.NewClient(g.Args[\"api_key\"].(string))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadUsers(client, g.Args[\"customer_id\"].(string)); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/addresses_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar addressesAllowEmptyValues = []string{\"\"}\n\nvar addressesAdditionalFields = map[string]interface{}{}\n\ntype AddressesGenerator struct {\n\tGCPService\n}\n\n// Run on addressesList and create for each TerraformResource\nfunc (g AddressesGenerator) createResources(ctx context.Context, addressesList *compute.AddressesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := addressesList.Pages(ctx, func(page *compute.AddressList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_address\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\taddressesAllowEmptyValues,\n\t\t\t\taddressesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each addresses create 1 TerraformResource\n// Need addresses name as ID for terraform resource\nfunc (g *AddressesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\taddressesList := computeService.Addresses.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, addressesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/autoscalers_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar autoscalersAllowEmptyValues = []string{\"\"}\n\nvar autoscalersAdditionalFields = map[string]interface{}{}\n\ntype AutoscalersGenerator struct {\n\tGCPService\n}\n\n// Run on autoscalersList and create for each TerraformResource\nfunc (g AutoscalersGenerator) createResources(ctx context.Context, autoscalersList *compute.AutoscalersListCall, zone string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := autoscalersList.Pages(ctx, func(page *compute.AutoscalerList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\t\"google_compute_autoscaler\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t\t\"zone\":    zone,\n\t\t\t\t},\n\t\t\t\tautoscalersAllowEmptyValues,\n\t\t\t\tautoscalersAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each autoscalers create 1 TerraformResource\n// Need autoscalers name as ID for terraform resource\nfunc (g *AutoscalersGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, zoneLink := range g.GetArgs()[\"region\"].(compute.Region).Zones {\n\t\tt := strings.Split(zoneLink, \"/\")\n\t\tzone := t[len(t)-1]\n\t\tautoscalersList := computeService.Autoscalers.List(g.GetArgs()[\"project\"].(string), zone)\n\t\tg.Resources = append(g.Resources, g.createResources(ctx, autoscalersList, zone)...)\n\t}\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/backendBuckets_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar backendBucketsAllowEmptyValues = []string{\"\"}\n\nvar backendBucketsAdditionalFields = map[string]interface{}{}\n\ntype BackendBucketsGenerator struct {\n\tGCPService\n}\n\n// Run on backendBucketsList and create for each TerraformResource\nfunc (g BackendBucketsGenerator) createResources(ctx context.Context, backendBucketsList *compute.BackendBucketsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := backendBucketsList.Pages(ctx, func(page *compute.BackendBucketList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_backend_bucket\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tbackendBucketsAllowEmptyValues,\n\t\t\t\tbackendBucketsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each backendBuckets create 1 TerraformResource\n// Need backendBuckets name as ID for terraform resource\nfunc (g *BackendBucketsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbackendBucketsList := computeService.BackendBuckets.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, backendBucketsList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/backendServices_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar backendServicesAllowEmptyValues = []string{\"\"}\n\nvar backendServicesAdditionalFields = map[string]interface{}{}\n\ntype BackendServicesGenerator struct {\n\tGCPService\n}\n\n// Run on backendServicesList and create for each TerraformResource\nfunc (g BackendServicesGenerator) createResources(ctx context.Context, backendServicesList *compute.BackendServicesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := backendServicesList.Pages(ctx, func(page *compute.BackendServiceList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_backend_service\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t},\n\t\t\t\tbackendServicesAllowEmptyValues,\n\t\t\t\tbackendServicesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each backendServices create 1 TerraformResource\n// Need backendServices name as ID for terraform resource\nfunc (g *BackendServicesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbackendServicesList := computeService.BackendServices.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, backendServicesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/bigquery.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"google.golang.org/api/bigquery/v2\"\n)\n\nvar bigQueryAllowEmptyValues = []string{\"\"}\n\ntype BigQueryGenerator struct {\n\tGCPService\n}\n\n// Run on datasetsList and create for each TerraformResource\nfunc (g BigQueryGenerator) createDatasets(ctx context.Context, dataSetsList *bigquery.DatasetsListCall, bigQueryService *bigquery.Service) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := dataSetsList.Pages(ctx, func(page *bigquery.DatasetList) error {\n\t\tfor _, dataset := range page.Datasets {\n\t\t\tname := dataset.FriendlyName\n\t\t\tif name == \"\" {\n\t\t\t\tname = dataset.Id\n\t\t\t}\n\t\t\tID := strings.Split(dataset.Id, \":\")[1]\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tdataset.Id,\n\t\t\t\tname,\n\t\t\t\t\"google_bigquery_dataset\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"project\":    g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"dataset_id\": ID,\n\t\t\t\t},\n\t\t\t\tbigQueryAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t\tresources = append(resources, g.createResourcesTables(ctx, ID, bigQueryService)...)\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\nfunc (g *BigQueryGenerator) createResourcesTables(ctx context.Context, datasetID string, bigQueryService *bigquery.Service) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\ttableList := bigQueryService.Tables.List(g.Args[\"project\"].(string), datasetID)\n\tif err := tableList.Pages(ctx, func(page *bigquery.TableList) error {\n\t\tfor _, table := range page.Tables {\n\t\t\tname := table.FriendlyName\n\t\t\tif name == \"\" {\n\t\t\t\tname = table.Id\n\t\t\t}\n\t\t\tID := strings.Split(table.Id, \".\")[1]\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\ttable.Id,\n\t\t\t\tname,\n\t\t\t\t\"google_bigquery_table\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"project\":    g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"table_id\":   ID,\n\t\t\t\t\t\"dataset_id\": datasetID,\n\t\t\t\t},\n\t\t\t\tbigQueryAllowEmptyValues,\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\nfunc (g *BigQueryGenerator) InitResources() error {\n\tctx := context.Background()\n\tbigQueryService, err := bigquery.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdatasetsList := bigQueryService.Datasets.List(g.GetArgs()[\"project\"].(string))\n\n\tg.Resources = g.createDatasets(ctx, datasetsList, bigQueryService)\n\treturn nil\n}\n\n// PostGenerateHook for convert schema json as heredoc\nfunc (g *BigQueryGenerator) PostConvertHook() error {\n\tfor i, dataset := range g.Resources {\n\t\tif dataset.InstanceInfo.Type != \"google_bigquery_dataset\" {\n\t\t\tcontinue\n\t\t}\n\t\tif val, ok := dataset.Item[\"default_table_expiration_ms\"].(string); ok { // TODO zero int issue\n\t\t\tif val == \"0\" {\n\t\t\t\tdelete(g.Resources[i].Item, \"default_table_expiration_ms\")\n\t\t\t}\n\t\t}\n\t\tfor j, table := range g.Resources {\n\t\t\tif table.InstanceInfo.Type != \"google_bigquery_table\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif table.InstanceState.Attributes[\"dataset_id\"] == dataset.InstanceState.Attributes[\"dataset_id\"] {\n\t\t\t\tg.Resources[j].Item[\"dataset_id\"] = \"${google_bigquery_dataset.\" + dataset.ResourceName + \".dataset_id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/cloudFunctions.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"google.golang.org/api/cloudfunctions/v2\"\n\t\"google.golang.org/api/compute/v1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar cloudFunctionsAllowEmptyValues = []string{\"\"}\n\nvar cloudFunctionsAdditionalFields = map[string]interface{}{}\n\ntype CloudFunctionsGenerator struct {\n\tGCPService\n}\n\n// Run on CloudFunctionsList and create for each TerraformResource\nfunc (g CloudFunctionsGenerator) createCloudFunctionsResources(ctx context.Context, functionsList *cloudfunctions.ProjectsLocationsFunctionsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := functionsList.Pages(ctx, func(page *cloudfunctions.ListFunctionsResponse) error {\n\t\tfor _, functions := range page.Functions {\n\t\t\tt := strings.Split(functions.Name, \"/\")\n\t\t\tif functions.Environment == \"GEN_1\" {\n\t\t\t\tname := t[len(t)-1]\n\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\tg.GetArgs()[\"project\"].(string)+\"/\"+g.GetArgs()[\"region\"].(compute.Region).Name+\"/\"+name,\n\t\t\t\t\tg.GetArgs()[\"region\"].(compute.Region).Name+\"_\"+name,\n\t\t\t\t\t\"google_cloudfunctions_function\",\n\t\t\t\t\tg.ProviderName,\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"name\":     name,\n\t\t\t\t\t\t\"project\":  g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\t\"location\": g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t\t},\n\t\t\t\t\tcloudFunctionsAllowEmptyValues,\n\t\t\t\t\tcloudFunctionsAdditionalFields,\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\nfunc (g CloudFunctionsGenerator) createCloudFunctions2ndGenResources(ctx context.Context, functionsList *cloudfunctions.ProjectsLocationsFunctionsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := functionsList.Pages(ctx, func(page *cloudfunctions.ListFunctionsResponse) error {\n\t\tfor _, functions := range page.Functions {\n\t\t\tt := strings.Split(functions.Name, \"/\")\n\t\t\tif functions.Environment == \"GEN_2\" {\n\t\t\t\tname := t[len(t)-1]\n\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\tg.GetArgs()[\"project\"].(string)+\"/\"+g.GetArgs()[\"region\"].(compute.Region).Name+\"/\"+name,\n\t\t\t\t\tg.GetArgs()[\"region\"].(compute.Region).Name+\"_\"+name,\n\t\t\t\t\t\"google_cloudfunctions2_function\",\n\t\t\t\t\tg.ProviderName,\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"name\":     name,\n\t\t\t\t\t\t\"project\":  g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\t\"location\": g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t\t},\n\t\t\t\t\tcloudFunctionsAllowEmptyValues,\n\t\t\t\t\tcloudFunctionsAdditionalFields,\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each CloudFunctions create 1 TerraformResource\n// Need CloudFunctions name as ID for terraform resource\nfunc (g *CloudFunctionsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcloudfunctionsService, err := cloudfunctions.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfunctionsList := cloudfunctionsService.Projects.Locations.Functions.List(\"projects/\" + g.GetArgs()[\"project\"].(string) + \"/locations/\" + g.GetArgs()[\"region\"].(compute.Region).Name)\n\n\tg.Resources = append(g.Resources, g.createCloudFunctionsResources(ctx, functionsList)...)\n\tg.Resources = append(g.Resources, g.createCloudFunctions2ndGenResources(ctx, functionsList)...)\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/cloudbuild.go",
    "content": "package gcp\n\nimport (\n\t\"context\"\n\n\tcloudbuild \"cloud.google.com/go/cloudbuild/apiv1\"\n\tpb \"google.golang.org/genproto/googleapis/devtools/cloudbuild/v1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nconst cbMaxPageSize = 50\n\ntype CloudBuildGenerator struct {\n\tGCPService\n}\n\n// InitResources generates TerraformResources from GCP API.\nfunc (g *CloudBuildGenerator) InitResources() error {\n\tctx := context.Background()\n\n\tc, err := cloudbuild.NewClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar (\n\t\ttriggers      []*pb.BuildTrigger\n\t\tnextPageToken string\n\t)\n\n\tfor {\n\t\treq := &pb.ListBuildTriggersRequest{\n\t\t\tProjectId: g.GetArgs()[\"project\"].(string),\n\t\t\tPageToken: nextPageToken,\n\t\t\tPageSize:  cbMaxPageSize,\n\t\t}\n\n\t\tres, err := c.ListBuildTriggers(ctx, req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ttriggers = append(triggers, res.Triggers...)\n\t\tnextPageToken = res.NextPageToken\n\n\t\tif nextPageToken == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tg.Resources = g.createBuildTriggers(triggers)\n\treturn nil\n}\n\nfunc (g *CloudBuildGenerator) createBuildTriggers(triggers []*pb.BuildTrigger) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, trigger := range triggers {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\ttrigger.GetId(),\n\t\t\ttrigger.GetName(),\n\t\t\t\"google_cloudbuild_trigger\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"filename\": trigger.GetFilename(),\n\t\t\t},\n\t\t))\n\t}\n\n\treturn resources\n}\n"
  },
  {
    "path": "providers/gcp/clouddns.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/dns/v1\"\n)\n\nvar cloudDNSAllowEmptyValues = []string{}\n\nvar cloudDNSAdditionalFields = map[string]interface{}{}\n\ntype CloudDNSGenerator struct {\n\tGCPService\n}\n\nfunc (g CloudDNSGenerator) createZonesResources(ctx context.Context, svc *dns.Service, project string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tmanagedZonesListCall := svc.ManagedZones.List(project)\n\terr := managedZonesListCall.Pages(ctx, func(listDNS *dns.ManagedZonesListResponse) error {\n\t\tfor _, zone := range listDNS.ManagedZones {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tzone.Name,\n\t\t\t\tzone.Name,\n\t\t\t\t\"google_dns_managed_zone\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    zone.Name,\n\t\t\t\t\t\"project\": project,\n\t\t\t\t},\n\t\t\t\tcloudDNSAllowEmptyValues,\n\t\t\t\tcloudDNSAdditionalFields,\n\t\t\t))\n\t\t\trecords := g.createRecordsResources(ctx, svc, project, zone.Name)\n\t\t\tresources = append(resources, records...)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn []terraformutils.Resource{}\n\t}\n\treturn resources\n}\nfunc (g CloudDNSGenerator) createRecordsResources(ctx context.Context, svc *dns.Service, project, zoneName string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tmanagedRecordsListCall := svc.ResourceRecordSets.List(project, zoneName)\n\terr := managedRecordsListCall.Pages(ctx, func(listDNS *dns.ResourceRecordSetsListResponse) error {\n\t\tfor _, record := range listDNS.Rrsets {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tfmt.Sprintf(\"%s/%s/%s\", zoneName, record.Name, record.Type),\n\t\t\t\tzoneName+\"_\"+strings.TrimSuffix(record.Name+\"-\"+record.Type, \".\"),\n\t\t\t\t\"google_dns_record_set\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":         record.Name,\n\t\t\t\t\t\"managed_zone\": zoneName,\n\t\t\t\t\t\"type\":         record.Type,\n\t\t\t\t\t\"project\":      project,\n\t\t\t\t},\n\t\t\t\tcloudDNSAllowEmptyValues,\n\t\t\t\tcloudDNSAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn []terraformutils.Resource{}\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// create terraform resource for each zone + each record\nfunc (g *CloudDNSGenerator) InitResources() error {\n\tproject := g.GetArgs()[\"project\"].(string)\n\tctx := context.Background()\n\tsvc, err := dns.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createZonesResources(ctx, svc, project)\n\treturn nil\n}\n\nfunc (g *CloudDNSGenerator) PostConvertHook() error {\n\tfor i, resourceRecord := range g.Resources {\n\t\tif resourceRecord.InstanceInfo.Type == \"google_dns_managed_zone\" {\n\t\t\tcontinue\n\t\t}\n\t\titem := resourceRecord.Item\n\t\tzoneID := item[\"managed_zone\"].(string)\n\t\tfor _, resourceZone := range g.Resources {\n\t\t\tif resourceZone.InstanceInfo.Type != \"google_dns_managed_zone\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif zoneID == resourceZone.InstanceState.ID {\n\t\t\t\tg.Resources[i].Item[\"managed_zone\"] = \"${google_dns_managed_zone.\" + resourceZone.ResourceName + \".name}\"\n\t\t\t\tname := g.Resources[i].Item[\"name\"].(string)\n\t\t\t\tname = strings.ReplaceAll(name, resourceZone.Item[\"dns_name\"].(string), \"\")\n\t\t\t\tg.Resources[i].Item[\"name\"] = name + \"${google_dns_managed_zone.\" + resourceZone.ResourceName + \".dns_name}\"\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/cloudsql.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\tsqladmin \"google.golang.org/api/sqladmin/v1beta4\"\n)\n\nvar cloudSQLAllowEmptyValues = []string{}\n\nvar cloudSQLAdditionalFields = map[string]interface{}{}\n\ntype CloudSQLGenerator struct {\n\tGCPService\n}\n\nfunc (g *CloudSQLGenerator) loadDBInstances(svc *sqladmin.Service, project string) error {\n\tdbInstances, err := svc.Instances.List(project).Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, dbInstance := range dbInstances.Items {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tdbInstance.Name,\n\t\t\tdbInstance.Name,\n\t\t\t\"google_sql_database_instance\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"project\": project,\n\t\t\t\t\"name\":    dbInstance.Name,\n\t\t\t},\n\t\t\tcloudSQLAllowEmptyValues,\n\t\t\tcloudSQLAdditionalFields,\n\t\t))\n\t\terr := g.loadDBs(svc, dbInstance.Name, project)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *CloudSQLGenerator) loadDBs(svc *sqladmin.Service, instanceName, project string) error {\n\tDBs, err := svc.Databases.List(project, instanceName).Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, db := range DBs.Items {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tinstanceName+\":\"+db.Name,\n\t\t\tinstanceName+\"-\"+db.Name,\n\t\t\t\"google_sql_database\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"instance\": instanceName,\n\t\t\t\t\"project\":  project,\n\t\t\t\t\"name\":     db.Name,\n\t\t\t},\n\n\t\t\tcloudSQLAllowEmptyValues,\n\t\t\tcloudSQLAdditionalFields,\n\t\t))\n\t}\n\treturn nil\n}\n\n// Generate TerraformResources from GCP API,\n// from each databases create many TerraformResource(dbinstance + databases)\n// Need dbinstance name as ID for terraform resource\nfunc (g *CloudSQLGenerator) InitResources() error {\n\tproject := g.GetArgs()[\"project\"].(string)\n\tctx := context.Background()\n\tsvc, err := sqladmin.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadDBInstances(svc, project); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/cloudtasks.go",
    "content": "package gcp\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"google.golang.org/api/iterator\"\n\n\tcloudtasks \"cloud.google.com/go/cloudtasks/apiv2\"\n\t\"google.golang.org/api/compute/v1\"\n\ttaskspb \"google.golang.org/genproto/googleapis/cloud/tasks/v2\"\n)\n\nvar cloudTasksAllowEmptyValues = []string{}\n\nvar cloudTasksAdditionalFields = map[string]interface{}{}\n\ntype CloudTaskGenerator struct {\n\tGCPService\n}\n\nfunc (g *CloudTaskGenerator) loadCloudTaskQueues(ctx context.Context, client *cloudtasks.Client) error {\n\tproject := g.GetArgs()[\"project\"].(string)\n\tregion := g.GetArgs()[\"region\"].(compute.Region).Name\n\n\treq := &taskspb.ListQueuesRequest{\n\t\tParent: fmt.Sprintf(\"projects/%s/locations/%s\", project, region),\n\t}\n\n\tqueueIterator := client.ListQueues(ctx, req)\n\tfor {\n\t\tresp, err := queueIterator.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsplitName := strings.Split(resp.Name, \"/\")\n\t\tqueueName := splitName[len(splitName)-1]\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tresp.Name,\n\t\t\tqueueName,\n\t\t\t\"google_cloud_tasks_queue\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"id\":       fmt.Sprintf(\"projects/%s/locations/%s/queues/%s\", project, region, queueName),\n\t\t\t\t\"name\":     queueName,\n\t\t\t\t\"project\":  project,\n\t\t\t\t\"location\": region,\n\t\t\t},\n\t\t\tcloudTasksAllowEmptyValues,\n\t\t\tcloudTasksAdditionalFields,\n\t\t))\n\t}\n\treturn nil\n}\n\n// Generate TerraformResources from GCP API,\n// from each cloud task queue create 1 TerraformResource\nfunc (g *CloudTaskGenerator) InitResources() error {\n\tctx := context.Background()\n\tclient, err := cloudtasks.NewClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadCloudTaskQueues(ctx, client); err != nil {\n\t\treturn err\n\t}\n\n\treturn client.Close()\n}\n"
  },
  {
    "path": "providers/gcp/compute.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\n// Map of supported GCP compute service with code generate\nvar ComputeServices = map[string]terraformutils.ServiceGenerator{\n\n\t\"addresses\":                   &GCPFacade{service: &AddressesGenerator{}},\n\t\"autoscalers\":                 &GCPFacade{service: &AutoscalersGenerator{}},\n\t\"backendBuckets\":              &GCPFacade{service: &BackendBucketsGenerator{}},\n\t\"backendServices\":             &GCPFacade{service: &BackendServicesGenerator{}},\n\t\"disks\":                       &GCPFacade{service: &DisksGenerator{}},\n\t\"externalVpnGateways\":         &GCPFacade{service: &ExternalVpnGatewaysGenerator{}},\n\t\"firewall\":                    &GCPFacade{service: &FirewallGenerator{}},\n\t\"forwardingRules\":             &GCPFacade{service: &ForwardingRulesGenerator{}},\n\t\"globalAddresses\":             &GCPFacade{service: &GlobalAddressesGenerator{}},\n\t\"globalForwardingRules\":       &GCPFacade{service: &GlobalForwardingRulesGenerator{}},\n\t\"healthChecks\":                &GCPFacade{service: &HealthChecksGenerator{}},\n\t\"httpHealthChecks\":            &GCPFacade{service: &HttpHealthChecksGenerator{}},\n\t\"httpsHealthChecks\":           &GCPFacade{service: &HttpsHealthChecksGenerator{}},\n\t\"images\":                      &GCPFacade{service: &ImagesGenerator{}},\n\t\"instanceGroupManagers\":       &GCPFacade{service: &InstanceGroupManagersGenerator{}},\n\t\"instanceGroups\":              &GCPFacade{service: &InstanceGroupsGenerator{}},\n\t\"instanceTemplates\":           &GCPFacade{service: &InstanceTemplatesGenerator{}},\n\t\"interconnectAttachments\":     &GCPFacade{service: &InterconnectAttachmentsGenerator{}},\n\t\"networkEndpointGroups\":       &GCPFacade{service: &NetworkEndpointGroupsGenerator{}},\n\t\"networks\":                    &GCPFacade{service: &NetworksGenerator{}},\n\t\"nodeGroups\":                  &GCPFacade{service: &NodeGroupsGenerator{}},\n\t\"nodeTemplates\":               &GCPFacade{service: &NodeTemplatesGenerator{}},\n\t\"packetMirrorings\":            &GCPFacade{service: &PacketMirroringsGenerator{}},\n\t\"regionAutoscalers\":           &GCPFacade{service: &RegionAutoscalersGenerator{}},\n\t\"regionBackendServices\":       &GCPFacade{service: &RegionBackendServicesGenerator{}},\n\t\"regionDisks\":                 &GCPFacade{service: &RegionDisksGenerator{}},\n\t\"regionHealthChecks\":          &GCPFacade{service: &RegionHealthChecksGenerator{}},\n\t\"regionInstanceGroupManagers\": &GCPFacade{service: &RegionInstanceGroupManagersGenerator{}},\n\t\"regionInstanceGroups\":        &GCPFacade{service: &RegionInstanceGroupsGenerator{}},\n\t\"regionSslCertificates\":       &GCPFacade{service: &RegionSslCertificatesGenerator{}},\n\t\"regionTargetHttpProxies\":     &GCPFacade{service: &RegionTargetHttpProxiesGenerator{}},\n\t\"regionTargetHttpsProxies\":    &GCPFacade{service: &RegionTargetHttpsProxiesGenerator{}},\n\t\"regionUrlMaps\":               &GCPFacade{service: &RegionUrlMapsGenerator{}},\n\t\"reservations\":                &GCPFacade{service: &ReservationsGenerator{}},\n\t\"resourcePolicies\":            &GCPFacade{service: &ResourcePoliciesGenerator{}},\n\t\"routers\":                     &GCPFacade{service: &RoutersGenerator{}},\n\t\"routes\":                      &GCPFacade{service: &RoutesGenerator{}},\n\t\"securityPolicies\":            &GCPFacade{service: &SecurityPoliciesGenerator{}},\n\t\"sslCertificates\":             &GCPFacade{service: &SslCertificatesGenerator{}},\n\t\"sslPolicies\":                 &GCPFacade{service: &SslPoliciesGenerator{}},\n\t\"subnetworks\":                 &GCPFacade{service: &SubnetworksGenerator{}},\n\t\"targetHttpProxies\":           &GCPFacade{service: &TargetHttpProxiesGenerator{}},\n\t\"targetHttpsProxies\":          &GCPFacade{service: &TargetHttpsProxiesGenerator{}},\n\t\"targetInstances\":             &GCPFacade{service: &TargetInstancesGenerator{}},\n\t\"targetPools\":                 &GCPFacade{service: &TargetPoolsGenerator{}},\n\t\"targetSslProxies\":            &GCPFacade{service: &TargetSslProxiesGenerator{}},\n\t\"targetTcpProxies\":            &GCPFacade{service: &TargetTcpProxiesGenerator{}},\n\t\"targetVpnGateways\":           &GCPFacade{service: &TargetVpnGatewaysGenerator{}},\n\t\"urlMaps\":                     &GCPFacade{service: &UrlMapsGenerator{}},\n\t\"vpnTunnels\":                  &GCPFacade{service: &VpnTunnelsGenerator{}},\n}\n"
  },
  {
    "path": "providers/gcp/dataproc.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"google.golang.org/api/compute/v1\"\n\t\"google.golang.org/api/dataproc/v1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar dataprocAllowEmptyValues = []string{\"\"}\n\nvar dataprocAdditionalFields = map[string]interface{}{}\n\ntype DataprocGenerator struct {\n\tGCPService\n}\n\n// Run on DataprocClusterList and create for each TerraformResource\nfunc (g DataprocGenerator) createClusterResources(ctx context.Context, clusterList *dataproc.ProjectsRegionsClustersListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := clusterList.Pages(ctx, func(page *dataproc.ListClustersResponse) error {\n\t\tfor _, cluster := range page.Clusters {\n\t\t\tresource := terraformutils.NewResource(\n\t\t\t\tcluster.ClusterName,\n\t\t\t\tcluster.ClusterName,\n\t\t\t\t\"google_dataproc_cluster\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    cluster.ClusterName,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tdataprocAllowEmptyValues,\n\t\t\t\tdataprocAdditionalFields,\n\t\t\t)\n\t\t\tresource.IgnoreKeys = append(resource.IgnoreKeys, \"^cluster_config.[0-9].delete_autogen_bucket$\")\n\t\t\tresources = append(resources, resource)\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n/*\n// Run on DataprocJobList and create for each TerraformResource\nfunc (g DataprocGenerator) createJobResources(jobList *dataproc.ProjectsRegionsJobsListCall, ctx context.Context) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := jobList.Pages(ctx, func(page *dataproc.ListJobsResponse) error {\n\t\tfor _, job := range page.Jobs {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tjob.Reference.JobId,\n\t\t\t\tjob.Reference.JobId,\n\t\t\t\t\"google_dataproc_job\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tdataprocAllowEmptyValues,\n\t\t\t\tdataprocAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn resources\n}\n*/\n\n// Generate TerraformResources from GCP API,\n// from each DataprocGenerator create 1 TerraformResource\n// Need DataprocGenerator name as ID for terraform resource\nfunc (g *DataprocGenerator) InitResources() error {\n\tctx := context.Background()\n\tdataprocService, err := dataproc.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclusterList := dataprocService.Projects.Regions.Clusters.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createClusterResources(ctx, clusterList)\n\n\t// jobList := dataprocService.Projects.Regions.Jobs.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"])\n\t// g.Resources = append(g.Resources, g.createJobResources(jobList, ctx)...)\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/disks_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar disksAllowEmptyValues = []string{\"\"}\n\nvar disksAdditionalFields = map[string]interface{}{}\n\ntype DisksGenerator struct {\n\tGCPService\n}\n\n// Run on disksList and create for each TerraformResource\nfunc (g DisksGenerator) createResources(ctx context.Context, disksList *compute.DisksListCall, zone string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := disksList.Pages(ctx, func(page *compute.DiskList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\t\"google_compute_disk\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t\t\"zone\":    zone,\n\t\t\t\t},\n\t\t\t\tdisksAllowEmptyValues,\n\t\t\t\tdisksAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each disks create 1 TerraformResource\n// Need disks name as ID for terraform resource\nfunc (g *DisksGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, zoneLink := range g.GetArgs()[\"region\"].(compute.Region).Zones {\n\t\tt := strings.Split(zoneLink, \"/\")\n\t\tzone := t[len(t)-1]\n\t\tdisksList := computeService.Disks.List(g.GetArgs()[\"project\"].(string), zone)\n\t\tg.Resources = append(g.Resources, g.createResources(ctx, disksList, zone)...)\n\t}\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/externalVpnGateways_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar externalVpnGatewaysAllowEmptyValues = []string{\"\"}\n\nvar externalVpnGatewaysAdditionalFields = map[string]interface{}{}\n\ntype ExternalVpnGatewaysGenerator struct {\n\tGCPService\n}\n\n// Run on externalVpnGatewaysList and create for each TerraformResource\nfunc (g ExternalVpnGatewaysGenerator) createResources(ctx context.Context, externalVpnGatewaysList *compute.ExternalVpnGatewaysListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := externalVpnGatewaysList.Pages(ctx, func(page *compute.ExternalVpnGatewayList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_external_vpn_gateway\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\texternalVpnGatewaysAllowEmptyValues,\n\t\t\t\texternalVpnGatewaysAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each externalVpnGateways create 1 TerraformResource\n// Need externalVpnGateways name as ID for terraform resource\nfunc (g *ExternalVpnGatewaysGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\texternalVpnGatewaysList := computeService.ExternalVpnGateways.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, externalVpnGatewaysList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/firewall_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar firewallAllowEmptyValues = []string{\"\"}\n\nvar firewallAdditionalFields = map[string]interface{}{}\n\ntype FirewallGenerator struct {\n\tGCPService\n}\n\n// Run on firewallList and create for each TerraformResource\nfunc (g FirewallGenerator) createResources(ctx context.Context, firewallList *compute.FirewallsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := firewallList.Pages(ctx, func(page *compute.FirewallList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_firewall\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tfirewallAllowEmptyValues,\n\t\t\t\tfirewallAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each firewall create 1 TerraformResource\n// Need firewall name as ID for terraform resource\nfunc (g *FirewallGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfirewallList := computeService.Firewalls.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, firewallList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/forwardingRules_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar forwardingRulesAllowEmptyValues = []string{\"\"}\n\nvar forwardingRulesAdditionalFields = map[string]interface{}{}\n\ntype ForwardingRulesGenerator struct {\n\tGCPService\n}\n\n// Run on forwardingRulesList and create for each TerraformResource\nfunc (g ForwardingRulesGenerator) createResources(ctx context.Context, forwardingRulesList *compute.ForwardingRulesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := forwardingRulesList.Pages(ctx, func(page *compute.ForwardingRuleList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_forwarding_rule\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tforwardingRulesAllowEmptyValues,\n\t\t\t\tforwardingRulesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each forwardingRules create 1 TerraformResource\n// Need forwardingRules name as ID for terraform resource\nfunc (g *ForwardingRulesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tforwardingRulesList := computeService.ForwardingRules.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, forwardingRulesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/gcp_compute_code_generator/backendServices.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\ntype backendServices struct {\n\tbasicGCPResource\n}\n\nfunc (b backendServices) ifNeedRegion() bool {\n\treturn false\n}\n"
  },
  {
    "path": "providers/gcp/gcp_compute_code_generator/basicGcpResource.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\ntype gcpResourceRenderable interface {\n\tgetTerraformName() string\n\tgetAdditionalFields() map[string]string\n\tgetAllowEmptyValues() []string\n\tifNeedRegion() bool\n\tifNeedZone(zoneInParameters bool) bool\n\tifIDWithZone(zoneInParameters bool) bool\n\tgetAdditionalFieldsForRefresh() map[string]string\n}\n\ntype basicGCPResource struct {\n\tterraformName              string\n\tallowEmptyValues           []string\n\tadditionalFields           map[string]string\n\tadditionalFieldsForRefresh map[string]string\n}\n\nfunc (b basicGCPResource) getTerraformName() string {\n\treturn b.terraformName\n}\n\nfunc (b basicGCPResource) getAdditionalFields() map[string]string {\n\treturn b.additionalFields\n}\n\nfunc (b basicGCPResource) getAdditionalFieldsForRefresh() map[string]string {\n\treturn b.additionalFieldsForRefresh\n}\n\nfunc (b basicGCPResource) getAllowEmptyValues() []string {\n\treturn b.allowEmptyValues\n}\nfunc (b basicGCPResource) ifNeedRegion() bool {\n\treturn true\n}\n\nfunc (b basicGCPResource) ifNeedZone(zoneInParameters bool) bool {\n\treturn zoneInParameters\n}\n\nfunc (b basicGCPResource) ifIDWithZone(zoneInParameters bool) bool {\n\treturn zoneInParameters\n}\n"
  },
  {
    "path": "providers/gcp/gcp_compute_code_generator/globalForwardingRules.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\ntype globalForwardingRules struct {\n\tbasicGCPResource\n}\n\nfunc (b globalForwardingRules) ifNeedRegion() bool {\n\treturn false\n}\n"
  },
  {
    "path": "providers/gcp/gcp_compute_code_generator/instanceGroupManagers.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\ntype instanceGroupManagers struct {\n\tbasicGCPResource\n}\n\nfunc (b instanceGroupManagers) ifNeedZone(zoneInParameters bool) bool {\n\treturn true\n}\n\nfunc (b instanceGroupManagers) ifIDWithZone(zoneInParameters bool) bool {\n\treturn false\n}\nfunc (b instanceGroupManagers) ifNeedRegion() bool {\n\treturn false\n}\n"
  },
  {
    "path": "providers/gcp/gcp_compute_code_generator/main.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"go/format\"\n\t\"log\"\n\t\"os\"\n\t\"strings\"\n\t\"text/template\"\n)\n\nconst pathForGenerateFiles = \"/providers/gcp/\"\nconst serviceTemplate = `\n// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t{{ if .byZone  }}\"strings\"{{end}}\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar {{.resource}}AllowEmptyValues = []string{\"{{join .allowEmptyValues \"\\\",\\\"\" }}\"}\n\nvar {{.resource}}AdditionalFields = map[string]interface{}{\n\t{{ range $key,$value := .additionalFields}}\n\t\"{{$key}}\":\t\t\t\"{{$value}}\",{{end}}\n}\n\ntype {{.titleResourceName}}Generator struct {\n\tGCPService\n}\n\n// Run on {{.resource}}List and create for each TerraformResource\nfunc (g {{.titleResourceName}}Generator) createResources(ctx context.Context, {{.resource}}List *compute.{{.titleResourceName}}ListCall{{ if .byZone  }}, zone string{{end}}) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := {{.resource}}List.Pages(ctx, func(page *compute.{{.responseName}}) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t{{ if .idWithZone  }}zone+\"/\"+obj.Name,{{else}}obj.Name,{{end}}\n\t\t\t\t{{ if .idWithZone  }}zone+\"/\"+obj.Name,{{else}}obj.Name,{{end}}\n\t\t\t\t\"{{.terraformName}}\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t{{ if .needRegion}}\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,{{end}}\n\t\t\t\t\t{{ if .byZone  }}\"zone\":    zone,{{end}}\n\t\t\t\t\t{{ range $key, $value := .additionalFieldsForRefresh}}\n\t\t\t\t\t\"{{$key}}\":\t\t\t\"{{$value}}\",{{end}}\n\t\t\t\t},\n\t\t\t\t{{.resource}}AllowEmptyValues,\n\t\t\t\t{{.resource}}AdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each {{.resource}} create 1 TerraformResource\n// Need {{.resource}} name as ID for terraform resource\nfunc (g *{{.titleResourceName}}Generator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\t{{ if .byZone  }}\n\tfor _, zoneLink := range g.GetArgs()[\"region\"].(compute.Region).Zones {\n\t\tt := strings.Split(zoneLink, \"/\")\n\t\tzone := t[len(t)-1]\n\t\t{{.resource}}List := computeService.{{.titleResourceName}}.List(g.GetArgs()[\"project\"].(string), zone)\n\t\tg.Resources = append(g.Resources, g.createResources(ctx, {{.resource}}List, zone)...)\n\t}\n\t{{else}}\n\t\t{{.resource}}List := computeService.{{.titleResourceName}}.List({{.parameterOrder}})\n\t\tg.Resources = g.createResources(ctx, {{.resource}}List)\n\t{{end}}\n\n\treturn nil\n\n}\n\n`\nconst computeTemplate = `\n// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\n// Map of supported GCP compute service with code generate\nvar ComputeServices = map[string]terraformutils.ServiceGenerator{\n{{ range $key, $value := .services }}\n\t\"{{$key}}\":                   &GCPFacade{service: &{{title $key}}Generator{}},{{ end }}\n\n}\n\n`\n\nfunc main() {\n\tcomputeAPIData, err := os.ReadFile(os.Getenv(\"GOPATH\") + \"/src/google.golang.org/api/compute/v1/compute-api.json\") // TODO delete this hack\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tcomputeAPI := map[string]interface{}{}\n\terr = json.Unmarshal(computeAPIData, &computeAPI)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfuncMap := template.FuncMap{\n\t\t\"title\":   strings.Title,\n\t\t\"toLower\": strings.ToLower,\n\t\t\"join\":    strings.Join,\n\t}\n\tfor resource, v := range computeAPI[\"resources\"].(map[string]interface{}) {\n\t\tif _, exist := terraformResources[resource]; !exist {\n\t\t\tcontinue\n\t\t}\n\t\tif value, exist := v.(map[string]interface{})[\"methods\"].(map[string]interface{})[\"list\"]; exist {\n\t\t\tparameters := []string{}\n\t\t\tfor _, param := range value.(map[string]interface{})[\"parameterOrder\"].([]interface{}) {\n\t\t\t\tswitch param.(string) {\n\t\t\t\tcase \"region\":\n\t\t\t\t\tparameters = append(parameters, `g.GetArgs()[\"region\"].(compute.Region).Name`)\n\t\t\t\tcase \"project\":\n\t\t\t\t\tparameters = append(parameters, `g.GetArgs()[\"project\"].(string)`)\n\t\t\t\tcase \"zone\":\n\t\t\t\t\tparameters = append(parameters, `g.GetArgs()[\"zone\"].(string)`)\n\t\t\t\t}\n\t\t\t}\n\t\t\tparameterOrder := strings.Join(parameters, \", \")\n\t\t\tvar tpl bytes.Buffer\n\t\t\tt := template.Must(template.New(\"resource.go\").Funcs(funcMap).Parse(serviceTemplate))\n\t\t\terr := t.Execute(&tpl, map[string]interface{}{\n\t\t\t\t\"titleResourceName\":          strings.Title(resource),\n\t\t\t\t\"resource\":                   resource,\n\t\t\t\t\"responseName\":               value.(map[string]interface{})[\"response\"].(map[string]interface{})[\"$ref\"].(string),\n\t\t\t\t\"terraformName\":              terraformResources[resource].getTerraformName(),\n\t\t\t\t\"additionalFields\":           terraformResources[resource].getAdditionalFields(),\n\t\t\t\t\"additionalFieldsForRefresh\": terraformResources[resource].getAdditionalFieldsForRefresh(),\n\t\t\t\t\"allowEmptyValues\":           terraformResources[resource].getAllowEmptyValues(),\n\t\t\t\t\"needRegion\":                 terraformResources[resource].ifNeedRegion(),\n\t\t\t\t\"resourcePackageName\":        resource,\n\t\t\t\t\"parameterOrder\":             parameterOrder,\n\t\t\t\t\"byZone\":                     terraformResources[resource].ifNeedZone(strings.Contains(parameterOrder, \"zone\")),\n\t\t\t\t\"idWithZone\":                 terraformResources[resource].ifIDWithZone(strings.Contains(parameterOrder, \"zone\")),\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(resource, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trootPath, _ := os.Getwd()\n\t\t\tcurrentPath := rootPath + pathForGenerateFiles\n\t\t\terr = os.MkdirAll(currentPath, os.ModePerm)\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(resource, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terr = os.WriteFile(currentPath+\"/\"+resource+\"_gen.go\", codeFormat(tpl.Bytes()), os.ModePerm)\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(resource, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Println(resource)\n\t\t}\n\t}\n\tvar tpl bytes.Buffer\n\tt := template.Must(template.New(\"compute.go\").Funcs(funcMap).Parse(computeTemplate))\n\terr = t.Execute(&tpl, map[string]interface{}{\n\t\t\"services\": terraformResources,\n\t})\n\tif err != nil {\n\t\tlog.Print(err)\n\t}\n\trootPath, _ := os.Getwd()\n\terr = os.WriteFile(rootPath+pathForGenerateFiles+\"compute.go\", codeFormat(tpl.Bytes()), os.ModePerm)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}\n\nfunc codeFormat(src []byte) []byte {\n\tcode, err := format.Source(src)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn code\n}\n"
  },
  {
    "path": "providers/gcp/gcp_compute_code_generator/resources.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\n// metadata for generate code for GCP compute service\nvar terraformResources = map[string]gcpResourceRenderable{\n\t\"addresses\": basicGCPResource{\n\t\tterraformName: \"google_compute_address\",\n\t},\n\t\"autoscalers\": basicGCPResource{\n\t\tterraformName: \"google_compute_autoscaler\",\n\t},\n\t\"backendBuckets\": basicGCPResource{\n\t\tterraformName: \"google_compute_backend_bucket\",\n\t},\n\t\"backendServices\": backendServices{\n\t\tbasicGCPResource{\n\t\t\tterraformName: \"google_compute_backend_service\",\n\t\t},\n\t},\n\t\"disks\": basicGCPResource{\n\t\tterraformName: \"google_compute_disk\",\n\t},\n\t\"externalVpnGateways\": basicGCPResource{\n\t\tterraformName: \"google_compute_external_vpn_gateway\",\n\t},\n\t\"firewall\": basicGCPResource{\n\t\tterraformName: \"google_compute_firewall\",\n\t},\n\t\"forwardingRules\": basicGCPResource{\n\t\tterraformName: \"google_compute_forwarding_rule\",\n\t},\n\t\"globalAddresses\": basicGCPResource{\n\t\tterraformName: \"google_compute_global_address\",\n\t},\n\t\"globalForwardingRules\": globalForwardingRules{\n\t\tbasicGCPResource{\n\t\t\tterraformName: \"google_compute_global_forwarding_rule\",\n\t\t},\n\t},\n\t// \"globalNetworkEndpointGroups\": basicGCPResource{\n\t// \tterraformName: \"google_compute_global_network_endpoint\",\n\t// },\n\t\"healthChecks\": basicGCPResource{\n\t\tterraformName: \"google_compute_health_check\",\n\t},\n\t\"httpHealthChecks\": basicGCPResource{\n\t\tterraformName: \"google_compute_http_health_check\",\n\t},\n\t\"httpsHealthChecks\": basicGCPResource{\n\t\tterraformName: \"google_compute_https_health_check\",\n\t},\n\t\"images\": basicGCPResource{\n\t\tterraformName: \"google_compute_image\",\n\t},\n\t\"instanceGroupManagers\": instanceGroupManagers{\n\t\tbasicGCPResource{\n\t\t\tterraformName:    \"google_compute_instance_group_manager\",\n\t\t\tallowEmptyValues: []string{\"^version.[0-9].name\", \"^auto_healing_policies.[0-9].health_check\"},\n\t\t},\n\t},\n\t\"instanceGroups\": basicGCPResource{\n\t\tterraformName: \"google_compute_instance_group\",\n\t},\n\t\"instanceTemplates\": basicGCPResource{\n\t\tterraformName: \"google_compute_instance_template\",\n\t},\n\t/*\"instances\": instances{\n\t\tbasicGCPResource{\n\t\t\tterraformName:    \"google_compute_instance\",\n\t\t\tallowEmptyValues: []string{\"labels.\"},\n\t\t\tadditionalFieldsForRefresh: map[string]string{\n\t\t\t\t\"disk.#\": \"0\",\n\t\t\t},\n\t\t},\n\t},*/\n\t\"networks\": basicGCPResource{\n\t\tterraformName: \"google_compute_network\",\n\t},\n\t\"packetMirrorings\": basicGCPResource{\n\t\tterraformName: \"google_compute_packet_mirroring\",\n\t},\n\t\"regionAutoscalers\": basicGCPResource{\n\t\tterraformName: \"google_compute_region_autoscaler\",\n\t},\n\t\"regionBackendServices\": basicGCPResource{\n\t\tterraformName: \"google_compute_region_backend_service\",\n\t},\n\t\"regionDisks\": basicGCPResource{\n\t\tterraformName: \"google_compute_region_disk\",\n\t},\n\t\"regionHealthChecks\": basicGCPResource{\n\t\tterraformName: \"google_compute_region_health_check\",\n\t},\n\t\"regionInstanceGroupManagers\": basicGCPResource{\n\t\tterraformName:    \"google_compute_region_instance_group_manager\",\n\t\tallowEmptyValues: []string{\"name\", \"health_check\"},\n\t},\n\t\"regionInstanceGroups\": basicGCPResource{\n\t\tterraformName: \"google_compute_region_instance_group\",\n\t},\n\t\"regionSslCertificates\": basicGCPResource{\n\t\tterraformName: \"google_compute_region_ssl_certificate\",\n\t},\n\t\"regionTargetHttpProxies\": basicGCPResource{\n\t\tterraformName: \"google_compute_region_target_http_proxy\",\n\t},\n\t\"regionTargetHttpsProxies\": basicGCPResource{\n\t\tterraformName: \"google_compute_region_target_https_proxy\",\n\t},\n\t\"regionUrlMaps\": basicGCPResource{\n\t\tterraformName: \"google_compute_region_url_map\",\n\t},\n\t\"reservations\": basicGCPResource{\n\t\tterraformName: \"google_compute_reservation\",\n\t},\n\t\"resourcePolicies\": basicGCPResource{\n\t\tterraformName: \"google_compute_resource_policy\",\n\t},\n\t\"routers\": basicGCPResource{\n\t\tterraformName: \"google_compute_router\",\n\t},\n\t\"routes\": basicGCPResource{\n\t\tterraformName: \"google_compute_route\",\n\t},\n\t\"securityPolicies\": basicGCPResource{\n\t\tterraformName: \"google_compute_security_policy\",\n\t},\n\t/*\"snapshots\": {\n\t\tterraformName: \"google_compute_snapshot\",\n\t\tignoreKeys: []string{\n\t\t\t\"snapshot_encryption_key_sha256\",\n\t\t\t\"source_disk_encryption_key_sha256\",\n\t\t\t\"source_disk_link\",\n\t\t},\n\t},*/\n\t\"sslCertificates\": basicGCPResource{\n\t\tterraformName: \"google_compute_managed_ssl_certificate\",\n\t},\n\t\"sslPolicies\": basicGCPResource{\n\t\tterraformName: \"google_compute_ssl_policy\",\n\t},\n\t\"subnetworks\": basicGCPResource{\n\t\tterraformName: \"google_compute_subnetwork\",\n\t},\n\t\"targetHttpProxies\": basicGCPResource{\n\t\tterraformName: \"google_compute_target_http_proxy\",\n\t},\n\t\"targetHttpsProxies\": basicGCPResource{\n\t\tterraformName: \"google_compute_target_https_proxy\",\n\t},\n\t\"targetSslProxies\": basicGCPResource{\n\t\tterraformName: \"google_compute_target_ssl_proxy\",\n\t},\n\t\"targetTcpProxies\": basicGCPResource{\n\t\tterraformName: \"google_compute_target_tcp_proxy\",\n\t},\n\t\"urlMaps\": basicGCPResource{\n\t\tterraformName: \"google_compute_url_map\",\n\t},\n\t\"vpnTunnels\": basicGCPResource{\n\t\tterraformName: \"google_compute_vpn_tunnel\",\n\t},\n\t\"nodeGroups\": basicGCPResource{\n\t\tterraformName: \"google_compute_node_group\",\n\t},\n\t\"nodeTemplates\": basicGCPResource{\n\t\tterraformName: \"google_compute_node_template\",\n\t},\n\t\"targetPools\": basicGCPResource{\n\t\tterraformName: \"google_compute_target_pool\",\n\t},\n\t\"interconnectAttachments\": basicGCPResource{\n\t\tterraformName: \"google_compute_interconnect_attachment\",\n\t},\n\t\"targetInstances\": basicGCPResource{\n\t\tterraformName: \"google_compute_target_instance\",\n\t},\n\t\"targetVpnGateways\": basicGCPResource{\n\t\tterraformName: \"google_compute_vpn_gateway\",\n\t},\n\t\"networkEndpointGroups\": basicGCPResource{\n\t\tterraformName: \"google_compute_network_endpoint_group\",\n\t},\n}\n"
  },
  {
    "path": "providers/gcp/gcp_facade.go",
    "content": "package gcp\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/providerwrapper\"\n)\n\ntype GCPFacade struct { //nolint\n\tGCPService\n\tservice terraformutils.ServiceGenerator\n}\n\nfunc (s *GCPFacade) SetProviderName(providerName string) {\n\ts.service.SetProviderName(providerName)\n}\n\nfunc (s *GCPFacade) SetVerbose(verbose bool) {\n\ts.service.SetVerbose(verbose)\n}\n\nfunc (s *GCPFacade) ParseFilters(rawFilters []string) {\n\ts.service.ParseFilters(rawFilters)\n}\n\nfunc (s *GCPFacade) ParseFilter(rawFilter string) []terraformutils.ResourceFilter {\n\treturn s.service.ParseFilter(rawFilter)\n}\n\nfunc (s *GCPFacade) SetName(name string) {\n\ts.service.SetName(name)\n}\nfunc (s *GCPFacade) GetName() string {\n\treturn s.service.GetName()\n}\n\nfunc (s *GCPFacade) InitialCleanup() {\n\ts.service.InitialCleanup()\n}\n\nfunc (s *GCPFacade) PostRefreshCleanup() {\n\ts.service.PostRefreshCleanup()\n}\n\nfunc (s *GCPFacade) GetArgs() map[string]interface{} {\n\treturn s.service.GetArgs()\n}\nfunc (s *GCPFacade) SetArgs(args map[string]interface{}) {\n\ts.service.SetArgs(args)\n}\n\nfunc (s *GCPFacade) GetResources() []terraformutils.Resource {\n\treturn s.service.GetResources()\n}\nfunc (s *GCPFacade) SetResources(resources []terraformutils.Resource) {\n\ts.service.SetResources(resources)\n}\n\nfunc (s *GCPFacade) InitResources() error {\n\terr := s.service.InitResources()\n\tif err == nil {\n\t\treturn nil\n\t}\n\treturn err\n}\n\nfunc (s *GCPFacade) PostConvertHook() error {\n\tif s.service.GetProviderName() != \"google\" {\n\t\ts.service.SetResources(s.applyCustomProviderType(s.service.GetResources(), s.service.GetProviderName()))\n\t}\n\treturn s.service.PostConvertHook()\n}\n\nfunc (s *GCPFacade) PopulateIgnoreKeys(providerWrapper *providerwrapper.ProviderWrapper) {\n\ts.service.PopulateIgnoreKeys(providerWrapper)\n}\n"
  },
  {
    "path": "providers/gcp/gcp_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"google.golang.org/api/compute/v1\"\n)\n\ntype GCPProvider struct { //nolint\n\tterraformutils.Provider\n\tprojectName  string\n\tregion       compute.Region\n\tproviderType string\n}\n\nfunc GetRegions(project string) []string {\n\tcomputeService, err := compute.NewService(context.Background())\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\tregionsList, err := computeService.Regions.List(project).Do()\n\tif err != nil {\n\t\treturn []string{}\n\t}\n\tregions := []string{}\n\tfor _, region := range regionsList.Items {\n\t\tregions = append(regions, region.Name)\n\t}\n\treturn regions\n}\n\nfunc getRegion(project, regionName string) *compute.Region {\n\tif regionName == \"global\" {\n\t\treturn &compute.Region{}\n\t}\n\tcomputeService, err := compute.NewService(context.Background())\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn &compute.Region{}\n\t}\n\tregionsGetCall := computeService.Regions.Get(project, regionName).Fields(\"name\", \"zones\")\n\tregion, err := regionsGetCall.Do()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn &compute.Region{}\n\t}\n\treturn region\n}\n\n// check projectName in env params\nfunc (p *GCPProvider) Init(args []string) error {\n\tprojectName := os.Getenv(\"GOOGLE_CLOUD_PROJECT\")\n\tif len(args) > 1 {\n\t\tprojectName = args[1]\n\t}\n\tif projectName == \"\" {\n\t\treturn errors.New(\"google cloud project name must be set\")\n\t}\n\tp.projectName = projectName\n\tp.region = *getRegion(projectName, args[0])\n\tp.providerType = args[2]\n\treturn nil\n}\n\nfunc (p *GCPProvider) GetName() string {\n\tif p.providerType != \"\" {\n\t\treturn \"google-\" + p.providerType\n\t}\n\treturn \"google\"\n}\n\nfunc (p *GCPProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"gcp: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"region\":  p.region,\n\t\t\"project\": p.projectName,\n\t})\n\treturn nil\n}\n\n// GetGCPSupportService return map of support service for GCP\nfunc (p *GCPProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\tservices := ComputeServices\n\tservices[\"bigQuery\"] = &GCPFacade{service: &BigQueryGenerator{}}\n\tservices[\"cloudFunctions\"] = &GCPFacade{service: &CloudFunctionsGenerator{}}\n\tservices[\"cloudsql\"] = &GCPFacade{service: &CloudSQLGenerator{}}\n\tservices[\"cloudtasks\"] = &GCPFacade{service: &CloudTaskGenerator{}}\n\tservices[\"dataProc\"] = &GCPFacade{service: &DataprocGenerator{}}\n\tservices[\"dns\"] = &GCPFacade{service: &CloudDNSGenerator{}}\n\tservices[\"gcs\"] = &GCPFacade{service: &GcsGenerator{}}\n\tservices[\"gke\"] = &GCPFacade{service: &GkeGenerator{}}\n\tservices[\"iam\"] = &GCPFacade{service: &IamGenerator{}}\n\tservices[\"kms\"] = &GCPFacade{service: &KmsGenerator{}}\n\tservices[\"logging\"] = &GCPFacade{service: &LoggingGenerator{}}\n\tservices[\"memoryStore\"] = &GCPFacade{service: &MemoryStoreGenerator{}}\n\tservices[\"monitoring\"] = &GCPFacade{service: &MonitoringGenerator{}}\n\tservices[\"project\"] = &GCPFacade{service: &ProjectGenerator{}}\n\tservices[\"instances\"] = &GCPFacade{service: &InstancesGenerator{}}\n\tservices[\"pubsub\"] = &GCPFacade{service: &PubsubGenerator{}}\n\tservices[\"schedulerJobs\"] = &GCPFacade{service: &SchedulerJobsGenerator{}}\n\tservices[\"cloudbuild\"] = &GCPFacade{service: &CloudBuildGenerator{}}\n\treturn services\n}\n\nfunc (GCPProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"backendBuckets\": {\"gcs\": []string{\"bucket_name\", \"name\"}},\n\t\t\"firewall\":       {\"networks\": []string{\"network\", \"self_link\"}},\n\t\t\"gke\": {\n\t\t\t\"networks\":    []string{\"network\", \"self_link\"},\n\t\t\t\"subnetworks\": []string{\"subnetwork\", \"self_link\"},\n\t\t},\n\t\t\"instanceTemplates\": {\n\t\t\t\"networks\":    []string{\"network\", \"self_link\"},\n\t\t\t\"subnetworks\": []string{\"subnetworks\", \"self_link\"},\n\t\t},\n\t\t\"regionInstanceGroupManagers\": {\"instanceTemplates\": []string{\"version.instance_template\", \"self_link\"}},\n\t\t\"instanceGroups\":              {\"instanceTemplates\": []string{\"version.instance_template\", \"self_link\"}},\n\t\t\"routes\":                      {\"networks\": []string{\"network\", \"self_link\"}},\n\t\t\"subnetworks\":                 {\"networks\": []string{\"network\", \"self_link\"}},\n\t\t\"forwardingRules\": {\n\t\t\t\"regionBackendServices\": []string{\"backend_service\", \"self_link\"},\n\t\t\t\"networks\":              []string{\"network\", \"self_link\"},\n\t\t},\n\t\t\"globalForwardingRules\": {\n\t\t\t\"targetHttpsProxies\": []string{\"target\", \"self_link\"},\n\t\t\t\"targetHttpProxies\":  []string{\"target\", \"self_link\"},\n\t\t\t\"targetSslProxies\":   []string{\"target\", \"self_link\"},\n\t\t},\n\t\t\"targetHttpsProxies\": {\n\t\t\t\"urlMaps\": []string{\"url_map\", \"self_link\"},\n\t\t},\n\t\t\"targetHttpProxies\": {\n\t\t\t\"urlMaps\": []string{\"url_map\", \"self_link\"},\n\t\t},\n\t\t\"targetSslProxies\": {\n\t\t\t\"backendServices\": []string{\"backend_service\", \"self_link\"},\n\t\t},\n\t\t\"backendServices\": {\n\t\t\t\"regionInstanceGroupManagers\": []string{\"backend.group\", \"instance_group\"},\n\t\t\t\"instanceGroupManagers\":       []string{\"backend.group\", \"instance_group\"},\n\t\t\t\"healthChecks\":                []string{\"health_checks\", \"self_link\"},\n\t\t},\n\t\t\"regionBackendServices\": {\n\t\t\t\"regionInstanceGroupManagers\": []string{\"backend.group\", \"instance_group\"},\n\t\t\t\"instanceGroupManagers\":       []string{\"backend.group\", \"instance_group\"},\n\t\t\t\"healthChecks\":                []string{\"health_checks\", \"self_link\"},\n\t\t},\n\t\t\"urlMaps\": {\n\t\t\t\"backendServices\": []string{\n\t\t\t\t\"default_service\", \"self_link\",\n\t\t\t\t\"path_matcher.default_service\", \"self_link\",\n\t\t\t\t\"path_matcher.path_rule.service\", \"self_link\",\n\t\t\t},\n\t\t\t\"regionBackendServices\": []string{\n\t\t\t\t\"default_service\", \"self_link\",\n\t\t\t\t\"path_matcher.default_service\", \"self_link\",\n\t\t\t\t\"path_matcher.path_rule.service\", \"self_link\",\n\t\t\t},\n\t\t},\n\t}\n}\nfunc (p GCPProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\tp.GetName(): map[string]interface{}{\n\t\t\t\t\"project\": p.projectName,\n\t\t\t},\n\t\t},\n\t}\n}\n"
  },
  {
    "path": "providers/gcp/gcp_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype GCPService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *GCPService) applyCustomProviderType(resources []terraformutils.Resource, providerName string) []terraformutils.Resource {\n\teditedResources := []terraformutils.Resource{}\n\tfor _, r := range resources {\n\t\tr.Item[\"provider\"] = providerName\n\t\teditedResources = append(editedResources, r)\n\t}\n\treturn editedResources\n}\n"
  },
  {
    "path": "providers/gcp/gcs.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/storage/v1\"\n)\n\nvar GcsAllowEmptyValues = []string{\"labels.\", \"created_before\"}\n\nvar GcsAdditionalFields = map[string]interface{}{}\n\ntype GcsGenerator struct {\n\tGCPService\n}\n\nfunc (g *GcsGenerator) createBucketsResources(ctx context.Context, gcsService *storage.Service) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tbucketList := gcsService.Buckets.List(g.GetArgs()[\"project\"].(string))\n\tif err := bucketList.Pages(ctx, func(page *storage.Buckets) error {\n\t\tfor _, bucket := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tbucket.Name,\n\t\t\t\tbucket.Name,\n\t\t\t\t\"google_storage_bucket\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":          bucket.Name,\n\t\t\t\t\t\"force_destroy\": \"false\",\n\t\t\t\t},\n\t\t\t\tGcsAllowEmptyValues,\n\t\t\t\tGcsAdditionalFields,\n\t\t\t))\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tbucket.Name,\n\t\t\t\tbucket.Name,\n\t\t\t\t\"google_storage_bucket_acl\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"bucket\":        bucket.Name,\n\t\t\t\t\t\"role_entity.#\": strconv.Itoa(len(bucket.Acl)),\n\t\t\t\t},\n\t\t\t\tGcsAllowEmptyValues,\n\t\t\t\tGcsAdditionalFields,\n\t\t\t))\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tbucket.Name,\n\t\t\t\tbucket.Name,\n\t\t\t\t\"google_storage_default_object_acl\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"bucket\":        bucket.Name,\n\t\t\t\t\t\"role_entity.#\": strconv.Itoa(len(bucket.Acl)),\n\t\t\t\t},\n\t\t\t\tGcsAllowEmptyValues,\n\t\t\t\tGcsAdditionalFields,\n\t\t\t))\n\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tbucket.Name,\n\t\t\t\tbucket.Name,\n\t\t\t\t\"google_storage_bucket_iam_policy\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"bucket\": bucket.Name,\n\t\t\t\t},\n\t\t\t\tGcsAllowEmptyValues,\n\t\t\t\tGcsAdditionalFields,\n\t\t\t))\n\n\t\t\tif iam, err := gcsService.Buckets.GetIamPolicy(bucket.Name).Do(); err == nil {\n\t\t\t\tfor _, binding := range iam.Bindings {\n\t\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\t\tbucket.Name,\n\t\t\t\t\t\tbucket.Name,\n\t\t\t\t\t\t\"google_storage_bucket_iam_binding\",\n\t\t\t\t\t\tg.ProviderName,\n\t\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\t\"bucket\": bucket.Name,\n\t\t\t\t\t\t\t\"role\":   binding.Role,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tGcsAllowEmptyValues,\n\t\t\t\t\t\tGcsAdditionalFields,\n\t\t\t\t\t))\n\n\t\t\t\t\tfor _, member := range binding.Members {\n\t\t\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\t\t\tbucket.Name,\n\t\t\t\t\t\t\tbucket.Name,\n\t\t\t\t\t\t\t\"google_storage_bucket_iam_member\",\n\t\t\t\t\t\t\tg.ProviderName,\n\t\t\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\t\t\"bucket\": bucket.Name,\n\t\t\t\t\t\t\t\t\"role\":   binding.Role,\n\t\t\t\t\t\t\t\t\"member\": member,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tGcsAllowEmptyValues,\n\t\t\t\t\t\t\tGcsAdditionalFields,\n\t\t\t\t\t\t))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresources = append(resources, g.createNotificationResources(gcsService, bucket)...)\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\nfunc (g *GcsGenerator) createNotificationResources(gcsService *storage.Service, bucket *storage.Bucket) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tnotificationList, err := gcsService.Notifications.List(bucket.Name).Do()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn resources\n\t}\n\tfor _, notification := range notificationList.Items {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tbucket.Name+\"/notificationConfigs/\"+notification.Id,\n\t\t\tbucket.Name+\"/\"+notification.Id,\n\t\t\t\"google_storage_notification\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{},\n\t\t\tGcsAllowEmptyValues,\n\t\t\tGcsAdditionalFields,\n\t\t))\n\t}\n\treturn resources\n}\n\n/*\nfunc (g *GcsGenerator) createTransferJobsResources(ctx context.Context, storageTransferService *storagetransfer.Service) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\ttransferJobsList := storageTransferService.TransferJobs.List()\n\terr := transferJobsList.Pages(ctx, func(page *storagetransfer.ListTransferJobsResponse) error {\n\t\tlog.Println(page.TransferJobs)\n\t\tfor _, transferJob := range page.TransferJobs {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\ttransferJob.Name,\n\t\t\t\ttransferJob.Name,\n\t\t\t\t\"google_storage_transfer_job\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\": transferJob.Name,\n\t\t\t\t},\n\t\t\t\tGcsAllowEmptyValues,\n\t\t\t\tGcsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn resources\n}\n*/\n\n// Generate TerraformResources from GCP API,\n// from each bucket  create 1 TerraformResource\n// Need bucket name as ID for terraform resource\nfunc (g *GcsGenerator) InitResources() error {\n\tctx := context.Background()\n\tgcsService, err := storage.NewService(ctx)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn err\n\t}\n\tg.Resources = g.createBucketsResources(ctx, gcsService)\n\n\t// TODO find bug with storageTransferService.TransferJobs.List().Pages\n\t// storageTransferService, err := storagetransfer.NewService(ctx)\n\t// if err != nil {\n\t// \tlog.Print(err)\n\t// \t\treturn err\n\t// \t}\n\t// g.Resources = append(g.Resources, g.createTransferJobsResources(ctx, storageTransferService)...)\n\treturn nil\n}\n\n// PostGenerateHook for add bucket policy json as heredoc\n// support only bucket with policy\nfunc (g *GcsGenerator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type != \"google_storage_bucket_iam_policy\" {\n\t\t\tcontinue\n\t\t}\n\t\tif _, exist := resource.Item[\"policy_data\"]; exist {\n\t\t\tpolicy := resource.Item[\"policy_data\"].(string)\n\t\t\tg.Resources[i].Item[\"policy_data\"] = fmt.Sprintf(`<<POLICY\n%s\nPOLICY`, policy)\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/gke.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\tcontainer \"google.golang.org/api/container/v1beta1\"\n)\n\nvar GkeAllowEmptyValues = []string{\"labels.\"}\n\nvar GkeAdditionalFields = map[string]interface{}{}\n\ntype GkeGenerator struct {\n\tGCPService\n}\n\nfunc (g *GkeGenerator) initClusters(clusters *container.ListClustersResponse) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, cluster := range clusters.Clusters {\n\t\tif _, exist := cluster.ResourceLabels[\"goog-composer-environment\"]; exist { // don't manage composer clusters\n\t\t\tcontinue\n\t\t}\n\t\tresource := terraformutils.NewResource(\n\t\t\tcluster.Name,\n\t\t\tcluster.Name,\n\t\t\t\"google_container_cluster\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":     cluster.Name, // provider need cluster name as Required\n\t\t\t\t\"project\":  g.GetArgs()[\"project\"].(string),\n\t\t\t\t\"location\": cluster.Location,\n\t\t\t\t\"zone\":     cluster.Zone,\n\t\t\t},\n\t\t\tGkeAllowEmptyValues,\n\t\t\tGkeAdditionalFields,\n\t\t)\n\t\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\t\"^region$\",\n\t\t\t\"^additional_zones\\\\.(.*)\",\n\t\t\t\"^zone$\",\n\t\t\t\"^node_pool\\\\.(.*)\",   // delete node_pool config from google_container_cluster\n\t\t\t\"^node_config\\\\.(.*)\", // delete node_config config from google_container_cluster\n\t\t\t\"^ip_allocation_policy\\\\.[0-9]\\\\.cluster_secondary_range_name$\",  // conflict with cluster_ipv4_cidr_block\n\t\t\t\"^ip_allocation_policy\\\\.[0-9]\\\\.services_secondary_range_name$\", // conflict with services_ipv4_cidr_block\n\t\t\t\"^ip_allocation_policy\\\\.[0-9]\\\\.create_subnetwork\")              // only for create new cluster conflict with others ip_allocation_policy fields\n\t\tresources = append(resources, resource)\n\t\tresources = append(resources, g.initNodePools(cluster.NodePools, cluster.Name, cluster.Location)...)\n\t}\n\treturn resources\n}\n\nfunc (g *GkeGenerator) initNodePools(nodePools []*container.NodePool, clusterName, location string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, nodePool := range nodePools {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s/%s/%s\", location, clusterName, nodePool.Name),\n\t\t\tclusterName+\"_\"+nodePool.Name,\n\t\t\t\"google_container_node_pool\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"location\": location,\n\t\t\t\t\"zone\":     location,\n\t\t\t\t\"project\":  g.GetArgs()[\"project\"].(string),\n\t\t\t\t\"cluster\":  clusterName, // provider need cluster name as Required\n\t\t\t\t\"name\":     nodePool.Name,\n\t\t\t},\n\t\t\tGkeAllowEmptyValues,\n\t\t\tGkeAdditionalFields,\n\t\t))\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\nfunc (g *GkeGenerator) InitResources() error {\n\tctx := context.Background()\n\tservice, err := container.NewService(ctx)\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn err\n\t}\n\t// GKE support zone and regional cluster, api use location, it's can be region or zone, for all \"-\"\n\tlocation := fmt.Sprintf(\"projects/%s/locations/%s\", g.GetArgs()[\"project\"].(string), \"-\")\n\tclusters, err := service.Projects.Locations.Clusters.List(location).Do()\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn err\n\t}\n\n\tg.Resources = g.initClusters(clusters)\n\treturn nil\n}\n\nfunc (g *GkeGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"google_container_node_pool\" {\n\t\t\tcontinue\n\t\t}\n\t\tif _, existNodeConfig := g.Resources[i].Item[\"node_config\"]; existNodeConfig {\n\t\t\tif _, existMetadata := g.Resources[i].Item[\"node_config\"].([]interface{})[0].(map[string]interface{})[\"metadata\"]; existMetadata {\n\t\t\t\tfor k, v := range g.Resources[i].Item[\"node_config\"].([]interface{})[0].(map[string]interface{})[\"metadata\"].(map[string]interface{}) {\n\t\t\t\t\tswitch x := v.(type) {\n\t\t\t\t\tcase bool:\n\t\t\t\t\t\tg.Resources[i].Item[\"node_config\"].([]interface{})[0].(map[string]interface{})[\"metadata\"].(map[string]interface{})[k] = strconv.FormatBool(x)\n\t\t\t\t\tdefault:\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor _, cluster := range g.Resources {\n\t\t\tif cluster.InstanceState.Attributes[\"name\"] == r.InstanceState.Attributes[\"cluster\"] {\n\t\t\t\tg.Resources[i].Item[\"cluster\"] = \"${google_container_cluster.\" + cluster.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t}\n\n\t// hacks for fix GCP API<=>provider<=>parser inconsistency\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"google_container_cluster\" {\n\t\t\tcontinue\n\t\t}\n\t\tif r.Item[\"master_authorized_networks_config\"] != nil {\n\t\t\tif len(r.Item[\"master_authorized_networks_config\"].([]interface{})) == 0 {\n\t\t\t\tg.Resources[i].Item[\"master_authorized_networks_config\"] = map[string]interface{}{}\n\t\t\t}\n\t\t}\n\t\tif r.Item[\"ip_allocation_policy\"] != nil {\n\t\t\tif len(r.Item[\"ip_allocation_policy\"].([]interface{})) == 0 {\n\t\t\t\tg.Resources[i].Item[\"ip_allocation_policy\"] = map[string]interface{}{}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/globalAddresses_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar globalAddressesAllowEmptyValues = []string{\"\"}\n\nvar globalAddressesAdditionalFields = map[string]interface{}{}\n\ntype GlobalAddressesGenerator struct {\n\tGCPService\n}\n\n// Run on globalAddressesList and create for each TerraformResource\nfunc (g GlobalAddressesGenerator) createResources(ctx context.Context, globalAddressesList *compute.GlobalAddressesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := globalAddressesList.Pages(ctx, func(page *compute.AddressList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_global_address\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tglobalAddressesAllowEmptyValues,\n\t\t\t\tglobalAddressesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each globalAddresses create 1 TerraformResource\n// Need globalAddresses name as ID for terraform resource\nfunc (g *GlobalAddressesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tglobalAddressesList := computeService.GlobalAddresses.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, globalAddressesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/globalForwardingRules_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar globalForwardingRulesAllowEmptyValues = []string{\"\"}\n\nvar globalForwardingRulesAdditionalFields = map[string]interface{}{}\n\ntype GlobalForwardingRulesGenerator struct {\n\tGCPService\n}\n\n// Run on globalForwardingRulesList and create for each TerraformResource\nfunc (g GlobalForwardingRulesGenerator) createResources(ctx context.Context, globalForwardingRulesList *compute.GlobalForwardingRulesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := globalForwardingRulesList.Pages(ctx, func(page *compute.ForwardingRuleList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_global_forwarding_rule\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t},\n\t\t\t\tglobalForwardingRulesAllowEmptyValues,\n\t\t\t\tglobalForwardingRulesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each globalForwardingRules create 1 TerraformResource\n// Need globalForwardingRules name as ID for terraform resource\nfunc (g *GlobalForwardingRulesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tglobalForwardingRulesList := computeService.GlobalForwardingRules.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, globalForwardingRulesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/healthChecks_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar healthChecksAllowEmptyValues = []string{\"\"}\n\nvar healthChecksAdditionalFields = map[string]interface{}{}\n\ntype HealthChecksGenerator struct {\n\tGCPService\n}\n\n// Run on healthChecksList and create for each TerraformResource\nfunc (g HealthChecksGenerator) createResources(ctx context.Context, healthChecksList *compute.HealthChecksListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := healthChecksList.Pages(ctx, func(page *compute.HealthCheckList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_health_check\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\thealthChecksAllowEmptyValues,\n\t\t\t\thealthChecksAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each healthChecks create 1 TerraformResource\n// Need healthChecks name as ID for terraform resource\nfunc (g *HealthChecksGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thealthChecksList := computeService.HealthChecks.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, healthChecksList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/httpHealthChecks_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar httpHealthChecksAllowEmptyValues = []string{\"\"}\n\nvar httpHealthChecksAdditionalFields = map[string]interface{}{}\n\ntype HttpHealthChecksGenerator struct {\n\tGCPService\n}\n\n// Run on httpHealthChecksList and create for each TerraformResource\nfunc (g HttpHealthChecksGenerator) createResources(ctx context.Context, httpHealthChecksList *compute.HttpHealthChecksListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := httpHealthChecksList.Pages(ctx, func(page *compute.HttpHealthCheckList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_http_health_check\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\thttpHealthChecksAllowEmptyValues,\n\t\t\t\thttpHealthChecksAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each httpHealthChecks create 1 TerraformResource\n// Need httpHealthChecks name as ID for terraform resource\nfunc (g *HttpHealthChecksGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thttpHealthChecksList := computeService.HttpHealthChecks.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, httpHealthChecksList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/httpsHealthChecks_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar httpsHealthChecksAllowEmptyValues = []string{\"\"}\n\nvar httpsHealthChecksAdditionalFields = map[string]interface{}{}\n\ntype HttpsHealthChecksGenerator struct {\n\tGCPService\n}\n\n// Run on httpsHealthChecksList and create for each TerraformResource\nfunc (g HttpsHealthChecksGenerator) createResources(ctx context.Context, httpsHealthChecksList *compute.HttpsHealthChecksListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := httpsHealthChecksList.Pages(ctx, func(page *compute.HttpsHealthCheckList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_https_health_check\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\thttpsHealthChecksAllowEmptyValues,\n\t\t\t\thttpsHealthChecksAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each httpsHealthChecks create 1 TerraformResource\n// Need httpsHealthChecks name as ID for terraform resource\nfunc (g *HttpsHealthChecksGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thttpsHealthChecksList := computeService.HttpsHealthChecks.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, httpsHealthChecksList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/iam.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"regexp\"\n\n\tadmin \"cloud.google.com/go/iam/admin/apiv1\"\n\t\"google.golang.org/api/cloudresourcemanager/v1\"\n\t\"google.golang.org/api/iterator\"\n\tadminpb \"google.golang.org/genproto/googleapis/iam/admin/v1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar IamAllowEmptyValues = []string{\"tags.\"}\n\nvar IamAdditionalFields = map[string]interface{}{}\n\ntype IamGenerator struct {\n\tGCPService\n}\n\nfunc (g IamGenerator) createServiceAccountResources(serviceAccountsIterator *admin.ServiceAccountIterator) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tre := regexp.MustCompile(`^[a-z]`)\n\tfor {\n\t\tserviceAccount, err := serviceAccountsIterator.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Println(\"error with service account:\", err)\n\t\t\tcontinue\n\t\t}\n\t\tif !re.MatchString(serviceAccount.Email) {\n\t\t\tlog.Printf(\"skipping %s: service account email must start with [a-z]\\n\", serviceAccount.Name)\n\t\t\tcontinue\n\t\t}\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tserviceAccount.Name,\n\t\t\tserviceAccount.UniqueId,\n\t\t\t\"google_service_account\",\n\t\t\tg.ProviderName,\n\t\t\tIamAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *IamGenerator) createIamCustomRoleResources(rolesResponse *adminpb.ListRolesResponse, project string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, role := range rolesResponse.Roles {\n\t\tif role.Deleted {\n\t\t\t// Note: no need to log that the resource has been deleted\n\t\t\tcontinue\n\t\t}\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\trole.Name,\n\t\t\trole.Name,\n\t\t\t\"google_project_iam_custom_role\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"role_id\": role.Name,\n\t\t\t\t\"project\": project,\n\t\t\t},\n\t\t\tIamAllowEmptyValues,\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"stage\": role.Stage.String(),\n\t\t\t},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *IamGenerator) createIamMemberResources(policy *cloudresourcemanager.Policy, project string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, b := range policy.Bindings {\n\t\tfor _, m := range b.Members {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tb.Role+m,\n\t\t\t\tb.Role+m,\n\t\t\t\t\"google_project_iam_member\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"role\":    b.Role,\n\t\t\t\t\t\"project\": project,\n\t\t\t\t\t\"member\":  m,\n\t\t\t\t},\n\t\t\t\tIamAllowEmptyValues,\n\t\t\t\tIamAdditionalFields,\n\t\t\t))\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *IamGenerator) InitResources() error {\n\tctx := context.Background()\n\n\tprojectID := g.GetArgs()[\"project\"].(string)\n\tclient, err := admin.NewIamClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tserviceAccountsIterator := client.ListServiceAccounts(ctx, &adminpb.ListServiceAccountsRequest{Name: \"projects/\" + projectID})\n\trolesResponse, err := client.ListRoles(ctx, &adminpb.ListRolesRequest{Parent: \"projects/\" + projectID})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcm, err := cloudresourcemanager.NewService(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\trb := &cloudresourcemanager.GetIamPolicyRequest{}\n\tpolicyResponse, err := cm.Projects.GetIamPolicy(projectID, rb).Context(context.Background()).Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createServiceAccountResources(serviceAccountsIterator)\n\tg.Resources = append(g.Resources, g.createIamCustomRoleResources(rolesResponse, projectID)...)\n\tg.Resources = append(g.Resources, g.createIamMemberResources(policyResponse, projectID)...)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/images_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar imagesAllowEmptyValues = []string{\"\"}\n\nvar imagesAdditionalFields = map[string]interface{}{}\n\ntype ImagesGenerator struct {\n\tGCPService\n}\n\n// Run on imagesList and create for each TerraformResource\nfunc (g ImagesGenerator) createResources(ctx context.Context, imagesList *compute.ImagesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := imagesList.Pages(ctx, func(page *compute.ImageList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_image\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\timagesAllowEmptyValues,\n\t\t\t\timagesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each images create 1 TerraformResource\n// Need images name as ID for terraform resource\nfunc (g *ImagesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\timagesList := computeService.Images.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, imagesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/instanceGroupManagers_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar instanceGroupManagersAllowEmptyValues = []string{\"^version.[0-9].name\", \"^auto_healing_policies.[0-9].health_check\"}\n\nvar instanceGroupManagersAdditionalFields = map[string]interface{}{}\n\ntype InstanceGroupManagersGenerator struct {\n\tGCPService\n}\n\n// Run on instanceGroupManagersList and create for each TerraformResource\nfunc (g InstanceGroupManagersGenerator) createResources(ctx context.Context, instanceGroupManagersList *compute.InstanceGroupManagersListCall, zone string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := instanceGroupManagersList.Pages(ctx, func(page *compute.InstanceGroupManagerList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_instance_group_manager\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\n\t\t\t\t\t\"zone\": zone,\n\t\t\t\t},\n\t\t\t\tinstanceGroupManagersAllowEmptyValues,\n\t\t\t\tinstanceGroupManagersAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each instanceGroupManagers create 1 TerraformResource\n// Need instanceGroupManagers name as ID for terraform resource\nfunc (g *InstanceGroupManagersGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, zoneLink := range g.GetArgs()[\"region\"].(compute.Region).Zones {\n\t\tt := strings.Split(zoneLink, \"/\")\n\t\tzone := t[len(t)-1]\n\t\tinstanceGroupManagersList := computeService.InstanceGroupManagers.List(g.GetArgs()[\"project\"].(string), zone)\n\t\tg.Resources = append(g.Resources, g.createResources(ctx, instanceGroupManagersList, zone)...)\n\t}\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/instanceGroups_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar instanceGroupsAllowEmptyValues = []string{\"\"}\n\nvar instanceGroupsAdditionalFields = map[string]interface{}{}\n\ntype InstanceGroupsGenerator struct {\n\tGCPService\n}\n\n// Run on instanceGroupsList and create for each TerraformResource\nfunc (g InstanceGroupsGenerator) createResources(ctx context.Context, instanceGroupsList *compute.InstanceGroupsListCall, zone string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := instanceGroupsList.Pages(ctx, func(page *compute.InstanceGroupList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\t\"google_compute_instance_group\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t\t\"zone\":    zone,\n\t\t\t\t},\n\t\t\t\tinstanceGroupsAllowEmptyValues,\n\t\t\t\tinstanceGroupsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each instanceGroups create 1 TerraformResource\n// Need instanceGroups name as ID for terraform resource\nfunc (g *InstanceGroupsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, zoneLink := range g.GetArgs()[\"region\"].(compute.Region).Zones {\n\t\tt := strings.Split(zoneLink, \"/\")\n\t\tzone := t[len(t)-1]\n\t\tinstanceGroupsList := computeService.InstanceGroups.List(g.GetArgs()[\"project\"].(string), zone)\n\t\tg.Resources = append(g.Resources, g.createResources(ctx, instanceGroupsList, zone)...)\n\t}\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/instanceTemplates_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar instanceTemplatesAllowEmptyValues = []string{\"\"}\n\nvar instanceTemplatesAdditionalFields = map[string]interface{}{}\n\ntype InstanceTemplatesGenerator struct {\n\tGCPService\n}\n\n// Run on instanceTemplatesList and create for each TerraformResource\nfunc (g InstanceTemplatesGenerator) createResources(ctx context.Context, instanceTemplatesList *compute.InstanceTemplatesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := instanceTemplatesList.Pages(ctx, func(page *compute.InstanceTemplateList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_instance_template\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tinstanceTemplatesAllowEmptyValues,\n\t\t\t\tinstanceTemplatesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each instanceTemplates create 1 TerraformResource\n// Need instanceTemplates name as ID for terraform resource\nfunc (g *InstanceTemplatesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinstanceTemplatesList := computeService.InstanceTemplates.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, instanceTemplatesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/instances.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar instancesAllowEmptyValues = []string{\"labels.\"}\n\nvar instancesAdditionalFields = map[string]interface{}{}\n\ntype InstancesGenerator struct {\n\tGCPService\n}\n\n// Run on instancesList and create for each TerraformResource\nfunc (g InstancesGenerator) createResources(ctx context.Context, instancesList *compute.InstancesListCall, zone string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := instancesList.Pages(ctx, func(page *compute.InstanceList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tif strings.HasPrefix(obj.Name, \"gke-\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresource := terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_instance\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"zone\":    zone,\n\t\t\t\t\t\"disk.#\":  \"0\",\n\t\t\t\t},\n\t\t\t\tinstancesAllowEmptyValues,\n\t\t\t\tinstancesAdditionalFields,\n\t\t\t)\n\t\t\tresource.IgnoreKeys = append(resource.IgnoreKeys, \"^boot_disk.[0-9].initialize_params\\\\.(.*)\")\n\t\t\tresources = append(resources, resource)\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each instances create 1 TerraformResource\n// Need instances name as ID for terraform resource\nfunc (g *InstancesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, zoneLink := range g.GetArgs()[\"region\"].(compute.Region).Zones {\n\t\tt := strings.Split(zoneLink, \"/\")\n\t\tzone := t[len(t)-1]\n\t\tinstancesList := computeService.Instances.List(g.GetArgs()[\"project\"].(string), zone)\n\t\tg.Resources = append(g.Resources, g.createResources(ctx, instancesList, zone)...)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/interconnectAttachments_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar interconnectAttachmentsAllowEmptyValues = []string{\"\"}\n\nvar interconnectAttachmentsAdditionalFields = map[string]interface{}{}\n\ntype InterconnectAttachmentsGenerator struct {\n\tGCPService\n}\n\n// Run on interconnectAttachmentsList and create for each TerraformResource\nfunc (g InterconnectAttachmentsGenerator) createResources(ctx context.Context, interconnectAttachmentsList *compute.InterconnectAttachmentsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := interconnectAttachmentsList.Pages(ctx, func(page *compute.InterconnectAttachmentList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_interconnect_attachment\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tinterconnectAttachmentsAllowEmptyValues,\n\t\t\t\tinterconnectAttachmentsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each interconnectAttachments create 1 TerraformResource\n// Need interconnectAttachments name as ID for terraform resource\nfunc (g *InterconnectAttachmentsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinterconnectAttachmentsList := computeService.InterconnectAttachments.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, interconnectAttachmentsList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/kms.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"google.golang.org/api/cloudkms/v1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar kmsAllowEmptyValues = []string{\"\"}\n\nvar kmsAdditionalFields = map[string]interface{}{}\n\ntype KmsGenerator struct {\n\tGCPService\n}\n\nfunc (g KmsGenerator) createKmsRingResources(ctx context.Context, keyRingList *cloudkms.ProjectsLocationsKeyRingsListCall, kmsService *cloudkms.Service) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := keyRingList.Pages(ctx, func(page *cloudkms.ListKeyRingsResponse) error {\n\t\tfor _, obj := range page.KeyRings {\n\t\t\ttm := strings.Split(obj.Name, \"/\")\n\t\t\tID := tm[1] + \"/\" + tm[3] + \"/\" + tm[5]\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tID,\n\t\t\t\ttm[len(tm)-3]+\"_\"+tm[len(tm)-1],\n\t\t\t\t\"google_kms_key_ring\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"project\":  g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"location\": tm[3],\n\t\t\t\t\t\"name\":     tm[5],\n\t\t\t\t},\n\t\t\t\tkmsAllowEmptyValues,\n\t\t\t\tkmsAdditionalFields,\n\t\t\t))\n\t\t\tresources = append(resources, g.createKmsKeyResources(ctx, obj.Name, kmsService)...)\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\nfunc (g *KmsGenerator) createKmsKeyResources(ctx context.Context, keyRingName string, kmsService *cloudkms.Service) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tkeyList := kmsService.Projects.Locations.KeyRings.CryptoKeys.List(keyRingName)\n\tif err := keyList.Pages(ctx, func(page *cloudkms.ListCryptoKeysResponse) error {\n\t\tfor _, key := range page.CryptoKeys {\n\t\t\ttm := strings.Split(key.Name, \"/\")\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tkey.Name,\n\t\t\t\ttm[1]+\"_\"+tm[3]+\"_\"+tm[5]+\"_\"+tm[7],\n\t\t\t\t\"google_kms_crypto_key\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"name\":    key.Name,\n\t\t\t\t},\n\t\t\t\tkmsAllowEmptyValues,\n\t\t\t\tkmsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\nfunc (g *KmsGenerator) InitResources() error {\n\tctx := context.Background()\n\tkmsService, err := cloudkms.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tkeyRingList := kmsService.Projects.Locations.KeyRings.List(\"projects/\" + g.GetArgs()[\"project\"].(string) + \"/locations/global\")\n\n\tg.Resources = g.createKmsRingResources(ctx, keyRingList, kmsService)\n\treturn nil\n}\n\nfunc (g *KmsGenerator) PostConvertHook() error {\n\tfor i, key := range g.Resources {\n\t\tif key.InstanceInfo.Type != \"google_kms_crypto_key\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, keyRing := range g.Resources {\n\t\t\tif keyRing.InstanceInfo.Type != \"google_kms_key_ring\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif key.Item[\"key_ring\"] == keyRing.InstanceState.ID {\n\t\t\t\tg.Resources[i].Item[\"key_ring\"] = \"${google_kms_key_ring.\" + keyRing.ResourceName + \".self_link}\"\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/logging.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"google.golang.org/api/iterator\"\n\n\t\"cloud.google.com/go/logging/logadmin\"\n)\n\nvar loggingAllowEmptyValues = []string{}\n\nvar loggingAdditionalFields = map[string]interface{}{}\n\ntype LoggingGenerator struct {\n\tGCPService\n}\n\nfunc (g *LoggingGenerator) loadLoggingMetrics(ctx context.Context, client *logadmin.Client) error {\n\tmetricIterator := client.Metrics(ctx)\n\n\tfor {\n\t\tmetric, err := metricIterator.Next()\n\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tmetric.ID,\n\t\t\tmetric.ID,\n\t\t\t\"google_logging_metric\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":    metric.ID,\n\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t},\n\t\t\tloggingAllowEmptyValues,\n\t\t\tloggingAdditionalFields,\n\t\t))\n\t}\n\treturn nil\n}\n\n// Generate TerraformResources from GCP API\nfunc (g *LoggingGenerator) InitResources() error {\n\tproject := g.GetArgs()[\"project\"].(string)\n\tctx := context.Background()\n\tclient, err := logadmin.NewClient(ctx, project)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadLoggingMetrics(ctx, client); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/memoryStore.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"google.golang.org/api/compute/v1\"\n\t\"google.golang.org/api/redis/v1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar redisAllowEmptyValues = []string{\"\"}\n\nvar redisAdditionalFields = map[string]interface{}{}\n\ntype MemoryStoreGenerator struct {\n\tGCPService\n}\n\n// Run on redisInstancesList and create for each TerraformResource\nfunc (g MemoryStoreGenerator) createResources(ctx context.Context, redisInstancesList *redis.ProjectsLocationsInstancesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := redisInstancesList.Pages(ctx, func(page *redis.ListInstancesResponse) error {\n\t\tfor _, obj := range page.Instances {\n\t\t\tt := strings.Split(obj.Name, \"/\")\n\t\t\tname := t[len(t)-1]\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tname,\n\t\t\t\t\"google_redis_instance\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tredisAllowEmptyValues,\n\t\t\t\tredisAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each redis create 1 TerraformResource\n// Need Redis name as ID for terraform resource\nfunc (g *MemoryStoreGenerator) InitResources() error {\n\tctx := context.Background()\n\tredisService, err := redis.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tredisInstancesList := redisService.Projects.Locations.Instances.List(\"projects/\" + g.GetArgs()[\"project\"].(string) + \"/locations/\" + g.GetArgs()[\"region\"].(compute.Region).Name)\n\n\tg.Resources = g.createResources(ctx, redisInstancesList)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/monitoring.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/iterator\"\n\n\tmonitoring \"cloud.google.com/go/monitoring/apiv3\" // nolint\n\tmonitoringpb \"google.golang.org/genproto/googleapis/monitoring/v3\"\n)\n\nvar monitoringAllowEmptyValues = []string{}\n\nvar monitoringAdditionalFields = map[string]interface{}{}\n\ntype MonitoringGenerator struct {\n\tGCPService\n}\n\nfunc (g *MonitoringGenerator) loadAlerts(ctx context.Context, project string) error {\n\tclient, err := monitoring.NewAlertPolicyClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq := &monitoringpb.ListAlertPoliciesRequest{\n\t\tName: \"projects/\" + project,\n\t}\n\n\talertIterator := client.ListAlertPolicies(ctx, req)\n\n\tfor {\n\t\talert, err := alertIterator.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Println(\"error with alert:\", err)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\talert.Name,\n\t\t\talert.Name,\n\t\t\t\"google_monitoring_alert_policy\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":    alert.Name,\n\t\t\t\t\"project\": project,\n\t\t\t},\n\t\t\tmonitoringAllowEmptyValues,\n\t\t\tmonitoringAdditionalFields,\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *MonitoringGenerator) loadGroups(ctx context.Context, project string) error {\n\tclient, err := monitoring.NewGroupClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq := &monitoringpb.ListGroupsRequest{\n\t\tName: \"projects/\" + project,\n\t}\n\n\tgroupsIterator := client.ListGroups(ctx, req)\n\tfor {\n\t\tgroup, err := groupsIterator.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Println(\"error with group:\", err)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tgroup.Name,\n\t\t\tgroup.Name,\n\t\t\t\"google_monitoring_group\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":    group.Name,\n\t\t\t\t\"project\": project,\n\t\t\t},\n\t\t\tmonitoringAllowEmptyValues,\n\t\t\tmonitoringAdditionalFields,\n\t\t))\n\t}\n\treturn nil\n}\n\nfunc (g *MonitoringGenerator) loadNotificationChannel(ctx context.Context, project string) error {\n\tclient, err := monitoring.NewNotificationChannelClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq := &monitoringpb.ListNotificationChannelsRequest{\n\t\tName: \"projects/\" + project,\n\t}\n\n\tnotificationChannelIterator := client.ListNotificationChannels(ctx, req)\n\tfor {\n\t\tnotificationChannel, err := notificationChannelIterator.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Println(\"error with notification Channel:\", err)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tnotificationChannel.Name,\n\t\t\tnotificationChannel.Name,\n\t\t\t\"google_monitoring_notification_channel\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":    notificationChannel.Name,\n\t\t\t\t\"project\": project,\n\t\t\t},\n\t\t\tmonitoringAllowEmptyValues,\n\t\t\tmonitoringAdditionalFields,\n\t\t))\n\t}\n\treturn nil\n}\nfunc (g *MonitoringGenerator) loadUptimeCheck(ctx context.Context, project string) error {\n\tclient, err := monitoring.NewUptimeCheckClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq := &monitoringpb.ListUptimeCheckConfigsRequest{\n\t\tParent: \"projects/\" + project,\n\t}\n\n\tuptimeCheckConfigsIterator := client.ListUptimeCheckConfigs(ctx, req)\n\tfor {\n\t\tuptimeCheckConfigs, err := uptimeCheckConfigsIterator.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Println(\"error with uptimeCheckConfigs:\", err)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tuptimeCheckConfigs.Name,\n\t\t\tuptimeCheckConfigs.Name,\n\t\t\t\"google_monitoring_uptime_check_config\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":    uptimeCheckConfigs.Name,\n\t\t\t\t\"project\": project,\n\t\t\t},\n\t\t\tmonitoringAllowEmptyValues,\n\t\t\tmonitoringAdditionalFields,\n\t\t))\n\t}\n\treturn nil\n}\n\n// Generate TerraformResources from GCP API,\n// from each alert  create 1 TerraformResource\n// Need alert name as ID for terraform resource\nfunc (g *MonitoringGenerator) InitResources() error {\n\tproject := g.GetArgs()[\"project\"].(string)\n\tctx := context.Background()\n\n\tif err := g.loadAlerts(ctx, project); err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadGroups(ctx, project); err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadNotificationChannel(ctx, project); err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadUptimeCheck(ctx, project); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/networkEndpointGroups_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar networkEndpointGroupsAllowEmptyValues = []string{\"\"}\n\nvar networkEndpointGroupsAdditionalFields = map[string]interface{}{}\n\ntype NetworkEndpointGroupsGenerator struct {\n\tGCPService\n}\n\n// Run on networkEndpointGroupsList and create for each TerraformResource\nfunc (g NetworkEndpointGroupsGenerator) createResources(ctx context.Context, networkEndpointGroupsList *compute.NetworkEndpointGroupsListCall, zone string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := networkEndpointGroupsList.Pages(ctx, func(page *compute.NetworkEndpointGroupList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\t\"google_compute_network_endpoint_group\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t\t\"zone\":    zone,\n\t\t\t\t},\n\t\t\t\tnetworkEndpointGroupsAllowEmptyValues,\n\t\t\t\tnetworkEndpointGroupsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each networkEndpointGroups create 1 TerraformResource\n// Need networkEndpointGroups name as ID for terraform resource\nfunc (g *NetworkEndpointGroupsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, zoneLink := range g.GetArgs()[\"region\"].(compute.Region).Zones {\n\t\tt := strings.Split(zoneLink, \"/\")\n\t\tzone := t[len(t)-1]\n\t\tnetworkEndpointGroupsList := computeService.NetworkEndpointGroups.List(g.GetArgs()[\"project\"].(string), zone)\n\t\tg.Resources = append(g.Resources, g.createResources(ctx, networkEndpointGroupsList, zone)...)\n\t}\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/networks_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar networksAllowEmptyValues = []string{\"\"}\n\nvar networksAdditionalFields = map[string]interface{}{}\n\ntype NetworksGenerator struct {\n\tGCPService\n}\n\n// Run on networksList and create for each TerraformResource\nfunc (g NetworksGenerator) createResources(ctx context.Context, networksList *compute.NetworksListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := networksList.Pages(ctx, func(page *compute.NetworkList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_network\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tnetworksAllowEmptyValues,\n\t\t\t\tnetworksAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each networks create 1 TerraformResource\n// Need networks name as ID for terraform resource\nfunc (g *NetworksGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnetworksList := computeService.Networks.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, networksList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/nodeGroups_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar nodeGroupsAllowEmptyValues = []string{\"\"}\n\nvar nodeGroupsAdditionalFields = map[string]interface{}{}\n\ntype NodeGroupsGenerator struct {\n\tGCPService\n}\n\n// Run on nodeGroupsList and create for each TerraformResource\nfunc (g NodeGroupsGenerator) createResources(ctx context.Context, nodeGroupsList *compute.NodeGroupsListCall, zone string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := nodeGroupsList.Pages(ctx, func(page *compute.NodeGroupList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\t\"google_compute_node_group\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t\t\"zone\":    zone,\n\t\t\t\t},\n\t\t\t\tnodeGroupsAllowEmptyValues,\n\t\t\t\tnodeGroupsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each nodeGroups create 1 TerraformResource\n// Need nodeGroups name as ID for terraform resource\nfunc (g *NodeGroupsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, zoneLink := range g.GetArgs()[\"region\"].(compute.Region).Zones {\n\t\tt := strings.Split(zoneLink, \"/\")\n\t\tzone := t[len(t)-1]\n\t\tnodeGroupsList := computeService.NodeGroups.List(g.GetArgs()[\"project\"].(string), zone)\n\t\tg.Resources = append(g.Resources, g.createResources(ctx, nodeGroupsList, zone)...)\n\t}\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/nodeTemplates_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar nodeTemplatesAllowEmptyValues = []string{\"\"}\n\nvar nodeTemplatesAdditionalFields = map[string]interface{}{}\n\ntype NodeTemplatesGenerator struct {\n\tGCPService\n}\n\n// Run on nodeTemplatesList and create for each TerraformResource\nfunc (g NodeTemplatesGenerator) createResources(ctx context.Context, nodeTemplatesList *compute.NodeTemplatesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := nodeTemplatesList.Pages(ctx, func(page *compute.NodeTemplateList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_node_template\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tnodeTemplatesAllowEmptyValues,\n\t\t\t\tnodeTemplatesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each nodeTemplates create 1 TerraformResource\n// Need nodeTemplates name as ID for terraform resource\nfunc (g *NodeTemplatesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnodeTemplatesList := computeService.NodeTemplates.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, nodeTemplatesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/packetMirrorings_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar packetMirroringsAllowEmptyValues = []string{\"\"}\n\nvar packetMirroringsAdditionalFields = map[string]interface{}{}\n\ntype PacketMirroringsGenerator struct {\n\tGCPService\n}\n\n// Run on packetMirroringsList and create for each TerraformResource\nfunc (g PacketMirroringsGenerator) createResources(ctx context.Context, packetMirroringsList *compute.PacketMirroringsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := packetMirroringsList.Pages(ctx, func(page *compute.PacketMirroringList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_packet_mirroring\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tpacketMirroringsAllowEmptyValues,\n\t\t\t\tpacketMirroringsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each packetMirrorings create 1 TerraformResource\n// Need packetMirrorings name as ID for terraform resource\nfunc (g *PacketMirroringsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpacketMirroringsList := computeService.PacketMirrorings.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, packetMirroringsList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/project.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar projectAllowEmptyValues = []string{\"\"}\n\nvar projectAdditionalFields = map[string]interface{}{}\n\ntype ProjectGenerator struct {\n\tGCPService\n}\n\n// Generate TerraformResources from GCP API,\nfunc (g *ProjectGenerator) InitResources() error {\n\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\tg.GetArgs()[\"project\"].(string),\n\t\tg.GetArgs()[\"project\"].(string),\n\t\t\"google_project\",\n\t\tg.ProviderName,\n\t\tmap[string]string{\n\t\t\t\"auto_create_network\": \"true\",\n\t\t},\n\t\tprojectAllowEmptyValues,\n\t\tprojectAdditionalFields,\n\t))\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/pubsub.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"google.golang.org/api/pubsub/v1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar pubsubAllowEmptyValues = []string{\"\"}\n\nvar pubsubAdditionalFields = map[string]interface{}{}\n\ntype PubsubGenerator struct {\n\tGCPService\n}\n\n// Run on subscriptionsList and create for each TerraformResource\nfunc (g PubsubGenerator) createSubscriptionsResources(ctx context.Context, subscriptionsList *pubsub.ProjectsSubscriptionsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := subscriptionsList.Pages(ctx, func(page *pubsub.ListSubscriptionsResponse) error {\n\t\tfor _, obj := range page.Subscriptions {\n\t\t\tt := strings.Split(obj.Name, \"/\")\n\t\t\tname := t[len(t)-1]\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tname,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_pubsub_subscription\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t},\n\t\t\t\tpubsubAllowEmptyValues,\n\t\t\t\tpubsubAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Run on topicsList and create for each TerraformResource\nfunc (g PubsubGenerator) createTopicsListResources(ctx context.Context, topicsList *pubsub.ProjectsTopicsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := topicsList.Pages(ctx, func(page *pubsub.ListTopicsResponse) error {\n\t\tfor _, obj := range page.Topics {\n\t\t\tt := strings.Split(obj.Name, \"/\")\n\t\t\tname := t[len(t)-1]\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tg.GetArgs()[\"project\"].(string)+\"/\"+name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_pubsub_topic\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t},\n\t\t\t\tpubsubAllowEmptyValues,\n\t\t\t\tpubsubAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\nfunc (g *PubsubGenerator) InitResources() error {\n\tctx := context.Background()\n\tpubsubService, err := pubsub.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsubscriptionsList := pubsubService.Projects.Subscriptions.List(\"projects/\" + g.GetArgs()[\"project\"].(string))\n\tsubscriptionsResources := g.createSubscriptionsResources(ctx, subscriptionsList)\n\n\ttopicsList := pubsubService.Projects.Topics.List(\"projects/\" + g.GetArgs()[\"project\"].(string))\n\ttopicsResources := g.createTopicsListResources(ctx, topicsList)\n\n\tg.Resources = append(g.Resources, subscriptionsResources...)\n\tg.Resources = append(g.Resources, topicsResources...)\n\n\treturn nil\n}\n\nfunc (g *PubsubGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tfor _, topic := range g.Resources {\n\t\t\tif r.InstanceState.Attributes[\"topic\"] == \"projects/\"+g.GetArgs()[\"project\"].(string)+\"/topics/\"+topic.InstanceState.Attributes[\"name\"] {\n\t\t\t\tg.Resources[i].Item[\"topic\"] = \"${google_pubsub_topic.\" + topic.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/regionAutoscalers_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar regionAutoscalersAllowEmptyValues = []string{\"\"}\n\nvar regionAutoscalersAdditionalFields = map[string]interface{}{}\n\ntype RegionAutoscalersGenerator struct {\n\tGCPService\n}\n\n// Run on regionAutoscalersList and create for each TerraformResource\nfunc (g RegionAutoscalersGenerator) createResources(ctx context.Context, regionAutoscalersList *compute.RegionAutoscalersListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := regionAutoscalersList.Pages(ctx, func(page *compute.RegionAutoscalerList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_region_autoscaler\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tregionAutoscalersAllowEmptyValues,\n\t\t\t\tregionAutoscalersAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each regionAutoscalers create 1 TerraformResource\n// Need regionAutoscalers name as ID for terraform resource\nfunc (g *RegionAutoscalersGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tregionAutoscalersList := computeService.RegionAutoscalers.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, regionAutoscalersList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/regionBackendServices_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar regionBackendServicesAllowEmptyValues = []string{\"\"}\n\nvar regionBackendServicesAdditionalFields = map[string]interface{}{}\n\ntype RegionBackendServicesGenerator struct {\n\tGCPService\n}\n\n// Run on regionBackendServicesList and create for each TerraformResource\nfunc (g RegionBackendServicesGenerator) createResources(ctx context.Context, regionBackendServicesList *compute.RegionBackendServicesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := regionBackendServicesList.Pages(ctx, func(page *compute.BackendServiceList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_region_backend_service\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tregionBackendServicesAllowEmptyValues,\n\t\t\t\tregionBackendServicesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each regionBackendServices create 1 TerraformResource\n// Need regionBackendServices name as ID for terraform resource\nfunc (g *RegionBackendServicesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tregionBackendServicesList := computeService.RegionBackendServices.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, regionBackendServicesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/regionDisks_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar regionDisksAllowEmptyValues = []string{\"\"}\n\nvar regionDisksAdditionalFields = map[string]interface{}{}\n\ntype RegionDisksGenerator struct {\n\tGCPService\n}\n\n// Run on regionDisksList and create for each TerraformResource\nfunc (g RegionDisksGenerator) createResources(ctx context.Context, regionDisksList *compute.RegionDisksListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := regionDisksList.Pages(ctx, func(page *compute.DiskList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_region_disk\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tregionDisksAllowEmptyValues,\n\t\t\t\tregionDisksAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each regionDisks create 1 TerraformResource\n// Need regionDisks name as ID for terraform resource\nfunc (g *RegionDisksGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tregionDisksList := computeService.RegionDisks.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, regionDisksList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/regionHealthChecks_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar regionHealthChecksAllowEmptyValues = []string{\"\"}\n\nvar regionHealthChecksAdditionalFields = map[string]interface{}{}\n\ntype RegionHealthChecksGenerator struct {\n\tGCPService\n}\n\n// Run on regionHealthChecksList and create for each TerraformResource\nfunc (g RegionHealthChecksGenerator) createResources(ctx context.Context, regionHealthChecksList *compute.RegionHealthChecksListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := regionHealthChecksList.Pages(ctx, func(page *compute.HealthCheckList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_region_health_check\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tregionHealthChecksAllowEmptyValues,\n\t\t\t\tregionHealthChecksAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each regionHealthChecks create 1 TerraformResource\n// Need regionHealthChecks name as ID for terraform resource\nfunc (g *RegionHealthChecksGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tregionHealthChecksList := computeService.RegionHealthChecks.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, regionHealthChecksList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/regionInstanceGroupManagers_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar regionInstanceGroupManagersAllowEmptyValues = []string{\"name\", \"health_check\"}\n\nvar regionInstanceGroupManagersAdditionalFields = map[string]interface{}{}\n\ntype RegionInstanceGroupManagersGenerator struct {\n\tGCPService\n}\n\n// Run on regionInstanceGroupManagersList and create for each TerraformResource\nfunc (g RegionInstanceGroupManagersGenerator) createResources(ctx context.Context, regionInstanceGroupManagersList *compute.RegionInstanceGroupManagersListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := regionInstanceGroupManagersList.Pages(ctx, func(page *compute.RegionInstanceGroupManagerList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_region_instance_group_manager\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tregionInstanceGroupManagersAllowEmptyValues,\n\t\t\t\tregionInstanceGroupManagersAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each regionInstanceGroupManagers create 1 TerraformResource\n// Need regionInstanceGroupManagers name as ID for terraform resource\nfunc (g *RegionInstanceGroupManagersGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tregionInstanceGroupManagersList := computeService.RegionInstanceGroupManagers.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, regionInstanceGroupManagersList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/regionInstanceGroups_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar regionInstanceGroupsAllowEmptyValues = []string{\"\"}\n\nvar regionInstanceGroupsAdditionalFields = map[string]interface{}{}\n\ntype RegionInstanceGroupsGenerator struct {\n\tGCPService\n}\n\n// Run on regionInstanceGroupsList and create for each TerraformResource\nfunc (g RegionInstanceGroupsGenerator) createResources(ctx context.Context, regionInstanceGroupsList *compute.RegionInstanceGroupsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := regionInstanceGroupsList.Pages(ctx, func(page *compute.RegionInstanceGroupList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_region_instance_group\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tregionInstanceGroupsAllowEmptyValues,\n\t\t\t\tregionInstanceGroupsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each regionInstanceGroups create 1 TerraformResource\n// Need regionInstanceGroups name as ID for terraform resource\nfunc (g *RegionInstanceGroupsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tregionInstanceGroupsList := computeService.RegionInstanceGroups.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, regionInstanceGroupsList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/regionSslCertificates_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar regionSslCertificatesAllowEmptyValues = []string{\"\"}\n\nvar regionSslCertificatesAdditionalFields = map[string]interface{}{}\n\ntype RegionSslCertificatesGenerator struct {\n\tGCPService\n}\n\n// Run on regionSslCertificatesList and create for each TerraformResource\nfunc (g RegionSslCertificatesGenerator) createResources(ctx context.Context, regionSslCertificatesList *compute.RegionSslCertificatesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := regionSslCertificatesList.Pages(ctx, func(page *compute.SslCertificateList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_region_ssl_certificate\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tregionSslCertificatesAllowEmptyValues,\n\t\t\t\tregionSslCertificatesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each regionSslCertificates create 1 TerraformResource\n// Need regionSslCertificates name as ID for terraform resource\nfunc (g *RegionSslCertificatesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tregionSslCertificatesList := computeService.RegionSslCertificates.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, regionSslCertificatesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/regionTargetHttpProxies_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar regionTargetHttpProxiesAllowEmptyValues = []string{\"\"}\n\nvar regionTargetHttpProxiesAdditionalFields = map[string]interface{}{}\n\ntype RegionTargetHttpProxiesGenerator struct {\n\tGCPService\n}\n\n// Run on regionTargetHttpProxiesList and create for each TerraformResource\nfunc (g RegionTargetHttpProxiesGenerator) createResources(ctx context.Context, regionTargetHttpProxiesList *compute.RegionTargetHttpProxiesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := regionTargetHttpProxiesList.Pages(ctx, func(page *compute.TargetHttpProxyList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_region_target_http_proxy\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tregionTargetHttpProxiesAllowEmptyValues,\n\t\t\t\tregionTargetHttpProxiesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each regionTargetHttpProxies create 1 TerraformResource\n// Need regionTargetHttpProxies name as ID for terraform resource\nfunc (g *RegionTargetHttpProxiesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tregionTargetHttpProxiesList := computeService.RegionTargetHttpProxies.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, regionTargetHttpProxiesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/regionTargetHttpsProxies_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar regionTargetHttpsProxiesAllowEmptyValues = []string{\"\"}\n\nvar regionTargetHttpsProxiesAdditionalFields = map[string]interface{}{}\n\ntype RegionTargetHttpsProxiesGenerator struct {\n\tGCPService\n}\n\n// Run on regionTargetHttpsProxiesList and create for each TerraformResource\nfunc (g RegionTargetHttpsProxiesGenerator) createResources(ctx context.Context, regionTargetHttpsProxiesList *compute.RegionTargetHttpsProxiesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := regionTargetHttpsProxiesList.Pages(ctx, func(page *compute.TargetHttpsProxyList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_region_target_https_proxy\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tregionTargetHttpsProxiesAllowEmptyValues,\n\t\t\t\tregionTargetHttpsProxiesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each regionTargetHttpsProxies create 1 TerraformResource\n// Need regionTargetHttpsProxies name as ID for terraform resource\nfunc (g *RegionTargetHttpsProxiesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tregionTargetHttpsProxiesList := computeService.RegionTargetHttpsProxies.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, regionTargetHttpsProxiesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/regionUrlMaps_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar regionUrlMapsAllowEmptyValues = []string{\"\"}\n\nvar regionUrlMapsAdditionalFields = map[string]interface{}{}\n\ntype RegionUrlMapsGenerator struct {\n\tGCPService\n}\n\n// Run on regionUrlMapsList and create for each TerraformResource\nfunc (g RegionUrlMapsGenerator) createResources(ctx context.Context, regionUrlMapsList *compute.RegionUrlMapsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := regionUrlMapsList.Pages(ctx, func(page *compute.UrlMapList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_region_url_map\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tregionUrlMapsAllowEmptyValues,\n\t\t\t\tregionUrlMapsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each regionUrlMaps create 1 TerraformResource\n// Need regionUrlMaps name as ID for terraform resource\nfunc (g *RegionUrlMapsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tregionUrlMapsList := computeService.RegionUrlMaps.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, regionUrlMapsList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/reservations_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar reservationsAllowEmptyValues = []string{\"\"}\n\nvar reservationsAdditionalFields = map[string]interface{}{}\n\ntype ReservationsGenerator struct {\n\tGCPService\n}\n\n// Run on reservationsList and create for each TerraformResource\nfunc (g ReservationsGenerator) createResources(ctx context.Context, reservationsList *compute.ReservationsListCall, zone string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := reservationsList.Pages(ctx, func(page *compute.ReservationList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\t\"google_compute_reservation\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t\t\"zone\":    zone,\n\t\t\t\t},\n\t\t\t\treservationsAllowEmptyValues,\n\t\t\t\treservationsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each reservations create 1 TerraformResource\n// Need reservations name as ID for terraform resource\nfunc (g *ReservationsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, zoneLink := range g.GetArgs()[\"region\"].(compute.Region).Zones {\n\t\tt := strings.Split(zoneLink, \"/\")\n\t\tzone := t[len(t)-1]\n\t\treservationsList := computeService.Reservations.List(g.GetArgs()[\"project\"].(string), zone)\n\t\tg.Resources = append(g.Resources, g.createResources(ctx, reservationsList, zone)...)\n\t}\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/resourcePolicies_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar resourcePoliciesAllowEmptyValues = []string{\"\"}\n\nvar resourcePoliciesAdditionalFields = map[string]interface{}{}\n\ntype ResourcePoliciesGenerator struct {\n\tGCPService\n}\n\n// Run on resourcePoliciesList and create for each TerraformResource\nfunc (g ResourcePoliciesGenerator) createResources(ctx context.Context, resourcePoliciesList *compute.ResourcePoliciesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := resourcePoliciesList.Pages(ctx, func(page *compute.ResourcePolicyList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_resource_policy\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tresourcePoliciesAllowEmptyValues,\n\t\t\t\tresourcePoliciesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each resourcePolicies create 1 TerraformResource\n// Need resourcePolicies name as ID for terraform resource\nfunc (g *ResourcePoliciesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresourcePoliciesList := computeService.ResourcePolicies.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, resourcePoliciesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/routers_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar routersAllowEmptyValues = []string{\"\"}\n\nvar routersAdditionalFields = map[string]interface{}{}\n\ntype RoutersGenerator struct {\n\tGCPService\n}\n\n// Run on routersList and create for each TerraformResource\nfunc (g RoutersGenerator) createResources(ctx context.Context, routersList *compute.RoutersListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := routersList.Pages(ctx, func(page *compute.RouterList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_router\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\troutersAllowEmptyValues,\n\t\t\t\troutersAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each routers create 1 TerraformResource\n// Need routers name as ID for terraform resource\nfunc (g *RoutersGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\troutersList := computeService.Routers.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, routersList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/routes_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar routesAllowEmptyValues = []string{\"\"}\n\nvar routesAdditionalFields = map[string]interface{}{}\n\ntype RoutesGenerator struct {\n\tGCPService\n}\n\n// Run on routesList and create for each TerraformResource\nfunc (g RoutesGenerator) createResources(ctx context.Context, routesList *compute.RoutesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := routesList.Pages(ctx, func(page *compute.RouteList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_route\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\troutesAllowEmptyValues,\n\t\t\t\troutesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each routes create 1 TerraformResource\n// Need routes name as ID for terraform resource\nfunc (g *RoutesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\troutesList := computeService.Routes.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, routesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/schedulerJobs.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\tcloudscheduler \"google.golang.org/api/cloudscheduler/v1beta1\"\n\t\"google.golang.org/api/compute/v1\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nvar schedulerJobsAllowEmptyValues = []string{\"\"}\n\nvar schedulerJobsAdditionalFields = map[string]interface{}{}\n\ntype SchedulerJobsGenerator struct {\n\tGCPService\n}\n\n// Run on SchedulerJobsList and create for each TerraformResource\nfunc (g SchedulerJobsGenerator) createResources(ctx context.Context, jobsList *cloudscheduler.ProjectsLocationsJobsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := jobsList.Pages(ctx, func(page *cloudscheduler.ListJobsResponse) error {\n\t\tfor _, obj := range page.Jobs {\n\t\t\tt := strings.Split(obj.Name, \"/\")\n\t\t\tname := t[len(t)-1]\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tname,\n\t\t\t\t\"google_cloud_scheduler_job\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tschedulerJobsAllowEmptyValues,\n\t\t\t\tschedulerJobsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\nfunc (g *SchedulerJobsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcloudSchedulerService, err := cloudscheduler.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tjobsList := cloudSchedulerService.Projects.Locations.Jobs.List(\"projects/\" + g.GetArgs()[\"project\"].(string) + \"/locations/\" + g.GetArgs()[\"region\"].(compute.Region).Name)\n\n\tg.Resources = g.createResources(ctx, jobsList)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gcp/securityPolicies_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar securityPoliciesAllowEmptyValues = []string{\"\"}\n\nvar securityPoliciesAdditionalFields = map[string]interface{}{}\n\ntype SecurityPoliciesGenerator struct {\n\tGCPService\n}\n\n// Run on securityPoliciesList and create for each TerraformResource\nfunc (g SecurityPoliciesGenerator) createResources(ctx context.Context, securityPoliciesList *compute.SecurityPoliciesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := securityPoliciesList.Pages(ctx, func(page *compute.SecurityPolicyList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_security_policy\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tsecurityPoliciesAllowEmptyValues,\n\t\t\t\tsecurityPoliciesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each securityPolicies create 1 TerraformResource\n// Need securityPolicies name as ID for terraform resource\nfunc (g *SecurityPoliciesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsecurityPoliciesList := computeService.SecurityPolicies.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, securityPoliciesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/sslCertificates_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar sslCertificatesAllowEmptyValues = []string{\"\"}\n\nvar sslCertificatesAdditionalFields = map[string]interface{}{}\n\ntype SslCertificatesGenerator struct {\n\tGCPService\n}\n\n// Run on sslCertificatesList and create for each TerraformResource\nfunc (g SslCertificatesGenerator) createResources(ctx context.Context, sslCertificatesList *compute.SslCertificatesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := sslCertificatesList.Pages(ctx, func(page *compute.SslCertificateList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_managed_ssl_certificate\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tsslCertificatesAllowEmptyValues,\n\t\t\t\tsslCertificatesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each sslCertificates create 1 TerraformResource\n// Need sslCertificates name as ID for terraform resource\nfunc (g *SslCertificatesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsslCertificatesList := computeService.SslCertificates.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, sslCertificatesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/sslPolicies_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar sslPoliciesAllowEmptyValues = []string{\"\"}\n\nvar sslPoliciesAdditionalFields = map[string]interface{}{}\n\ntype SslPoliciesGenerator struct {\n\tGCPService\n}\n\n// Run on sslPoliciesList and create for each TerraformResource\nfunc (g SslPoliciesGenerator) createResources(ctx context.Context, sslPoliciesList *compute.SslPoliciesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := sslPoliciesList.Pages(ctx, func(page *compute.SslPoliciesList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_ssl_policy\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tsslPoliciesAllowEmptyValues,\n\t\t\t\tsslPoliciesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each sslPolicies create 1 TerraformResource\n// Need sslPolicies name as ID for terraform resource\nfunc (g *SslPoliciesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsslPoliciesList := computeService.SslPolicies.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, sslPoliciesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/subnetworks_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar subnetworksAllowEmptyValues = []string{\"\"}\n\nvar subnetworksAdditionalFields = map[string]interface{}{}\n\ntype SubnetworksGenerator struct {\n\tGCPService\n}\n\n// Run on subnetworksList and create for each TerraformResource\nfunc (g SubnetworksGenerator) createResources(ctx context.Context, subnetworksList *compute.SubnetworksListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := subnetworksList.Pages(ctx, func(page *compute.SubnetworkList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_subnetwork\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tsubnetworksAllowEmptyValues,\n\t\t\t\tsubnetworksAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each subnetworks create 1 TerraformResource\n// Need subnetworks name as ID for terraform resource\nfunc (g *SubnetworksGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsubnetworksList := computeService.Subnetworks.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, subnetworksList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/targetHttpProxies_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar targetHttpProxiesAllowEmptyValues = []string{\"\"}\n\nvar targetHttpProxiesAdditionalFields = map[string]interface{}{}\n\ntype TargetHttpProxiesGenerator struct {\n\tGCPService\n}\n\n// Run on targetHttpProxiesList and create for each TerraformResource\nfunc (g TargetHttpProxiesGenerator) createResources(ctx context.Context, targetHttpProxiesList *compute.TargetHttpProxiesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := targetHttpProxiesList.Pages(ctx, func(page *compute.TargetHttpProxyList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_target_http_proxy\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\ttargetHttpProxiesAllowEmptyValues,\n\t\t\t\ttargetHttpProxiesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each targetHttpProxies create 1 TerraformResource\n// Need targetHttpProxies name as ID for terraform resource\nfunc (g *TargetHttpProxiesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttargetHttpProxiesList := computeService.TargetHttpProxies.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, targetHttpProxiesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/targetHttpsProxies_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar targetHttpsProxiesAllowEmptyValues = []string{\"\"}\n\nvar targetHttpsProxiesAdditionalFields = map[string]interface{}{}\n\ntype TargetHttpsProxiesGenerator struct {\n\tGCPService\n}\n\n// Run on targetHttpsProxiesList and create for each TerraformResource\nfunc (g TargetHttpsProxiesGenerator) createResources(ctx context.Context, targetHttpsProxiesList *compute.TargetHttpsProxiesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := targetHttpsProxiesList.Pages(ctx, func(page *compute.TargetHttpsProxyList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_target_https_proxy\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\ttargetHttpsProxiesAllowEmptyValues,\n\t\t\t\ttargetHttpsProxiesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each targetHttpsProxies create 1 TerraformResource\n// Need targetHttpsProxies name as ID for terraform resource\nfunc (g *TargetHttpsProxiesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttargetHttpsProxiesList := computeService.TargetHttpsProxies.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, targetHttpsProxiesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/targetInstances_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar targetInstancesAllowEmptyValues = []string{\"\"}\n\nvar targetInstancesAdditionalFields = map[string]interface{}{}\n\ntype TargetInstancesGenerator struct {\n\tGCPService\n}\n\n// Run on targetInstancesList and create for each TerraformResource\nfunc (g TargetInstancesGenerator) createResources(ctx context.Context, targetInstancesList *compute.TargetInstancesListCall, zone string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := targetInstancesList.Pages(ctx, func(page *compute.TargetInstanceList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\tzone+\"/\"+obj.Name,\n\t\t\t\t\"google_compute_target_instance\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t\t\"zone\":    zone,\n\t\t\t\t},\n\t\t\t\ttargetInstancesAllowEmptyValues,\n\t\t\t\ttargetInstancesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each targetInstances create 1 TerraformResource\n// Need targetInstances name as ID for terraform resource\nfunc (g *TargetInstancesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, zoneLink := range g.GetArgs()[\"region\"].(compute.Region).Zones {\n\t\tt := strings.Split(zoneLink, \"/\")\n\t\tzone := t[len(t)-1]\n\t\ttargetInstancesList := computeService.TargetInstances.List(g.GetArgs()[\"project\"].(string), zone)\n\t\tg.Resources = append(g.Resources, g.createResources(ctx, targetInstancesList, zone)...)\n\t}\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/targetPools_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar targetPoolsAllowEmptyValues = []string{\"\"}\n\nvar targetPoolsAdditionalFields = map[string]interface{}{}\n\ntype TargetPoolsGenerator struct {\n\tGCPService\n}\n\n// Run on targetPoolsList and create for each TerraformResource\nfunc (g TargetPoolsGenerator) createResources(ctx context.Context, targetPoolsList *compute.TargetPoolsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := targetPoolsList.Pages(ctx, func(page *compute.TargetPoolList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_target_pool\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\ttargetPoolsAllowEmptyValues,\n\t\t\t\ttargetPoolsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each targetPools create 1 TerraformResource\n// Need targetPools name as ID for terraform resource\nfunc (g *TargetPoolsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttargetPoolsList := computeService.TargetPools.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, targetPoolsList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/targetSslProxies_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar targetSslProxiesAllowEmptyValues = []string{\"\"}\n\nvar targetSslProxiesAdditionalFields = map[string]interface{}{}\n\ntype TargetSslProxiesGenerator struct {\n\tGCPService\n}\n\n// Run on targetSslProxiesList and create for each TerraformResource\nfunc (g TargetSslProxiesGenerator) createResources(ctx context.Context, targetSslProxiesList *compute.TargetSslProxiesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := targetSslProxiesList.Pages(ctx, func(page *compute.TargetSslProxyList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_target_ssl_proxy\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\ttargetSslProxiesAllowEmptyValues,\n\t\t\t\ttargetSslProxiesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each targetSslProxies create 1 TerraformResource\n// Need targetSslProxies name as ID for terraform resource\nfunc (g *TargetSslProxiesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttargetSslProxiesList := computeService.TargetSslProxies.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, targetSslProxiesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/targetTcpProxies_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar targetTcpProxiesAllowEmptyValues = []string{\"\"}\n\nvar targetTcpProxiesAdditionalFields = map[string]interface{}{}\n\ntype TargetTcpProxiesGenerator struct {\n\tGCPService\n}\n\n// Run on targetTcpProxiesList and create for each TerraformResource\nfunc (g TargetTcpProxiesGenerator) createResources(ctx context.Context, targetTcpProxiesList *compute.TargetTcpProxiesListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := targetTcpProxiesList.Pages(ctx, func(page *compute.TargetTcpProxyList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_target_tcp_proxy\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\ttargetTcpProxiesAllowEmptyValues,\n\t\t\t\ttargetTcpProxiesAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each targetTcpProxies create 1 TerraformResource\n// Need targetTcpProxies name as ID for terraform resource\nfunc (g *TargetTcpProxiesGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttargetTcpProxiesList := computeService.TargetTcpProxies.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, targetTcpProxiesList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/targetVpnGateways_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar targetVpnGatewaysAllowEmptyValues = []string{\"\"}\n\nvar targetVpnGatewaysAdditionalFields = map[string]interface{}{}\n\ntype TargetVpnGatewaysGenerator struct {\n\tGCPService\n}\n\n// Run on targetVpnGatewaysList and create for each TerraformResource\nfunc (g TargetVpnGatewaysGenerator) createResources(ctx context.Context, targetVpnGatewaysList *compute.TargetVpnGatewaysListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := targetVpnGatewaysList.Pages(ctx, func(page *compute.TargetVpnGatewayList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_vpn_gateway\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\ttargetVpnGatewaysAllowEmptyValues,\n\t\t\t\ttargetVpnGatewaysAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each targetVpnGateways create 1 TerraformResource\n// Need targetVpnGateways name as ID for terraform resource\nfunc (g *TargetVpnGatewaysGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttargetVpnGatewaysList := computeService.TargetVpnGateways.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, targetVpnGatewaysList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/urlMaps_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar urlMapsAllowEmptyValues = []string{\"\"}\n\nvar urlMapsAdditionalFields = map[string]interface{}{}\n\ntype UrlMapsGenerator struct {\n\tGCPService\n}\n\n// Run on urlMapsList and create for each TerraformResource\nfunc (g UrlMapsGenerator) createResources(ctx context.Context, urlMapsList *compute.UrlMapsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := urlMapsList.Pages(ctx, func(page *compute.UrlMapList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_url_map\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\turlMapsAllowEmptyValues,\n\t\t\t\turlMapsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each urlMaps create 1 TerraformResource\n// Need urlMaps name as ID for terraform resource\nfunc (g *UrlMapsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\turlMapsList := computeService.UrlMaps.List(g.GetArgs()[\"project\"].(string))\n\tg.Resources = g.createResources(ctx, urlMapsList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/gcp/vpnTunnels_gen.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// AUTO-GENERATED CODE. DO NOT EDIT.\npackage gcp\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"google.golang.org/api/compute/v1\"\n)\n\nvar vpnTunnelsAllowEmptyValues = []string{\"\"}\n\nvar vpnTunnelsAdditionalFields = map[string]interface{}{}\n\ntype VpnTunnelsGenerator struct {\n\tGCPService\n}\n\n// Run on vpnTunnelsList and create for each TerraformResource\nfunc (g VpnTunnelsGenerator) createResources(ctx context.Context, vpnTunnelsList *compute.VpnTunnelsListCall) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tif err := vpnTunnelsList.Pages(ctx, func(page *compute.VpnTunnelList) error {\n\t\tfor _, obj := range page.Items {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tobj.Name,\n\t\t\t\tobj.Name,\n\t\t\t\t\"google_compute_vpn_tunnel\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"name\":    obj.Name,\n\t\t\t\t\t\"project\": g.GetArgs()[\"project\"].(string),\n\t\t\t\t\t\"region\":  g.GetArgs()[\"region\"].(compute.Region).Name,\n\t\t\t\t},\n\t\t\t\tvpnTunnelsAllowEmptyValues,\n\t\t\t\tvpnTunnelsAdditionalFields,\n\t\t\t))\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from GCP API,\n// from each vpnTunnels create 1 TerraformResource\n// Need vpnTunnels name as ID for terraform resource\nfunc (g *VpnTunnelsGenerator) InitResources() error {\n\tctx := context.Background()\n\tcomputeService, err := compute.NewService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvpnTunnelsList := computeService.VpnTunnels.List(g.GetArgs()[\"project\"].(string), g.GetArgs()[\"region\"].(compute.Region).Name)\n\tg.Resources = g.createResources(ctx, vpnTunnelsList)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/github/github_organization.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage github\n\nimport (\n\t\"context\"\n)\n\ntype OrganizationGenerator struct {\n\tGithubService\n}\n\n// Generate TerraformResources from Github API\nfunc (g *OrganizationGenerator) InitResources() error {\n\tctx := context.Background()\n\tclient, err := g.createClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\towner := g.Args[\"owner\"].(string)\n\tg.Resources = append(g.Resources, createMembershipsResources(ctx, client, owner)...)\n\tg.Resources = append(g.Resources, createOrganizationBlocksResources(ctx, client, owner)...)\n\tg.Resources = append(g.Resources, createOrganizationProjects(ctx, client, owner)...)\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/github/github_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage github\n\nimport (\n\t\"os\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/pkg/errors\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype GithubProvider struct { //nolint\n\tterraformutils.Provider\n\towner          string\n\ttoken          string\n\tbaseURL        string\n\tappID          int64\n\tinstallationID int64\n\tpem            string\n}\n\nfunc (p GithubProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p GithubProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"github\": map[string]interface{}{\n\t\t\t\t\"owner\": p.owner,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (p *GithubProvider) GetConfig() cty.Value {\n\tif p.appID != 0 && p.installationID != 0 && p.pem != \"\" {\n\t\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\t\"owner\": cty.StringVal(p.owner),\n\t\t\t\"app_auth\": cty.ListVal(\n\t\t\t\t[]cty.Value{\n\t\t\t\t\tcty.ObjectVal(map[string]cty.Value{\n\t\t\t\t\t\t\"id\":              cty.NumberIntVal(p.appID),\n\t\t\t\t\t\t\"installation_id\": cty.NumberIntVal(p.installationID),\n\t\t\t\t\t\t\"pem_file\":        cty.StringVal(p.pem),\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t),\n\t\t})\n\t}\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"owner\":    cty.StringVal(p.owner),\n\t\t\"token\":    cty.StringVal(p.token),\n\t\t\"base_url\": cty.StringVal(p.baseURL),\n\t})\n}\n\n// Init GithubProvider with owner\nfunc (p *GithubProvider) Init(args []string) error {\n\tif appIDValue, ok := os.LookupEnv(\"GITHUB_APP_ID\"); ok {\n\t\tappID, err := strconv.ParseInt(appIDValue, 10, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tp.appID = appID\n\t}\n\tif installationIDValue, ok := os.LookupEnv(\"GITHUB_APP_INSTALLATION_ID\"); ok {\n\t\tinstallationID, err := strconv.ParseInt(installationIDValue, 10, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tp.installationID = installationID\n\t}\n\tif pem, ok := os.LookupEnv(\"GITHUB_APP_PEM_FILE\"); ok {\n\t\tp.pem = strings.Replace(pem, `\\n`, \"\\n\", -1)\n\t}\n\n\tp.owner = args[0]\n\tif len(args) < 2 {\n\t\tif os.Getenv(\"GITHUB_TOKEN\") == \"\" {\n\t\t\treturn errors.New(\"token requirement\")\n\t\t}\n\t\tp.token = os.Getenv(\"GITHUB_TOKEN\")\n\t} else {\n\t\tp.token = args[1]\n\t}\n\tif len(args) > 2 {\n\t\tif args[2] != \"\" {\n\t\t\tp.baseURL = args[2]\n\t\t} else {\n\t\t\tp.baseURL = githubDefaultURL\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (p *GithubProvider) GetName() string {\n\treturn \"github\"\n}\n\nfunc (p *GithubProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"owner\":           p.owner,\n\t\t\"token\":           p.token,\n\t\t\"base_url\":        p.baseURL,\n\t\t\"app_id\":          p.appID,\n\t\t\"installation_id\": p.installationID,\n\t\t\"pem\":             p.pem,\n\t})\n\treturn nil\n}\n\n// GetSupportedService return map of support service for Github\nfunc (p *GithubProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"members\":               &MembersGenerator{},\n\t\t\"organization\":          &OrganizationGenerator{},\n\t\t\"organization_blocks\":   &OrganizationBlockGenerator{},\n\t\t\"organization_projects\": &OrganizationProjectGenerator{},\n\t\t\"organization_webhooks\": &OrganizationWebhooksGenerator{},\n\t\t\"repositories\":          &RepositoriesGenerator{},\n\t\t\"teams\":                 &TeamsGenerator{},\n\t\t\"user_ssh_keys\":         &UserSSHKeyGenerator{},\n\t}\n}\n"
  },
  {
    "path": "providers/github/github_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage github\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/bradleyfalzon/ghinstallation/v2\"\n\t\"github.com/google/go-github/v35/github\"\n\t\"golang.org/x/oauth2\"\n)\n\nconst githubDefaultURL = \"https://api.github.com/\"\n\ntype GithubService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (g *GithubService) createClient() (*github.Client, error) {\n\tif g.GetArgs()[\"base_url\"].(string) == githubDefaultURL {\n\t\treturn g.createRegularClient(), nil\n\t}\n\treturn g.createEnterpriseClient()\n}\n\nfunc (g *GithubService) createRegularClient() *github.Client {\n\tctx := context.Background()\n\tif g.Args[\"app_id\"].(int64) != 0 && g.Args[\"installation_id\"].(int64) != 0 && g.Args[\"pem\"].(string) != \"\" {\n\t\titr, err := ghinstallation.New(http.DefaultTransport, g.Args[\"app_id\"].(int64), g.Args[\"installation_id\"].(int64), []byte(g.Args[\"pem\"].(string)))\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn github.NewClient(&http.Client{Transport: itr})\n\t}\n\tts := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: g.Args[\"token\"].(string)},\n\t)\n\ttc := oauth2.NewClient(ctx, ts)\n\treturn github.NewClient(tc)\n}\n\nfunc (g *GithubService) createEnterpriseClient() (*github.Client, error) {\n\tctx := context.Background()\n\tbaseURL := g.GetArgs()[\"base_url\"].(string)\n\tif g.Args[\"app_id\"].(int64) != 0 && g.Args[\"installation_id\"].(int64) != 0 && g.Args[\"pem\"].(string) != \"\" {\n\t\titr, err := ghinstallation.New(http.DefaultTransport, g.Args[\"app_id\"].(int64), g.Args[\"installation_id\"].(int64), []byte(g.Args[\"pem\"].(string)))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn github.NewEnterpriseClient(baseURL, baseURL, &http.Client{Transport: itr})\n\t}\n\tts := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: g.Args[\"token\"].(string)},\n\t)\n\ttc := oauth2.NewClient(ctx, ts)\n\treturn github.NewEnterpriseClient(baseURL, baseURL, tc)\n}\n"
  },
  {
    "path": "providers/github/members.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage github\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\tgithubAPI \"github.com/google/go-github/v35/github\"\n)\n\n// MembersGenerator holds GithubService struct of Terraform service information\ntype MembersGenerator struct {\n\tGithubService\n}\n\n// InitResources generates TerraformResources from Github API,\nfunc (g *MembersGenerator) InitResources() error {\n\tctx := context.Background()\n\tclient, err := g.createClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\towner := g.Args[\"owner\"].(string)\n\tg.Resources = append(g.Resources, createMembershipsResources(ctx, client, owner)...)\n\n\treturn nil\n}\n\nfunc createMembershipsResources(ctx context.Context, client *githubAPI.Client, owner string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\n\topt := &githubAPI.ListMembersOptions{\n\t\tListOptions: githubAPI.ListOptions{PerPage: 100},\n\t}\n\n\t// List all organization members for the authenticated user\n\tfor {\n\t\tmembers, resp, err := client.Organizations.ListMembers(ctx, owner, opt)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, member := range members {\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\towner+\":\"+member.GetLogin(),\n\t\t\t\tmember.GetLogin(),\n\t\t\t\t\"github_membership\",\n\t\t\t\t\"github\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\n\t\t\tresources = append(resources, resource)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\n\treturn resources\n}\n"
  },
  {
    "path": "providers/github/organizationWebhooks.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage github\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\tgithubAPI \"github.com/google/go-github/v35/github\"\n)\n\ntype OrganizationWebhooksGenerator struct {\n\tGithubService\n}\n\n// Generate TerraformResources from Github API,\nfunc (g *OrganizationWebhooksGenerator) InitResources() error {\n\tctx := context.Background()\n\tclient, err := g.createClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\topt := &githubAPI.ListOptions{PerPage: 100}\n\n\t// List all organization hooks for the authenticated user\n\tfor {\n\t\thooks, resp, err := client.Organizations.ListHooks(ctx, g.Args[\"owner\"].(string), opt)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, hook := range hooks {\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tstrconv.FormatInt(hook.GetID(), 10),\n\t\t\t\tstrconv.FormatInt(hook.GetID(), 10),\n\t\t\t\t\"github_organization_webhook\",\n\t\t\t\t\"github\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/github/organization_block.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage github\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\tgithubAPI \"github.com/google/go-github/v35/github\"\n)\n\ntype OrganizationBlockGenerator struct {\n\tGithubService\n}\n\n// Generate TerraformResources from Github API,\nfunc (g *OrganizationBlockGenerator) InitResources() error {\n\tctx := context.Background()\n\tclient, err := g.createClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\towner := g.Args[\"owner\"].(string)\n\tg.Resources = append(g.Resources, createOrganizationBlocksResources(ctx, client, owner)...)\n\n\treturn nil\n}\n\nfunc createOrganizationBlocksResources(ctx context.Context, client *githubAPI.Client, owner string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\n\topt := &githubAPI.ListOptions{PerPage: 100}\n\n\t// List all organization blocks for the authenticated user\n\tfor {\n\t\tblocks, resp, err := client.Organizations.ListBlockedUsers(ctx, owner, opt)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, block := range blocks {\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tblock.GetLogin(),\n\t\t\t\tblock.GetLogin(),\n\t\t\t\t\"github_organization_block\",\n\t\t\t\t\"github\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\n\t\t\tresources = append(resources, resource)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\treturn resources\n}\n"
  },
  {
    "path": "providers/github/organization_project.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage github\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\tgithubAPI \"github.com/google/go-github/v35/github\"\n)\n\ntype OrganizationProjectGenerator struct {\n\tGithubService\n}\n\n// Generate TerraformResources from Github API,\nfunc (g *OrganizationProjectGenerator) InitResources() error {\n\tctx := context.Background()\n\tclient, err := g.createClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\towner := g.Args[\"owner\"].(string)\n\tg.Resources = append(g.Resources, createOrganizationProjects(ctx, client, owner)...)\n\n\treturn nil\n}\n\nfunc createOrganizationProjects(ctx context.Context, client *githubAPI.Client, owner string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\n\topt := &githubAPI.ProjectListOptions{\n\t\tListOptions: githubAPI.ListOptions{PerPage: 100},\n\t}\n\n\t// List all organization projects for the authenticated user\n\tfor {\n\t\tprojects, resp, err := client.Organizations.ListProjects(ctx, owner, opt)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, project := range projects {\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tstrconv.FormatInt(project.GetID(), 10),\n\t\t\t\tstrconv.FormatInt(project.GetID(), 10),\n\t\t\t\t\"github_organization_project\",\n\t\t\t\t\"github\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\t\t\tresources = append(resources, resource)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\treturn resources\n}\n"
  },
  {
    "path": "providers/github/repositories.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage github\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tgithubAPI \"github.com/google/go-github/v35/github\"\n)\n\ntype RepositoriesGenerator struct {\n\tGithubService\n}\n\n// Generate TerraformResources from github API,\nfunc (g *RepositoriesGenerator) InitResources() error {\n\tctx := context.Background()\n\tclient, err := g.createClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\topt := &githubAPI.RepositoryListByOrgOptions{\n\t\tListOptions: githubAPI.ListOptions{PerPage: 100},\n\t}\n\t// list all repositories for the authenticated user\n\tfor {\n\t\trepos, resp, err := client.Repositories.ListByOrg(ctx, g.GetArgs()[\"owner\"].(string), opt)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\t\tfor _, repo := range repos {\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\trepo.GetName(),\n\t\t\t\trepo.GetName(),\n\t\t\t\t\"github_repository\",\n\t\t\t\t\"github\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t\tg.Resources = append(g.Resources, g.createRepositoryWebhookResources(ctx, client, repo)...)\n\t\t\tg.Resources = append(g.Resources, g.createRepositoryBranchProtectionResources(ctx, client, repo)...)\n\t\t\tg.Resources = append(g.Resources, g.createRepositoryCollaboratorResources(ctx, client, repo)...)\n\t\t\tg.Resources = append(g.Resources, g.createRepositoryDeployKeyResources(ctx, client, repo)...)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\n\treturn nil\n}\n\nfunc (g *RepositoriesGenerator) createRepositoryWebhookResources(ctx context.Context, client *githubAPI.Client, repo *githubAPI.Repository) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\thooks, _, err := client.Repositories.ListHooks(ctx, g.GetArgs()[\"owner\"].(string), repo.GetName(), nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tfor _, hook := range hooks {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tstrconv.FormatInt(hook.GetID(), 10),\n\t\t\trepo.GetName()+\"_\"+strconv.FormatInt(hook.GetID(), 10),\n\t\t\t\"github_repository_webhook\",\n\t\t\t\"github\",\n\t\t\tmap[string]string{\n\t\t\t\t\"repository\": repo.GetName(),\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *RepositoriesGenerator) createRepositoryBranchProtectionResources(ctx context.Context, client *githubAPI.Client, repo *githubAPI.Repository) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tbranches, _, err := client.Repositories.ListBranches(ctx, g.GetArgs()[\"owner\"].(string), repo.GetName(), nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tfor _, branch := range branches {\n\t\tif branch.GetProtected() {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\trepo.GetName()+\":\"+branch.GetName(),\n\t\t\t\trepo.GetName()+\"_\"+branch.GetName(),\n\t\t\t\t\"github_branch_protection\",\n\t\t\t\t\"github\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *RepositoriesGenerator) createRepositoryCollaboratorResources(ctx context.Context, client *githubAPI.Client, repo *githubAPI.Repository) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tcollaborators, _, err := client.Repositories.ListCollaborators(ctx, g.GetArgs()[\"owner\"].(string), repo.GetName(), nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tfor _, collaborator := range collaborators {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\trepo.GetName()+\":\"+collaborator.GetLogin(),\n\t\t\trepo.GetName()+\":\"+collaborator.GetLogin(),\n\t\t\t\"github_repository_collaborator\",\n\t\t\t\"github\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *RepositoriesGenerator) createRepositoryDeployKeyResources(ctx context.Context, client *githubAPI.Client, repo *githubAPI.Repository) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tdeployKeys, _, err := client.Repositories.ListKeys(ctx, g.GetArgs()[\"owner\"].(string), repo.GetName(), nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tfor _, key := range deployKeys {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\trepo.GetName()+\":\"+strconv.FormatInt(key.GetID(), 10),\n\t\t\trepo.GetName()+\":\"+key.GetTitle(),\n\t\t\t\"github_repository_deploy_key\",\n\t\t\t\"github\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\treturn resources\n}\n\n// PostGenerateHook for connect between resources\nfunc (g *RepositoriesGenerator) PostConvertHook() error {\n\tfor _, repo := range g.Resources {\n\t\tif repo.InstanceInfo.Type != \"github_repository\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor i, member := range g.Resources {\n\t\t\tif member.InstanceInfo.Type != \"github_repository_webhook\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif member.InstanceState.Attributes[\"repository\"] == repo.InstanceState.Attributes[\"name\"] {\n\t\t\t\tg.Resources[i].Item[\"repository\"] = \"${github_repository.\" + repo.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t\tfor i, branch := range g.Resources {\n\t\t\tif branch.InstanceInfo.Type != \"github_branch_protection\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif branch.InstanceState.Attributes[\"repository\"] == repo.InstanceState.Attributes[\"name\"] {\n\t\t\t\tg.Resources[i].Item[\"repository\"] = \"${github_repository.\" + repo.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t\tfor i, collaborator := range g.Resources {\n\t\t\tif collaborator.InstanceInfo.Type != \"github_repository_collaborator\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif collaborator.InstanceState.Attributes[\"repository\"] == repo.InstanceState.Attributes[\"name\"] {\n\t\t\t\tg.Resources[i].Item[\"repository\"] = \"${github_repository.\" + repo.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t\tfor i, key := range g.Resources {\n\t\t\tif key.InstanceInfo.Type != \"github_repository_deploy_key\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif key.InstanceState.Attributes[\"repository\"] == repo.InstanceState.Attributes[\"name\"] {\n\t\t\t\tg.Resources[i].Item[\"repository\"] = \"${github_repository.\" + repo.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/github/teams.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage github\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\tgithubAPI \"github.com/google/go-github/v35/github\"\n)\n\ntype TeamsGenerator struct {\n\tGithubService\n}\n\nfunc (g *TeamsGenerator) createTeamsResources(ctx context.Context, teams []*githubAPI.Team, client *githubAPI.Client) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, team := range teams {\n\t\tresource := terraformutils.NewSimpleResource(\n\t\t\tstrconv.FormatInt(team.GetID(), 10),\n\t\t\tteam.GetName(),\n\t\t\t\"github_team\",\n\t\t\t\"github\",\n\t\t\t[]string{},\n\t\t)\n\t\tresource.SlowQueryRequired = true\n\t\tresources = append(resources, resource)\n\t\tresources = append(resources, g.createTeamMembersResources(ctx, team, client)...)\n\t\tresources = append(resources, g.createTeamRepositoriesResources(ctx, team, client)...)\n\t}\n\treturn resources\n}\n\nfunc (g *TeamsGenerator) createTeamMembersResources(ctx context.Context, team *githubAPI.Team, client *githubAPI.Client) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tmembers, _, err := client.Teams.ListTeamMembersBySlug(ctx, g.Args[\"owner\"].(string), team.GetSlug(), nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tfor _, member := range members {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tstrconv.FormatInt(team.GetID(), 10)+\":\"+member.GetLogin(),\n\t\t\tteam.GetName()+\"_\"+member.GetLogin(),\n\t\t\t\"github_team_membership\",\n\t\t\t\"github\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *TeamsGenerator) createTeamRepositoriesResources(ctx context.Context, team *githubAPI.Team, client *githubAPI.Client) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\trepos, _, err := client.Teams.ListTeamReposBySlug(ctx, g.Args[\"owner\"].(string), team.GetSlug(), nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tfor _, repo := range repos {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tstrconv.FormatInt(team.GetID(), 10)+\":\"+repo.GetName(),\n\t\t\tteam.GetName()+\"_\"+repo.GetName(),\n\t\t\t\"github_team_repository\",\n\t\t\t\"github\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\treturn resources\n}\n\n// InitResources generates TerraformResources from Github API,\nfunc (g *TeamsGenerator) InitResources() error {\n\tctx := context.Background()\n\tclient, err := g.createClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\topt := &githubAPI.ListOptions{PerPage: 1}\n\n\tfor {\n\t\tteams, resp, err := client.Teams.ListTeams(ctx, g.Args[\"owner\"].(string), opt)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tg.Resources = append(g.Resources, g.createTeamsResources(ctx, teams, client)...)\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\n\treturn nil\n}\n\n// PostConvertHook for connect between team and members\nfunc (g *TeamsGenerator) PostConvertHook() error {\n\tfor _, team := range g.Resources {\n\t\tif team.InstanceInfo.Type != \"github_team\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor i, member := range g.Resources {\n\t\t\tif member.InstanceInfo.Type != \"github_team_membership\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif member.InstanceState.Attributes[\"team_id\"] == team.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"team_id\"] = \"${github_team.\" + team.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t\tfor i, repo := range g.Resources {\n\t\t\tif repo.InstanceInfo.Type != \"github_team_repository\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif repo.InstanceState.Attributes[\"team_id\"] == team.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"team_id\"] = \"${github_team.\" + team.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/github/user_ssh_keys.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage github\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\tgithubAPI \"github.com/google/go-github/v35/github\"\n)\n\ntype UserSSHKeyGenerator struct {\n\tGithubService\n}\n\n// Generate TerraformResources from Github API,\nfunc (g *UserSSHKeyGenerator) InitResources() error {\n\tctx := context.Background()\n\tclient, err := g.createClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\topt := &githubAPI.ListOptions{PerPage: 100}\n\n\t// List all ssh keys for the authenticated user\n\tfor {\n\t\tkeys, resp, err := client.Users.ListKeys(ctx, \"\", opt)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, key := range keys {\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tstrconv.FormatInt(key.GetID(), 10),\n\t\t\t\tstrconv.FormatInt(key.GetID(), 10),\n\t\t\t\t\"github_user_ssh_key\",\n\t\t\t\t\"github\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gitlab/gitlab_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gitlab\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/pkg/errors\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype GitLabProvider struct { //nolint\n\tterraformutils.Provider\n\tgroup   string\n\ttoken   string\n\tbaseURL string\n}\n\nfunc (p GitLabProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p GitLabProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"gitlab\": map[string]interface{}{\n\t\t\t\t// TODO: Should I add some default config here?\n\t\t\t\t// \"token\": p.token,\n\t\t\t\t// \"base_url\": p.baseURL,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (p *GitLabProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"token\": cty.StringVal(p.token),\n\t\t// NOTE: Real provider doesn't support empty/null base_url, only set when there's value\n\t\t\"base_url\": cty.StringVal(p.baseURL),\n\t})\n}\n\n// Init GitLabProvider with group\nfunc (p *GitLabProvider) Init(args []string) error {\n\tp.group = args[0]\n\tp.baseURL = gitLabDefaultURL\n\tif len(args) < 2 {\n\t\tif os.Getenv(\"GITLAB_TOKEN\") == \"\" {\n\t\t\treturn errors.New(\"token requirement\")\n\t\t}\n\t\tp.token = os.Getenv(\"GITLAB_TOKEN\")\n\t} else {\n\t\tp.token = args[1]\n\t}\n\tif len(args) > 2 {\n\t\tif args[2] != \"\" {\n\t\t\tp.baseURL = args[2]\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (p *GitLabProvider) GetName() string {\n\treturn \"gitlab\"\n}\n\nfunc (p *GitLabProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"group\":    p.group,\n\t\t\"token\":    p.token,\n\t\t\"base_url\": p.baseURL,\n\t})\n\treturn nil\n}\n\n// GetSupportedService return map of support service for gitlab\nfunc (p *GitLabProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"projects\": &ProjectGenerator{},\n\t\t\"groups\":   &GroupGenerator{},\n\t}\n}\n"
  },
  {
    "path": "providers/gitlab/gitlab_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gitlab\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/xanzy/go-gitlab\"\n)\n\nconst gitLabDefaultURL = \"https://gitlab.com/api/v4/\"\n\ntype GitLabService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (g *GitLabService) createClient() (*gitlab.Client, error) {\n\tif g.GetArgs()[\"base_url\"].(string) == gitLabDefaultURL {\n\t\treturn g.createRegularClient()\n\t}\n\treturn g.createEnterpriseClient()\n}\n\nfunc (g *GitLabService) createRegularClient() (*gitlab.Client, error) {\n\treturn gitlab.NewClient(g.Args[\"token\"].(string))\n}\n\nfunc (g *GitLabService) createEnterpriseClient() (*gitlab.Client, error) {\n\treturn gitlab.NewClient(g.Args[\"token\"].(string), gitlab.WithBaseURL(g.GetArgs()[\"base_url\"].(string)))\n}\n"
  },
  {
    "path": "providers/gitlab/group.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gitlab\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/xanzy/go-gitlab\"\n)\n\ntype GroupGenerator struct {\n\tGitLabService\n}\n\n// Generate TerraformResources from gitlab API,\nfunc (g *GroupGenerator) InitResources() error {\n\tctx := context.Background()\n\tclient, err := g.createClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgroup := g.Args[\"group\"].(string)\n\tg.Resources = append(g.Resources, createGroups(ctx, client, group)...)\n\n\treturn nil\n}\n\nfunc createGroups(ctx context.Context, client *gitlab.Client, groupID string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tgroup, _, err := client.Groups.GetGroup(groupID, gitlab.WithContext(ctx))\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil\n\t}\n\n\tresource := terraformutils.NewSimpleResource(\n\t\tstrconv.FormatInt(int64(group.ID), 10),\n\t\tgetGroupResourceName(group),\n\t\t\"gitlab_group\",\n\t\t\"gitlab\",\n\t\t[]string{},\n\t)\n\n\t// NOTE: mirror fields from API doesn't match with the ones from terraform provider\n\tresource.IgnoreKeys = []string{\"mirror_trigger_builds\", \"only_mirror_protected_branches\", \"mirror\", \"mirror_overwrites_diverged_branches\"}\n\n\tresource.SlowQueryRequired = true\n\tresources = append(resources, resource)\n\tresources = append(resources, createGroupVariables(ctx, client, group)...)\n\tresources = append(resources, createGroupMembership(ctx, client, group)...)\n\n\treturn resources\n}\nfunc createGroupVariables(ctx context.Context, client *gitlab.Client, group *gitlab.Group) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\topt := &gitlab.ListGroupVariablesOptions{}\n\n\tfor {\n\t\tgroupVariables, resp, err := client.GroupVariables.ListVariables(group.ID, opt, gitlab.WithContext(ctx))\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, groupVariable := range groupVariables {\n\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%d:%s:%s\", group.ID, groupVariable.Key, groupVariable.EnvironmentScope),\n\t\t\t\tfmt.Sprintf(\"%s___%s___%s\", getGroupResourceName(group), groupVariable.Key, groupVariable.EnvironmentScope),\n\t\t\t\t\"gitlab_group_variable\",\n\t\t\t\t\"gitlab\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\t\t\tresources = append(resources, resource)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\treturn resources\n}\n\nfunc createGroupMembership(ctx context.Context, client *gitlab.Client, group *gitlab.Group) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\topt := &gitlab.ListGroupMembersOptions{}\n\n\tfor {\n\t\tgroupMembers, resp, err := client.Groups.ListGroupMembers(group.ID, opt, gitlab.WithContext(ctx))\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, groupMember := range groupMembers {\n\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%d:%d\", group.ID, groupMember.ID),\n\t\t\t\tfmt.Sprintf(\"%s___%s\", getGroupResourceName(group), groupMember.Username),\n\t\t\t\t\"gitlab_group_membership\",\n\t\t\t\t\"gitlab\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\t\t\tresources = append(resources, resource)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\treturn resources\n}\n\nfunc getGroupResourceName(group *gitlab.Group) string {\n\treturn fmt.Sprintf(\"%d___%s\", group.ID, strings.ReplaceAll(group.FullPath, \"/\", \"__\"))\n}\n"
  },
  {
    "path": "providers/gitlab/project.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gitlab\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/xanzy/go-gitlab\"\n)\n\ntype ProjectGenerator struct {\n\tGitLabService\n}\n\n// Generate TerraformResources from gitlab API,\nfunc (g *ProjectGenerator) InitResources() error {\n\tctx := context.Background()\n\tclient, err := g.createClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgroup := g.Args[\"group\"].(string)\n\tg.Resources = append(g.Resources, createProjects(ctx, client, group)...)\n\n\treturn nil\n}\n\nfunc createProjects(ctx context.Context, client *gitlab.Client, group string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\topt := &gitlab.ListGroupProjectsOptions{\n\t\tListOptions: gitlab.ListOptions{\n\t\t\tPerPage: 100,\n\t\t},\n\t}\n\n\tfor {\n\t\tprojects, resp, err := client.Groups.ListGroupProjects(group, opt, gitlab.WithContext(ctx))\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, project := range projects {\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tstrconv.FormatInt(int64(project.ID), 10),\n\t\t\t\tgetProjectResourceName(project),\n\t\t\t\t\"gitlab_project\",\n\t\t\t\t\"gitlab\",\n\t\t\t\t[]string{},\n\t\t\t)\n\n\t\t\t// NOTE: mirror fields from API doesn't match with the ones from terraform provider\n\t\t\tresource.IgnoreKeys = []string{\"mirror_trigger_builds\", \"only_mirror_protected_branches\", \"mirror\", \"mirror_overwrites_diverged_branches\"}\n\n\t\t\tresource.SlowQueryRequired = true\n\t\t\tresources = append(resources, resource)\n\t\t\tresources = append(resources, createProjectVariables(ctx, client, project)...)\n\t\t\tresources = append(resources, createBranchProtections(ctx, client, project)...)\n\t\t\tresources = append(resources, createTagProtections(ctx, client, project)...)\n\t\t\tresources = append(resources, createProjectMembership(ctx, client, project)...)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\treturn resources\n}\nfunc createProjectVariables(ctx context.Context, client *gitlab.Client, project *gitlab.Project) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\topt := &gitlab.ListProjectVariablesOptions{}\n\n\tfor {\n\t\tprojectVariables, resp, err := client.ProjectVariables.ListVariables(project.ID, opt, gitlab.WithContext(ctx))\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, projectVariable := range projectVariables {\n\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%d:%s:%s\", project.ID, projectVariable.Key, projectVariable.EnvironmentScope),\n\t\t\t\tfmt.Sprintf(\"%s___%s___%s\", getProjectResourceName(project), projectVariable.Key, projectVariable.EnvironmentScope),\n\t\t\t\t\"gitlab_project_variable\",\n\t\t\t\t\"gitlab\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\t\t\tresources = append(resources, resource)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\treturn resources\n}\n\nfunc createBranchProtections(ctx context.Context, client *gitlab.Client, project *gitlab.Project) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\topt := &gitlab.ListProtectedBranchesOptions{}\n\n\tfor {\n\t\tprotectedBranches, resp, err := client.ProtectedBranches.ListProtectedBranches(project.ID, opt, gitlab.WithContext(ctx))\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, protectedBranch := range protectedBranches {\n\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%d:%s\", project.ID, protectedBranch.Name),\n\t\t\t\tfmt.Sprintf(\"%s___%s\", getProjectResourceName(project), protectedBranch.Name),\n\t\t\t\t\"gitlab_branch_protection\",\n\t\t\t\t\"gitlab\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\t\t\tresources = append(resources, resource)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\treturn resources\n}\n\nfunc createTagProtections(ctx context.Context, client *gitlab.Client, project *gitlab.Project) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\topt := &gitlab.ListProtectedTagsOptions{}\n\n\tfor {\n\t\tprotectedTags, resp, err := client.ProtectedTags.ListProtectedTags(project.ID, opt, gitlab.WithContext(ctx))\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, protectedTag := range protectedTags {\n\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%d:%s\", project.ID, protectedTag.Name),\n\t\t\t\tfmt.Sprintf(\"%s___%s\", getProjectResourceName(project), protectedTag.Name),\n\t\t\t\t\"gitlab_tag_protection\",\n\t\t\t\t\"gitlab\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\t\t\tresources = append(resources, resource)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\treturn resources\n}\n\nfunc createProjectMembership(ctx context.Context, client *gitlab.Client, project *gitlab.Project) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\topt := &gitlab.ListProjectMembersOptions{}\n\n\tfor {\n\t\tprojectMembers, resp, err := client.ProjectMembers.ListProjectMembers(project.ID, opt, gitlab.WithContext(ctx))\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tfor _, projectMember := range projectMembers {\n\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%d:%d\", project.ID, projectMember.ID),\n\t\t\t\tfmt.Sprintf(\"%s___%s\", getProjectResourceName(project), projectMember.Username),\n\t\t\t\t\"gitlab_project_membership\",\n\t\t\t\t\"gitlab\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresource.SlowQueryRequired = true\n\t\t\tresources = append(resources, resource)\n\t\t}\n\n\t\tif resp.NextPage == 0 {\n\t\t\tbreak\n\t\t}\n\t\topt.Page = resp.NextPage\n\t}\n\treturn resources\n}\n\nfunc getProjectResourceName(project *gitlab.Project) string {\n\treturn fmt.Sprintf(\"%d___%s\", project.ID, strings.ReplaceAll(project.PathWithNamespace, \"/\", \"__\"))\n}\n"
  },
  {
    "path": "providers/gmailfilter/filter.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gmailfilter\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"google.golang.org/api/gmail/v1\"\n)\n\ntype FilterGenerator struct {\n\tGmailfilterService\n}\n\nfunc (g FilterGenerator) createResources(filters []*gmail.Filter) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, f := range filters {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tf.Id,\n\t\t\tf.Id,\n\t\t\t\"gmailfilter_filter\",\n\t\t\t\"gmailfilter\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn resources\n}\n\nfunc (g *FilterGenerator) InitResources() error {\n\tctx := context.Background()\n\tgmailService, err := g.gmailService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfilters, err := gmailService.Users.Settings.Filters.List(gmailUser).Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = append(g.Resources, g.createResources(filters.Filter)...)\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/gmailfilter/gmailfilter_provider.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gmailfilter\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype GmailfilterProvider struct { //nolint\n\tterraformutils.Provider\n\tcredentials           string\n\timpersonatedUserEmail string\n}\n\nfunc (p *GmailfilterProvider) Init(args []string) error {\n\tcredentials := os.Getenv(\"GOOGLE_CREDENTIALS\")\n\tif len(args) > 0 && args[0] != \"\" {\n\t\tcredentials = args[0]\n\t\tos.Setenv(\"GOOGLE_CREDENTIALS\", credentials)\n\t}\n\temail := os.Getenv(\"IMPERSONATED_USER_EMAIL\")\n\tif len(args) > 1 && args[1] != \"\" {\n\t\temail = args[1]\n\t\tos.Setenv(\"IMPERSONATED_USER_EMAIL\", email)\n\t}\n\n\tp.credentials = credentials\n\tp.impersonatedUserEmail = email\n\n\treturn nil\n}\n\nfunc (p *GmailfilterProvider) GetName() string {\n\treturn \"gmailfilter\"\n}\n\nfunc (p *GmailfilterProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"gmailfilter: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"credentials\":           p.credentials,\n\t\t\"impersonatedUserEmail\": p.impersonatedUserEmail,\n\t})\n\treturn nil\n}\n\n// GetGCPSupportService return map of support service for GCP\nfunc (p *GmailfilterProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\tservices := make(map[string]terraformutils.ServiceGenerator)\n\tservices[\"label\"] = &LabelGenerator{}\n\tservices[\"filter\"] = &FilterGenerator{}\n\treturn services\n}\n\nfunc (p *GmailfilterProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"filter\": {\n\t\t\t\"label\": {\n\t\t\t\t\"action.add_label_ids\", \"id\",\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (p *GmailfilterProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n"
  },
  {
    "path": "providers/gmailfilter/gmailfilter_service.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gmailfilter\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/hashicorp/terraform/helper/pathorcontents\"\n\t\"golang.org/x/oauth2\"\n\tgoogleoauth \"golang.org/x/oauth2/google\"\n\t\"golang.org/x/oauth2/jwt\"\n\t\"google.golang.org/api/gmail/v1\"\n\t\"google.golang.org/api/option\"\n)\n\nconst gmailUser = \"me\"\n\nvar gmailAPIScopes = []string{\n\tgmail.GmailLabelsScope,\n\tgmail.GmailSettingsBasicScope,\n}\n\ntype GmailfilterService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *GmailfilterService) gmailService(ctx context.Context) (*gmail.Service, error) {\n\tcreds := s.GetArgs()[\"credentials\"].(string)\n\timpersonatedEmailAddr := s.GetArgs()[\"impersonatedUserEmail\"].(string)\n\n\ttokenSource, err := s.getTokenSource(creds, impersonatedEmailAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := oauth2.NewClient(ctx, tokenSource)\n\tclient.Timeout = 30 * time.Second\n\n\tsvc, err := gmail.NewService(ctx, option.WithHTTPClient(client))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn svc, nil\n}\n\nfunc (s *GmailfilterService) validateCredentials(creds string) error {\n\tif _, err := os.Stat(creds); err == nil {\n\t\treturn nil\n\t}\n\tif _, err := googleoauth.CredentialsFromJSON(context.Background(), []byte(creds)); err != nil {\n\t\treturn fmt.Errorf(\"JSON credentials in %q are not valid: %s\", creds, err)\n\t}\n\treturn nil\n}\n\nfunc (s *GmailfilterService) getTokenSource(creds string, impersonatedEmailAddr string) (oauth2.TokenSource, error) {\n\tif creds != \"\" && impersonatedEmailAddr != \"\" {\n\t\tif err := s.validateCredentials(creds); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tcontents, _, err := pathorcontents.Read(creds)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error loading credentials: %s\", err)\n\t\t}\n\n\t\tvar serviceAccount serviceAccountFile\n\t\tif err := parseJSON(&serviceAccount, contents); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error parsing credentials %q: %s\", contents, err)\n\t\t}\n\n\t\tconf := jwt.Config{\n\t\t\tEmail:      serviceAccount.ClientEmail,\n\t\t\tPrivateKey: []byte(serviceAccount.PrivateKey),\n\t\t\tScopes:     gmailAPIScopes,\n\t\t\tTokenURL:   \"https://oauth2.googleapis.com/token\",\n\t\t}\n\t\tconf.Subject = impersonatedEmailAddr\n\t\treturn conf.TokenSource(context.Background()), nil\n\t}\n\n\treturn googleoauth.DefaultTokenSource(context.Background(), gmailAPIScopes...)\n}\n\ntype serviceAccountFile struct {\n\tPrivateKeyID string `json:\"private_key_id\"`\n\tPrivateKey   string `json:\"private_key\"`\n\tClientEmail  string `json:\"client_email\"`\n\tClientID     string `json:\"client_id\"`\n}\n\nfunc parseJSON(result interface{}, contents string) error {\n\tr := strings.NewReader(contents)\n\tdec := json.NewDecoder(r)\n\n\treturn dec.Decode(result)\n}\n"
  },
  {
    "path": "providers/gmailfilter/label.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gmailfilter\n\nimport (\n\t\"context\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"google.golang.org/api/gmail/v1\"\n)\n\ntype LabelGenerator struct {\n\tGmailfilterService\n}\n\nfunc (g LabelGenerator) createResources(labels []*gmail.Label) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, l := range labels {\n\t\tif l.Type == \"system\" {\n\t\t\tcontinue // ignore system labels\n\t\t}\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tl.Id,\n\t\t\tstrings.ReplaceAll(l.Name, \"/\", \"_\"),\n\t\t\t\"gmailfilter_label\",\n\t\t\t\"gmailfilter\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn resources\n}\n\nfunc (g *LabelGenerator) InitResources() error {\n\tctx := context.Background()\n\tgmailService, err := g.gmailService(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlabels, err := gmailService.Users.Labels.List(gmailUser).Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = append(g.Resources, g.createResources(labels.Labels)...)\n\n\treturn nil\n\n}\n"
  },
  {
    "path": "providers/grafana/dashboard.go",
    "content": "package grafana\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tgapi \"github.com/grafana/grafana-api-golang-client\"\n)\n\ntype DashboardGenerator struct {\n\tGrafanaService\n}\n\nfunc (g *DashboardGenerator) InitResources() error {\n\tclient, err := g.buildClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to build grafana client: %v\", err)\n\t}\n\n\terr = g.createDashboardResources(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *DashboardGenerator) createDashboardResources(client *gapi.Client) error {\n\tdashboards, err := client.Dashboards()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list grafana dashboards: %v\", err)\n\t}\n\n\tfor _, dashboard := range dashboards {\n\t\t// search result doesn't include slug, so need to look up dashboard.\n\t\tdash, err := client.DashboardByUID(dashboard.UID)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to read grafana dashboard %s: %v\", dashboard.Title, err)\n\t\t}\n\n\t\tconfigJSON, err := json.MarshalIndent(dash.Model, \"\", \"  \")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to marshal configuration for grafana dashboard %s: %v\", dashboard.Title, err)\n\t\t}\n\n\t\tfilename := fmt.Sprintf(\"dashboard-%s.json\", dash.Meta.Slug)\n\t\tresource := terraformutils.NewResource(\n\t\t\tdashboard.UID,\n\t\t\tdashboard.Title,\n\t\t\t\"grafana_dashboard\",\n\t\t\t\"grafana\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"config_json\": fmt.Sprintf(\"file(\\\"data/%s\\\")\", filename),\n\t\t\t\t\"folder\":      dashboard.FolderID,\n\t\t\t},\n\t\t)\n\t\tresource.DataFiles = map[string][]byte{\n\t\t\tfilename: configJSON,\n\t\t}\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/grafana/folder.go",
    "content": "package grafana\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tgapi \"github.com/grafana/grafana-api-golang-client\"\n)\n\ntype FolderGenerator struct {\n\tGrafanaService\n}\n\nfunc (g *FolderGenerator) InitResources() error {\n\tclient, err := g.buildClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to build grafana client: %v\", err)\n\t}\n\n\terr = g.createFolderResources(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *FolderGenerator) createFolderResources(client *gapi.Client) error {\n\tfolders, err := client.Folders()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list grafana folders: %v\", err)\n\t}\n\n\tfor _, folder := range folders {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tfmt.Sprint(folder.ID),\n\t\t\tfolder.Title,\n\t\t\t\"grafana_folder\",\n\t\t\t\"grafana\",\n\t\t\tmap[string]string{\n\t\t\t\t\"uid\": folder.UID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/grafana/grafana_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage grafana\n\nimport (\n\t\"os\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/pkg/errors\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype GrafanaProvider struct { //nolint\n\tterraformutils.Provider\n\tauth               string\n\turl                string\n\torgID              int\n\ttlsKey             string\n\ttlsCert            string\n\tcaCert             string\n\tinsecureSkipVerify bool\n}\n\nfunc (p GrafanaProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"grafana_dashboard\": {\n\t\t\t\"grafana_folder\": []string{\"folder\", \"id\"},\n\t\t},\n\t}\n}\n\nfunc (p GrafanaProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"grafana\": map[string]interface{}{\n\t\t\t\t\"org_id\":               p.orgID,\n\t\t\t\t\"url\":                  p.url,\n\t\t\t\t\"auth\":                 p.auth,\n\t\t\t\t\"tls_key\":              p.tlsKey,\n\t\t\t\t\"tls_cert\":             p.tlsCert,\n\t\t\t\t\"ca_cert\":              p.caCert,\n\t\t\t\t\"insecure_skip_verify\": p.insecureSkipVerify,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (p *GrafanaProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"org_id\":               cty.NumberIntVal(int64(p.orgID)),\n\t\t\"url\":                  cty.StringVal(p.url),\n\t\t\"auth\":                 cty.StringVal(p.auth),\n\t\t\"tls_key\":              cty.StringVal(p.tlsKey),\n\t\t\"tls_cert\":             cty.StringVal(p.tlsCert),\n\t\t\"ca_cert\":              cty.StringVal(p.caCert),\n\t\t\"insecure_skip_verify\": cty.BoolVal(p.insecureSkipVerify),\n\t})\n}\n\nfunc (p *GrafanaProvider) Init(args []string) error {\n\tp.auth = os.Getenv(\"GRAFANA_AUTH\")\n\tif p.auth == \"\" {\n\t\treturn errors.New(\"Grafana API authentication must be set through `GRAFANA_AUTH` env var, either as an API token or as username:password for HTTP basic auth\")\n\t}\n\n\tp.url = os.Getenv(\"GRAFANA_URL\")\n\tif p.url == \"\" {\n\t\treturn errors.New(\"Grafana API URL must be set through `GRAFANA_URL` env var\")\n\t}\n\n\torgID, err := strconv.Atoi(os.Getenv(\"GRAFANA_ORG_ID\"))\n\tif err != nil {\n\t\torgID = 1\n\t}\n\tp.orgID = orgID\n\n\tp.tlsKey = os.Getenv(\"HTTPS_TLS_KEY\")\n\tp.tlsCert = os.Getenv(\"HTTPS_TLS_CERT\")\n\tp.caCert = os.Getenv(\"HTTPS_CA_CERT\")\n\n\tif os.Getenv(\"HTTPS_INSECURE_SKIP_VERIFY\") == \"1\" {\n\t\tp.insecureSkipVerify = true\n\t}\n\n\treturn nil\n}\n\nfunc (p *GrafanaProvider) GetName() string {\n\treturn \"grafana\"\n}\n\nfunc (p *GrafanaProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"org_id\":               p.orgID,\n\t\t\"url\":                  p.url,\n\t\t\"auth\":                 p.auth,\n\t\t\"tls_key\":              p.tlsKey,\n\t\t\"tls_cert\":             p.tlsCert,\n\t\t\"ca_cert\":              p.caCert,\n\t\t\"insecure_skip_verify\": p.insecureSkipVerify,\n\t})\n\treturn nil\n}\n\nfunc (p *GrafanaProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"grafana_dashboard\": &DashboardGenerator{},\n\t\t\"grafana_folder\":    &FolderGenerator{},\n\t}\n}\n"
  },
  {
    "path": "providers/grafana/grafana_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage grafana\n\nimport (\n\t\"crypto/tls\"\n\t\"crypto/x509\"\n\t\"net/url\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tgapi \"github.com/grafana/grafana-api-golang-client\"\n\t\"github.com/hashicorp/go-cleanhttp\"\n\t\"github.com/hashicorp/terraform/helper/logging\"\n)\n\ntype GrafanaService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *GrafanaService) buildClient() (*gapi.Client, error) {\n\tauth := strings.SplitN(s.Args[\"auth\"].(string), \":\", 2)\n\tcli := cleanhttp.DefaultClient()\n\ttransport := cleanhttp.DefaultTransport()\n\ttransport.TLSClientConfig = &tls.Config{}\n\n\t// TLS Config\n\ttlsKey := s.Args[\"tls_key\"].(string)\n\ttlsCert := s.Args[\"tls_cert\"].(string)\n\tcaCert := s.Args[\"ca_cert\"].(string)\n\tinsecure := s.Args[\"insecure_skip_verify\"].(bool)\n\n\tif caCert != \"\" {\n\t\tca, err := os.ReadFile(caCert)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpool := x509.NewCertPool()\n\t\tpool.AppendCertsFromPEM(ca)\n\t\ttransport.TLSClientConfig.RootCAs = pool\n\t}\n\n\tif tlsKey != \"\" && tlsCert != \"\" {\n\t\tcert, err := tls.LoadX509KeyPair(tlsCert, tlsKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttransport.TLSClientConfig.Certificates = []tls.Certificate{cert}\n\t}\n\n\tif insecure {\n\t\ttransport.TLSClientConfig.InsecureSkipVerify = true\n\t}\n\n\tcli.Transport = logging.NewTransport(\"Grafana\", transport)\n\tcfg := gapi.Config{\n\t\tClient: cli,\n\t\tOrgID:  int64(s.Args[\"org_id\"].(int)),\n\t}\n\n\tif len(auth) == 2 {\n\t\tcfg.BasicAuth = url.UserPassword(auth[0], auth[1])\n\t} else {\n\t\tcfg.APIKey = auth[0]\n\t}\n\n\tclient, err := gapi.New(s.Args[\"url\"].(string), cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}\n"
  },
  {
    "path": "providers/heroku/account_feature.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage heroku\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\theroku \"github.com/heroku/heroku-go/v5\"\n)\n\ntype AccountFeatureGenerator struct {\n\tHerokuService\n}\n\nfunc (g AccountFeatureGenerator) createResources(accountFeatureList []heroku.AccountFeature) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, accountFeature := range accountFeatureList {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\taccountFeature.ID,\n\t\t\taccountFeature.Name,\n\t\t\t\"heroku_account_feature\",\n\t\t\t\"heroku\",\n\t\t\tmap[string]string{\"name\": accountFeature.Name},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn resources\n}\n\nfunc (g *AccountFeatureGenerator) InitResources() error {\n\tsvc := g.generateService()\n\tctx := context.Background()\n\tlist := []heroku.AccountFeature{}\n\n\taccountFeatures, err := svc.AccountFeatureList(ctx, &heroku.ListRange{Field: \"id\"})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, accountFeature := range accountFeatures {\n\t\tif accountFeature.Enabled {\n\t\t\tlist = append(list, accountFeature)\n\t\t}\n\t}\n\tg.Resources = g.createResources(list)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/heroku/app.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage heroku\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\theroku \"github.com/heroku/heroku-go/v5\"\n)\n\ntype AppGenerator struct {\n\tHerokuService\n}\n\nfunc (g AppGenerator) createResources(appList []heroku.App) ([]terraformutils.Resource, error) {\n\tvar resources []terraformutils.Resource\n\tvar resourcesEmpty []terraformutils.Resource\n\n\tfor _, app := range appList {\n\t\tconfigVars, err := g.getSettableConfigVars(app.ID)\n\t\tif err != nil {\n\t\t\treturn resourcesEmpty, fmt.Errorf(\"Error in getSettableConfigVars for '%s': %w\", app.ID, err)\n\t\t}\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tapp.ID,\n\t\t\tapp.Name,\n\t\t\t\"heroku_app\",\n\t\t\t\"heroku\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"config_vars\": configVars,\n\t\t\t}))\n\t}\n\treturn resources, nil\n}\n\nfunc (g *AppGenerator) InitResources() error {\n\tsvc := g.generateService()\n\tctx := context.Background()\n\tteam := g.GetArgs()[\"team\"].(string)\n\n\tvar output []heroku.App\n\tvar hasRequiredFilter bool\n\n\tif len(g.Filter) > 0 {\n\t\tfor _, filter := range g.Filter {\n\t\t\tif filter.IsApplicable(\"app\") {\n\t\t\t\thasRequiredFilter = true\n\t\t\t\tfor _, appID := range filter.AcceptableValues {\n\t\t\t\t\tapp, err := svc.AppInfo(ctx, appID)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"Error filtering apps by app '%s': %w\", appID, err)\n\t\t\t\t\t}\n\t\t\t\t\toutput = append(output, *app)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif team != \"\" {\n\t\thasRequiredFilter = true\n\t\tteamApps, err := svc.TeamAppListByTeam(ctx, team, &heroku.ListRange{Field: \"id\", Max: 1000})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error querying apps by team '%s': %w\", team, err)\n\t\t}\n\t\tfor _, app := range teamApps {\n\t\t\toutput = append(output, heroku.App{ID: app.ID, Name: app.Name})\n\t\t}\n\t}\n\n\tif !hasRequiredFilter {\n\t\treturn fmt.Errorf(\"Heroku Apps must be scoped by team or filtered by app: --team=<name> or --filter=app=<ID>\")\n\t}\n\n\tresources, err := g.createResources(output)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error creating app resources: %w\", err)\n\t}\n\tg.Resources = resources\n\n\tfor _, app := range output {\n\t\tappFeatures, err := g.createAppFeatureResources(ctx, svc, app)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error creating app feature resources: %w\", err)\n\t\t}\n\t\tg.Resources = append(g.Resources, appFeatures...)\n\n\t\taddons, err := g.createAddonResources(ctx, svc, app)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error creating app addon resources: %w\", err)\n\t\t}\n\t\tg.Resources = append(g.Resources, addons...)\n\n\t\taddonAttachments, err := g.createAddonAttachmentResources(ctx, svc, app)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error creating app addon attachment resources: %w\", err)\n\t\t}\n\t\tg.Resources = append(g.Resources, addonAttachments...)\n\n\t\tappWebooks, err := g.createAppWebhookResources(ctx, svc, app)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error creating app webhook resources: %w\", err)\n\t\t}\n\t\tg.Resources = append(g.Resources, appWebooks...)\n\n\t\tssls, err := g.createSslResources(ctx, svc, app)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error creating SSL resources: %w\", err)\n\t\t}\n\t\tg.Resources = append(g.Resources, ssls...)\n\n\t\tdomains, err := g.createDomainResources(ctx, svc, app)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error creating domain resources: %w\", err)\n\t\t}\n\t\tg.Resources = append(g.Resources, domains...)\n\n\t\tdrains := g.createDrainResources(ctx, svc, app)\n\t\tg.Resources = append(g.Resources, drains...)\n\n\t\tformations, err := g.createFormationResources(ctx, svc, app)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error creating formation resources: %w\", err)\n\t\t}\n\t\tg.Resources = append(g.Resources, formations...)\n\t}\n\n\treturn nil\n}\n\nfunc (g AppGenerator) getSettableConfigVars(appID string) (map[string]string, error) {\n\tsvc := g.generateService()\n\tctx := context.Background()\n\toutput := map[string]string{}\n\temptyOutput := map[string]string{}\n\n\tvars, err := svc.ConfigVarInfoForApp(ctx, appID)\n\tif err != nil {\n\t\treturn emptyOutput, fmt.Errorf(\"Error querying ConfigVarInfoForApp '%s': %w\", appID, err)\n\t}\n\n\tfor k, v := range vars {\n\t\tif v != nil {\n\t\t\toutput[k] = *v\n\t\t}\n\t}\n\n\tappAddons, err := svc.AddOnListByApp(ctx, appID, &heroku.ListRange{Field: \"id\", Max: 1000})\n\tif err != nil {\n\t\treturn emptyOutput, fmt.Errorf(\"Error querying AddOnListByApp '%s': %w\", appID, err)\n\t}\n\tfor _, addOn := range appAddons {\n\t\tfor _, addOnConfigVar := range addOn.ConfigVars {\n\t\t\tdelete(output, addOnConfigVar)\n\t\t}\n\t}\n\n\treturn output, nil\n}\n\nfunc (g AppGenerator) createAppFeatureResources(ctx context.Context, svc *heroku.Service, app heroku.App) ([]terraformutils.Resource, error) {\n\tlist := []heroku.AppFeature{}\n\n\tappFeatures, err := svc.AppFeatureList(ctx, app.ID, &heroku.ListRange{Field: \"id\", Max: 1000})\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}, fmt.Errorf(\"Error listing for features for app '%s': %w\", app.ID, err)\n\t}\n\tfor _, appFeature := range appFeatures {\n\t\tif appFeature.Enabled {\n\t\t\tlist = append(list, appFeature)\n\t\t}\n\t}\n\tvar resources []terraformutils.Resource\n\tfor _, appFeature := range list {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s:%s\", app.ID, appFeature.Name),\n\t\t\tfmt.Sprintf(\"%s-%s\", app.Name, appFeature.Name),\n\t\t\t\"heroku_app_feature\",\n\t\t\t\"heroku\",\n\t\t\tmap[string]string{\"app_id\": app.ID},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"app_id\": fmt.Sprintf(\"${heroku_app.tfer--%s.id}\", app.Name),\n\t\t\t}))\n\t}\n\treturn resources, nil\n}\n\nfunc (g AppGenerator) createAddonResources(ctx context.Context, svc *heroku.Service, app heroku.App) ([]terraformutils.Resource, error) {\n\tlist := []heroku.AddOn{}\n\n\tappAddons, err := svc.AddOnListByApp(ctx, app.ID, &heroku.ListRange{Field: \"id\", Max: 1000})\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}, fmt.Errorf(\"Error listing addons by app '%s': %w\", app.ID, err)\n\t}\n\tfor _, addOn := range appAddons {\n\t\tlist = append(list, addOn)\n\t}\n\tvar resources []terraformutils.Resource\n\tfor _, addOn := range list {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\taddOn.ID,\n\t\t\taddOn.Name,\n\t\t\t\"heroku_addon\",\n\t\t\t\"heroku\",\n\t\t\tmap[string]string{\"app_id\": app.ID},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"app_id\": fmt.Sprintf(\"${heroku_app.tfer--%s.id}\", app.Name),\n\t\t\t}))\n\t}\n\treturn resources, nil\n}\n\nfunc (g AppGenerator) createAddonAttachmentResources(ctx context.Context, svc *heroku.Service, app heroku.App) ([]terraformutils.Resource, error) {\n\tlist := []heroku.AddOnAttachment{}\n\n\tappAddons, err := svc.AddOnListByApp(ctx, app.ID, &heroku.ListRange{Field: \"id\", Max: 1000})\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}, fmt.Errorf(\"Error listing addons by app '%s': %w\", app.ID, err)\n\t}\n\tfor _, addOn := range appAddons {\n\t\taddonAttachments, err := svc.AddOnAttachmentListByAddOn(ctx, addOn.ID, &heroku.ListRange{Field: \"id\", Max: 1000})\n\t\tif err != nil {\n\t\t\treturn []terraformutils.Resource{}, fmt.Errorf(\"Error listing addon attachments by addon '%s': %w\", addOn.Name, err)\n\t\t}\n\t\tfor _, attachment := range addonAttachments {\n\t\t\tlist = append(list, attachment)\n\t\t}\n\t}\n\tvar resources []terraformutils.Resource\n\tfor _, addOnAttachment := range list {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\taddOnAttachment.ID,\n\t\t\tfmt.Sprintf(\"%s-%s\", addOnAttachment.App.Name, addOnAttachment.Name),\n\t\t\t\"heroku_addon_attachment\",\n\t\t\t\"heroku\",\n\t\t\tmap[string]string{\n\t\t\t\t\"app_id\":   addOnAttachment.App.ID,\n\t\t\t\t\"addon_id\": addOnAttachment.Addon.ID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"app_id\":   fmt.Sprintf(\"${heroku_app.tfer--%s.id}\", addOnAttachment.App.Name),\n\t\t\t\t\"addon_id\": fmt.Sprintf(\"${heroku_addon.tfer--%s.id}\", addOnAttachment.Addon.Name),\n\t\t\t}))\n\t}\n\treturn resources, nil\n}\n\nfunc (g AppGenerator) createAppWebhookResources(ctx context.Context, svc *heroku.Service, app heroku.App) ([]terraformutils.Resource, error) {\n\n\tappWebhooks, err := svc.AppWebhookList(ctx, app.ID, &heroku.ListRange{Field: \"id\", Max: 1000})\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}, fmt.Errorf(\"Error listing webhooks for app '%s': %w\", app.ID, err)\n\t}\n\tvar resources []terraformutils.Resource\n\tfor _, appWebhook := range appWebhooks {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tappWebhook.ID,\n\t\t\tappWebhook.ID,\n\t\t\t\"heroku_app_webhook\",\n\t\t\t\"heroku\",\n\t\t\tmap[string]string{\"app_id\": app.ID},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"app_id\": fmt.Sprintf(\"${heroku_app.tfer--%s.id}\", app.Name),\n\t\t\t}))\n\t}\n\treturn resources, nil\n}\n\nfunc (g AppGenerator) createSslResources(ctx context.Context, svc *heroku.Service, app heroku.App) ([]terraformutils.Resource, error) {\n\t// When app is using automated certificate management, do not import this resource.\n\tif app.Acm {\n\t\treturn []terraformutils.Resource{}, nil\n\t}\n\tsniEnpoints, err := svc.SniEndpointList(ctx, app.ID, &heroku.ListRange{Field: \"id\", Max: 1000})\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}, fmt.Errorf(\"Error listing SNI endpoints (SSL) for app '%s': %w\", app.ID, err)\n\t}\n\tvar resources []terraformutils.Resource\n\tfor _, sniEndpoint := range sniEnpoints {\n\t\t// Empty domains indicates inactive endpoint, such as expired/past ACM cert\n\t\tif len(sniEndpoint.Domains) < 1 {\n\t\t\tcontinue\n\t\t}\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tsniEndpoint.ID,\n\t\t\tsniEndpoint.Name,\n\t\t\t\"heroku_ssl\",\n\t\t\t\"heroku\",\n\t\t\tmap[string]string{\"app_id\": app.ID},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"app_id\": fmt.Sprintf(\"${heroku_app.tfer--%s.id}\", app.Name),\n\t\t\t}))\n\t}\n\treturn resources, nil\n}\n\nfunc (g AppGenerator) createDomainResources(ctx context.Context, svc *heroku.Service, app heroku.App) ([]terraformutils.Resource, error) {\n\tdomains, err := svc.DomainList(ctx, app.ID, &heroku.ListRange{Field: \"id\", Max: 1000})\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}, fmt.Errorf(\"Error listing domains for app '%s': %w\", app.ID, err)\n\t}\n\tvar resources []terraformutils.Resource\n\tfor _, domain := range domains {\n\t\tif strings.HasSuffix(domain.Hostname, \"herokuapp.com\") {\n\t\t\tcontinue\n\t\t}\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tdomain.ID,\n\t\t\tstrings.ReplaceAll(domain.Hostname, \".\", \"-\"),\n\t\t\t\"heroku_domain\",\n\t\t\t\"heroku\",\n\t\t\tmap[string]string{\"app_id\": app.ID},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"app_id\": fmt.Sprintf(\"${heroku_app.tfer--%s.id}\", app.Name),\n\t\t\t}))\n\t}\n\treturn resources, nil\n}\n\nfunc (g AppGenerator) createDrainResources(ctx context.Context, svc *heroku.Service, app heroku.App) []terraformutils.Resource {\n\tdrains, err := svc.LogDrainList(ctx, app.ID, &heroku.ListRange{Field: \"id\", Max: 1000})\n\tif err != nil {\n\t\tlog.Printf(\"skipping App Drains due to error: '%s': %s\", app.ID, err)\n\t\treturn []terraformutils.Resource{}\n\t}\n\tvar resources []terraformutils.Resource\n\tfor _, drain := range drains {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s:%s\", app.ID, drain.ID),\n\t\t\tfmt.Sprintf(\"%s-%s\", app.Name, drain.ID),\n\t\t\t\"heroku_drain\",\n\t\t\t\"heroku\",\n\t\t\tmap[string]string{\"app_id\": app.ID},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"app_id\": fmt.Sprintf(\"${heroku_app.tfer--%s.id}\", app.Name),\n\t\t\t}))\n\t}\n\treturn resources\n}\n\nfunc (g AppGenerator) createFormationResources(ctx context.Context, svc *heroku.Service, app heroku.App) ([]terraformutils.Resource, error) {\n\tformations, err := svc.FormationList(ctx, app.ID, &heroku.ListRange{Field: \"id\", Max: 1000})\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}, fmt.Errorf(\"Error listing formations for app '%s': %w\", app.ID, err)\n\t}\n\tvar resources []terraformutils.Resource\n\tfor _, formation := range formations {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tformation.ID,\n\t\t\tfmt.Sprintf(\"%s-%s\", app.Name, formation.Type),\n\t\t\t\"heroku_formation\",\n\t\t\t\"heroku\",\n\t\t\tmap[string]string{\"app_id\": app.ID},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"app_id\": fmt.Sprintf(\"${heroku_app.tfer--%s.id}\", app.Name),\n\t\t\t}))\n\t}\n\treturn resources, nil\n}\n"
  },
  {
    "path": "providers/heroku/heroku_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage heroku\n\nimport (\n\t\"errors\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype HerokuProvider struct { //nolint\n\tterraformutils.Provider\n\tapiKey string\n\tteam   string\n}\n\n// Init the Provider for imports. args are defined in cmd/provider_cmd_heroku.go\nfunc (p *HerokuProvider) Init(args []string) error {\n\tif len(args) > 0 {\n\t\tp.apiKey = args[0]\n\t}\n\tif len(args) > 1 {\n\t\tp.team = args[1]\n\t}\n\treturn nil\n}\n\nfunc (p *HerokuProvider) GetName() string {\n\treturn \"heroku\"\n}\n\nfunc (p *HerokuProvider) GetSource() string {\n\treturn \"heroku/heroku\"\n}\n\nfunc (p *HerokuProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"heroku\": map[string]interface{}{},\n\t\t},\n\t}\n}\n\nfunc (HerokuProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *HerokuProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"account_feature\":   &AccountFeatureGenerator{},\n\t\t\"app\":               &AppGenerator{},\n\t\t\"pipeline\":          &PipelineGenerator{},\n\t\t\"pipeline_coupling\": &PipelineCouplingGenerator{},\n\t\t\"team_collaborator\": &TeamCollaboratorGenerator{},\n\t\t\"team_member\":       &TeamMemberGenerator{},\n\t}\n}\n\nfunc (p *HerokuProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"heroku: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"api_key\": p.apiKey,\n\t\t\"team\":    p.team,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/heroku/heroku_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage heroku\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\theroku \"github.com/heroku/heroku-go/v5\"\n)\n\ntype HerokuService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *HerokuService) generateService() *heroku.Service {\n\theroku.DefaultTransport.Password = s.Args[\"api_key\"].(string)\n\theroku.DefaultTransport.Debug = s.Verbose\n\treturn heroku.NewService(heroku.DefaultClient)\n}\n"
  },
  {
    "path": "providers/heroku/pipeline.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage heroku\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\theroku \"github.com/heroku/heroku-go/v5\"\n)\n\ntype PipelineGenerator struct {\n\tHerokuService\n}\n\nfunc (g PipelineGenerator) createResources(pipelineList []heroku.Pipeline) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, pipeline := range pipelineList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tpipeline.ID,\n\t\t\tpipeline.Name,\n\t\t\t\"heroku_pipeline\",\n\t\t\t\"heroku\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *PipelineGenerator) InitResources() error {\n\tsvc := g.generateService()\n\toutput, err := svc.PipelineList(context.TODO(), &heroku.ListRange{Field: \"id\"})\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/heroku/pipeline_coupling.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage heroku\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\theroku \"github.com/heroku/heroku-go/v5\"\n)\n\ntype PipelineCouplingGenerator struct {\n\tHerokuService\n}\n\nfunc (g PipelineCouplingGenerator) createResources(pipelineCouplingList []heroku.PipelineCoupling) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, pipelineCoupling := range pipelineCouplingList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tpipelineCoupling.ID,\n\t\t\tpipelineCoupling.ID,\n\t\t\t\"heroku_pipeline_coupling\",\n\t\t\t\"heroku\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *PipelineCouplingGenerator) InitResources() error {\n\tsvc := g.generateService()\n\toutput, err := svc.PipelineCouplingList(context.TODO(), &heroku.ListRange{Field: \"id\"})\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/heroku/team_collaborator.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage heroku\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\theroku \"github.com/heroku/heroku-go/v5\"\n)\n\ntype TeamCollaboratorGenerator struct {\n\tHerokuService\n}\n\nfunc (g TeamCollaboratorGenerator) createResources(svc *heroku.Service, teamList []heroku.Team) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, team := range teamList {\n\t\tapps, err := svc.TeamAppListByTeam(context.TODO(), team.ID, &heroku.ListRange{Field: \"id\"})\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tfor _, app := range apps {\n\t\t\tcollaborators, err := svc.TeamAppCollaboratorList(context.TODO(), app.ID, &heroku.ListRange{Field: \"id\"})\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\tfor _, collaborator := range collaborators {\n\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\tcollaborator.ID,\n\t\t\t\t\tcollaborator.ID,\n\t\t\t\t\t\"heroku_team_collaborator\",\n\t\t\t\t\t\"heroku\",\n\t\t\t\t\tmap[string]string{\"app\": app.Name},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t}\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *TeamCollaboratorGenerator) InitResources() error {\n\tsvc := g.generateService()\n\toutput, err := svc.TeamList(context.TODO(), &heroku.ListRange{Field: \"id\"})\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(svc, output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/heroku/team_member.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage heroku\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\theroku \"github.com/heroku/heroku-go/v5\"\n)\n\ntype TeamMemberGenerator struct {\n\tHerokuService\n}\n\nfunc (g TeamMemberGenerator) createResources(svc *heroku.Service, teamList []heroku.Team) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, team := range teamList {\n\t\toutput, err := svc.TeamMemberList(context.TODO(), team.ID, &heroku.ListRange{Field: \"id\"})\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tfor _, member := range output {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%s:%s\", team.ID, member.Email),\n\t\t\t\tmember.ID,\n\t\t\t\t\"heroku_team_member\",\n\t\t\t\t\"heroku\",\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *TeamMemberGenerator) InitResources() error {\n\tsvc := g.generateService()\n\toutput, err := svc.TeamList(context.TODO(), &heroku.ListRange{Field: \"id\"})\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(svc, output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/honeycombio/board.go",
    "content": "package honeycombio\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype BoardGenerator struct {\n\tHoneycombService\n}\n\nfunc (g *BoardGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to initialize Honeycomb client: %v\", err)\n\t}\n\n\tboards, err := client.Boards.List(context.TODO())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list Honeycomb boards: %v\", err)\n\t}\n\n\tfor _, board := range boards {\n\t\t// all of a board's queries must be in our list of target datasets or we don't import it\n\t\tonlyValidDatasets := true\n\t\tfor _, query := range board.Queries {\n\t\t\tif query.Dataset == \"\" {\n\t\t\t\t// assume an unset dataset is an environment-wide query\n\t\t\t\tquery.Dataset = environmentWideDatasetSlug\n\t\t\t}\n\t\t\tif _, exists := g.datasets[query.Dataset]; !exists {\n\t\t\t\tonlyValidDatasets = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif onlyValidDatasets {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tboard.ID,\n\t\t\t\tboard.ID,\n\t\t\t\t\"honeycombio_board\",\n\t\t\t\t\"honeycombio\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/honeycombio/burn_alert.go",
    "content": "package honeycombio\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype BurnAlertGenerator struct {\n\tHoneycombService\n}\n\nfunc (g *BurnAlertGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to initialize Honeycomb client: %v\", err)\n\t}\n\n\tfor _, dataset := range g.datasets {\n\t\tif dataset.Slug == environmentWideDatasetSlug {\n\t\t\t// environment-wide Burn Alerts are not supported\n\t\t\tcontinue\n\t\t}\n\t\tslos, err := client.SLOs.List(context.TODO(), dataset.Slug)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to list Honeycomb SLOs for dataset %q: %v\", dataset.Slug, err)\n\t\t}\n\n\t\tfor _, slo := range slos {\n\t\t\tbas, _ := client.BurnAlerts.ListForSLO(context.TODO(), dataset.Slug, slo.ID)\n\t\t\tfor _, ba := range bas {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\tba.ID,\n\t\t\t\t\tba.ID,\n\t\t\t\t\t\"honeycombio_burn_alert\",\n\t\t\t\t\t\"honeycombio\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"dataset\": dataset.Name,\n\t\t\t\t\t\t\"slo_id\":  slo.ID,\n\t\t\t\t\t},\n\t\t\t\t\t[]string{\"recipient\"},\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/honeycombio/column.go",
    "content": "package honeycombio\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype ColumnGenerator struct {\n\tHoneycombService\n}\n\nfunc (g *ColumnGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to initialize Honeycomb client: %v\", err)\n\t}\n\n\tfor _, dataset := range g.datasets {\n\t\tif dataset.Slug == environmentWideDatasetSlug {\n\t\t\tcontinue\n\t\t}\n\t\tcolumns, err := client.Columns.List(context.TODO(), dataset.Slug)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to list Honeycomb columns for dataset %s: %v\", dataset.Slug, err)\n\t\t}\n\n\t\tfor _, column := range columns {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tcolumn.ID,\n\t\t\t\tfmt.Sprintf(\"%s_%s\", dataset.Name, column.KeyName),\n\t\t\t\t\"honeycombio_column\",\n\t\t\t\t\"honeycombio\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"dataset\":  dataset.Name,\n\t\t\t\t\t\"key_name\": column.KeyName,\n\t\t\t\t},\n\t\t\t\t[]string{\"hidden\", \"type\"},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/honeycombio/dataset.go",
    "content": "package honeycombio\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype DatasetGenerator struct {\n\tHoneycombService\n}\n\nfunc (g *DatasetGenerator) InitResources() error {\n\t// client is not used but initializing the client populates `g.datasets`\n\t_, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to initialize Honeycomb client: %v\", err)\n\t}\n\n\tfor _, dataset := range g.datasets {\n\t\tif dataset.Slug == environmentWideDatasetSlug {\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tdataset.Slug,\n\t\t\tdataset.Slug,\n\t\t\t\"honeycombio_dataset\",\n\t\t\t\"honeycombio\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/honeycombio/derived_column.go",
    "content": "package honeycombio\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype DerivedColumnGenerator struct {\n\tHoneycombService\n}\n\nfunc (g *DerivedColumnGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to initialize Honeycomb client: %v\", err)\n\t}\n\n\tfor _, dataset := range g.datasets {\n\t\tcolumns, err := client.DerivedColumns.List(context.TODO(), dataset.Slug)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to list Honeycomb derived columns for dataset %q: %v\", dataset.Slug, err)\n\t\t}\n\n\t\tfor _, column := range columns {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tcolumn.ID,\n\t\t\t\tfmt.Sprintf(\"%s_%s\", dataset.Name, column.Alias),\n\t\t\t\t\"honeycombio_derived_column\",\n\t\t\t\t\"honeycombio\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"dataset\": dataset.Name,\n\t\t\t\t\t\"alias\":   column.Alias,\n\t\t\t\t\t// TODO: is there a nicer way to format the expression?\n\t\t\t\t\t\"expression\": column.Expression,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/honeycombio/honeycomb_provider.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage honeycombio\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\nconst honeycombDefaultURL = \"https://api.honeycomb.io\"\nconst honeycombTerraformerProviderVersion = \"0.0.2\"\n\ntype HoneycombProvider struct { //nolint\n\tterraformutils.Provider\n\tapiKey   string\n\tapiURL   string\n\tdatasets []string\n}\n\nfunc (p HoneycombProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"honeycomb\": map[string]interface{}{\n\t\t\t\t\"api_url\": p.apiURL,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (p *HoneycombProvider) GetName() string {\n\treturn \"honeycombio\"\n}\n\n// This mapping will stop working if queries/query annotations are generated as\n// sub-resources of boards or triggers\nfunc (p HoneycombProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"board\": {\n\t\t\t\"dataset\":          {\"query.dataset\", \"name\"},\n\t\t\t\"query\":            {\"query.query_id\", \"id\"},\n\t\t\t\"query_annotation\": {\"query.query_annotation_id\", \"id\"},\n\t\t},\n\t\t\"column\": {\n\t\t\t\"dataset\": {\"dataset\", \"name\"},\n\t\t},\n\t\t\"derived_column\": {\n\t\t\t\"dataset\": {\"dataset\", \"name\"},\n\t\t},\n\t\t\"query\": {\n\t\t\t\"dataset\": {\"dataset\", \"name\"},\n\t\t},\n\t\t\"query_annotation\": {\n\t\t\t\"query\":   {\"query_id\", \"id\"},\n\t\t\t\"dataset\": {\"dataset\", \"name\"},\n\t\t},\n\t\t\"slo\": {\n\t\t\t\"dataset\": {\"dataset\", \"name\"},\n\t\t},\n\t\t\"burn_alert\": {\n\t\t\t\"slo\":     {\"slo_id\", \"id\"},\n\t\t\t\"dataset\": {\"dataset\", \"name\"},\n\t\t},\n\t\t\"trigger\": {\n\t\t\t\"query\":   {\"query_id\", \"id\"},\n\t\t\t\"dataset\": {\"dataset\", \"name\"},\n\t\t},\n\t}\n}\nfunc (p *HoneycombProvider) Init(args []string) error {\n\tp.apiKey = os.Getenv(\"HONEYCOMB_API_KEY\")\n\tif p.apiKey == \"\" {\n\t\treturn errors.New(\"the Honeycomb API key must be set via `HONEYCOMB_API_KEY` env var\")\n\t}\n\tp.apiURL = os.Getenv(\"HONEYCOMB_API_URL\")\n\tif p.apiURL == \"\" {\n\t\tp.apiURL = honeycombDefaultURL\n\t}\n\t// datasets are the only argument\n\tp.datasets = args\n\n\treturn nil\n}\n\nfunc (p *HoneycombProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"api_key\": cty.StringVal(p.apiKey),\n\t\t\"api_url\": cty.StringVal(p.apiURL),\n\t})\n}\n\nfunc (p *HoneycombProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"honeycombio: \" + serviceName + \" is not a supported resource type\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"api_key\":  p.apiKey,\n\t\t\"api_url\":  p.apiURL,\n\t\t\"datasets\": p.datasets,\n\t})\n\treturn nil\n}\n\nfunc (p *HoneycombProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"board\":            &BoardGenerator{},\n\t\t\"derived_column\":   &DerivedColumnGenerator{},\n\t\t\"trigger\":          &TriggerGenerator{},\n\t\t\"dataset\":          &DatasetGenerator{},\n\t\t\"column\":           &ColumnGenerator{},\n\t\t\"query\":            &QueryGenerator{},\n\t\t\"query_annotation\": &QueryAnnotationGenerator{},\n\t\t\"slo\":              &SLOGenerator{},\n\t\t\"burn_alert\":       &BurnAlertGenerator{},\n\t}\n}\n"
  },
  {
    "path": "providers/honeycombio/honeycomb_service.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage honeycombio\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\thnyclient \"github.com/honeycombio/terraform-provider-honeycombio/client\"\n)\n\ntype HoneycombService struct { //nolint\n\tterraformutils.Service\n\tdatasets map[string]hnyclient.Dataset\n}\n\nfunc (s *HoneycombService) newClient() (*hnyclient.Client, error) {\n\tenableDebug, _ := strconv.ParseBool(os.Getenv(\"HONEYCOMBIO_DEBUG\"))\n\n\tclient, err := hnyclient.NewClient(&hnyclient.Config{\n\t\tAPIKey:    s.GetArgs()[\"api_key\"].(string),\n\t\tAPIUrl:    s.GetArgs()[\"api_url\"].(string),\n\t\tUserAgent: fmt.Sprintf(\"terraformer-honeycombio/%s\", honeycombTerraformerProviderVersion),\n\t\tDebug:     enableDebug,\n\t})\n\tif err != nil {\n\t\treturn client, fmt.Errorf(\"unable to initialize Honeycomb client: %v\", err)\n\t}\n\n\tctx := context.TODO()\n\tds := s.GetArgs()[\"datasets\"].([]string)\n\ts.datasets = make(map[string]hnyclient.Dataset)\n\tif len(ds) == 0 {\n\t\t// assume all datasets\n\t\tdatasets, err := client.Datasets.List(ctx)\n\t\tif err != nil {\n\t\t\treturn client, fmt.Errorf(\"unable to list Honeycomb datasets: %v\", err)\n\t\t}\n\t\tfor _, d := range datasets {\n\t\t\ts.datasets[d.Name] = d\n\t\t}\n\t\tif !s.isClassicEnvironment() {\n\t\t\ts.datasets[environmentWideDatasetSlug] = s.environmentWideDataset()\n\t\t}\n\t} else {\n\t\t// verify the provided datasets exist\n\t\tfor _, d := range ds {\n\t\t\tif d == environmentWideDatasetSlug {\n\t\t\t\tif s.isClassicEnvironment() {\n\t\t\t\t\treturn client, fmt.Errorf(\"%q provided as a dataset but the API key is for a Classic environment\", environmentWideDatasetSlug)\n\t\t\t\t}\n\t\t\t\ts.datasets[environmentWideDatasetSlug] = s.environmentWideDataset()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tds, err := client.Datasets.Get(ctx, d)\n\t\t\tif err != nil {\n\t\t\t\treturn client, fmt.Errorf(\"unable to get Honeycomb dataset %q: %v\", d, err)\n\t\t\t}\n\t\t\ts.datasets[ds.Name] = *ds\n\t\t}\n\t}\n\n\treturn client, nil\n}\n\nfunc (s *HoneycombService) isClassicEnvironment() bool {\n\treturn len(s.GetArgs()[\"api_key\"].(string)) == 32\n}\n\nconst environmentWideDatasetSlug = \"__all__\"\n\nfunc (s *HoneycombService) environmentWideDataset() hnyclient.Dataset {\n\treturn hnyclient.Dataset{Name: environmentWideDatasetSlug, Slug: environmentWideDatasetSlug}\n}\n"
  },
  {
    "path": "providers/honeycombio/query.go",
    "content": "package honeycombio\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype QueryGenerator struct {\n\tHoneycombService\n}\n\nfunc (g *QueryGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to initialize Honeycomb client: %v\", err)\n\t}\n\n\tfor _, dataset := range g.datasets {\n\t\tif dataset.Slug == environmentWideDatasetSlug {\n\t\t\t// environment-wide Triggers are not supported\n\t\t\tcontinue\n\t\t}\n\t\ttriggers, err := client.Triggers.List(context.TODO(), dataset.Slug)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to list Honeycomb triggers for dataset %s: %v\", dataset.Slug, err)\n\t\t}\n\n\t\tfor _, trigger := range triggers {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\ttrigger.QueryID,\n\t\t\t\ttrigger.QueryID,\n\t\t\t\t\"honeycombio_query\",\n\t\t\t\t\"honeycombio\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"dataset\": dataset.Name,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\n\tboards, err := client.Boards.List(context.TODO())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list Honeycomb boards: %v\", err)\n\t}\n\n\tfor _, board := range boards {\n\t\tfor _, query := range board.Queries {\n\t\t\tif query.Dataset == \"\" {\n\t\t\t\t// assume an unset dataset is an environment-wide query\n\t\t\t\tquery.Dataset = environmentWideDatasetSlug\n\t\t\t}\n\t\t\tif _, exists := g.datasets[query.Dataset]; exists {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\tquery.QueryID,\n\t\t\t\t\tquery.QueryID,\n\t\t\t\t\t\"honeycombio_query\",\n\t\t\t\t\t\"honeycombio\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"dataset\": query.Dataset,\n\t\t\t\t\t},\n\t\t\t\t\t[]string{\"caption\", \"query_annotation_id\"},\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// PostGenerateHook to format any generated query resource's QuerySpec JSON as a heredoc\n// func (g *QueryGenerator) PostConvertHook() error {\n// \tfor i, resource := range g.Resources {\n// \t\tif resource.InstanceInfo.Type != \"honeycombio_query\" {\n// \t\t\tcontinue\n// \t\t}\n// \t\tif _, exist := resource.Item[\"query_json\"]; exist {\n// \t\t\tqueryJSON := resource.Item[\"query_json\"].(string)\n// \t\t\tunquotedStr, _ := strconv.Unquote(queryJSON)\n// \t\t\tfmt.Println(queryJSON)\n// \t\t\tg.Resources[i].Item[\"query_json\"] = `<<EOH\n// ` + unquotedStr + `\n// EOH`\n// \t\t}\n// \t}\n// \treturn nil\n// }\n"
  },
  {
    "path": "providers/honeycombio/query_annotation.go",
    "content": "package honeycombio\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype QueryAnnotationGenerator struct {\n\tHoneycombService\n}\n\nfunc (g *QueryAnnotationGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to initialize Honeycomb client: %v\", err)\n\t}\n\n\tboards, err := client.Boards.List(context.TODO())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, board := range boards {\n\t\tfor _, query := range board.Queries {\n\t\t\tif query.QueryAnnotationID == \"\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif query.Dataset == \"\" {\n\t\t\t\t// assume unset dataset is an environment-wide query\n\t\t\t\tquery.Dataset = g.environmentWideDataset().Name\n\t\t\t}\n\t\t\tif _, exists := g.datasets[query.Dataset]; exists {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\tquery.QueryAnnotationID,\n\t\t\t\t\tquery.QueryAnnotationID,\n\t\t\t\t\t\"honeycombio_query_annotation\",\n\t\t\t\t\t\"honeycombio\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"query_id\": query.QueryID,\n\t\t\t\t\t\t\"dataset\":  query.Dataset,\n\t\t\t\t\t},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/honeycombio/slo.go",
    "content": "package honeycombio\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype SLOGenerator struct {\n\tHoneycombService\n}\n\nfunc (g *SLOGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to initialize Honeycomb client: %v\", err)\n\t}\n\n\tctx := context.TODO()\n\n\tfor _, dataset := range g.datasets {\n\t\tif dataset.Slug == environmentWideDatasetSlug {\n\t\t\t// environment-wide SLOs are not supported\n\t\t\tcontinue\n\t\t}\n\t\tslos, err := client.SLOs.List(ctx, dataset.Slug)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to list Honeycomb SLOs for dataset %s: %v\", dataset.Slug, err)\n\t\t}\n\n\t\tfor _, slo := range slos {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tslo.ID,\n\t\t\t\tslo.ID,\n\t\t\t\t\"honeycombio_slo\",\n\t\t\t\t\"honeycombio\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"dataset\": dataset.Name,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/honeycombio/trigger.go",
    "content": "package honeycombio\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype TriggerGenerator struct {\n\tHoneycombService\n}\n\nfunc (g *TriggerGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to initialize Honeycomb client: %v\", err)\n\t}\n\n\tfor _, dataset := range g.datasets {\n\t\tif dataset.Slug == environmentWideDatasetSlug {\n\t\t\t// environment-wide Triggers are not supported\n\t\t\tcontinue\n\t\t}\n\t\ttriggers, err := client.Triggers.List(context.TODO(), dataset.Slug)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to list Honeycomb triggers for dataset %s: %v\", dataset.Slug, err)\n\t\t}\n\n\t\tfor _, trigger := range triggers {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\ttrigger.ID,\n\t\t\t\ttrigger.ID,\n\t\t\t\t\"honeycombio_trigger\",\n\t\t\t\t\"honeycombio\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"dataset\": dataset.Name,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/cis.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n\t\"github.com/IBM/go-sdk-core/v3/core\"\n\t\"github.com/IBM/networking-go-sdk/custompagesv1\"\n\t\"github.com/IBM/networking-go-sdk/dnsrecordsv1\"\n\t\"github.com/IBM/networking-go-sdk/edgefunctionsapiv1\"\n\t\"github.com/IBM/networking-go-sdk/filtersv1\"\n\t\"github.com/IBM/networking-go-sdk/globalloadbalancermonitorv1\"\n\t\"github.com/IBM/networking-go-sdk/globalloadbalancerpoolsv0\"\n\t\"github.com/IBM/networking-go-sdk/globalloadbalancerv1\"\n\t\"github.com/IBM/networking-go-sdk/pageruleapiv1\"\n\t\"github.com/IBM/networking-go-sdk/rangeapplicationsv1\"\n\t\"github.com/IBM/networking-go-sdk/routingv1\"\n\t\"github.com/IBM/networking-go-sdk/sslcertificateapiv1\"\n\t\"github.com/IBM/networking-go-sdk/useragentblockingrulesv1\"\n\t\"github.com/IBM/networking-go-sdk/wafrulegroupsapiv1\"\n\t\"github.com/IBM/networking-go-sdk/wafrulepackagesapiv1\"\n\t\"github.com/IBM/networking-go-sdk/zonefirewallaccessrulesv1\"\n\t\"github.com/IBM/networking-go-sdk/zonelockdownv1\"\n\t\"github.com/IBM/networking-go-sdk/zoneratelimitsv1\"\n\t\"github.com/IBM/networking-go-sdk/zonesv1\"\n)\n\n// CISGenerator ..\ntype CISGenerator struct {\n\tIBMService\n}\n\nfunc (g CISGenerator) loadInstances(crn, name, resGrpID string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tcrn,\n\t\tnormalizeResourceName(name, false),\n\t\t\"ibm_cis\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"resource_group_id\": resGrpID,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadDomains(crn, domainID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s\", domainID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_domain\", true),\n\t\t\"ibm_cis_domain\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadDNSRecords(crn, domainID, dnsRecordID string, dependsOn []string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s\", dnsRecordID, domainID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_dns_record\", true),\n\t\t\"ibm_cis_dns_record\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resources\n}\n\nfunc (g CISGenerator) loadFirewall(crn, domainID, fID, fType string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s:%s\", fType, fID, domainID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_firewall\", true),\n\t\t\"ibm_cis_firewall\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadDomainSettings(crn, dID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s\", dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_domain_settings\", true),\n\t\t\"ibm_cis_domain_settings\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadGlobalBalancer(crn, dID, gID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s\", gID, dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_global_load_balancer\", true),\n\t\t\"ibm_cis_global_load_balancer\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\n\t// Conflicts with proxied attribute\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^ttl$\",\n\t)\n\treturn resource\n}\n\nfunc (g CISGenerator) loadGlobalBalancerPool(crn, pID, pName string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s\", pID, crn),\n\t\tnormalizeResourceName(pName, true),\n\t\t\"ibm_cis_origin_pool\",\n\t\tg.ProviderName,\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadGlobalBalancerMonitor(crn, gblmID, port string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s\", gblmID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_healthcheck\", true),\n\t\t\"ibm_cis_healthcheck\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"port\": port,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadRateLimit(crn, dID, rID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s\", rID, dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_rate_limit\", true),\n\t\t\"ibm_cis_rate_limit\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadEdgeFunctionAction(crn, dID, actionID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s\", actionID, dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_edge_functions_action\", true),\n\t\t\"ibm_cis_edge_functions_action\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadEdgeFunctionTrigger(crn, dID, triggerID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s\", triggerID, dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_edge_functions_trigger\", true),\n\t\t\"ibm_cis_edge_functions_trigger\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadWafRulePackage(crn, dID, pkgID, actionMode, sensitivity string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s\", pkgID, dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_waf_package\", true),\n\t\t\"ibm_cis_waf_package\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"action_mode\": actionMode,\n\t\t\t\"sensitivity\": sensitivity,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadWafGroups(crn, dID, pkgID, grpID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s:%s\", grpID, pkgID, dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_waf_group\", true),\n\t\t\"ibm_cis_waf_group\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadPageRule(crn, dID, ruleID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s\", ruleID, dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_page_rule\", true),\n\t\t\"ibm_cis_page_rule\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadCustomPage(crn, dID, cpID, url string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s\", cpID, dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_custom_page\", true),\n\t\t\"ibm_cis_custom_page\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"url\": url,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadRangeApp(crn, dID, appID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s\", appID, dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_range_app\", true),\n\t\t\"ibm_cis_range_app\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadSSLCertificates(crn, dID, cID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s\", cID, dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_certificate_order\", true),\n\t\t\"ibm_cis_certificate_order\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadCISRouting(crn, dID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s\", dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_routing\", true),\n\t\t\"ibm_cis_routing\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadCacheSettings(crn, dID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s\", dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_cache_settings\", true),\n\t\t\"ibm_cis_cache_settings\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadTLSSettings(crn, dID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s\", dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_tls_settings\", true),\n\t\t\"ibm_cis_tls_settings\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g CISGenerator) loadFilters(crn, dID, fID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s:%s\", fID, dID, crn),\n\t\tnormalizeResourceName(\"ibm_cis_filter\", true),\n\t\t\"ibm_cis_filter\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\n// InitResources ..\nfunc (g *CISGenerator) InitResources() error {\n\tDefaultCisURL := \"https://api.cis.cloud.ibm.com\"\n\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t}\n\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = authenticateAPIKey(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbluemixToken := \"\"\n\tif strings.HasPrefix(sess.Config.IAMAccessToken, \"Bearer\") {\n\t\tbluemixToken = sess.Config.IAMAccessToken[7:len(sess.Config.IAMAccessToken)]\n\t} else {\n\t\tbluemixToken = sess.Config.IAMAccessToken\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"internet-svcs\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tcisInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, c := range cisInstances {\n\t\t// Instance\n\t\tcrn := c.Crn.String()\n\t\tg.Resources = append(g.Resources, g.loadInstances(crn, c.Name, c.ResourceGroupID))\n\t\tresourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\n\t\tvar cisDependsOn []string\n\t\tcisDependsOn = append(cisDependsOn,\n\t\t\t\"ibm_cis.\"+resourceName)\n\n\t\t// Domain\n\t\tzoneOpts := &zonesv1.ZonesV1Options{\n\t\t\tURL: DefaultCisURL,\n\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\tBearerToken: bluemixToken,\n\t\t\t},\n\t\t\tCrn: &crn,\n\t\t}\n\n\t\tzService, err := zonesv1.NewZonesV1(zoneOpts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdomainOpts := zService.NewListZonesOptions()\n\t\tdomainOpts.SetPage(1)       // list all zones in one page\n\t\tdomainOpts.SetPerPage(1000) // maximum allowed limit is 1000 per page\n\n\t\tzoneList, _, err := zService.ListZones(domainOpts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Origin pool\n\t\tgblOpts := &globalloadbalancerpoolsv0.GlobalLoadBalancerPoolsV0Options{\n\t\t\tURL:           DefaultCisURL,\n\t\t\tAuthenticator: &core.BearerTokenAuthenticator{BearerToken: bluemixToken},\n\t\t\tCrn:           &crn,\n\t\t}\n\n\t\tgblService, err := globalloadbalancerpoolsv0.NewGlobalLoadBalancerPoolsV0(gblOpts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tgblPoolList, _, err := gblService.ListAllLoadBalancerPools(&globalloadbalancerpoolsv0.ListAllLoadBalancerPoolsOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, gbl := range gblPoolList.Result {\n\t\t\tif gbl.ID != nil {\n\t\t\t\tg.Resources = append(g.Resources, g.loadGlobalBalancerPool(crn, *gbl.ID, *gbl.Name, cisDependsOn))\n\t\t\t}\n\t\t}\n\n\t\t// Health Monitor\n\t\tgblmOpts := &globalloadbalancermonitorv1.GlobalLoadBalancerMonitorV1Options{\n\t\t\tURL:           DefaultCisURL,\n\t\t\tAuthenticator: &core.BearerTokenAuthenticator{BearerToken: bluemixToken},\n\t\t\tCrn:           &crn,\n\t\t}\n\n\t\tgblmService, err := globalloadbalancermonitorv1.NewGlobalLoadBalancerMonitorV1(gblmOpts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tgblmList, _, err := gblmService.ListAllLoadBalancerMonitors(&globalloadbalancermonitorv1.ListAllLoadBalancerMonitorsOptions{})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, gblm := range gblmList.Result {\n\t\t\tif gblm.Port != nil {\n\t\t\t\tport := strconv.FormatInt(*gblm.Port, 10)\n\t\t\t\tg.Resources = append(g.Resources, g.loadGlobalBalancerMonitor(crn, *gblm.ID, port, cisDependsOn))\n\t\t\t}\n\t\t}\n\n\t\tfor _, z := range zoneList.Result {\n\t\t\tvar domainDependsOn []string\n\t\t\tdomainDependsOn = append(domainDependsOn,\n\t\t\t\t\"ibm_cis.\"+resourceName)\n\n\t\t\tg.Resources = append(g.Resources, g.loadDomains(crn, *z.ID, domainDependsOn))\n\t\t\tzoneResourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\t\t\tdomainDependsOn = append(domainDependsOn,\n\t\t\t\t\"ibm_cis_domain.\"+zoneResourceName)\n\n\t\t\t// DNS Record\n\t\t\tzoneID := *z.ID\n\t\t\tdnsOpts := &dnsrecordsv1.DnsRecordsV1Options{\n\t\t\t\tURL: DefaultCisURL,\n\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t},\n\t\t\t\tCrn:            &crn,\n\t\t\t\tZoneIdentifier: &zoneID,\n\t\t\t}\n\n\t\t\t// Domain Setting\n\t\t\tg.Resources = append(g.Resources, g.loadDomainSettings(crn, *z.ID, domainDependsOn))\n\n\t\t\t// DNS Records\n\t\t\tdnsService, err := dnsrecordsv1.NewDnsRecordsV1(dnsOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tdOpts := &dnsrecordsv1.ListAllDnsRecordsOptions{}\n\t\t\tdnsList, _, err := dnsService.ListAllDnsRecords(dOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// IBM Network CIS WAF Package\n\t\t\tcisWAFPackagesOpt := &wafrulepackagesapiv1.WafRulePackagesApiV1Options{\n\t\t\t\tURL: DefaultCisURL,\n\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t},\n\t\t\t\tCrn:    &crn,\n\t\t\t\tZoneID: &zoneID,\n\t\t\t}\n\t\t\tcisWAFPackageClient, _ := wafrulepackagesapiv1.NewWafRulePackagesApiV1(cisWAFPackagesOpt)\n\t\t\twasPkgList, _, err := cisWAFPackageClient.ListWafPackages(&wafrulepackagesapiv1.ListWafPackagesOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, wafPkg := range wasPkgList.Result {\n\t\t\t\tcisWAFPackageOpt := &wafrulepackagesapiv1.GetWafPackageOptions{\n\t\t\t\t\tPackageID: wafPkg.ID,\n\t\t\t\t}\n\t\t\t\twafPkg, _, err := cisWAFPackageClient.GetWafPackage(cisWAFPackageOpt)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tif wafPkg.Result != nil && wafPkg.Result.ActionMode != nil {\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadWafRulePackage(crn, *z.ID, *wafPkg.Result.ID, *wafPkg.Result.ActionMode, *wafPkg.Result.Sensitivity, domainDependsOn))\n\n\t\t\t\t\t// CIS waf-groups\n\t\t\t\t\tcisWAFGroupOpt := &wafrulegroupsapiv1.WafRuleGroupsApiV1Options{\n\t\t\t\t\t\tURL: DefaultCisURL,\n\t\t\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tCrn:    &crn,\n\t\t\t\t\t\tZoneID: &zoneID,\n\t\t\t\t\t}\n\t\t\t\t\tcisWAFGroupClient, _ := wafrulegroupsapiv1.NewWafRuleGroupsApiV1(cisWAFGroupOpt)\n\t\t\t\t\twasGrpList, _, err := cisWAFGroupClient.ListWafRuleGroups(&wafrulegroupsapiv1.ListWafRuleGroupsOptions{\n\t\t\t\t\t\tPkgID: wafPkg.Result.ID,\n\t\t\t\t\t})\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tfor _, wafGrp := range wasGrpList.Result {\n\t\t\t\t\t\tg.Resources = append(g.Resources, g.loadWafGroups(crn, *z.ID, *wafPkg.Result.ID, *wafGrp.ID, domainDependsOn))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Rate Limit\n\t\t\trateLimitPoolOpts := &zoneratelimitsv1.ZoneRateLimitsV1Options{\n\t\t\t\tURL:            DefaultCisURL,\n\t\t\t\tAuthenticator:  &core.BearerTokenAuthenticator{BearerToken: bluemixToken},\n\t\t\t\tCrn:            &crn,\n\t\t\t\tZoneIdentifier: &zoneID,\n\t\t\t}\n\n\t\t\trateLimitService, _ := zoneratelimitsv1.NewZoneRateLimitsV1(rateLimitPoolOpts)\n\t\t\trateLimitList, _, err := rateLimitService.ListAllZoneRateLimits(&zoneratelimitsv1.ListAllZoneRateLimitsOptions{})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error in getting rate limit.\")\n\t\t\t}\n\n\t\t\tif rateLimitList != nil {\n\t\t\t\tfor _, rl := range rateLimitList.Result {\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadRateLimit(crn, *z.ID, *rl.ID, domainDependsOn))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Firewall -  Lockdown\n\t\t\tfirewallOpts := &zonelockdownv1.ZoneLockdownV1Options{\n\t\t\t\tURL: DefaultCisURL,\n\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t},\n\t\t\t\tCrn:            &crn,\n\t\t\t\tZoneIdentifier: &zoneID,\n\t\t\t}\n\n\t\t\tfService, err := zonelockdownv1.NewZoneLockdownV1(firewallOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfirewallList, _, err := fService.ListAllZoneLockownRules(&zonelockdownv1.ListAllZoneLockownRulesOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, f := range firewallList.Result {\n\t\t\t\tg.Resources = append(g.Resources, g.loadFirewall(crn, *z.ID, *f.ID, \"lockdowns\", domainDependsOn))\n\t\t\t}\n\n\t\t\t// Firewall -  AccessRules\n\t\t\tfirewallAccessOpts := &zonefirewallaccessrulesv1.ZoneFirewallAccessRulesV1Options{\n\t\t\t\tURL: DefaultCisURL,\n\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t},\n\t\t\t\tCrn:            &crn,\n\t\t\t\tZoneIdentifier: &zoneID,\n\t\t\t}\n\n\t\t\tfAccessService, err := zonefirewallaccessrulesv1.NewZoneFirewallAccessRulesV1(firewallAccessOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfirewalAccesslList, _, err := fAccessService.ListAllZoneAccessRules(&zonefirewallaccessrulesv1.ListAllZoneAccessRulesOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif firewalAccesslList != nil {\n\t\t\t\tfor _, f := range firewalAccesslList.Result {\n\t\t\t\t\tif f.Configuration.Target != nil {\n\t\t\t\t\t\tg.Resources = append(g.Resources, g.loadFirewall(crn, *z.ID, *f.ID, \"access_rules\", domainDependsOn))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Useragent blocking rules\n\t\t\tfirewallUAOpts := &useragentblockingrulesv1.UserAgentBlockingRulesV1Options{\n\t\t\t\tURL: DefaultCisURL,\n\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t},\n\t\t\t\tCrn:            &crn,\n\t\t\t\tZoneIdentifier: &zoneID,\n\t\t\t}\n\n\t\t\tfUAService, err := useragentblockingrulesv1.NewUserAgentBlockingRulesV1(firewallUAOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfirewalUAlList, _, err := fUAService.ListAllZoneUserAgentRules(&useragentblockingrulesv1.ListAllZoneUserAgentRulesOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, f := range firewalUAlList.Result {\n\t\t\t\tif f.Configuration.Target != nil {\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadFirewall(crn, *z.ID, *f.ID, \"ua_rules\", domainDependsOn))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// IBM Network CIS Edge Function Action & Triggers\n\t\t\tcisEdgeFunctionOpt := &edgefunctionsapiv1.EdgeFunctionsApiV1Options{\n\t\t\t\tURL: DefaultCisURL,\n\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t},\n\t\t\t\tCrn:            &crn,\n\t\t\t\tZoneIdentifier: &zoneID,\n\t\t\t}\n\n\t\t\tcisEdgeFunctionClient, _ := edgefunctionsapiv1.NewEdgeFunctionsApiV1(cisEdgeFunctionOpt)\n\t\t\tedgeActionResonse, _, err := cisEdgeFunctionClient.ListEdgeFunctionsActions(&edgefunctionsapiv1.ListEdgeFunctionsActionsOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, el := range edgeActionResonse.Result {\n\t\t\t\tif el.Routes != nil {\n\t\t\t\t\tfor _, elT := range el.Routes {\n\t\t\t\t\t\tg.Resources = append(g.Resources, g.loadEdgeFunctionAction(crn, *z.ID, *elT.Script, domainDependsOn))\n\t\t\t\t\t\telResourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\t\t\t\t\t\tedgeFunctionActionDependsOn := makeDependsOn(domainDependsOn,\n\t\t\t\t\t\t\t\"ibm_cis_edge_functions_action.\"+elResourceName)\n\n\t\t\t\t\t\tg.Resources = append(g.Resources, g.loadEdgeFunctionTrigger(crn, *z.ID, *elT.ID, edgeFunctionActionDependsOn))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Range app\n\t\t\trangeAppOpt := &rangeapplicationsv1.RangeApplicationsV1Options{\n\t\t\t\tURL: DefaultCisURL,\n\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t},\n\t\t\t\tCrn:            &crn,\n\t\t\t\tZoneIdentifier: &zoneID,\n\t\t\t}\n\n\t\t\trangeAppClient, _ := rangeapplicationsv1.NewRangeApplicationsV1(rangeAppOpt)\n\t\t\tranegAppList, _, err := rangeAppClient.ListRangeApps(&rangeapplicationsv1.ListRangeAppsOptions{})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error in getting range app list.\")\n\t\t\t}\n\n\t\t\tif ranegAppList != nil {\n\t\t\t\tfor _, r := range ranegAppList.Result {\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadRangeApp(crn, *z.ID, *r.ID, domainDependsOn))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Page Rules\n\t\t\tpageRueleOpt := &pageruleapiv1.PageRuleApiV1Options{\n\t\t\t\tURL: DefaultCisURL,\n\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t},\n\t\t\t\tCrn:    &crn,\n\t\t\t\tZoneID: &zoneID,\n\t\t\t}\n\n\t\t\tpageRuleClient, _ := pageruleapiv1.NewPageRuleApiV1(pageRueleOpt)\n\t\t\tpageRuleList, _, err := pageRuleClient.ListPageRules(&pageruleapiv1.ListPageRulesOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, p := range pageRuleList.Result {\n\t\t\t\tg.Resources = append(g.Resources, g.loadPageRule(crn, *z.ID, *p.ID, domainDependsOn))\n\t\t\t}\n\n\t\t\t// Custom Page\n\t\t\tcustomPageOpt := &custompagesv1.CustomPagesV1Options{\n\t\t\t\tURL: DefaultCisURL,\n\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t},\n\t\t\t\tCrn:            &crn,\n\t\t\t\tZoneIdentifier: &zoneID,\n\t\t\t}\n\n\t\t\tcustomPageClient, _ := custompagesv1.NewCustomPagesV1(customPageOpt)\n\t\t\tcustomPageList, _, err := customPageClient.ListInstanceCustomPages(&custompagesv1.ListInstanceCustomPagesOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, cp := range customPageList.Result {\n\t\t\t\tif cp.URL != nil {\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadCustomPage(crn, *z.ID, *cp.ID, *cp.URL, domainDependsOn))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// SSL Certificate - order\n\t\t\tsslOpt := &sslcertificateapiv1.SslCertificateApiV1Options{\n\t\t\t\tURL: DefaultCisURL,\n\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t},\n\t\t\t\tCrn:            &crn,\n\t\t\t\tZoneIdentifier: &zoneID,\n\t\t\t}\n\t\t\tsslClient, err := sslcertificateapiv1.NewSslCertificateApiV1(sslOpt)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tsslList, _, err := sslClient.ListCertificates(&sslcertificateapiv1.ListCertificatesOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor _, cert := range sslList.Result {\n\t\t\t\tg.Resources = append(g.Resources, g.loadSSLCertificates(crn, *z.ID, *cert.ID, domainDependsOn))\n\t\t\t}\n\n\t\t\t// routingv1\n\t\t\troutingOpt := &routingv1.RoutingV1Options{\n\t\t\t\tURL: DefaultCisURL,\n\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t},\n\t\t\t\tCrn:            &crn,\n\t\t\t\tZoneIdentifier: &zoneID,\n\t\t\t}\n\n\t\t\troutingClient, err := routingv1.NewRoutingV1(routingOpt)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\troutingList, _, err := routingClient.GetSmartRouting(&routingv1.GetSmartRoutingOptions{})\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error in getting routing list.\")\n\t\t\t}\n\n\t\t\tif routingList != nil {\n\t\t\t\tg.Resources = append(g.Resources, g.loadCISRouting(crn, *z.ID, domainDependsOn))\n\t\t\t}\n\n\t\t\t// Filters\n\t\t\tfilterOpts := &filtersv1.FiltersV1Options{\n\t\t\t\tURL: DefaultCisURL,\n\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tfilterClient, err := filtersv1.NewFiltersV1(filterOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfilterList, _, err := filterClient.ListAllFilters(&filtersv1.ListAllFiltersOptions{\n\t\t\t\tCrn:            &crn,\n\t\t\t\tZoneIdentifier: &zoneID,\n\t\t\t\tXAuthUserToken: &bluemixToken,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif filterList != nil {\n\t\t\t\tfor _, f := range filterList.Result {\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadFilters(crn, *z.ID, *f.ID, domainDependsOn))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Cache Settings\n\t\t\tg.Resources = append(g.Resources, g.loadCacheSettings(crn, *z.ID, domainDependsOn))\n\n\t\t\t// TLS Settings\n\t\t\tg.Resources = append(g.Resources, g.loadTLSSettings(crn, *z.ID, domainDependsOn))\n\n\t\t\tfor _, d := range dnsList.Result {\n\t\t\t\tg.Resources = append(g.Resources, g.loadDNSRecords(crn, *z.ID, *d.ID, domainDependsOn))\n\t\t\t\tdnsResourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\t\t\t\tdnsDependsOn := makeDependsOn(domainDependsOn,\n\t\t\t\t\t\"ibm_cis_dns_record.\"+dnsResourceName)\n\n\t\t\t\t// Global Load Balancer\n\t\t\t\tgblSetttingOpts := &globalloadbalancerv1.GlobalLoadBalancerV1Options{\n\t\t\t\t\tURL: DefaultCisURL,\n\t\t\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\t\t\tBearerToken: bluemixToken,\n\t\t\t\t\t},\n\t\t\t\t\tCrn:            &crn,\n\t\t\t\t\tZoneIdentifier: &zoneID,\n\t\t\t\t}\n\n\t\t\t\tgblService, err := globalloadbalancerv1.NewGlobalLoadBalancerV1(gblSetttingOpts)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tgblList, _, err := gblService.ListAllLoadBalancers(&globalloadbalancerv1.ListAllLoadBalancersOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tfor _, gb := range gblList.Result {\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadGlobalBalancer(crn, *z.ID, *gb.ID, dnsDependsOn))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc makeDependsOn(dependsOn []string, resource string) []string {\n\treturn append(dependsOn, resource)\n}\n"
  },
  {
    "path": "providers/ibm/cloud_functions.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\n\tns \"github.com/IBM-Cloud/bluemix-go/api/functions\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n\n\t\"github.com/apache/openwhisk-client-go/whisk\"\n)\n\n// CloudFunctionGenerator ..\ntype CloudFunctionGenerator struct {\n\tIBMService\n}\n\nfunc (g CloudFunctionGenerator) loadPackages(namespace, pkgName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s\", namespace, pkgName),\n\t\tnormalizeResourceName(fmt.Sprintf(\"%s_%s\", namespace, pkgName), false),\n\t\t\"ibm_function_package\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resource\n}\n\nfunc (g CloudFunctionGenerator) loadRules(namespace, ruleName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s\", namespace, ruleName),\n\t\tnormalizeResourceName(ruleName, true),\n\t\t\"ibm_function_rule\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resource\n}\n\nfunc (g CloudFunctionGenerator) loadTriggers(namespace, triggerName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s\", namespace, triggerName),\n\t\tnormalizeResourceName(triggerName, true),\n\t\t\"ibm_function_trigger\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resource\n}\n\n/*\n *\n * Configure a HTTP client using the OpenWhisk properties (i.e. host, auth, iamtoken)\n * Only cf-based namespaces needs auth key value.\n * iam-based namespace don't have an auth key and needs only iam token for authorization.\n *\n */\nfunc setupOpenWhiskClientConfigIAM(response ns.NamespaceResponse, c *bluemix.Config, region string) (*whisk.Client, error) {\n\tu, _ := url.Parse(fmt.Sprintf(\"https://%s.functions.cloud.ibm.com/api\", region))\n\twskClient, _ := whisk.NewClient(http.DefaultClient, &whisk.Config{\n\t\tHost:    u.Host,\n\t\tVersion: \"v1\",\n\t})\n\n\tif os.Getenv(\"TF_LOG\") != \"\" {\n\t\twhisk.SetDebug(true)\n\t}\n\n\t// Configure whisk properties to handle iam-based/iam-migrated  namespaces.\n\tif response.IsIamEnabled() {\n\t\tadditionalHeaders := make(http.Header)\n\t\tadditionalHeaders.Add(\"Authorization\", c.IAMAccessToken)\n\t\tadditionalHeaders.Add(\"X-Namespace-Id\", response.GetID())\n\n\t\twskClient.Config.Namespace = response.GetID()\n\t\twskClient.Config.AdditionalHeaders = additionalHeaders\n\t\treturn wskClient, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"Failed to create whisk config object for IAM based namespace '%v'\", response.GetName())\n}\n\n// InitResources ..\nfunc (g *CloudFunctionGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t}\n\n\tbmxConfig.Region = region\n\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = authenticateAPIKey(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = authenticateCF(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnsClient, err := ns.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnsList, err := nsClient.Namespaces().GetNamespaces()\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tfor _, n := range nsList.Namespaces {\n\t\t// Namespace\n\t\tif !n.IsIamEnabled() {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Build whisk object\n\t\twskClient, err := setupOpenWhiskClientConfigIAM(n, sess.Config, region)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Package\n\t\tpackageService := wskClient.Packages\n\t\tpkgOptions := &whisk.PackageListOptions{\n\t\t\tLimit: 100,\n\t\t\tSkip:  0,\n\t\t}\n\t\tpkgs, _, err := packageService.List(pkgOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error retrieving IBM Cloud Function package: %s\", err)\n\t\t}\n\n\t\tfor _, p := range pkgs {\n\t\t\tg.Resources = append(g.Resources, g.loadPackages(n.GetName(), p.GetName()))\n\t\t}\n\n\t\t// Action\n\t\tactionService := wskClient.Actions\n\t\tactionOptions := &whisk.ActionListOptions{\n\t\t\tLimit: 100,\n\t\t\tSkip:  0,\n\t\t}\n\t\tactions, _, err := actionService.List(\"\", actionOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error retrieving IBM Cloud Function action: %s\", err)\n\t\t}\n\n\t\tfor _, a := range actions {\n\t\t\tactionID := \"\"\n\t\t\tparts := strings.Split(a.Namespace, \"/\")\n\t\t\tif len(parts) == 2 {\n\t\t\t\tvar pkgDependsOn []string\n\t\t\t\tpkgDependsOn = append(pkgDependsOn,\n\t\t\t\t\t\"ibm_function_package.\"+terraformutils.TfSanitize(fmt.Sprintf(\"%s_%s\", n.GetName(), parts[1])))\n\t\t\t\tactionID = fmt.Sprintf(\"%s/%s\", parts[1], a.Name)\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\tfmt.Sprintf(\"%s:%s\", n.GetName(), actionID),\n\t\t\t\t\tnormalizeResourceName(a.Name, true),\n\t\t\t\t\t\"ibm_function_action\",\n\t\t\t\t\t\"ibm\",\n\t\t\t\t\tmap[string]string{},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\"depends_on\": pkgDependsOn,\n\t\t\t\t\t}))\n\t\t\t} else {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\tfmt.Sprintf(\"%s:%s\", n.GetName(), a.Name),\n\t\t\t\t\tnormalizeResourceName(a.Name, true),\n\t\t\t\t\t\"ibm_function_action\",\n\t\t\t\t\t\"ibm\",\n\t\t\t\t\tmap[string]string{},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t}\n\t\t}\n\n\t\t// Rule\n\t\truleService := wskClient.Rules\n\t\truleOptions := &whisk.RuleListOptions{\n\t\t\tLimit: 100,\n\t\t\tSkip:  0,\n\t\t}\n\t\trules, _, err := ruleService.List(ruleOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error retrieving IBM Cloud Function rule: %s\", err)\n\t\t}\n\n\t\tfor _, r := range rules {\n\t\t\tg.Resources = append(g.Resources, g.loadRules(n.GetName(), r.Name))\n\t\t}\n\n\t\t// Triggers\n\t\ttriggerService := wskClient.Triggers\n\t\ttriggerOptions := &whisk.TriggerListOptions{\n\t\t\tLimit: 100,\n\t\t\tSkip:  0,\n\t\t}\n\t\ttriggers, _, err := triggerService.List(triggerOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error retrieving IBM Cloud Function trigger: %s\", err)\n\t\t}\n\n\t\tfor _, t := range triggers {\n\t\t\tg.Resources = append(g.Resources, g.loadTriggers(n.GetName(), t.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *CloudFunctionGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"ibm_function_action\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, ri := range g.Resources {\n\t\t\tif ri.InstanceInfo.Type != \"ibm_function_package\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif len(strings.Split(r.InstanceState.Attributes[\"id\"], \"/\")) == 2 {\n\t\t\t\tif strings.Split(r.InstanceState.Attributes[\"id\"], \"/\")[0] == ri.InstanceState.Attributes[\"id\"] {\n\t\t\t\t\tg.Resources[i].Item[\"name\"] = \"${ibm_function_package.\" + ri.ResourceName + \".name}\" + \"/\" + r.InstanceState.Attributes[\"action_id\"]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/cloud_log_analysis.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// LogAnalysisGenerator ..\ntype LogAnalysisGenerator struct {\n\tIBMService\n}\n\n// loadCloudMonitoring ..\nfunc (g LogAnalysisGenerator) loadCloudMonitoring(logID string, logName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tlogID,\n\t\tnormalizeResourceName(logName, true),\n\t\t\"ibm_resource_instance\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *LogAnalysisGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"logdna\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tlogAnalysisInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, logDNA := range logAnalysisInstances {\n\t\tif logDNA.RegionID == region {\n\t\t\tg.Resources = append(g.Resources, g.loadCloudMonitoring(logDNA.ID, logDNA.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/cloud_log_atracker.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// ActivityTrackerGenerator ..\ntype ActivityTrackerGenerator struct {\n\tIBMService\n}\n\n// loadCloudAtracker ..\nfunc (g ActivityTrackerGenerator) loadCloudAtracker(aTrackerID string, aTrackerName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\taTrackerID,\n\t\tnormalizeResourceName(aTrackerName, true),\n\t\t\"ibm_resource_instance\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *ActivityTrackerGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"logdnaat\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\taTrackerInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, aTracker := range aTrackerInstances {\n\t\tif aTracker.RegionID == region {\n\t\t\tg.Resources = append(g.Resources, g.loadCloudAtracker(aTracker.ID, aTracker.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/cloud_monitoring.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// MonitoringGenerator ...\ntype MonitoringGenerator struct {\n\tIBMService\n}\n\n// loadCloudMonitoring ...\nfunc (g MonitoringGenerator) loadCloudMonitoring(cdID, cdName, service, region string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tcdID,\n\t\tnormalizeResourceName(cdName, true),\n\t\t\"ibm_resource_instance\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"name\":     cdName,\n\t\t\t\"service\":  service,\n\t\t\t\"location\": region,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *MonitoringGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"sysdig-monitor\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tcontinuousDeliveryInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, cd := range continuousDeliveryInstances {\n\t\tif cd.RegionID == region && cd.Name != \"\" {\n\t\t\tg.Resources = append(g.Resources, g.loadCloudMonitoring(cd.ID, cd.Name, cd.ServiceName, cd.RegionID))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/cloud_watson_machine_learning.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// WatsonMachineLearningGenerator ..\ntype WatsonMachineLearningGenerator struct {\n\tIBMService\n}\n\n// loadWatsonMachineLearning ..\nfunc (g WatsonMachineLearningGenerator) loadWatsonMachineLearning(wmlID string, wmlName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\twmlID,\n\t\tnormalizeResourceName(wmlName, false),\n\t\t\"ibm_resource_instance\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *WatsonMachineLearningGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"pm-20\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tmachineLearningInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, wml := range machineLearningInstances {\n\t\tif wml.RegionID == region {\n\t\t\tg.Resources = append(g.Resources, g.loadWatsonMachineLearning(wml.ID, wml.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/cloud_watson_studio.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// LogAnalysisGenerator ..\ntype WatsonStudioGenerator struct {\n\tIBMService\n}\n\n// loadWatsonStudio ..\nfunc (g WatsonStudioGenerator) loadWatsonStudio(wsID string, wsName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\twsID,\n\t\tnormalizeResourceName(wsName, false),\n\t\t\"ibm_resource_instance\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *WatsonStudioGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"data-science-experience\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\twatsonStudioInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, ws := range watsonStudioInstances {\n\t\tif ws.RegionID == region {\n\t\t\tg.Resources = append(g.Resources, g.loadWatsonStudio(ws.ID, ws.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/container_cluster.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/container/containerv1\"\n\tv1 \"github.com/IBM-Cloud/bluemix-go/api/container/containerv1\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/container/containerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\nconst (\n\tdefaultWorkerPool = \"default\"\n\thardwareShared    = \"shared\"\n\thardwareDedicated = \"dedicated\"\n\tisolationPublic   = \"public\"\n\tisolationPrivate  = \"private\"\n)\n\ntype ContainerClusterGenerator struct {\n\tIBMService\n}\n\nfunc (g ContainerClusterGenerator) loadcluster(clustersID, clusterName, datacenter, hardware string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tclustersID,\n\t\tnormalizeResourceName(clusterName, false),\n\t\t\"ibm_container_cluster\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"force_delete_storage\":   \"true\",\n\t\t\t\"update_all_workers\":     \"false\",\n\t\t\t\"wait_for_worker_update\": \"true\",\n\t\t\t\"datacenter\":             datacenter,\n\t\t\t\"hardware\":               hardware,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^worker_num$\", \"^region$\",\n\t)\n\n\treturn resource\n}\n\nfunc (g ContainerClusterGenerator) loadWorkerPools(clustersID, poolID, poolName string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", clustersID, poolID),\n\t\tnormalizeResourceName(poolName, true),\n\t\t\"ibm_container_worker_pool\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\treturn resources\n}\n\nfunc (g ContainerClusterGenerator) loadWorkerPoolZones(clustersID, poolID, zoneID string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s/%s\", clustersID, poolID, zoneID),\n\t\tnormalizeResourceName(\"ibm_container_worker_pool_zone_attachment\", true),\n\t\t\"ibm_container_worker_pool_zone_attachment\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"wait_till_albs\": \"true\",\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resources\n}\n\nfunc (g ContainerClusterGenerator) loadNlbDNS(clusterID string, nlbIPs []interface{}) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tclusterID,\n\t\tnormalizeResourceName(clusterID, true),\n\t\t\"ibm_container_nlb_dns\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"nlb_ips\": nlbIPs,\n\t\t})\n\n\treturn resources\n}\n\nfunc (g *ContainerClusterGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\tclient, err := containerv1.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclusters, err := client.Clusters().List(containerv1.ClusterTargetHeader{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclientNlb, err := containerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, cs := range clusters {\n\t\tif region == cs.Region {\n\t\t\thardware := hardwareShared\n\n\t\t\tworkerPools, err := client.WorkerPools().ListWorkerPools(cs.ID, containerv1.ClusterTargetHeader{\n\t\t\t\tResourceGroup: cs.ResourceGroupID,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif len(workerPools) > 0 && workerPoolContains(workerPools, defaultWorkerPool) {\n\t\t\t\thardware = workerPools[0].Isolation\n\t\t\t\tswitch strings.ToLower(hardware) {\n\t\t\t\tcase \"\":\n\t\t\t\t\thardware = hardwareShared\n\t\t\t\tcase isolationPrivate:\n\t\t\t\t\thardware = hardwareDedicated\n\t\t\t\tcase isolationPublic:\n\t\t\t\t\thardware = hardwareShared\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tg.Resources = append(g.Resources, g.loadcluster(cs.ID, cs.Name, cs.DataCenter, hardware))\n\n\t\t\tfor _, pool := range workerPools {\n\t\t\t\tg.Resources = append(g.Resources, g.loadWorkerPools(cs.ID, pool.ID, pool.Name))\n\n\t\t\t\tzones := pool.Zones\n\t\t\t\tfor _, zone := range zones {\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadWorkerPoolZones(cs.ID, pool.ID, zone.ID))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnlbData, err := clientNlb.NlbDns().GetNLBDNSList(cs.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, data := range nlbData {\n\t\t\t\tg.Resources = append(g.Resources, g.loadNlbDNS(data.Nlb.Cluster, data.Nlb.NlbIPArray))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc workerPoolContains(workerPools []v1.WorkerPoolResponse, pool string) bool {\n\tfor _, workerPool := range workerPools {\n\t\tif workerPool.Name == pool {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc (g *ContainerClusterGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"ibm_container_cluster\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor i, wp := range g.Resources {\n\t\t\tif wp.InstanceInfo.Type != \"ibm_container_worker_pool\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif wp.InstanceState.Attributes[\"cluster\"] == r.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"cluster\"] = \"${ibm_container_cluster.\" + r.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\n\t\tfor i, wpZoneAttach := range g.Resources {\n\t\t\tif wpZoneAttach.InstanceInfo.Type != \"ibm_container_worker_pool_zone_attachment\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif wpZoneAttach.InstanceState.Attributes[\"cluster\"] == r.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"cluster\"] = \"${ibm_container_cluster.\" + r.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\n\t\tfor i, wp := range g.Resources {\n\t\t\tif wp.InstanceInfo.Type != \"ibm_container_worker_pool\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif wp.InstanceState.Attributes[\"cluster\"] == r.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"cluster\"] = \"${ibm_container_cluster.\" + r.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\n\t\tfor i, nlb := range g.Resources {\n\t\t\tif nlb.InstanceInfo.Type != \"ibm_container_nlb_dns\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif nlb.InstanceState.Attributes[\"cluster\"] == r.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"cluster\"] = \"${ibm_container_cluster.\" + r.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/continuous_delivery.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// DatabaseRedisGenerator ...\ntype ContinuousDeliveryGenerator struct {\n\tIBMService\n}\n\n// loadRedisDB ...\nfunc (g ContinuousDeliveryGenerator) loadContinuousDelivery(cdID string, cdName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tcdID,\n\t\tnormalizeResourceName(cdName, true),\n\t\t\"ibm_resource_instance\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *ContinuousDeliveryGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"continuous-delivery\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tcontinuousDeliveryInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, cd := range continuousDeliveryInstances {\n\t\tif cd.RegionID == region {\n\t\t\tg.Resources = append(g.Resources, g.loadContinuousDelivery(cd.ID, cd.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/cos.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"regexp\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n\t\"github.com/IBM/ibm-cos-sdk-go/aws/credentials/ibmiam\"\n\n\tibmaws \"github.com/IBM/ibm-cos-sdk-go/aws\"\n\tcossession \"github.com/IBM/ibm-cos-sdk-go/aws/session\"\n\tcoss3 \"github.com/IBM/ibm-cos-sdk-go/service/s3\"\n)\n\ntype COSGenerator struct {\n\tIBMService\n}\n\nfunc (g COSGenerator) loadCOS(cosID string, cosName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tcosID,\n\t\tnormalizeResourceName(cosName, true),\n\t\t\"ibm_resource_instance\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\nfunc (g COSGenerator) loadCOSBuckets(bucketID, bucketName string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tbucketID,\n\t\tnormalizeResourceName(bucketName, true),\n\t\t\"ibm_cos_bucket\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"force_delete\": \"true\",\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resources\n}\n\nfunc (g *COSGenerator) InitResources() error {\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"cloud-object-storage\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tcosInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tauthEndpoint := GetAuthEndPoint()\n\tfor _, cs := range cosInstances {\n\t\tg.Resources = append(g.Resources, g.loadCOS(cs.ID, cs.Name))\n\t\ts3Conf := ibmaws.NewConfig().WithCredentials(ibmiam.NewStaticCredentials(ibmaws.NewConfig(), authEndpoint, os.Getenv(\"IC_API_KEY\"), cs.ID)).WithS3ForcePathStyle(true).WithEndpoint(\"s3.us-south.cloud-object-storage.appdomain.cloud\")\n\t\ts3Sess := cossession.Must(cossession.NewSession())\n\t\ts3Client := coss3.New(s3Sess, s3Conf)\n\n\t\tsingleSiteLocationRegex := regexp.MustCompile(\"^[a-z]{3}[0-9][0-9]-[a-z]{4,8}$\")\n\t\tregionLocationRegex := regexp.MustCompile(\"^[a-z]{2}-[a-z]{2,5}[0-9]?-[a-z]{4,8}$\")\n\t\tcrossRegionLocationRegex := regexp.MustCompile(\"^[a-z]{2}-[a-z]{4,8}$\")\n\t\td, _ := s3Client.ListBucketsExtended(&coss3.ListBucketsExtendedInput{})\n\t\tfor _, b := range d.Buckets {\n\t\t\tvar apiType, location string\n\n\t\t\tbLocationConstraint := *b.LocationConstraint\n\t\t\tif singleSiteLocationRegex.MatchString(bLocationConstraint) {\n\t\t\t\tapiType = \"ssl\"\n\t\t\t\tlocation = strings.Split(bLocationConstraint, \"-\")[0]\n\t\t\t}\n\t\t\tif regionLocationRegex.MatchString(bLocationConstraint) {\n\t\t\t\tapiType = \"rl\"\n\t\t\t\tlocation = fmt.Sprintf(\"%s-%s\", strings.Split(bLocationConstraint, \"-\")[0], strings.Split(bLocationConstraint, \"-\")[1])\n\t\t\t}\n\t\t\tif crossRegionLocationRegex.MatchString(bLocationConstraint) {\n\t\t\t\tapiType = \"crl\"\n\t\t\t\tlocation = strings.Split(bLocationConstraint, \"-\")[0]\n\t\t\t}\n\t\t\tbucketID := fmt.Sprintf(\"%s:%s:%s:meta:%s:%s\", strings.ReplaceAll(cs.ID, \"::\", \"\"), \"bucket\", *b.Name, apiType, location)\n\t\t\tg.Resources = append(g.Resources, g.loadCOSBuckets(bucketID, *b.Name))\n\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *COSGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"ibm_cos_bucket\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, rt := range g.Resources {\n\t\t\tif rt.InstanceInfo.Type != \"ibm_resource_instance\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif r.InstanceState.Attributes[\"resource_instance_id\"] == rt.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"resource_instance_id\"] = \"${ibm_resource_instance.\" + rt.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/database_elasticsearch.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// DatabaseElasticSearchGenerator ...\ntype DatabaseElasticSearchGenerator struct {\n\tIBMService\n}\n\n// loadElasticSearchDB ...\nfunc (g DatabaseElasticSearchGenerator) loadElasticSearchDB(dbID string, dbName string) terraformutils.Resource {\n\tresource := terraformutils.NewSimpleResource(\n\t\tdbID,\n\t\tnormalizeResourceName(dbName, false),\n\t\t\"ibm_database\",\n\t\t\"ibm\",\n\t\t[]string{})\n\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^node_count$\",\n\t\t\"^members_memory_allocation_mb$\",\n\t\t\"^node_memory_allocation_mb$\",\n\t\t\"^members_disk_allocation_mb$\",\n\t\t\"^members_cpu_allocation_count$\",\n\t\t\"^node_cpu_allocation_count$\",\n\t\t\"^node_disk_allocation_mb$\",\n\t)\n\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *DatabaseElasticSearchGenerator) InitResources() error {\n\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"databases-for-elasticsearch\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\telasticSearchInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, db := range elasticSearchInstances {\n\t\tif db.RegionID == region {\n\t\t\tg.Resources = append(g.Resources, g.loadElasticSearchDB(db.ID, db.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/database_etcd.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// DatabaseETCDGenerator ...\ntype DatabaseETCDGenerator struct {\n\tIBMService\n}\n\n// loadETCDDB ...\nfunc (g DatabaseETCDGenerator) loadETCDDB(dbID string, dbName string) terraformutils.Resource {\n\tresource := terraformutils.NewSimpleResource(\n\t\tdbID,\n\t\tnormalizeResourceName(dbName, false),\n\t\t\"ibm_database\",\n\t\t\"ibm\",\n\t\t[]string{})\n\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^node_count$\",\n\t\t\"^members_memory_allocation_mb$\",\n\t\t\"^node_memory_allocation_mb$\",\n\t\t\"^members_disk_allocation_mb$\",\n\t\t\"^members_cpu_allocation_count$\",\n\t\t\"^node_cpu_allocation_count$\",\n\t\t\"^node_disk_allocation_mb$\",\n\t)\n\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *DatabaseETCDGenerator) InitResources() error {\n\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"databases-for-etcd\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tetcdInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, db := range etcdInstances {\n\t\tif db.RegionID == region {\n\t\t\tg.Resources = append(g.Resources, g.loadETCDDB(db.ID, db.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/database_mongo.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// DatabaseMongoGenerator ...\ntype DatabaseMongoGenerator struct {\n\tIBMService\n}\n\n// loadMongoDB ...\nfunc (g DatabaseMongoGenerator) loadMongoDB(dbID string, dbName string) terraformutils.Resource {\n\tresource := terraformutils.NewSimpleResource(\n\t\tdbID,\n\t\tnormalizeResourceName(dbName, false),\n\t\t\"ibm_database\",\n\t\t\"ibm\",\n\t\t[]string{})\n\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^node_count$\",\n\t\t\"^members_memory_allocation_mb$\",\n\t\t\"^node_memory_allocation_mb$\",\n\t\t\"^members_disk_allocation_mb$\",\n\t\t\"^members_cpu_allocation_count$\",\n\t\t\"^node_cpu_allocation_count$\",\n\t\t\"^node_disk_allocation_mb$\",\n\t)\n\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *DatabaseMongoGenerator) InitResources() error {\n\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"databases-for-mongodb\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tmongoInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, db := range mongoInstances {\n\t\tif db.RegionID == region {\n\t\t\tg.Resources = append(g.Resources, g.loadMongoDB(db.ID, db.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/database_postgresql.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// DatabasePostgresqlGenerator ...\ntype DatabasePostgresqlGenerator struct {\n\tIBMService\n}\n\n// loadPostgresqlDB ...\nfunc (g DatabasePostgresqlGenerator) loadPostgresqlDB(dbID string, dbName string) terraformutils.Resource {\n\tresource := terraformutils.NewSimpleResource(\n\t\tdbID,\n\t\tnormalizeResourceName(dbName, false),\n\t\t\"ibm_database\",\n\t\t\"ibm\",\n\t\t[]string{})\n\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^node_count$\",\n\t\t\"^members_memory_allocation_mb$\",\n\t\t\"^node_memory_allocation_mb$\",\n\t\t\"^members_disk_allocation_mb$\",\n\t\t\"^members_cpu_allocation_count$\",\n\t\t\"^node_cpu_allocation_count$\",\n\t\t\"^node_disk_allocation_mb$\",\n\t)\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *DatabasePostgresqlGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"databases-for-postgresql\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tpostgreSQLInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, db := range postgreSQLInstances {\n\t\tif db.RegionID == region {\n\t\t\tg.Resources = append(g.Resources, g.loadPostgresqlDB(db.ID, db.Name))\n\t\t}\n\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/database_rabbitmq.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// DatabaseRabbitMQGenerator ...\ntype DatabaseRabbitMQGenerator struct {\n\tIBMService\n}\n\n// loadRabbitMQDB ...\nfunc (g DatabaseRabbitMQGenerator) loadRabbitMQDB(dbID string, dbName string) terraformutils.Resource {\n\tresource := terraformutils.NewSimpleResource(\n\t\tdbID,\n\t\tnormalizeResourceName(dbName, false),\n\t\t\"ibm_database\",\n\t\t\"ibm\",\n\t\t[]string{})\n\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^node_count$\",\n\t\t\"^members_memory_allocation_mb$\",\n\t\t\"^node_memory_allocation_mb$\",\n\t\t\"^members_disk_allocation_mb$\",\n\t\t\"^members_cpu_allocation_count$\",\n\t\t\"^node_cpu_allocation_count$\",\n\t\t\"^node_disk_allocation_mb$\",\n\t)\n\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *DatabaseRabbitMQGenerator) InitResources() error {\n\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"messages-for-rabbitmq\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\trabbitmqInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, db := range rabbitmqInstances {\n\t\tif db.RegionID == region {\n\t\t\tg.Resources = append(g.Resources, g.loadRabbitMQDB(db.ID, db.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/database_redis.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// DatabaseRedisGenerator ...\ntype DatabaseRedisGenerator struct {\n\tIBMService\n}\n\n// loadRedisDB ...\nfunc (g DatabaseRedisGenerator) loadRedisDB(dbID string, dbName string) terraformutils.Resource {\n\tresource := terraformutils.NewSimpleResource(\n\t\tdbID,\n\t\tnormalizeResourceName(dbName, false),\n\t\t\"ibm_database\",\n\t\t\"ibm\",\n\t\t[]string{})\n\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^node_count$\",\n\t\t\"^members_memory_allocation_mb$\",\n\t\t\"^node_memory_allocation_mb$\",\n\t\t\"^members_disk_allocation_mb$\",\n\t\t\"^members_cpu_allocation_count$\",\n\t\t\"^node_cpu_allocation_count$\",\n\t\t\"^node_disk_allocation_mb$\",\n\t)\n\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *DatabaseRedisGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"databases-for-redis\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tredisInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, db := range redisInstances {\n\t\tif db.RegionID == region {\n\t\t\tg.Resources = append(g.Resources, g.loadRedisDB(db.ID, db.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/helpers.go",
    "content": "package ibm\n\nimport (\n\t\"fmt\"\n\t\"math/rand\"\n\t\"regexp\"\n\t\"strings\"\n)\n\nfunc normalizeResourceName(s string, rand bool) string {\n\tspecialChars := `-<>()*#{}[]|@_ .%'\",&`\n\tfor _, c := range specialChars {\n\t\ts = strings.ReplaceAll(s, string(c), \"_\")\n\t}\n\ts = regexp.MustCompile(`^[^a-zA-Z_]+`).ReplaceAllLiteralString(s, \"\")\n\ts = strings.TrimSuffix(s, \"`_\")\n\tif rand {\n\t\trandString := RandStringBytes(4)\n\t\treturn fmt.Sprintf(\"%s_%s\", strings.ToLower(s), randString)\n\t}\n\treturn strings.ToLower(s)\n}\n\nconst letterBytes = \"abcdefghijklmnopqrstuvwxyz0123456789\"\n\nfunc RandStringBytes(n int) string {\n\tb := make([]byte, n)\n\tfor i := range b {\n\t\tb[i] = letterBytes[rand.Intn(len(letterBytes))]\n\t}\n\treturn string(b)\n}\nfunc getRandom(names map[string]struct{}, name string, random bool) (map[string]struct{}, bool) {\n\tif _, ok := names[name]; ok {\n\t\trandom = true\n\t}\n\tnames[name] = struct{}{}\n\treturn names, random\n}\n"
  },
  {
    "path": "providers/ibm/iam.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/iampap/iampapv1\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/iamuum/iamuumv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/usermanagement/usermanagementv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n\t\"github.com/IBM/go-sdk-core/core\"\n\t\"github.com/IBM/platform-services-go-sdk/iamidentityv1\"\n\t\"github.com/IBM/platform-services-go-sdk/iampolicymanagementv1\"\n)\n\ntype IAMGenerator struct {\n\tIBMService\n}\n\nfunc (g IAMGenerator) loadUserPolicies(policyID string, user string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tfmt.Sprintf(\"%s/%s\", user, policyID),\n\t\tnormalizeResourceName(\"iam_user_policy\", true),\n\t\t\"ibm_iam_user_policy\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\nfunc (g IAMGenerator) loadAccessGroups() func(grpID, grpName string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := false\n\treturn func(grpID, grpName string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, grpName, random)\n\t\tresources := terraformutils.NewSimpleResource(\n\t\t\tgrpID,\n\t\t\tnormalizeResourceName(grpName, random),\n\t\t\t\"ibm_iam_access_group\",\n\t\t\t\"ibm\",\n\t\t\t[]string{})\n\t\treturn resources\n\t}\n}\n\nfunc (g IAMGenerator) loadServiceIDs() func(serviceID, grpName string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := false\n\treturn func(grpID, grpName string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, grpName, random)\n\t\tresources := terraformutils.NewSimpleResource(\n\t\t\tgrpID,\n\t\t\tnormalizeResourceName(grpName, random),\n\t\t\t\"ibm_iam_service_id\",\n\t\t\t\"ibm\",\n\t\t\t[]string{})\n\t\treturn resources\n\t}\n}\n\nfunc (g IAMGenerator) loadAuthPolicies(policyID string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tpolicyID,\n\t\tnormalizeResourceName(\"iam_authorization_policy\", true),\n\t\t\"ibm_iam_authorization_policy\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\t// Conflict parameters\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^subject_attributes$\",\n\t\t\"^resource_attributes$\",\n\t\t\"^source_resource_instance_id$\",\n\t\t\"^target_resource_instance_id$\",\n\t\t\"^transaction_id$\",\n\t)\n\treturn resource\n}\n\nfunc (g IAMGenerator) loadCustomRoles() func(roleID, roleName string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := false\n\treturn func(roleID, roleName string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, roleName, random)\n\t\tresources := terraformutils.NewSimpleResource(\n\t\t\troleID,\n\t\t\tnormalizeResourceName(roleName, random),\n\t\t\t\"ibm_iam_custom_role\",\n\t\t\t\"ibm\",\n\t\t\t[]string{})\n\t\treturn resources\n\t}\n}\n\nfunc (g IAMGenerator) loadServicePolicies(serviceID, policyID string, dependsOn []string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", serviceID, policyID),\n\t\tnormalizeResourceName(\"iam_service_policy\", true),\n\t\t\"ibm_iam_service_policy\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resources\n}\n\nfunc (g IAMGenerator) loadAccessGroupMembers() func(grpID string, dependsOn []string, grpName string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := false\n\treturn func(grpID string, dependsOn []string, grpName string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, grpName, random)\n\t\tresources := terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s/%s\", grpID, grpID),\n\t\t\tnormalizeResourceName(grpName, random),\n\t\t\t\"ibm_iam_access_group_members\",\n\t\t\t\"ibm\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"depends_on\": dependsOn,\n\t\t\t})\n\t\treturn resources\n\t}\n}\n\nfunc (g IAMGenerator) loadAccessGroupPolicies(grpID, policyID string, dependsOn []string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", grpID, policyID),\n\t\tnormalizeResourceName(\"iam_access_group_policy\", true),\n\t\t\"ibm_iam_access_group_policy\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resources\n}\n\nfunc (g IAMGenerator) loadAccessGroupDynamicPolicies() func(grpID, ruleID, name string, dependsOn []string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := false\n\treturn func(grpID, ruleID, name string, dependsOn []string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, name, random)\n\t\tresources := terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s/%s\", grpID, ruleID),\n\t\t\tnormalizeResourceName(name, random),\n\t\t\t\"ibm_iam_access_group_dynamic_rule\",\n\t\t\t\"ibm\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"depends_on\": dependsOn,\n\t\t\t})\n\t\treturn resources\n\t}\n}\n\nfunc (g *IAMGenerator) InitResources() error {\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuserManagementAPI, err := usermanagementv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = authenticateAPIKey(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\tgeneration := envFallBack([]string{\"Generation\"}, \"2\")\n\tgen, err := strconv.Atoi(generation)\n\tif err != nil {\n\t\treturn err\n\t}\n\tuserInfo, err := fetchUserDetails(sess, gen)\n\tif err != nil {\n\t\treturn err\n\t}\n\taccountID := userInfo.userAccount\n\n\tusers, err := userManagementAPI.UserInvite().GetUsers(userInfo.userAccount)\n\tif err != nil {\n\t\treturn err\n\t}\n\tiampap, err := iampapv1.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, u := range users.Resources {\n\t\t// User policies\n\t\tpolicies, err := iampap.V1Policy().List(iampapv1.SearchParams{\n\t\t\tAccountID: accountID,\n\t\t\tIAMID:     u.IamID,\n\t\t\tType:      iampapv1.AccessPolicyType,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, p := range policies {\n\t\t\tg.Resources = append(g.Resources, g.loadUserPolicies(p.ID, u.Email))\n\t\t}\n\t}\n\n\tiamuumClient, err := iamuumv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tagrps, err := iamuumClient.AccessGroup().List(accountID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfnObjt := g.loadAccessGroups()\n\tagmfnObj := g.loadAccessGroupMembers()\n\tfor _, group := range agrps {\n\t\tg.Resources = append(g.Resources, fnObjt(group.ID, group.Name))\n\t\tresourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\t\tvar dependsOn []string\n\t\tdependsOn = append(dependsOn,\n\t\t\t\"ibm_iam_access_group.\"+resourceName)\n\t\tg.Resources = append(g.Resources, agmfnObj(group.ID, dependsOn, group.Name))\n\n\t\tpolicies, err := iampap.V1Policy().List(iampapv1.SearchParams{\n\t\t\tAccountID:     accountID,\n\t\t\tAccessGroupID: group.ID,\n\t\t\tType:          iampapv1.AccessPolicyType,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error retrieving access group policy: %s\", err)\n\t\t}\n\t\tfor _, p := range policies {\n\t\t\tg.Resources = append(g.Resources, g.loadAccessGroupPolicies(group.ID, p.ID, dependsOn))\n\t\t}\n\n\t\tdynamicPolicies, err := iamuumClient.DynamicRule().List(group.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdpfnObj := g.loadAccessGroupDynamicPolicies()\n\t\tfor _, d := range dynamicPolicies {\n\t\t\tg.Resources = append(g.Resources, dpfnObj(group.ID, d.RuleID, d.Name, dependsOn))\n\t\t}\n\t}\n\n\t// service id and service policy\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"no API key set\")\n\t}\n\n\tiamIDurl := \"https://iam.cloud.ibm.com\"\n\tiamOptions := &iamidentityv1.IamIdentityV1Options{\n\t\tURL: envFallBack([]string{\"IBMCLOUD_IAM_API_ENDPOINT\"}, iamIDurl),\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t},\n\t}\n\n\tiamPolicyOptions := &iampolicymanagementv1.IamPolicyManagementV1Options{\n\t\tURL: envFallBack([]string{\"IBMCLOUD_IAM_API_ENDPOINT\"}, iamIDurl),\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t},\n\t}\n\n\tiamIDClient, err := iamidentityv1.NewIamIdentityV1(iamOptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tiamPolicyClient, err := iampolicymanagementv1.NewIamPolicyManagementV1(iamPolicyOptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstart := \"\"\n\tallrecs := []iamidentityv1.ServiceID{}\n\tvar pg int64 = 100\n\n\tfor {\n\t\tlistServiceIDOptions := iamidentityv1.ListServiceIdsOptions{\n\t\t\tAccountID: &accountID,\n\t\t\tPagesize:  &pg,\n\t\t}\n\t\tif start != \"\" {\n\t\t\tlistServiceIDOptions.Pagetoken = &start\n\t\t}\n\n\t\tserviceIDs, resp, err := iamIDClient.ListServiceIds(&listServiceIDOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"[ERROR] Error listing Service Ids %s %s\", err, resp)\n\t\t}\n\t\tstart = GetNextIAM(serviceIDs.Next)\n\t\tallrecs = append(allrecs, serviceIDs.Serviceids...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\tservicefnObjt := g.loadServiceIDs()\n\t// loop through all service IDs and fetch policies correspponds to each service ID\n\tfor _, service := range allrecs {\n\t\tg.Resources = append(g.Resources, servicefnObjt(*service.ID, *service.Name))\n\t\tresourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\t\tvar dependsOn []string\n\t\tdependsOn = append(dependsOn,\n\t\t\t\"ibm_iam_service_id.\"+resourceName)\n\n\t\tlistServicePolicyOptions := iampolicymanagementv1.ListPoliciesOptions{\n\t\t\tAccountID: core.StringPtr(accountID),\n\t\t\tIamID:     core.StringPtr(*service.IamID),\n\t\t\tType:      core.StringPtr(\"access\"),\n\t\t}\n\n\t\tpolicyList, _, err := iamPolicyClient.ListPolicies(&listServicePolicyOptions)\n\t\tpolicies := policyList.Policies\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error retrieving service policy: %s\", err)\n\t\t}\n\n\t\tfor _, p := range policies {\n\t\t\tg.Resources = append(g.Resources, g.loadServicePolicies(*service.ID, *p.ID, dependsOn))\n\t\t}\n\t}\n\n\t// Authorization policy\n\tlistAuthPolicyOptions := iampolicymanagementv1.ListPoliciesOptions{\n\t\tAccountID: core.StringPtr(accountID),\n\t\tType:      core.StringPtr(\"authorization\"),\n\t}\n\n\tauthPolicyList, _, err := iamPolicyClient.ListPolicies(&listAuthPolicyOptions)\n\tauthPolicies := authPolicyList.Policies\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error retrieving authorization policy: %s\", err)\n\t}\n\n\tfor _, ap := range authPolicies {\n\t\tg.Resources = append(g.Resources, g.loadAuthPolicies(*ap.ID))\n\t}\n\n\t// Custom role\n\tlistCustomRoleOptions := iampolicymanagementv1.ListRolesOptions{\n\t\tAccountID: core.StringPtr(accountID),\n\t}\n\n\trolesList, _, err := iamPolicyClient.ListRoles(&listCustomRoleOptions)\n\tcustomRoles := rolesList.CustomRoles\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error retrieving custom roles: %s\", err)\n\t}\n\trolefnObjt := g.loadCustomRoles()\n\tfor _, r := range customRoles {\n\t\tg.Resources = append(g.Resources, rolefnObjt(*r.ID, *r.Name))\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_cd_toolchain.go",
    "content": "package ibm\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"regexp\"\n\t\"slices\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n\t\"github.com/IBM/continuous-delivery-go-sdk/v2/cdtektonpipelinev2\"\n\t\"github.com/IBM/continuous-delivery-go-sdk/v2/cdtoolchainv2\"\n\t\"github.com/IBM/go-sdk-core/v5/core\"\n\t\"github.com/IBM/platform-services-go-sdk/iampolicymanagementv1\"\n)\n\ntype ToolchainGenerator struct {\n\tIBMService\n}\n\nvar workerIDMutex sync.RWMutex // Used in PostConvertHook\nvar repoMutex sync.RWMutex     // Used in PostConvertHook\nvar toolMutex sync.RWMutex     // Used in PostConvertHook\n\nfunc (g ToolchainGenerator) loadToolchain(tcID string, tcName string) terraformutils.Resource {\n\tresource := terraformutils.NewSimpleResource(\n\t\ttcID,\n\t\ttcName,\n\t\t\"ibm_cd_toolchain\",\n\t\t\"ibm\",\n\t\t[]string{},\n\t)\n\treturn resource\n}\n\nfunc (g ToolchainGenerator) loadTool(resourceType string, tID string, tName string, tcIDref string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\ttID,\n\t\ttName,\n\t\tresourceType,\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"toolchain_id\": tcIDref,\n\t\t})\n\treturn resource\n}\n\n// Adds S2S authorization required by some integrations\nfunc (g ToolchainGenerator) loadAuthPolicies(policyID string, tcIDref string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tpolicyID,\n\t\tnormalizeResourceName(\"iam_authorization_policy\", true),\n\t\t\"ibm_iam_authorization_policy\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"source_resource_instance_id\": tcIDref,\n\t\t})\n\n\t// Conflict parameters\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^subject_attributes$\",\n\t\t\"^resource_attributes$\",\n\t\t\"^source_service_account$\",\n\t\t\"^transaction_id$\",\n\t)\n\treturn resource\n}\n\nfunc (g ToolchainGenerator) loadPL(plID string, plName string, plIDref string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tplID,\n\t\tplName,\n\t\t\"ibm_cd_tekton_pipeline\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"pipeline_id\": plIDref,\n\t\t})\n\treturn resource\n}\n\nfunc (g ToolchainGenerator) loadPLProp(resourceType string, pID string, pName string, plIDref string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tpID,\n\t\tpName,\n\t\tresourceType,\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"pipeline_id\": plIDref,\n\t\t})\n\treturn resource\n}\n\nfunc (g ToolchainGenerator) loadPLDef(resourceType string, pID string, pName string, plIDref string, tcID string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tpID,\n\t\tpName,\n\t\tresourceType,\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"pipeline_id\":         plIDref,\n\t\t\t\"toolchain_id_actual\": tcID, // removed on PostConvertHook\n\t\t})\n\treturn resource\n}\n\nfunc (g ToolchainGenerator) loadPLTrigProp(resourceType string, pID string, pName string, plIDref string, trigIDref string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tpID,\n\t\tpName,\n\t\tresourceType,\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"pipeline_id\": plIDref,\n\t\t\t\"trigger_id\":  trigIDref,\n\t\t})\n\treturn resource\n}\n\n// Goroutine helper to handle different tool types\nfunc (g *ToolchainGenerator) HandleTool(t cdtoolchainv2.ToolModel, toolType string, tID string, tName string, tcID string, tcIDref string, waitGroup *sync.WaitGroup) error {\n\tdefer waitGroup.Done()\n\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\n\t// typical case. handle exceptional cases seperately\n\t// maps tool_type_id to the terraform resource type\n\tsupportedTools := map[string]string{\n\t\t\"appconfig\":           \"ibm_cd_toolchain_tool_appconfig\",\n\t\t\"artifactory\":         \"ibm_cd_toolchain_tool_artifactory\",\n\t\t\"bitbucketgit\":        \"ibm_cd_toolchain_tool_bitbucketgit\",\n\t\t\"private_worker\":      \"ibm_cd_toolchain_tool_privateworker\",\n\t\t\"draservicebroker\":    \"ibm_cd_toolchain_tool_devopsinsights\",\n\t\t\"eventnotifications\":  \"ibm_cd_toolchain_tool_eventnotifications\",\n\t\t\"hostedgit\":           \"ibm_cd_toolchain_tool_hostedgit\",\n\t\t\"githubconsolidated\":  \"ibm_cd_toolchain_tool_githubconsolidated\",\n\t\t\"gitlab\":              \"ibm_cd_toolchain_tool_gitlab\",\n\t\t\"hashicorpvault\":      \"ibm_cd_toolchain_tool_hashicorpvault\",\n\t\t\"jenkins\":             \"ibm_cd_toolchain_tool_jenkins\",\n\t\t\"jira\":                \"ibm_cd_toolchain_tool_jira\",\n\t\t\"keyprotect\":          \"ibm_cd_toolchain_tool_keyprotect\",\n\t\t\"nexus\":               \"ibm_cd_toolchain_tool_nexus\",\n\t\t\"customtool\":          \"ibm_cd_toolchain_tool_custom\",\n\t\t\"saucelabs\":           \"ibm_cd_toolchain_tool_saucelabs\",\n\t\t\"secretsmanager\":      \"ibm_cd_toolchain_tool_secretsmanager\",\n\t\t\"security_compliance\": \"ibm_cd_toolchain_tool_securitycompliance\",\n\t\t\"slack\":               \"ibm_cd_toolchain_tool_slack\",\n\t\t\"sonarqube\":           \"ibm_cd_toolchain_tool_sonarqube\",\n\t}\n\n\tif resourceType, ok := supportedTools[toolType]; ok {\n\t\tresourceMutex.Lock()\n\t\tg.Resources = append(g.Resources, g.loadTool(resourceType, tID, tName, tcIDref))\n\t\tresourceMutex.Unlock()\n\t} else {\n\t\tswitch toolType {\n\t\tcase \"pipeline\":\n\t\t\t// Classic pipelines cannot be created using Terraform\n\t\t\tif t.Parameters[\"type\"] != \"tekton\" {\n\t\t\t\tresourceMutex.Lock()\n\t\t\t\tg.Resources = append(g.Resources, g.loadTool(\"ibm_cd_toolchain_tool_pipeline\", tID, tName+\"--classic\", tcIDref))\n\t\t\t\tresourceMutex.Unlock()\n\t\t\t\tfmt.Println(\"......! Only Tekton pipelines are supported in Terraform\", toolType)\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tresourceMutex.Lock()\n\t\t\tg.Resources = append(g.Resources, g.loadTool(\"ibm_cd_toolchain_tool_pipeline\", tID, tName+\"--tekton\", tcIDref))\n\t\t\tresourceMutex.Unlock()\n\n\t\t\tplID := *(t.ID)\n\t\t\tplName := tName\n\n\t\t\tplIDref := fmt.Sprintf(\"${ibm_cd_toolchain_tool_pipeline.tfer--%s--tekton.tool_id}\", tName)\n\n\t\t\tresourceMutex.Lock()\n\t\t\tg.Resources = append(g.Resources, g.loadPL(plID, plName, plIDref))\n\t\t\tresourceMutex.Unlock()\n\n\t\t\t// Get pipeline\n\t\t\tcdTektonPipelineServiceOptions := &cdtektonpipelinev2.CdTektonPipelineV2Options{\n\t\t\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\t\t\tApiKey: apiKey,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tcdTektonPipelineService, err := cdtektonpipelinev2.NewCdTektonPipelineV2UsingExternalConfig(cdTektonPipelineServiceOptions)\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(\"......! Error getting pipeline information: \", err)\n\t\t\t}\n\n\t\t\tgetTektonPipelineOptions := cdTektonPipelineService.NewGetTektonPipelineOptions(plID)\n\n\t\t\ttektonPipeline, _, err := cdTektonPipelineService.GetTektonPipeline(getTektonPipelineOptions)\n\t\t\tif err != nil {\n\t\t\t\tlog.Print(\"......! Error getting pipeline information: \", err)\n\t\t\t}\n\n\t\t\t// Definitions\n\t\t\tfor _, def := range tektonPipeline.Definitions {\n\t\t\t\tdefID := fmt.Sprintf(\"%s/%s\", plID, *(def.ID))\n\t\t\t\tdefName := normalizeResourceName(\"definition\", true)\n\n\t\t\t\tresourceMutex.Lock()\n\t\t\t\tg.Resources = append(g.Resources, g.loadPLDef(\"ibm_cd_tekton_pipeline_definition\", defID, defName, plIDref, plID))\n\t\t\t\tresourceMutex.Unlock()\n\t\t\t}\n\n\t\t\t// Properties\n\t\t\tfor _, prop := range tektonPipeline.Properties {\n\t\t\t\tpID := fmt.Sprintf(\"%s/%s\", plID, *(prop.Name))\n\t\t\t\tpName := normalizeResourceName(*(prop.Name), true)\n\n\t\t\t\tresourceMutex.Lock()\n\t\t\t\tg.Resources = append(g.Resources, g.loadPLProp(\"ibm_cd_tekton_pipeline_property\", pID, pName, plIDref))\n\t\t\t\tresourceMutex.Unlock()\n\t\t\t}\n\n\t\t\t// Triggers\n\t\t\tfor _, trig := range tektonPipeline.Triggers {\n\t\t\t\ttrigger := trig.(*cdtektonpipelinev2.Trigger)\n\n\t\t\t\ttrigID := fmt.Sprintf(\"%s/%s\", plID, *(trigger.ID))\n\t\t\t\ttrigName := normalizeResourceName(*(trigger.Name), true)\n\n\t\t\t\tresourceMutex.Lock()\n\t\t\t\tg.Resources = append(g.Resources, g.loadPLProp(\"ibm_cd_tekton_pipeline_trigger\", trigID, trigName, plIDref))\n\t\t\t\tresourceMutex.Unlock()\n\n\t\t\t\t// Trigger Properties\n\t\t\t\tfor _, trigp := range trigger.Properties {\n\t\t\t\t\ttrigpID := fmt.Sprintf(\"%s/%s\", trigID, *(trigp.Name))\n\t\t\t\t\ttrigpName := normalizeResourceName(*(trigp.Name), true)\n\n\t\t\t\t\ttrigIDref := fmt.Sprintf(\"${ibm_cd_tekton_pipeline_trigger.tfer--%s.trigger_id}\", trigName)\n\n\t\t\t\t\tresourceMutex.Lock()\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadPLTrigProp(\"ibm_cd_tekton_pipeline_trigger_property\", trigpID, trigpName, plIDref, trigIDref))\n\t\t\t\t\tresourceMutex.Unlock()\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"pagerduty\":\n\t\t\t// If this integration is misconfigured, it lacks the necessary fields to work in Terraform\n\t\t\tif *(t.State) == \"configured\" {\n\t\t\t\tresourceMutex.Lock()\n\t\t\t\tg.Resources = append(g.Resources, g.loadTool(\"ibm_cd_toolchain_tool_pagerduty\", tID, tName, tcIDref))\n\t\t\t\tresourceMutex.Unlock()\n\t\t\t}\n\t\tdefault:\n\t\t\tfmt.Println(\"......! Unknown tool type\", toolType)\n\t\t}\n\t}\n\treturn nil\n}\n\n// Called within InitResources when IBM_CD_TOOLCHAIN_INCLUDE_S2S is set\nfunc getS2SPolicies(sess *session.Session, targetTcID string) (map[string][]iampolicymanagementv1.Policy, error) {\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\n\temptyPolicies := map[string][]iampolicymanagementv1.Policy{}\n\n\tiamPolicyOptions := &iampolicymanagementv1.IamPolicyManagementV1Options{\n\t\tURL: \"https://iam.cloud.ibm.com\",\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t},\n\t}\n\n\tiamPolicyClient, err := iampolicymanagementv1.NewIamPolicyManagementV1(iamPolicyOptions)\n\tif err != nil {\n\t\treturn emptyPolicies, err\n\t}\n\n\tuserInfo, err := fetchUserDetails(sess, 2)\n\tif err != nil {\n\t\treturn emptyPolicies, err\n\t}\n\taccountID := userInfo.userAccount\n\n\tlistAuthPolicyOptions := iampolicymanagementv1.ListPoliciesOptions{\n\t\tAccountID: core.StringPtr(accountID),\n\t\tType:      core.StringPtr(\"authorization\"),\n\t}\n\n\tauthPolicyList, _, err := iamPolicyClient.ListPolicies(&listAuthPolicyOptions)\n\tif err != nil {\n\t\treturn emptyPolicies, fmt.Errorf(\"error retrieving authorization policy: %s\", err)\n\t}\n\tauthPolicies := authPolicyList.Policies\n\n\ts2sPolicies := map[string][]iampolicymanagementv1.Policy{} // map of toolchain id to s2s policies under it\n\n\tfor _, ap := range authPolicies {\n\t\tfor _, a := range ap.Subjects[0].Attributes {\n\t\t\tif *(a.Name) != \"serviceInstance\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (targetTcID != \"\" && *(a.Value) == targetTcID) || targetTcID == \"\" {\n\t\t\t\t// get s2s policies for target toolchain\n\t\t\t\tif _, ok := s2sPolicies[*(a.Value)]; !ok {\n\t\t\t\t\ts2sPolicies[*(a.Value)] = []iampolicymanagementv1.Policy{}\n\t\t\t\t}\n\t\t\t\ts2sPolicies[*(a.Value)] = append(s2sPolicies[*(a.Value)], ap)\n\t\t\t}\n\t\t}\n\t}\n\treturn s2sPolicies, nil\n}\n\nfunc (g *ToolchainGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\n\tguidRegex := regexp.MustCompile(\"[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$\")\n\n\ttargetTcID := os.Getenv(\"IBM_CD_TOOLCHAIN_TARGET\")\n\tif targetTcID != \"\" && !guidRegex.MatchString(targetTcID) {\n\t\tlog.Fatal(\"Env variable IBM_CD_TOOLCHAIN_TARGET is not a GUID\")\n\t}\n\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatal(\"No API key set\")\n\t}\n\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: apiKey,\n\t\tRegion:        region,\n\t}\n\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = authenticateAPIKey(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"toolchain\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\n\ttcInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Get s2s policies\n\ts2sPolicies := map[string][]iampolicymanagementv1.Policy{}\n\n\tincludeS2S := os.Getenv(\"IBM_CD_TOOLCHAIN_INCLUDE_S2S\")\n\tif includeS2S != \"\" {\n\t\ts2sPolicies, err = getS2SPolicies(sess, targetTcID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar toolWG sync.WaitGroup\n\n\t// Iterate over toolchains to get tools\n\tfor _, tc := range tcInstances {\n\t\t// Get toolchain ids, double-checking if they are valid\n\t\tcrnSplit := strings.Split(tc.ID, \":\")\n\t\tif len(crnSplit) < 8 {\n\t\t\tfmt.Println(\"received invalid CRN format from Resource Controller, skipping...\")\n\t\t\tcontinue\n\t\t}\n\n\t\ttcID := crnSplit[7]\n\n\t\tif !guidRegex.MatchString(tcID) {\n\t\t\tfmt.Println(\"received invalid CRN format from Resource Controller, skipping...\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif targetTcID != \"\" && tcID != targetTcID {\n\t\t\tcontinue\n\t\t}\n\n\t\tif tc.RegionID == region {\n\t\t\ttcName := normalizeResourceName(tc.Name, true)\n\t\t\ttcIDref := fmt.Sprintf(\"${ibm_cd_toolchain.tfer--%s.id}\", tcName)\n\n\t\t\tresourceMutex.Lock()\n\t\t\tg.Resources = append(g.Resources, g.loadToolchain(tcID, tcName))\n\t\t\tresourceMutex.Unlock()\n\n\t\t\tfmt.Println(\"=== FOUND TOOLCHAIN\", tcID, \"WITH NAME\", tcName)\n\n\t\t\t// Get tools\n\t\t\ttoolchainClientOptions := &cdtoolchainv2.CdToolchainV2Options{\n\t\t\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\t\t\tApiKey: apiKey,\n\t\t\t\t},\n\t\t\t}\n\n\t\t\ttoolchainClient, err := cdtoolchainv2.NewCdToolchainV2UsingExternalConfig(toolchainClientOptions)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tlistToolsOptions := toolchainClient.NewListToolsOptions(tcID)\n\n\t\t\tlistToolsOptions.SetLimit(150) // 150 is max num tools per toolchain\n\n\t\t\ttools, _, err := toolchainClient.ListTools(listToolsOptions)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif includeS2S != \"\" {\n\t\t\t\t// Add toolchain's s2s policies (some tools require it)\n\t\t\t\tfor _, pol := range s2sPolicies[tcID] {\n\t\t\t\t\tresourceMutex.Lock()\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadAuthPolicies(*(pol.ID), tcIDref))\n\t\t\t\t\tresourceMutex.Unlock()\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, t := range tools.Tools {\n\t\t\t\ttoolType := *(t.ToolTypeID)\n\t\t\t\ttID := fmt.Sprintf(\"%s/%s\", tcID, *(t.ID))\n\n\t\t\t\t// Name won't always exist in Parameters\n\t\t\t\tvar tName string\n\n\t\t\t\tif t.Parameters[\"name\"] != nil {\n\t\t\t\t\ttName = normalizeResourceName(t.Parameters[\"name\"].(string), true)\n\t\t\t\t} else {\n\t\t\t\t\ttName = normalizeResourceName(toolType, true)\n\t\t\t\t}\n\n\t\t\t\ttoolWG.Add(1)\n\t\t\t\tgo g.HandleTool(t, toolType, tID, tName, tcID, tcIDref, &toolWG)\n\t\t\t}\n\t\t}\n\t}\n\ttoolWG.Wait()\n\treturn nil\n}\n\n// Goroutine helper to collect worker IDs for TektonPipelinePostProcess\nfunc (g *ToolchainGenerator) updateWorkerIDs(i int, res terraformutils.Resource, workerIDs map[string]string) {\n\tresID := g.Resources[i].InstanceState.ID\n\twkrIDSplit := strings.Split(resID, \"/\")\n\tif resID == \"\" || len(wkrIDSplit) != 2 {\n\t\treturn\n\t}\n\tworkerID := wkrIDSplit[1]\n\tworkerIDMutex.Lock()\n\tworkerIDs[workerID] = res.InstanceInfo.ResourceAddress().String()\n\tworkerIDMutex.Unlock()\n}\n\n// Goroutine helper to collect repos for TektonDefinitionPostProcess\nfunc (g *ToolchainGenerator) updateRepos(i int, res terraformutils.Resource, repos map[string](map[string]string)) {\n\tparams, ok := g.Resources[i].Item[\"parameters\"].([]interface{})\n\tif !ok || len(params) == 0 {\n\t\treturn\n\t}\n\tparamsMap, ok := params[0].(map[string]interface{})\n\tif !ok {\n\t\treturn\n\t}\n\tif tcID, ok := g.Resources[i].InstanceState.Attributes[\"toolchain_id\"]; ok {\n\t\trepoMutex.Lock()\n\t\tif repos[tcID] == nil {\n\t\t\trepos[tcID] = make(map[string]string)\n\t\t}\n\t\trepos[tcID][paramsMap[\"repo_url\"].(string)] = res.InstanceInfo.ResourceAddress().String()\n\t\trepoMutex.Unlock()\n\t}\n}\n\nfunc (g *ToolchainGenerator) PostConvertHook() error {\n\tworkerIDs := map[string]string{}\n\trepos := map[string](map[string]string){}\n\ttools := map[string]string{}\n\n\tvar resWG sync.WaitGroup\n\tfor i, res := range g.Resources {\n\t\tresWG.Add(1)\n\t\tgo func() {\n\t\t\tdefer resWG.Done()\n\n\t\t\tswitch res.InstanceInfo.Type {\n\t\t\tcase \"ibm_cd_toolchain_tool_privateworker\":\n\t\t\t\tg.updateWorkerIDs(i, res, workerIDs)\n\t\t\tcase \"ibm_cd_toolchain_tool_bitbucketgit\":\n\t\t\t\tg.updateRepos(i, res, repos)\n\t\t\tcase \"ibm_cd_toolchain_tool_hostedgit\":\n\t\t\t\tg.updateRepos(i, res, repos)\n\t\t\tcase \"ibm_cd_toolchain_tool_gitlab\":\n\t\t\t\tg.updateRepos(i, res, repos)\n\t\t\tcase \"ibm_cd_toolchain_tool_githubconsolidated\":\n\t\t\t\tg.updateRepos(i, res, repos)\n\t\t\t}\n\n\t\t\t// Collect tools for TektonPropertyPostProcess\n\t\t\tif strings.HasPrefix(res.InstanceInfo.Type, \"ibm_cd_toolchain_tool_\") {\n\t\t\t\tif tID, ok := g.Resources[i].InstanceState.Attributes[\"tool_id\"]; ok {\n\t\t\t\t\ttoolMutex.Lock()\n\t\t\t\t\ttools[tID] = res.InstanceInfo.ResourceAddress().String()\n\t\t\t\t\ttoolMutex.Unlock()\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\tresWG.Wait()\n\n\tfor i, res := range g.Resources {\n\t\tswitch res.InstanceInfo.Type {\n\t\tcase \"ibm_cd_tekton_pipeline\":\n\t\t\tg.TektonPipelinePostProcess(i, res, workerIDs)\n\n\t\tcase \"ibm_cd_tekton_pipeline_definition\":\n\t\t\tg.TektonDefinitionPostProcess(i, res, repos)\n\n\t\tcase \"ibm_cd_tekton_pipeline_property\":\n\t\t\tg.TektonPropertyPostProcess(i, res, tools)\n\n\t\tcase \"ibm_cd_tekton_pipeline_trigger_property\":\n\t\t\tg.TektonPropertyPostProcess(i, res, tools)\n\n\t\tcase \"ibm_cd_toolchain_tool_jenkins\":\n\t\t\tg.JenkinsPostProcess(i, res)\n\n\t\tcase \"ibm_cd_toolchain_tool_bitbucketgit\":\n\t\t\tg.GitRepositoryPostProcess(i, res)\n\n\t\tcase \"ibm_cd_toolchain_tool_hostedgit\":\n\t\t\tg.GitRepositoryPostProcess(i, res)\n\n\t\tcase \"ibm_cd_toolchain_tool_gitlab\":\n\t\t\tg.GitRepositoryPostProcess(i, res)\n\n\t\tcase \"ibm_cd_toolchain_tool_githubconsolidated\":\n\t\t\tg.GitRepositoryPostProcess(i, res)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// PostConvertHook helper to add private workers refs to tekton pipelines\nfunc (g *ToolchainGenerator) TektonPipelinePostProcess(i int, res terraformutils.Resource, workerIDs map[string]string) {\n\tworker, ok := g.Resources[i].Item[\"worker\"].([]interface{})\n\tif !ok {\n\t\treturn\n\t}\n\tworkerMap, ok := worker[0].(map[string]interface{})\n\tif !ok {\n\t\treturn\n\t}\n\tplWorkerID := workerMap[\"id\"]\n\tif plWorkerID == nil || plWorkerID == \"public\" {\n\t\treturn\n\t}\n\tif wkr, ok := workerIDs[plWorkerID.(string)]; ok {\n\t\tworkerMap[\"id\"] = fmt.Sprintf(\"${%s.tool_id}\", wkr)\n\t\treturn\n\t}\n}\n\n// PostConvertHook helper to add repo depends_on to tekton pipeline definitions\nfunc (g *ToolchainGenerator) TektonDefinitionPostProcess(i int, res terraformutils.Resource, repos map[string](map[string]string)) {\n\tdefSource, ok := g.Resources[i].Item[\"source\"].([]interface{})\n\tif !ok || len(defSource) == 0 {\n\t\treturn\n\t}\n\tdefSourceMap, ok := defSource[0].(map[string]interface{})\n\tif !ok {\n\t\treturn\n\t}\n\tdefProps, ok := defSourceMap[\"properties\"].([]interface{})\n\tif !ok || len(defProps) == 0 {\n\t\treturn\n\t}\n\tdefPropsMap, ok := defProps[0].(map[string]interface{})\n\tif !ok {\n\t\treturn\n\t}\n\ttcID, ok := g.Resources[i].Item[\"toolchain_id_actual\"]\n\tif !ok {\n\t\treturn\n\t}\n\tif repo, ok := repos[tcID.(string)][defPropsMap[\"url\"].(string)]; ok {\n\t\tg.Resources[i].Item[\"depends_on\"] = []string{repo}\n\t}\n\tdelete(g.Resources[i].Item, \"toolchain_id_actual\")\n}\n\n// PostConvertHook helper to add tool refs to tekton pipeline properties and additional escape appconfig substitution\nfunc (g *ToolchainGenerator) TektonPropertyPostProcess(i int, res terraformutils.Resource, tools map[string]string) {\n\ttarget, ok := g.Resources[i].Item[\"value\"].(string)\n\tif !ok {\n\t\treturn\n\t}\n\n\t// escape appconfig values -- ${...} is interpreted as a template in terraform\n\tg.Resources[i].Item[\"value\"] = strings.ReplaceAll(g.Resources[i].Item[\"value\"].(string), \"${\", \"$${\")\n\n\t// add tool integration ref to tekton definitions\n\tif g.Resources[i].Item[\"type\"] != \"integration\" {\n\t\treturn\n\t}\n\n\tif tool, ok := tools[target]; ok {\n\t\tg.Resources[i].Item[\"value\"] = fmt.Sprintf(\"${%s.tool_id}\", tool)\n\t\treturn\n\t}\n\tfmt.Println(\"......! Could not link pipeline property of type integration:\", res.InstanceInfo.ResourceAddress().String())\n}\n\n// PostConvertHook helper to remove Jenkins webhook_url from tf files, which is supposed to be sensitive and computed\nfunc (g *ToolchainGenerator) JenkinsPostProcess(i int, res terraformutils.Resource) {\n\tparams, ok := g.Resources[i].Item[\"parameters\"].([]interface{})\n\tif !ok || len(params) == 0 {\n\t\treturn\n\t}\n\tparamsMap, ok := params[0].(map[string]interface{})\n\tif !ok {\n\t\treturn\n\t}\n\tif _, ok := paramsMap[\"webhook_url\"].(string); ok {\n\t\tdelete(paramsMap, \"webhook_url\")\n\t}\n}\n\n// PostConvertHook helper to generate initialization block and remove computed values for git repo resources\nfunc (g *ToolchainGenerator) GitRepositoryPostProcess(i int, res terraformutils.Resource) {\n\t// Handle Initialization args\n\tparams, ok := g.Resources[i].Item[\"parameters\"].([]interface{})\n\tif !ok || len(params) == 0 {\n\t\treturn\n\t}\n\tparamsMap, ok := params[0].(map[string]interface{})\n\tif !ok {\n\t\treturn\n\t}\n\tinitMap := map[string]interface{}{}\n\n\tinitMap[\"git_id\"] = paramsMap[\"git_id\"]\n\tinitMap[\"type\"] = paramsMap[\"type\"] // this will always be \"link\"\n\tinitMap[\"repo_url\"] = paramsMap[\"repo_url\"]\n\tinitMap[\"private_repo\"] = paramsMap[\"private_repo\"]\n\n\t// additional parameters\n\tif res.InstanceInfo.Type == \"ibm_cd_toolchain_tool_githubconsolidated\" {\n\t\tinitMap[\"blind_connection\"] = paramsMap[\"blind_connection\"]\n\t\tinitMap[\"auto_init\"] = paramsMap[\"auto_init\"]\n\t} else if res.InstanceInfo.Type == \"ibm_cd_toolchain_tool_gitlab\" {\n\t\tinitMap[\"blind_connection\"] = paramsMap[\"blind_connection\"]\n\t}\n\n\t// add to initialization accordingly\n\tg.Resources[i].Item[\"initialization\"] = initMap\n\n\t// add missing initialization to terraform state attributes\n\tg.Resources[i].InstanceState.Attributes[\"initialization.#\"] = \"1\"\n\tfor key, val := range initMap {\n\t\tg.Resources[i].InstanceState.Attributes[\"initialization.0.\"+key] = val.(string)\n\t}\n\n\t// only include non-computed parameters\n\tincludeParams := []string{\"api_token\", \"auth_type\", \"enable_traceability\", \"integration_owner\", \"toolchain_issues_enabled\"}\n\n\tfor key := range paramsMap {\n\t\tif !slices.Contains(includeParams, key) {\n\t\t\tdelete(g.Resources[i].Item[\"parameters\"].([]interface{})[0].(map[string]interface{}), key)\n\t\t\tdelete(g.Resources[i].InstanceState.Attributes, key)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "providers/ibm/ibm_certificate_manager.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/certificatemanager\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\ntype CMGenerator struct {\n\tIBMService\n}\n\nfunc (g CMGenerator) loadCM(cmID, cmGuID string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tcmID,\n\t\tcmGuID,\n\t\t\"ibm_resource_instance\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\nfunc (g CMGenerator) loadImportedCM(cmID, certificateID, cisInstance string, dependsOn []string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tcmID,\n\t\tcertificateID,\n\t\t\"ibm_certificate_manager_import\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"dns_provider_instance_crn\": cisInstance,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resources\n}\n\nfunc (g CMGenerator) loadOrderedCM(cmID, certificateID, cisInstance string, dependsOn []string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tcmID,\n\t\tcertificateID,\n\t\t\"ibm_certificate_manager_order\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"dns_provider_instance_crn\": cisInstance,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resources\n}\n\nfunc (g *CMGenerator) InitResources() error {\n\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar cisInstance string\n\tvar cisID string\n\tcis := g.Args[\"cis\"]\n\tif cis != nil {\n\t\tcisInstance = cis.(string)\n\t}\n\n\t// Client creation\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcertManagementClient, err := certificatemanager.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Get ServiceID of certificate manager service\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"cloudcerts\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID2, err := catalogClient.ResourceCatalog().FindByName(\"internet-svcs\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\n\tquery2 := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID2[0].ID,\n\t}\n\n\t// Get all Certificate manager instances\n\tcmInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Get all CIS instances\n\tcisInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query2)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, cis := range cisInstances {\n\t\tif cisInstance == cis.Name {\n\t\t\tcisID = cis.Guid\n\t\t}\n\t}\n\n\t// Get all certificates associated with a certificate manager instance\n\tfor _, cmInstance := range cmInstances {\n\n\t\tg.Resources = append(g.Resources, g.loadCM(cmInstance.ID, cmInstance.Guid))\n\n\t\t// For each instance get associated certificates\n\t\tcertificateList, err := certManagementClient.Certificate().ListCertificates(cmInstance.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, cert := range certificateList {\n\t\t\t// Get certificate info\n\t\t\tcertificatedata, err := certManagementClient.Certificate().GetCertData(cert.ID)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tvar dependsOn []string\n\t\t\tdependsOn = append(dependsOn,\n\t\t\t\t\"ibm_resource_instance.\"+terraformutils.TfSanitize(cmInstance.Guid))\n\n\t\t\tif certificatedata.Imported {\n\t\t\t\tg.Resources = append(g.Resources, g.loadImportedCM(cert.ID, cert.ID, cisID, dependsOn))\n\t\t\t} else {\n\t\t\t\tg.Resources = append(g.Resources, g.loadOrderedCM(cert.ID, cert.ID, cisID, dependsOn))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_cloudant.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// CloudantGenerator ...\ntype CloudantGenerator struct {\n\tIBMService\n}\n\n// loadMongoDB ...\nfunc (g CloudantGenerator) loadCloudant(dbID string, dbName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tdbID,\n\t\tnormalizeResourceName(dbName, false),\n\t\t\"ibm_cloudant\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *CloudantGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"cloudantnosqldb\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, service := range serviceID {\n\t\tquery := controllerv2.ServiceInstanceQuery{\n\t\t\tServiceID: service.ID,\n\t\t}\n\t\tcloudantInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, cloudantInstance := range cloudantInstances {\n\t\t\tif cloudantInstance.RegionID == region {\n\t\t\t\t// load Cloudant DBs for each Instance\n\t\t\t\tg.Resources = append(g.Resources, g.loadCloudant(cloudantInstance.ID, cloudantInstance.Name))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_code_engine.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\n// CodeEngineGenerator ...\ntype CodeEngineGenerator struct {\n\tIBMService\n}\n\n// loadCodeEngine ...\nfunc (g CodeEngineGenerator) loadCodeEngine(ceID string, ceName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tceID,\n\t\tnormalizeResourceName(ceName, false),\n\t\t\"ibm_resource_instance\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *CodeEngineGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"codeengine\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tcodeEngineInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, ce := range codeEngineInstances {\n\t\tif ce.RegionID == region {\n\t\t\tg.Resources = append(g.Resources, g.loadCodeEngine(ce.ID, ce.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_dl.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\tdlProviderV2 \"github.com/IBM/networking-go-sdk/directlinkproviderv2\"\n\tdl \"github.com/IBM/networking-go-sdk/directlinkv1\"\n)\n\n// DLGenerator ...\ntype DLGenerator struct {\n\tIBMService\n}\n\nfunc (g DLGenerator) createDirectLinkGatewayResources(gatewayID, gatewayName string) terraformutils.Resource {\n\tresource := terraformutils.NewSimpleResource(\n\t\tgatewayID,\n\t\tnormalizeResourceName(gatewayName, false),\n\t\t\"ibm_dl_gateway\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resource\n}\n\nfunc (g DLGenerator) createDirectLinkVirtualConnectionResources(gatewayID, connectionID, connectionName string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", gatewayID, connectionID),\n\t\tnormalizeResourceName(connectionName, false),\n\t\t\"ibm_dl_virtual_connection\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g DLGenerator) createDirectLinkProviderGatewayResources(providerGatewayID, providerGatewayName string) terraformutils.Resource {\n\tresource := terraformutils.NewSimpleResource(\n\t\tproviderGatewayID,\n\t\tnormalizeResourceName(providerGatewayName, false),\n\t\t\"ibm_dl_provider_gateway\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *DLGenerator) InitResources() error {\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"no API key set\")\n\t}\n\tdlURL := \"https://directlink.cloud.ibm.com/v1\"\n\tdirectlinkOptions := &dl.DirectLinkV1Options{\n\t\tURL: envFallBack([]string{\"IBMCLOUD_DL_API_ENDPOINT\"}, dlURL),\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t},\n\t\tVersion: CreateVersionDate(),\n\t}\n\tdlclient, err := dl.NewDirectLinkV1(directlinkOptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlistGatewaysOptions := &dl.ListGatewaysOptions{}\n\tgateways, response, err := dlclient.ListGateways(listGatewaysOptions)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error Fetching Direct Link Gateways %s\\n%s\", err, response)\n\t}\n\tif gateways.Gateways != nil {\n\t\tfor _, gateway := range gateways.Gateways {\n\t\t\tg.Resources = append(g.Resources, g.createDirectLinkGatewayResources(*gateway.ID, *gateway.Name))\n\t\t\tresourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\t\t\tvar dependsOn []string\n\t\t\tdependsOn = append(dependsOn, \"ibm_dl_gateway.\"+resourceName)\n\t\t\tlistGatewayVirtualConnectionsOptions := &dl.ListGatewayVirtualConnectionsOptions{\n\t\t\t\tGatewayID: gateway.ID,\n\t\t\t}\n\t\t\tconnections, response, err := dlclient.ListGatewayVirtualConnections(listGatewayVirtualConnectionsOptions)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Direct Link Virtual connections %s\\n%s\", err, response)\n\t\t\t}\n\t\t\tfor _, connection := range connections.VirtualConnections {\n\t\t\t\tg.Resources = append(g.Resources, g.createDirectLinkVirtualConnectionResources(*gateway.ID, *connection.ID, *connection.Name, dependsOn))\n\t\t\t}\n\t\t}\n\t}\n\n\tdlproviderURL := \"https://directlink.cloud.ibm.com/provider/v2\"\n\tdlproviderOptions := &dlProviderV2.DirectLinkProviderV2Options{\n\t\tURL: envFallBack([]string{\"IBMCLOUD_DL_PROVIDER_API_ENDPOINT\"}, dlproviderURL),\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t},\n\t\tVersion: CreateVersionDate(),\n\t}\n\tdlproviderclient, err := dlProviderV2.NewDirectLinkProviderV2(dlproviderOptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tallrecs := []dlProviderV2.ProviderGateway{}\n\tfor {\n\t\tlistProviderGatewaysOptions := &dlProviderV2.ListProviderGatewaysOptions{}\n\t\tif start != \"\" {\n\t\t\tlistProviderGatewaysOptions.Start = &start\n\t\t}\n\n\t\tproviderGateways, resp, err := dlproviderclient.ListProviderGateways(listProviderGatewaysOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Listing Direct Link Provider Gateways %s\\n%s\", err, resp)\n\t\t}\n\t\tstart = GetNext(providerGateways.Next)\n\t\tallrecs = append(allrecs, providerGateways.Gateways...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\tfor _, providerGateway := range allrecs {\n\t\tg.Resources = append(g.Resources, g.createDirectLinkProviderGatewayResources(*providerGateway.ID, *providerGateway.Name))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_floating_ip.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// FloatingIPGenerator ...\ntype FloatingIPGenerator struct {\n\tIBMService\n}\n\nfunc (g FloatingIPGenerator) createFloatingIPResources(fipID, fipName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfipID,\n\t\tnormalizeResourceName(fipName, true),\n\t\t\"ibm_is_floating_ip\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\t// Conflict parameters\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^zone$\",\n\t)\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *FloatingIPGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatal(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.FloatingIP\n\tfor {\n\t\toptions := &vpcv1.ListFloatingIpsOptions{}\n\t\tif start != \"\" {\n\t\t\toptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\toptions.ResourceGroupID = &rg\n\t\t}\n\t\tfips, response, err := vpcclient.ListFloatingIps(options)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching Floating IPs %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(fips.Next)\n\t\tallrecs = append(allrecs, fips.FloatingIps...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, fip := range allrecs {\n\t\tif fip.Target != nil {\n\t\t\tg.Resources = append(g.Resources, g.createFloatingIPResources(*fip.ID, *fip.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_flow_log.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// FlowLogGenerator ...\ntype FlowLogGenerator struct {\n\tIBMService\n}\n\nfunc (g FlowLogGenerator) createFlowLogResources(flogID, flogName string) terraformutils.Resource {\n\tresource := terraformutils.NewSimpleResource(\n\t\tflogID,\n\t\tnormalizeResourceName(flogName, false),\n\t\t\"ibm_is_flow_log\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *FlowLogGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatal(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.FlowLogCollector\n\tfor {\n\t\toptions := &vpcv1.ListFlowLogCollectorsOptions{}\n\t\tif start != \"\" {\n\t\t\toptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\toptions.ResourceGroupID = &rg\n\t\t}\n\t\tflogs, response, err := vpcclient.ListFlowLogCollectors(options)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching Flow Logs %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(flogs.Next)\n\t\tallrecs = append(allrecs, flogs.FlowLogCollectors...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, flog := range allrecs {\n\t\tg.Resources = append(g.Resources, g.createFlowLogResources(*flog.ID, *flog.Name))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_ike_policy.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// IkeGenerator ...\ntype IkeGenerator struct {\n\tIBMService\n}\n\nfunc (g IkeGenerator) createIkeResources(ikeID, ikeName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tikeID,\n\t\tnormalizeResourceName(ikeName, false),\n\t\t\"ibm_is_ike_policy\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *IkeGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatal(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.IkePolicy\n\tfor {\n\t\toptions := &vpcv1.ListIkePoliciesOptions{}\n\t\tif start != \"\" {\n\t\t\toptions.Start = &start\n\t\t}\n\t\tpolicies, response, err := vpcclient.ListIkePolicies(options)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching IKE Policies %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(policies.Next)\n\t\tallrecs = append(allrecs, policies.IkePolicies...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, policy := range allrecs {\n\t\tg.Resources = append(g.Resources, g.createIkeResources(*policy.ID, *policy.Name))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_image.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// ImageGenerator ...\ntype ImageGenerator struct {\n\tIBMService\n}\n\nfunc (g ImageGenerator) createImageResources(imageID, imageName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\timageID,\n\t\tnormalizeResourceName(imageName, true),\n\t\t\"ibm_is_image\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *ImageGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatal(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.Image\n\tfor {\n\t\toptions := &vpcv1.ListImagesOptions{}\n\t\tif start != \"\" {\n\t\t\toptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\toptions.ResourceGroupID = &rg\n\t\t}\n\t\timages, response, err := vpcclient.ListImages(options)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching Images %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(images.Next)\n\t\tallrecs = append(allrecs, images.Images...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, image := range allrecs {\n\t\tg.Resources = append(g.Resources, g.createImageResources(*image.ID, *image.Name))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_instance.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// InstanceGenerator ...\ntype InstanceGenerator struct {\n\tIBMService\n}\n\nfunc (g InstanceGenerator) createInstanceResources(instanceID, instanceName, instanceImgID string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tinstanceID,\n\t\tnormalizeResourceName(instanceName, true),\n\t\t\"ibm_is_instance\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"image\": instanceImgID,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"keys\": []string{},\n\t\t})\n\n\t// Deprecated parameters\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^port_speed$\",\n\t\t\"^primary_network_interface.[0-9].port_speed$\",\n\t\t\"^primary_network_interface.[0-9].primary_ip.[0-9].address$\",\n\t\t\"^primary_network_interface.[0-9].primary_ip.[0-9].reserved_ip$\",\n\t)\n\treturn resource\n}\n\nfunc (g InstanceGenerator) createVPCVolumeAttachmentResource(instanceID, volumeAttachedID, volumeAttachedName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", instanceID, volumeAttachedID),\n\t\tnormalizeResourceName(volumeAttachedName, true),\n\t\t\"ibm_is_instance_volume_attachment\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^volume$\",\n\t\t\"^iops$\",\n\t)\n\n\treturn resource\n}\n\nfunc (g InstanceGenerator) createInstanceActionResource(instanceID, instanceStatus string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tinstanceID,\n\t\tnormalizeResourceName(fmt.Sprintf(\"%s_%s\", instanceID, instanceStatus), true),\n\t\t\"ibm_is_instance_action\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"instance\": instanceID,\n\t\t\t\"action\":   getAction(instanceStatus),\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"force_action\": false,\n\t\t})\n\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *InstanceGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.Instance\n\tfor {\n\t\toptions := &vpcv1.ListInstancesOptions{}\n\t\tif start != \"\" {\n\t\t\toptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\toptions.ResourceGroupID = &rg\n\t\t}\n\t\tinstances, response, err := vpcclient.ListInstances(options)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching Instances %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(instances.Next)\n\t\tallrecs = append(allrecs, instances.Instances...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, instance := range allrecs {\n\t\tg.Resources = append(g.Resources, g.createInstanceResources(*instance.ID, *instance.Name, *instance.Image.ID))\n\n\t\tlistVPCInsVolOptions := &vpcv1.ListInstanceVolumeAttachmentsOptions{\n\t\t\tInstanceID: instance.ID,\n\t\t}\n\n\t\tvolumeAtts, response, err := vpcclient.ListInstanceVolumeAttachments(listVPCInsVolOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"fetching vpc Instance volume Attachments %s\\n%s\", err, response)\n\t\t}\n\t\tallrecs := []vpcv1.VolumeAttachment{}\n\t\tallrecs = append(allrecs, volumeAtts.VolumeAttachments...)\n\n\t\tfor _, volumeAtt := range allrecs {\n\t\t\tg.Resources = append(g.Resources, g.createVPCVolumeAttachmentResource(*instance.ID, *volumeAtt.ID, *volumeAtt.Name))\n\t\t}\n\n\t\tg.Resources = append(g.Resources, g.createInstanceActionResource(*instance.ID, *instance.Status))\n\t}\n\treturn nil\n}\n\nfunc (g *InstanceGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"ibm_is_instance_volume_attachment\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, ri := range g.Resources {\n\t\t\tif ri.InstanceInfo.Type != \"ibm_is_instance\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif r.InstanceState.Attributes[\"instance\"] == ri.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"instance\"] = \"${ibm_is_instance.\" + ri.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"ibm_is_instance_action\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, ri := range g.Resources {\n\t\t\tif ri.InstanceInfo.Type != \"ibm_is_instance\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif r.InstanceState.Attributes[\"instance\"] == ri.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"instance\"] = \"${ibm_is_instance.\" + ri.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_instance_template.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// InstanceTemplateGenerator ...\ntype InstanceTemplateGenerator struct {\n\tIBMService\n}\n\nfunc (g InstanceTemplateGenerator) createInstanceTemplateResources(templateID, templateName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\ttemplateID,\n\t\tnormalizeResourceName(templateName, false),\n\t\t\"ibm_is_instance_template\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *InstanceTemplateGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"no API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\toptions := &vpcv1.ListInstanceTemplatesOptions{}\n\ttemplates, response, err := vpcclient.ListInstanceTemplates(options)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error Fetching Instance Templates %s\\n%s\", err, response)\n\t}\n\n\tfor _, template := range templates.Templates {\n\t\tinstemp := template.(*vpcv1.InstanceTemplate)\n\t\tg.Resources = append(g.Resources, g.createInstanceTemplateResources(*instemp.ID, *instemp.Name))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_ipsec_policy.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// IpsecGenerator ...\ntype IpsecGenerator struct {\n\tIBMService\n}\n\nfunc (g IpsecGenerator) createIpsecResources() func(ipsecID, ipsecName string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := false\n\treturn func(ipsecID, ipsecName string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, ipsecName, random)\n\t\tresources := terraformutils.NewSimpleResource(\n\t\t\tipsecID,\n\t\t\tnormalizeResourceName(ipsecName, random),\n\t\t\t\"ibm_is_ipsec_policy\",\n\t\t\t\"ibm\",\n\t\t\t[]string{})\n\t\treturn resources\n\t}\n}\n\n// InitResources ...\nfunc (g *IpsecGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatal(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.IPsecPolicy\n\tfor {\n\t\toptions := &vpcv1.ListIpsecPoliciesOptions{}\n\t\tif start != \"\" {\n\t\t\toptions.Start = &start\n\t\t}\n\t\tpolicies, response, err := vpcclient.ListIpsecPolicies(options)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching IPSEC Policies %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(policies.Next)\n\t\tallrecs = append(allrecs, policies.IpsecPolicies...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfnObjt := g.createIpsecResources()\n\tfor _, policy := range allrecs {\n\t\tg.Resources = append(g.Resources, fnObjt(*policy.ID, *policy.Name))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_lb.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v5/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// LBGenerator ...\ntype LBGenerator struct {\n\tIBMService\n}\n\nfunc (g LBGenerator) createLBResources(lbID, lbName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tlbID,\n\t\tnormalizeResourceName(lbName, true),\n\t\t\"ibm_is_lb\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\t// Deprecated parameters\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^profile$\",\n\t)\n\treturn resource\n}\n\nfunc (g LBGenerator) createLBPoolResources(lbID, lbPoolID, lbPoolName string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", lbID, lbPoolID),\n\t\tnormalizeResourceName(lbPoolName, true),\n\t\t\"ibm_is_lb_pool\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resources\n}\n\nfunc (g LBGenerator) createLBPoolMemberResources(lbID, lbPoolID, lbPoolMemberID, lbPoolMemberName string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s/%s\", lbID, lbPoolID, lbPoolMemberID),\n\t\tnormalizeResourceName(lbPoolMemberName, true),\n\t\t\"ibm_is_lb_pool_member\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resources\n}\n\nfunc (g LBGenerator) createLBListenerResources(lbID, lbListenerID, lbListenerName string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", lbID, lbListenerID),\n\t\tnormalizeResourceName(lbListenerName, true),\n\t\t\"ibm_is_lb_listener\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resources\n}\n\nfunc (g LBGenerator) createLBListenerPolicyResources(lbID, lbListenerID, lbListenerPolicyID, lbListenerPolicyName string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s/%s\", lbID, lbListenerID, lbListenerPolicyID),\n\t\tnormalizeResourceName(lbListenerPolicyName, true),\n\t\t\"ibm_is_lb_listener_policy\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"target_http_status_code\": \"302\",\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resources\n}\n\nfunc (g LBGenerator) createLBListenerPolicyRuleResources(lbID, lbListenerID, lbListenerPolicyID, lbListenerPolicyRuleID, lbListenerPolicyName string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s/%s/%s\", lbID, lbListenerID, lbListenerPolicyID, lbListenerPolicyRuleID),\n\t\tnormalizeResourceName(lbListenerPolicyName, true),\n\t\t\"ibm_is_lb_listener_policy_rule\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *LBGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"no API key set\")\n\t}\n\n\trg := g.Args[\"resource_group\"]\n\tif rg != nil {\n\t\t_ = rg.(string)\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar allrecs []vpcv1.LoadBalancer\n\n\tlistLoadBalancersOptions := &vpcv1.ListLoadBalancersOptions{}\n\tlbs, response, err := vpcclient.ListLoadBalancers(listLoadBalancersOptions)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error Fetching load balancers %s\\n%s\", err, response)\n\t}\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"ibm_is_lb\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\tif len(filters) > 0 {\n\t\tfor _, filter := range filters {\n\t\t\tfor _, lb := range lbs.LoadBalancers {\n\t\t\t\tif *lb.ID == filter {\n\t\t\t\t\tallrecs = append(allrecs, lb)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tallrecs = append(allrecs, lbs.LoadBalancers...)\n\t}\n\n\tfor _, lb := range allrecs {\n\t\tg.Resources = append(g.Resources, g.createLBResources(*lb.ID, *lb.Name))\n\n\t\tlistLoadBalancerPoolsOptions := &vpcv1.ListLoadBalancerPoolsOptions{\n\t\t\tLoadBalancerID: lb.ID,\n\t\t}\n\t\tlbPools, response, err := vpcclient.ListLoadBalancerPools(listLoadBalancerPoolsOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching Load Balancer Pools %s\\n%s\", err, response)\n\t\t}\n\t\tfor _, lbPool := range lbPools.Pools {\n\t\t\tg.Resources = append(g.Resources, g.createLBPoolResources(*lb.ID, *lbPool.ID, *lbPool.Name))\n\t\t\tlistLoadBalancerPoolMembersOptions := &vpcv1.ListLoadBalancerPoolMembersOptions{\n\t\t\t\tLoadBalancerID: lb.ID,\n\t\t\t\tPoolID:         lbPool.ID,\n\t\t\t}\n\t\t\tlbPoolMembers, response, err := vpcclient.ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Load Balancer Pool Members %s\\n%s\", err, response)\n\t\t\t}\n\t\t\tfor _, lbPoolMember := range lbPoolMembers.Members {\n\t\t\t\tg.Resources = append(g.Resources, g.createLBPoolMemberResources(*lb.ID, *lbPool.ID, *lbPoolMember.ID, *lbPool.Name))\n\t\t\t}\n\t\t}\n\n\t\tlistLoadBalancerListenersOptions := &vpcv1.ListLoadBalancerListenersOptions{\n\t\t\tLoadBalancerID: lb.ID,\n\t\t}\n\t\tlbListeners, response, err := vpcclient.ListLoadBalancerListeners(listLoadBalancerListenersOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching Load Balancer Listeners %s\\n%s\", err, response)\n\t\t}\n\t\tfor _, lbListener := range lbListeners.Listeners {\n\t\t\tg.Resources = append(g.Resources, g.createLBListenerResources(*lb.ID, *lbListener.ID, *lbListener.ID))\n\t\t\tlistLoadBalancerListenerPoliciesOptions := &vpcv1.ListLoadBalancerListenerPoliciesOptions{\n\t\t\t\tLoadBalancerID: lb.ID,\n\t\t\t\tListenerID:     lbListener.ID,\n\t\t\t}\n\t\t\tlbListenerPolicies, response, err := vpcclient.ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Load Balancer Listener Policies %s\\n%s\", err, response)\n\t\t\t}\n\t\t\tfor _, lbListenerPolicy := range lbListenerPolicies.Policies {\n\t\t\t\tg.Resources = append(g.Resources, g.createLBListenerPolicyResources(*lb.ID, *lbListener.ID, *lbListenerPolicy.ID, *lbListenerPolicy.Name))\n\t\t\t\tlistLoadBalancerListenerPolicyRulesOptions := &vpcv1.ListLoadBalancerListenerPolicyRulesOptions{\n\t\t\t\t\tLoadBalancerID: lb.ID,\n\t\t\t\t\tListenerID:     lbListener.ID,\n\t\t\t\t\tPolicyID:       lbListenerPolicy.ID,\n\t\t\t\t}\n\t\t\t\tlbListenerPolicyRules, response, err := vpcclient.ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Error Fetching Load Balancer Listener Policy Rules %s\\n%s\", err, response)\n\t\t\t\t}\n\t\t\t\tfor _, lbListenerPolicyRule := range lbListenerPolicyRules.Rules {\n\t\t\t\t\tg.Resources = append(g.Resources, g.createLBListenerPolicyRuleResources(*lb.ID, *lbListener.ID, *lbListenerPolicy.ID, *lbListenerPolicyRule.ID, *lbListenerPolicyRule.ID))\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *LBGenerator) PostConvertHook() error {\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"ibm_is_lb\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor i, pool := range g.Resources {\n\t\t\tif pool.InstanceInfo.Type != \"ibm_is_lb_pool\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif pool.InstanceState.Attributes[\"lb\"] == r.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"lb\"] = \"${ibm_is_lb.\" + r.ResourceName + \".id}\"\n\t\t\t}\n\t\t\tfor i, poolMember := range g.Resources {\n\t\t\t\tif poolMember.InstanceInfo.Type != \"ibm_is_lb_pool_member\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tpoolID := strings.Split(pool.InstanceState.Attributes[\"id\"], \"/\")[1]\n\t\t\t\tif poolMember.InstanceState.Attributes[\"pool\"] == poolID {\n\t\t\t\t\tg.Resources[i].Item[\"pool\"] = \"${ibm_is_lb_pool.\" + pool.ResourceName + \".id}\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor i, poolMember := range g.Resources {\n\t\t\tif poolMember.InstanceInfo.Type != \"ibm_is_lb_pool_member\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif poolMember.InstanceState.Attributes[\"lb\"] == r.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"lb\"] = \"${ibm_is_lb.\" + r.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\n\t\tfor i, listener := range g.Resources {\n\t\t\tif listener.InstanceInfo.Type != \"ibm_is_lb_listener\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif listener.InstanceState.Attributes[\"lb\"] == r.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"lb\"] = \"${ibm_is_lb.\" + r.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\n\t\tfor i, listenerPolicy := range g.Resources {\n\t\t\tif listenerPolicy.InstanceInfo.Type != \"ibm_is_lb_listener_policy\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif listenerPolicy.InstanceState.Attributes[\"lb\"] == r.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"lb\"] = \"${ibm_is_lb.\" + r.ResourceName + \".id}\"\n\t\t\t}\n\t\t\tfor i, listenerPolicyRule := range g.Resources {\n\t\t\t\tif listenerPolicyRule.InstanceInfo.Type != \"ibm_is_lb_listener_policy_rule\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif listenerPolicyRule.InstanceState.Attributes[\"listener\"] == listenerPolicy.InstanceState.Attributes[\"id\"] {\n\t\t\t\t\tg.Resources[i].Item[\"listener\"] = \"${ibm_is_lb_listener_policy.\" + listenerPolicy.ResourceName + \".id}\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor i, listenerPolicyRule := range g.Resources {\n\t\t\tif listenerPolicyRule.InstanceInfo.Type != \"ibm_is_lb_listener_policy_rule\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif listenerPolicyRule.InstanceState.Attributes[\"lb\"] == r.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"lb\"] = \"${ibm_is_lb.\" + r.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_network_acl.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// NetworkACLGenerator ...\ntype NetworkACLGenerator struct {\n\tIBMService\n}\n\nfunc (g NetworkACLGenerator) createNetworkACLResources(nwaclID, nwaclName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tnwaclID,\n\t\tnormalizeResourceName(nwaclName, true),\n\t\t\"ibm_is_network_acl\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *NetworkACLGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatal(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.NetworkACL\n\tfor {\n\t\toptions := &vpcv1.ListNetworkAclsOptions{}\n\t\tif start != \"\" {\n\t\t\toptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\toptions.ResourceGroupID = &rg\n\t\t}\n\t\tnwacls, response, err := vpcclient.ListNetworkAcls(options)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching Network ACLs %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(nwacls.Next)\n\t\tallrecs = append(allrecs, nwacls.NetworkAcls...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, nwacl := range allrecs {\n\t\tg.Resources = append(g.Resources, g.createNetworkACLResources(*nwacl.ID, *nwacl.Name))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_public_gateway.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// PublicGatewayGenerator ...\ntype PublicGatewayGenerator struct {\n\tIBMService\n}\n\nfunc (g PublicGatewayGenerator) createPublicGatewayResources(publicGatewayID, publicGatewayName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tpublicGatewayID,\n\t\tnormalizeResourceName(publicGatewayName, false),\n\t\t\"ibm_is_public_gateway\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *PublicGatewayGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatal(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.PublicGateway\n\tfor {\n\t\toptions := &vpcv1.ListPublicGatewaysOptions{}\n\t\tif start != \"\" {\n\t\t\toptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\toptions.ResourceGroupID = &rg\n\t\t}\n\t\tpgs, response, err := vpcclient.ListPublicGateways(options)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching Public Gateways %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(pgs.Next)\n\t\tallrecs = append(allrecs, pgs.PublicGateways...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, pg := range allrecs {\n\t\tg.Resources = append(g.Resources, g.createPublicGatewayResources(*pg.ID, *pg.Name))\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_security_group.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"reflect\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// SecurityGroupGenerator ...\ntype SecurityGroupGenerator struct {\n\tIBMService\n}\n\nfunc (g SecurityGroupGenerator) createSecurityGroupResources(sgID, sgName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tsgID,\n\t\tnormalizeResourceName(sgName, true),\n\t\t\"ibm_is_security_group\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\nfunc (g SecurityGroupGenerator) createSecurityGroupRuleResources(sgID, sgRuleID string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s.%s\", sgID, sgRuleID),\n\t\tnormalizeResourceName(sgRuleID, false),\n\t\t\"ibm_is_security_group_rule\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *SecurityGroupGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstart := \"\"\n\tvar allrecs []vpcv1.SecurityGroup\n\tfor {\n\t\toptions := &vpcv1.ListSecurityGroupsOptions{}\n\t\tif start != \"\" {\n\t\t\toptions.Start = &start\n\t\t}\n\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\toptions.ResourceGroupID = &rg\n\t\t}\n\n\t\tsgs, response, err := vpcclient.ListSecurityGroups(options)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching security Groups %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(sgs.Next)\n\t\tallrecs = append(allrecs, sgs.SecurityGroups...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, group := range allrecs {\n\t\tg.Resources = append(g.Resources, g.createSecurityGroupResources(*group.ID, *group.Name))\n\t\tlistSecurityGroupRulesOptions := &vpcv1.ListSecurityGroupRulesOptions{\n\t\t\tSecurityGroupID: group.ID,\n\t\t}\n\t\trules, response, err := vpcclient.ListSecurityGroupRules(listSecurityGroupRulesOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching security group rules %s\\n%s\", err, response)\n\t\t}\n\t\tfor _, sgrule := range rules.Rules {\n\t\t\tswitch reflect.TypeOf(sgrule).String() {\n\t\t\tcase \"*vpcv1.SecurityGroupRuleSecurityGroupRuleProtocolIcmp\":\n\t\t\t\t{\n\t\t\t\t\trule := sgrule.(*vpcv1.SecurityGroupRuleSecurityGroupRuleProtocolIcmp)\n\t\t\t\t\tg.Resources = append(g.Resources, g.createSecurityGroupRuleResources(*group.ID, *rule.ID))\n\t\t\t\t}\n\n\t\t\tcase \"*vpcv1.SecurityGroupRuleSecurityGroupRuleProtocolAll\":\n\t\t\t\t{\n\t\t\t\t\trule := sgrule.(*vpcv1.SecurityGroupRuleSecurityGroupRuleProtocolAll)\n\t\t\t\t\tg.Resources = append(g.Resources, g.createSecurityGroupRuleResources(*group.ID, *rule.ID))\n\t\t\t\t}\n\n\t\t\tcase \"*vpcv1.SecurityGroupRuleSecurityGroupRuleProtocolTcpudp\":\n\t\t\t\t{\n\t\t\t\t\trule := sgrule.(*vpcv1.SecurityGroupRuleSecurityGroupRuleProtocolTcpudp)\n\t\t\t\t\tg.Resources = append(g.Resources, g.createSecurityGroupRuleResources(*group.ID, *rule.ID))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *SecurityGroupGenerator) PostConvertHook() error {\n\tfor i, rule := range g.Resources {\n\t\tif rule.InstanceInfo.Type != \"ibm_is_security_group_rule\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, sg := range g.Resources {\n\t\t\tif sg.InstanceInfo.Type != \"ibm_is_security_group\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif rule.InstanceState.Attributes[\"group\"] == sg.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"group\"] = \"${ibm_is_security_group.\" + sg.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_ssh_key.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// SSHKeyGenerator ...\ntype SSHKeyGenerator struct {\n\tIBMService\n}\n\nfunc (g SSHKeyGenerator) createSSHKeyResources(sshKeyID, sshKeyName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tsshKeyID,\n\t\tnormalizeResourceName(sshKeyName, true),\n\t\t\"ibm_is_ssh_key\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *SSHKeyGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatal(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\toptions := &vpcv1.ListKeysOptions{}\n\tkeys, response, err := vpcclient.ListKeys(options)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error Fetching SSH Keys %s\\n%s\", err, response)\n\t}\n\n\tfor _, key := range keys.Keys {\n\t\tg.Resources = append(g.Resources, g.createSSHKeyResources(*key.ID, *key.Name))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_subnet.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// SubnetGenerator ...\ntype SubnetGenerator struct {\n\tIBMService\n}\n\nfunc (g SubnetGenerator) createSubnetResources(subnetID, subnetName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tsubnetID,\n\t\tnormalizeResourceName(subnetName, true),\n\t\t\"ibm_is_subnet\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^total_ipv4_address_count$\",\n\t)\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *SubnetGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.VPC\n\tfor {\n\t\tlistVpcsOptions := &vpcv1.ListVpcsOptions{}\n\t\tif start != \"\" {\n\t\t\tlistVpcsOptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\tlistVpcsOptions.ResourceGroupID = &rg\n\t\t}\n\t\tvpcs, response, err := vpcclient.ListVpcs(listVpcsOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching vpcs %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(vpcs.Next)\n\t\tallrecs = append(allrecs, vpcs.Vpcs...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, vpc := range allrecs {\n\t\tstart = \"\"\n\t\tvar allSubNetRecs []vpcv1.Subnet\n\t\tfor {\n\t\t\toptions := &vpcv1.ListSubnetsOptions{}\n\t\t\tif start != \"\" {\n\t\t\t\toptions.Start = &start\n\t\t\t}\n\n\t\t\tsubnets, response, err := vpcclient.ListSubnets(options)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching subnets %s\\n%s\", err, response)\n\t\t\t}\n\t\t\tstart = GetNext(subnets.Next)\n\t\t\tallSubNetRecs = append(allSubNetRecs, subnets.Subnets...)\n\t\t\tif start == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tfor _, subnet := range allSubNetRecs {\n\t\t\tif *vpc.ID == *subnet.VPC.ID {\n\t\t\t\tg.Resources = append(g.Resources, g.createSubnetResources(*subnet.ID, *subnet.Name))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_virtual_endpoint_gateway.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// VPEGenerator ...\ntype VPEGenerator struct {\n\tIBMService\n}\n\nfunc (g VPEGenerator) createVPEGatewayResources(gatewayID, gatewayName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tgatewayID,\n\t\tnormalizeResourceName(gatewayName, false),\n\t\t\"ibm_is_virtual_endpoint_gateway\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\nfunc (g VPEGenerator) createVPEGatewayIPResources(gatewayID, gatewayIPID, gatewayIPName string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", gatewayID, gatewayIPID),\n\t\tnormalizeResourceName(gatewayIPName, false),\n\t\t\"ibm_is_virtual_endpoint_gateway_ip\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *VPEGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstart := \"\"\n\tallrecs := []vpcv1.EndpointGateway{}\n\tfor {\n\t\tlistEndpointGatewaysOptions := &vpcv1.ListEndpointGatewaysOptions{}\n\t\tif start != \"\" {\n\t\t\tlistEndpointGatewaysOptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\tlistEndpointGatewaysOptions.ResourceGroupID = &rg\n\t\t}\n\t\tgateways, response, err := vpcclient.ListEndpointGateways(listEndpointGatewaysOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching endpoint gateways %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(gateways.Next)\n\t\tallrecs = append(allrecs, gateways.EndpointGateways...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, gateway := range allrecs {\n\t\tstart := \"\"\n\t\tallrecs := []vpcv1.ReservedIP{}\n\t\tg.Resources = append(g.Resources, g.createVPEGatewayResources(*gateway.ID, *gateway.Name))\n\t\tlistEndpointGatewayIpsOptions := &vpcv1.ListEndpointGatewayIpsOptions{\n\t\t\tEndpointGatewayID: gateway.ID,\n\t\t}\n\t\tif start != \"\" {\n\t\t\tlistEndpointGatewayIpsOptions.Start = &start\n\t\t}\n\t\tips, response, err := vpcclient.ListEndpointGatewayIps(listEndpointGatewayIpsOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching endpoint gateway ips %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(ips.Next)\n\t\tallrecs = append(allrecs, ips.Ips...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tfor _, ip := range allrecs {\n\t\t\tg.Resources = append(g.Resources, g.createVPEGatewayIPResources(*gateway.ID, *ip.ID, *ip.Name))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *VPEGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"ibm_is_virtual_endpoint_gateway\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, gIP := range g.Resources {\n\t\t\tif gIP.InstanceInfo.Type != \"ibm_is_virtual_endpoint_gateway_ip\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif gIP.InstanceState.Attributes[\"gateway\"] == r.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"gateway\"] = \"${ibm_is_virtual_endpoint_gateway.\" + r.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_volume.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// VolumeGenerator ...\ntype VolumeGenerator struct {\n\tIBMService\n}\n\nfunc (g VolumeGenerator) createVolumeResources(volID, volName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tvolID,\n\t\tnormalizeResourceName(volName, true),\n\t\t\"ibm_is_volume\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *VolumeGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\tlog.Fatal(\"No API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.Volume\n\tfor {\n\t\toptions := &vpcv1.ListVolumesOptions{}\n\t\tif start != \"\" {\n\t\t\toptions.Start = &start\n\t\t}\n\t\tvolumes, response, err := vpcclient.ListVolumes(options)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching Volumes %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(volumes.Next)\n\t\tallrecs = append(allrecs, volumes.Volumes...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, volume := range allrecs {\n\t\tg.Resources = append(g.Resources, g.createVolumeResources(*volume.ID, *volume.Name))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_vpc.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// VPCGenerator ...\ntype VPCGenerator struct {\n\tIBMService\n}\n\nfunc (g VPCGenerator) createVPCResources(vpcID, vpcName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tvpcID,\n\t\tnormalizeResourceName(vpcName, false),\n\t\t\"ibm_is_vpc\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\t// Deprecated parameters\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^default_network_acl$\",\n\t)\n\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *VPCGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"no API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.VPC\n\tfor {\n\t\tlistVpcsOptions := &vpcv1.ListVpcsOptions{}\n\t\tif start != \"\" {\n\t\t\tlistVpcsOptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\tlistVpcsOptions.ResourceGroupID = &rg\n\t\t}\n\t\tvpcs, response, err := vpcclient.ListVpcs(listVpcsOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching vpcs %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(vpcs.Next)\n\t\tallrecs = append(allrecs, vpcs.Vpcs...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, vpc := range allrecs {\n\t\tg.Resources = append(g.Resources, g.createVPCResources(*vpc.ID, *vpc.Name))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_vpc_address_prefix.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// VPCGenerator ...\ntype VPCAddressPrefixGenerator struct {\n\tIBMService\n}\n\nfunc (g VPCAddressPrefixGenerator) createVPCAddressPrefixResources(vpcID, addPrefixID, addPrefixName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", vpcID, addPrefixID),\n\t\tnormalizeResourceName(addPrefixName, false),\n\t\t\"ibm_is_vpc_address_prefix\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *VPCAddressPrefixGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"no API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.VPC\n\tfor {\n\t\tlistVpcsOptions := &vpcv1.ListVpcsOptions{}\n\t\tif start != \"\" {\n\t\t\tlistVpcsOptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\tlistVpcsOptions.ResourceGroupID = &rg\n\t\t}\n\t\tvpcs, response, err := vpcclient.ListVpcs(listVpcsOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching vpcs %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(vpcs.Next)\n\t\tallrecs = append(allrecs, vpcs.Vpcs...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, vpc := range allrecs {\n\n\t\t// address prefix\n\t\tlistVPCAddressPrefixesOptions := &vpcv1.ListVPCAddressPrefixesOptions{\n\t\t\tVPCID: vpc.ID,\n\t\t}\n\t\taddprefixes, response, err := vpcclient.ListVPCAddressPrefixes(listVPCAddressPrefixesOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching vpc address prefixes %s\\n%s\", err, response)\n\t\t}\n\t\tfor _, addprefix := range addprefixes.AddressPrefixes {\n\t\t\tg.Resources = append(g.Resources, g.createVPCAddressPrefixResources(*vpc.ID, *addprefix.ID, *addprefix.Name))\n\n\t\t}\n\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_vpc_route.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// VPCRouteGenerator ...\ntype VPCRouteGenerator struct {\n\tIBMService\n}\n\nfunc (g VPCRouteGenerator) loadVPCRouteResources(vpcID, routeID, routeName string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", vpcID, routeID),\n\t\tnormalizeResourceName(routeName, false),\n\t\t\"ibm_is_vpc_route\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *VPCRouteGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"no API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.VPC\n\tfor {\n\t\tlistVpcsOptions := &vpcv1.ListVpcsOptions{}\n\t\tif start != \"\" {\n\t\t\tlistVpcsOptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\tlistVpcsOptions.ResourceGroupID = &rg\n\t\t}\n\t\tvpcs, response, err := vpcclient.ListVpcs(listVpcsOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching vpcs %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(vpcs.Next)\n\t\tallrecs = append(allrecs, vpcs.Vpcs...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, vpc := range allrecs {\n\t\tlistVPCRoutesOptions := &vpcv1.ListVPCRoutesOptions{\n\t\t\tVPCID: vpc.ID,\n\t\t}\n\t\troutes, response, err := vpcclient.ListVPCRoutes(listVPCRoutesOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching vpc routes %s\\n%s\", err, response)\n\t\t}\n\t\tfor _, route := range routes.Routes {\n\t\t\tg.Resources = append(g.Resources, g.loadVPCRouteResources(*vpc.ID, *route.ID, *route.Name))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_vpc_routing_table.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// VPCGenerator ...\ntype VPCRoutingTableGenerator struct {\n\tIBMService\n}\n\nfunc (g VPCRoutingTableGenerator) loadVPCRouteTableResources(vpcID, routeTableID, routeTableName string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", vpcID, routeTableID),\n\t\tnormalizeResourceName(routeTableName, false),\n\t\t\"ibm_is_vpc_routing_table\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\treturn resources\n}\n\nfunc (g VPCRoutingTableGenerator) loadVPCRouteTableRouteResources(vpcID, routeTableID, routeTableRouteID, routeTableRouteName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s/%s\", vpcID, routeTableID, routeTableRouteID),\n\t\tnormalizeResourceName(routeTableRouteName, false),\n\t\t\"ibm_is_vpc_routing_table_route\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"routing_table\": routeTableID,\n\t\t\t\"action\":        \"deliver\",\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\t// Deprecated parameters\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^action$\",\n\t)\n\treturn resource\n}\n\n// InitResources ...\nfunc (g *VPCRoutingTableGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"no API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.VPC\n\tfor {\n\t\tlistVpcsOptions := &vpcv1.ListVpcsOptions{}\n\t\tif start != \"\" {\n\t\t\tlistVpcsOptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\tlistVpcsOptions.ResourceGroupID = &rg\n\t\t}\n\t\tvpcs, response, err := vpcclient.ListVpcs(listVpcsOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching vpcs %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(vpcs.Next)\n\t\tallrecs = append(allrecs, vpcs.Vpcs...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, vpc := range allrecs {\n\n\t\t// routing table\n\t\tlistVPCRoutingTablesOptions := &vpcv1.ListVPCRoutingTablesOptions{\n\t\t\tVPCID: vpc.ID,\n\t\t}\n\t\ttables, response, err := vpcclient.ListVPCRoutingTables(listVPCRoutingTablesOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching vpc routing tables %s\\n%s\", err, response)\n\t\t}\n\t\tfor _, table := range tables.RoutingTables {\n\t\t\tg.Resources = append(g.Resources, g.loadVPCRouteTableResources(*vpc.ID, *table.ID, *table.Name))\n\t\t\tlistVPCRoutingTableRoutesOptions := &vpcv1.ListVPCRoutingTableRoutesOptions{\n\t\t\t\tVPCID:          vpc.ID,\n\t\t\t\tRoutingTableID: table.ID,\n\t\t\t}\n\t\t\ttableroutes, response, err := vpcclient.ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching vpc route table routes %s\\n%s\", err, response)\n\t\t\t}\n\t\t\tfor _, tableroute := range tableroutes.Routes {\n\t\t\t\tg.Resources = append(g.Resources, g.loadVPCRouteTableRouteResources(*vpc.ID, *table.ID, *tableroute.ID, *tableroute.Name))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *VPCRoutingTableGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"ibm_is_vpc_routing_table_route\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, rt := range g.Resources {\n\t\t\tif rt.InstanceInfo.Type != \"ibm_is_vpc_routing_table\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif r.InstanceState.Attributes[\"routing_table\"] == rt.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"routing_table\"] = \"${ibm_is_vpc_routing_table.\" + rt.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_is_vpn_gateway.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// VPNGatewayGenerator ...\ntype VPNGatewayGenerator struct {\n\tIBMService\n}\n\nfunc (g VPNGatewayGenerator) createVPNGatewayResources(vpngwID, vpngwName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tvpngwID,\n\t\tnormalizeResourceName(vpngwName, false),\n\t\t\"ibm_is_vpn_gateway\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\nfunc (g VPNGatewayGenerator) createVPNGatewayConnectionResources(vpngwID, vpngwConnectionID, vpngwConnectionName string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", vpngwID, vpngwConnectionID),\n\t\tnormalizeResourceName(vpngwConnectionName, false),\n\t\t\"ibm_is_vpn_gateway_connection\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resources\n}\n\n// InitResources ...\nfunc (g *VPNGatewayGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"no API key set\")\n\t}\n\n\tisURL := GetVPCEndPoint(region)\n\tiamURL := GetAuthEndPoint()\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: isURL,\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t\tURL:    iamURL,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tvar allrecs []vpcv1.VPNGatewayIntf\n\tfor {\n\t\tlistVPNGatewaysOptions := &vpcv1.ListVPNGatewaysOptions{}\n\t\tif start != \"\" {\n\t\t\tlistVPNGatewaysOptions.Start = &start\n\t\t}\n\t\tif rg := g.Args[\"resource_group\"].(string); rg != \"\" {\n\t\t\trg, err = GetResourceGroupID(apiKey, rg, region)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error Fetching Resource Group Id %s\", err)\n\t\t\t}\n\t\t\tlistVPNGatewaysOptions.ResourceGroupID = &rg\n\t\t}\n\t\tvpngws, response, err := vpcclient.ListVPNGateways(listVPNGatewaysOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching VPN Gateways %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(vpngws.Next)\n\t\tallrecs = append(allrecs, vpngws.VPNGateways...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tfor _, gw := range allrecs {\n\t\tvpngw := gw.(*vpcv1.VPNGateway)\n\t\tg.Resources = append(g.Resources, g.createVPNGatewayResources(*vpngw.ID, *vpngw.Name))\n\t\tlistVPNGatewayConnectionsOptions := &vpcv1.ListVPNGatewayConnectionsOptions{\n\t\t\tVPNGatewayID: vpngw.ID,\n\t\t}\n\t\tvpngwConnections, response, err := vpcclient.ListVPNGatewayConnections(listVPNGatewayConnectionsOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching VPN Gateway Connections %s\\n%s\", err, response)\n\t\t}\n\t\tfor _, connection := range vpngwConnections.Connections {\n\t\t\tvpngwConnection := connection.(*vpcv1.VPNGatewayConnection)\n\t\t\tg.Resources = append(g.Resources, g.createVPNGatewayConnectionResources(*vpngw.ID, *vpngwConnection.ID, *vpngwConnection.Name))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *VPNGatewayGenerator) PostConvertHook() error {\n\tfor i, con := range g.Resources {\n\t\tif con.InstanceInfo.Type != \"ibm_is_vpn_gateway_connection\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, vpn := range g.Resources {\n\t\t\tif vpn.InstanceInfo.Type != \"ibm_is_vpn_gateway\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif con.InstanceState.Attributes[\"vpn_gateway\"] == vpn.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"vpn_gateway\"] = \"${ibm_is_vpn_gateway.\" + vpn.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_kp.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n\tkp \"github.com/IBM/keyprotect-go-client\"\n)\n\ntype KPGenerator struct {\n\tIBMService\n}\n\nfunc (g KPGenerator) loadKP() func(kpID, kpName string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := true\n\treturn func(kpID, kpName string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, kpName, random)\n\t\tresource := terraformutils.NewSimpleResource(\n\t\t\tkpID,\n\t\t\tnormalizeResourceName(kpName, random),\n\t\t\t\"ibm_resource_instance\",\n\t\t\t\"ibm\",\n\t\t\t[]string{})\n\t\treturn resource\n\t}\n}\n\nfunc (g KPGenerator) loadkPKeys() func(kpKeyCRN, kpKeyName string, dependsOn []string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := true\n\treturn func(kpKeyCRN, kpKeyName string, dependsOn []string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, kpKeyName, random)\n\t\tresource := terraformutils.NewResource(\n\t\t\tkpKeyCRN,\n\t\t\tnormalizeResourceName(kpKeyName, random),\n\t\t\t\"ibm_kms_key\",\n\t\t\t\"ibm\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"depends_on\": dependsOn,\n\t\t\t})\n\t\treturn resource\n\t}\n}\n\nfunc (g KPGenerator) loadkPKeyAliases() func(kpKeyCRN, kpKeyAlias string, dependsOn []string) terraformutils.Resource {\n\treturn func(kpKeyCRN, kpKeyAlias string, dependsOn []string) terraformutils.Resource {\n\t\tresource := terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s:alias:%s\", kpKeyAlias, kpKeyCRN),\n\t\t\tnormalizeResourceName(kpKeyAlias, true),\n\t\t\t\"ibm_kms_key_alias\",\n\t\t\t\"ibm\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"depends_on\": dependsOn,\n\t\t\t})\n\t\treturn resource\n\t}\n}\n\nfunc (g KPGenerator) loadKpKeyPolicies() func(kpKeyCRN string, dependsOn []string) terraformutils.Resource {\n\treturn func(kpKeyCRN string, dependsOn []string) terraformutils.Resource {\n\t\tresource := terraformutils.NewResource(\n\t\t\tkpKeyCRN,\n\t\t\tnormalizeResourceName(\"kp_policies\", true),\n\t\t\t\"ibm_kms_key_policies\",\n\t\t\t\"ibm\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"depends_on\": dependsOn,\n\t\t\t})\n\t\treturn resource\n\t}\n}\n\nfunc (g *KPGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"kms\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tkpInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\tkpurl := fmt.Sprintf(\"https://%s.kms.cloud.ibm.com\", region)\n\toptions := kp.ClientConfig{\n\t\tBaseURL: envFallBack([]string{\"IBMCLOUD_KP_API_ENDPOINT\"}, kpurl),\n\t\tAPIKey:  os.Getenv(\"IC_API_KEY\"),\n\t\tVerbose: kp.VerboseFailOnly,\n\t}\n\n\tclient, err := kp.New(options, kp.DefaultTransport())\n\tif err != nil {\n\t\treturn err\n\t}\n\tfnObjt := g.loadKP()\n\tfor _, kpInstance := range kpInstances {\n\t\tg.Resources = append(g.Resources, fnObjt(kpInstance.ID, kpInstance.Name))\n\t\tresourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\t\tclient.Config.InstanceID = kpInstance.Guid\n\n\t\toutput, err := client.GetKeys(context.Background(), 100, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfnObjt := g.loadkPKeys()\n\t\tfor _, key := range output.Keys {\n\t\t\tvar dependsOn []string\n\t\t\tdependsOn = append(dependsOn,\n\t\t\t\t\"ibm_resource_instance.\"+resourceName)\n\t\t\tg.Resources = append(g.Resources, fnObjt(key.CRN, key.Name, dependsOn))\n\t\t\tresourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\n\t\t\tfnObjt := g.loadkPKeyAliases()\n\t\t\tdependsOn = append(dependsOn,\n\t\t\t\t\"ibm_kms_key.\"+resourceName)\n\t\t\tfor _, alias := range key.Aliases {\n\t\t\t\tg.Resources = append(g.Resources, fnObjt(key.CRN, alias, dependsOn))\n\t\t\t}\n\n\t\t\tpolicies, _ := client.GetPolicies(context.Background(), key.ID)\n\t\t\tfunObjt := g.loadKpKeyPolicies()\n\t\t\tfor range policies {\n\t\t\t\tg.Resources = append(g.Resources, funObjt(key.CRN, dependsOn))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *KPGenerator) PostConvertHook() error {\n\tfor i, rk := range g.Resources {\n\t\tif rk.InstanceInfo.Type != \"ibm_kms_key\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, ri := range g.Resources {\n\t\t\tif ri.InstanceInfo.Type != \"ibm_resource_instance\" {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif rk.InstanceState.Attributes[\"instance_id\"] == ri.InstanceState.Attributes[\"guid\"] {\n\t\t\t\tg.Resources[i].Item[\"instance_id\"] = \"${ibm_resource_instance.\" + ri.ResourceName + \".guid}\"\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i, ra := range g.Resources {\n\t\tif ra.InstanceInfo.Type != \"ibm_kms_key_alias\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, rk := range g.Resources {\n\t\t\tif rk.InstanceInfo.Type != \"ibm_kms_key\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ra.InstanceState.Attributes[\"instance_id\"] == rk.InstanceState.Attributes[\"instance_id\"] && ra.InstanceState.Attributes[\"key_id\"] == rk.InstanceState.Attributes[\"key_id\"] {\n\t\t\t\tg.Resources[i].Item[\"instance_id\"] = \"${ibm_kms_key.\" + rk.ResourceName + \".instance_id}\"\n\t\t\t\tg.Resources[i].Item[\"key_id\"] = \"${ibm_kms_key.\" + rk.ResourceName + \".key_id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i, rp := range g.Resources {\n\t\tif rp.InstanceInfo.Type != \"ibm_kms_key_policies\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, rk := range g.Resources {\n\t\t\tif rk.InstanceInfo.Type != \"ibm_kms_key\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif rp.InstanceState.Attributes[\"instance_id\"] == rk.InstanceState.Attributes[\"instance_id\"] && rp.InstanceState.Attributes[\"key_id\"] == rk.InstanceState.Attributes[\"key_id\"] {\n\t\t\t\tg.Resources[i].Item[\"instance_id\"] = \"${ibm_kms_key.\" + rk.ResourceName + \".instance_id}\"\n\t\t\t\tg.Resources[i].Item[\"key_id\"] = \"${ibm_kms_key.\" + rk.ResourceName + \".key_id}\"\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_private_dns.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n\t\"github.com/IBM/go-sdk-core/v3/core\"\n\tdns \"github.com/IBM/networking-go-sdk/dnssvcsv1\"\n)\n\n// privateDNSTemplateGenerator ...\ntype privateDNSTemplateGenerator struct {\n\tIBMService\n}\n\n// loadPrivateDNS ...\nfunc (g privateDNSTemplateGenerator) loadPrivateDNS() func(pDNSID, pDNSName, resGrpID string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := true\n\treturn func(pDNSID, pDNSName, resGrpID string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, pDNSName, random)\n\t\tresource := terraformutils.NewResource(\n\t\t\tpDNSID,\n\t\t\tnormalizeResourceName(pDNSName, random),\n\t\t\t\"ibm_resource_instance\",\n\t\t\t\"ibm\",\n\t\t\tmap[string]string{\n\t\t\t\t\"resource_group_id\": resGrpID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{})\n\t\treturn resource\n\t}\n}\n\n// loadPrivateDNSZone ...\nfunc (g privateDNSTemplateGenerator) loadPrivateDNSZone(pDNSGuid string, zoneID string, dependsOn []string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", pDNSGuid, zoneID),\n\t\tnormalizeResourceName(\"ibm_dns_zone\", true),\n\t\t\"ibm_dns_zone\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resources\n}\n\n// loadPrivateDNSPermittedNetwork ...\nfunc (g privateDNSTemplateGenerator) loadPrivateDNSPermittedNetwork(pDNSGuid string, zoneID string, permittedNetworkID string, dependsOn []string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s/%s\", pDNSGuid, zoneID, permittedNetworkID),\n\t\tnormalizeResourceName(\"ibm_dns_permitted_network\", true),\n\t\t\"ibm_dns_permitted_network\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resources\n}\n\n// loadPrivateDNSResourceRecord ...\nfunc (g privateDNSTemplateGenerator) loadPrivateDNSResourceRecord() func(pDNSGuid, zoneID, recordID, recordName string, dependsOn []string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := true\n\treturn func(pDNSGuid, zoneID, recordID, recordName string, dependsOn []string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, recordName, random)\n\t\tresources := terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s/%s/%s\", pDNSGuid, zoneID, recordID),\n\t\t\tnormalizeResourceName(recordName, random),\n\t\t\t\"ibm_dns_resource_record\",\n\t\t\t\"ibm\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"depends_on\": dependsOn,\n\t\t\t})\n\t\treturn resources\n\t}\n}\n\n// loadPrivateDNSGLBMonitor ...\nfunc (g privateDNSTemplateGenerator) loadPrivateDNSGLBMonitor() func(pDNSGuid, monitorID, monitorName string, dependsOn []string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := false\n\treturn func(pDNSGuid, monitorID, monitorName string, dependsOn []string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, monitorName, random)\n\t\tresources := terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s/%s\", pDNSGuid, monitorID),\n\t\t\tnormalizeResourceName(monitorName, random),\n\t\t\t\"ibm_dns_glb_monitor\",\n\t\t\t\"ibm\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"depends_on\": dependsOn,\n\t\t\t})\n\t\treturn resources\n\t}\n}\n\n// loadPrivateDNSGLBPool ...\nfunc (g privateDNSTemplateGenerator) loadPrivateDNSGLBPool() func(pDNSGuid, poolID, poolName string, dependsOn []string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := false\n\treturn func(pDNSGuid, poolID, poolName string, dependsOn []string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, poolName, random)\n\t\tresources := terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s/%s\", pDNSGuid, poolID),\n\t\t\tnormalizeResourceName(poolName, random),\n\t\t\t\"ibm_dns_glb_pool\",\n\t\t\t\"ibm\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"depends_on\": dependsOn,\n\t\t\t})\n\t\treturn resources\n\t}\n}\n\n// loadPrivateDNSGLB ...\nfunc (g privateDNSTemplateGenerator) loadPrivateDNSGLB() func(pDNSGuid, zoneID, lbID, lbName string, dependsOn []string) terraformutils.Resource {\n\tnames := make(map[string]struct{})\n\trandom := false\n\treturn func(pDNSGuid, zoneID, lbID, lbName string, dependsOn []string) terraformutils.Resource {\n\t\tnames, random = getRandom(names, lbName, random)\n\t\tresources := terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s/%s/%s\", pDNSGuid, zoneID, lbID),\n\t\t\tnormalizeResourceName(lbName, random),\n\t\t\t\"ibm_dns_glb\",\n\t\t\t\"ibm\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{\n\t\t\t\t\"depends_on\": dependsOn,\n\t\t\t})\n\t\treturn resources\n\t}\n}\n\n// InitResources ...\nfunc (g *privateDNSTemplateGenerator) InitResources() error {\n\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t\tRegion:        region,\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefaultDNSURL := \"https://api.dns-svcs.cloud.ibm.com/v1\"\n\n\terr = authenticateAPIKey(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbluemixToken := \"\"\n\tif strings.HasPrefix(sess.Config.IAMAccessToken, \"Bearer\") {\n\t\tbluemixToken = sess.Config.IAMAccessToken[7:len(sess.Config.IAMAccessToken)]\n\t} else {\n\t\tbluemixToken = sess.Config.IAMAccessToken\n\t}\n\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"dns-svcs\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\tpDNSInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, instance := range pDNSInstances {\n\t\tinstanceID := instance.ID\n\t\tinstanceGUID := instance.Guid\n\t\t// Instance\n\t\tfnObjt := g.loadPrivateDNS()\n\t\tg.Resources = append(g.Resources, fnObjt(instanceID, instance.Name, instance.ResourceGroupID))\n\t\tresourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\t\tvar pDNSDependsOn []string\n\t\tpDNSDependsOn = append(pDNSDependsOn,\n\t\t\t\"ibm_resource_instance.\"+resourceName)\n\n\t\t// Zones\n\t\tzoneOpts := &dns.DnsSvcsV1Options{\n\t\t\tURL: defaultDNSURL,\n\t\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\t\tBearerToken: bluemixToken,\n\t\t\t},\n\t\t}\n\n\t\tzService, err := dns.NewDnsSvcsV1(zoneOpts)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tzoneOpt := dns.ListDnszonesOptions{\n\t\t\tInstanceID: &instanceGUID,\n\t\t}\n\t\tzoneList, _, err := zService.ListDnszones(&zoneOpt)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error Listing Zones %s\", err)\n\t\t}\n\t\tfor _, zone := range zoneList.Dnszones {\n\t\t\tzoneID := *zone.ID\n\t\t\tg.Resources = append(g.Resources, g.loadPrivateDNSZone(instanceGUID, zoneID, pDNSDependsOn))\n\t\t\tdomainResourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\t\t\tdomainDependsOn := makeDependsOn(pDNSDependsOn, \"ibm_dns_zone.\"+domainResourceName)\n\n\t\t\t// Permitted Network Records\n\t\t\tpermittedNetworkOpt := dns.ListPermittedNetworksOptions{\n\t\t\t\tInstanceID: &instanceGUID,\n\t\t\t\tDnszoneID:  &zoneID,\n\t\t\t}\n\t\t\tpermittedNetworkList, _, err := zService.ListPermittedNetworks(&permittedNetworkOpt)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error Listing Permitted Networks %s\", err)\n\t\t\t}\n\t\t\tfor _, permittedNetwork := range permittedNetworkList.PermittedNetworks {\n\t\t\t\tpermittedNetworkID := *permittedNetwork.ID\n\t\t\t\tg.Resources = append(g.Resources, g.loadPrivateDNSPermittedNetwork(instanceGUID, zoneID, permittedNetworkID, domainDependsOn))\n\t\t\t}\n\n\t\t\t// Resource Records\n\t\t\tdnsRecordOpt := dns.ListResourceRecordsOptions{\n\t\t\t\tInstanceID: &instanceGUID,\n\t\t\t\tDnszoneID:  &zoneID,\n\t\t\t}\n\t\t\tresourceRecordList, _, err := zService.ListResourceRecords(&dnsRecordOpt)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error Listing Resource Records %s\", err)\n\t\t\t}\n\n\t\t\tpdnsFnObjt := g.loadPrivateDNSResourceRecord()\n\t\t\tfor _, record := range resourceRecordList.ResourceRecords {\n\t\t\t\tg.Resources = append(g.Resources, pdnsFnObjt(instanceGUID, zoneID, *record.ID, *record.Name, domainDependsOn))\n\t\t\t}\n\n\t\t\t// GLB Records\n\t\t\tglbOpt := dns.ListLoadBalancersOptions{\n\t\t\t\tInstanceID: &instanceGUID,\n\t\t\t\tDnszoneID:  &zoneID,\n\t\t\t}\n\t\t\tglbOptList, _, err := zService.ListLoadBalancers(&glbOpt)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error Listing GLBs %s\", err)\n\t\t\t}\n\t\t\tglbFntObj := g.loadPrivateDNSGLB()\n\t\t\tfor _, lb := range glbOptList.LoadBalancers {\n\t\t\t\tg.Resources = append(g.Resources, glbFntObj(instanceGUID, zoneID, *lb.ID, *lb.Name, domainDependsOn))\n\t\t\t}\n\t\t}\n\t\t// Monitor Records\n\t\tmonitorOpt := dns.ListMonitorsOptions{\n\t\t\tInstanceID: &instanceGUID,\n\t\t}\n\t\tglbMonitorList, _, err := zService.ListMonitors(&monitorOpt)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error Listing GLB Monitor %s\", err)\n\t\t}\n\n\t\tlbMonitorObjt := g.loadPrivateDNSGLBMonitor()\n\t\tfor _, monitor := range glbMonitorList.Monitors {\n\t\t\tg.Resources = append(g.Resources, lbMonitorObjt(instanceGUID, *monitor.ID, *monitor.Name, pDNSDependsOn))\n\t\t}\n\n\t\t// Pool Records\n\t\tglbPoolOpt := dns.ListPoolsOptions{\n\t\t\tInstanceID: &instanceGUID,\n\t\t}\n\t\tglbPoolOptList, _, err := zService.ListPools(&glbPoolOpt)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error Listing GLB Pools %s\", err)\n\t\t}\n\t\tdnsGlbfnObj := g.loadPrivateDNSGLBPool()\n\t\tfor _, pool := range glbPoolOptList.Pools {\n\t\t\tg.Resources = append(g.Resources, dnsGlbfnObj(instanceGUID, *pool.ID, *pool.Name, pDNSDependsOn))\n\t\t}\n\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"errors\"\n\t\"os\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nconst DefaultRegion = \"us-south\"\nconst NoRegion = \"\"\n\nvar resourceMutex sync.RWMutex // Used for g.Resources\n\ntype IBMProvider struct { //nolint\n\tterraformutils.Provider\n\tResourceGroup string\n\tRegion        string\n\tVPC           string\n}\n\nfunc (p *IBMProvider) Init(args []string) error {\n\tp.ResourceGroup = args[0]\n\tp.Region = args[1]\n\tp.VPC = args[2]\n\n\tvar err error\n\tif p.Region != NoRegion {\n\t\terr = os.Setenv(\"IC_REGION\", p.Region)\n\t} else {\n\t\tp.Region = DefaultRegion\n\t\terr = os.Setenv(\"IC_REGION\", DefaultRegion)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (p *IBMProvider) GetName() string {\n\treturn \"ibm\"\n}\n\nfunc (p *IBMProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"ibm\": map[string]interface{}{\n\t\t\t\t\"region\": p.Region,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (IBMProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"ibm_is_vpc_route\": {\n\t\t\t\"ibm_is_vpc\": []string{\"vpc\", \"id\"},\n\t\t},\n\t\t\"ibm_is_vpc_routing_table\": {\n\t\t\t\"ibm_is_vpc\": []string{\"vpc\", \"id\"},\n\t\t},\n\t\t\"ibm_is_subnet\": {\n\t\t\t\"ibm_is_vpc\":            []string{\"vpc\", \"id\"},\n\t\t\t\"ibm_is_public_gateway\": []string{\"public_gateway\", \"id\"},\n\t\t},\n\t\t\"ibm_is_vpc_address_prefix\": {\n\t\t\t\"ibm_is_vpc\": []string{\"vpc\", \"id\"},\n\t\t},\n\t\t\"ibm_is_lb\": {\n\t\t\t\"ibm_is_vpc\":            []string{\"vpc\", \"id\"},\n\t\t\t\"ibm_is_subnet\":         []string{\"subnets\", \"id\"},\n\t\t\t\"ibm_is_security_group\": []string{\"security_groups\", \"id\"},\n\t\t},\n\t\t\"ibm_is_instance\": {\n\t\t\t\"ibm_is_vpc\":            []string{\"vpc\", \"id\"},\n\t\t\t\"ibm_is_image\":          []string{\"image\", \"id\"},\n\t\t\t\"ibm_is_subnet\":         []string{\"primary_network_interface.subnet\", \"id\"},\n\t\t\t\"ibm_is_security_group\": []string{\"primary_network_interface.security_groups\", \"id\"},\n\t\t\t\"ibm_is_volume\":         []string{\"volumes\", \"id\"},\n\t\t},\n\t\t\"ibm_is_security_group\": {\n\t\t\t\"ibm_is_vpc\": []string{\"vpc\", \"id\"},\n\t\t},\n\t\t\"ibm_is_network_acl\": {\n\t\t\t\"ibm_is_vpc\":    []string{\"vpc\", \"id\"},\n\t\t\t\"ibm_is_subnet\": []string{\"subnets\", \"id\"},\n\t\t},\n\t\t\"ibm_is_public_gateway\": {\n\t\t\t\"ibm_is_vpc\":         []string{\"vpc\", \"id\"},\n\t\t\t\"ibm_is_floating_ip\": []string{\"floating_ip.id\", \"id\"},\n\t\t},\n\t\t\"ibm_container_vpc_cluster\": {\n\t\t\t\"ibm_is_vpc\":    []string{\"vpc_id\", \"id\"},\n\t\t\t\"ibm_is_subnet\": []string{\"zones.subnet_id\", \"id\"},\n\t\t},\n\t\t\"ibm_vpe_gateway\": {\n\t\t\t\"ibm_is_vpc\":            []string{\"vpc\", \"id\"},\n\t\t\t\"ibm_is_security_group\": []string{\"security_groups\", \"id\"},\n\t\t\t\"ibm_is_subnet\":         []string{\"ips.subnet\", \"id\"},\n\t\t},\n\t\t\"ibm_is_vpn_gateway\": {\n\t\t\t\"ibm_is_subnet\": []string{\"subnet\", \"id\"},\n\t\t},\n\t}\n}\n\nfunc (p *IBMProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"ibm_kp\":                            &KPGenerator{},\n\t\t\"ibm_container_vpc_cluster\":         &VPCClusterGenerator{},\n\t\t\"ibm_container_cluster\":             &ContainerClusterGenerator{},\n\t\t\"ibm_cos\":                           &COSGenerator{},\n\t\t\"ibm_database_elasticsearch\":        &DatabaseElasticSearchGenerator{},\n\t\t\"ibm_database_etcd\":                 &DatabaseETCDGenerator{},\n\t\t\"ibm_database_mongo\":                &DatabaseMongoGenerator{},\n\t\t\"ibm_database_postgresql\":           &DatabasePostgresqlGenerator{},\n\t\t\"ibm_database_rabbitmq\":             &DatabaseRabbitMQGenerator{},\n\t\t\"ibm_database_redis\":                &DatabaseRedisGenerator{},\n\t\t\"ibm_iam\":                           &IAMGenerator{},\n\t\t\"ibm_is_instance_group\":             &InstanceGroupGenerator{},\n\t\t\"ibm_is_vpc\":                        &VPCGenerator{},\n\t\t\"ibm_is_vpc_address_prefix\":         &VPCAddressPrefixGenerator{},\n\t\t\"ibm_is_vpc_route\":                  &VPCRouteGenerator{},\n\t\t\"ibm_is_vpc_routing_table\":          &VPCRoutingTableGenerator{},\n\t\t\"ibm_is_subnet\":                     &SubnetGenerator{},\n\t\t\"ibm_is_instance\":                   &InstanceGenerator{},\n\t\t\"ibm_is_security_group\":             &SecurityGroupGenerator{},\n\t\t\"ibm_cis\":                           &CISGenerator{},\n\t\t\"ibm_is_network_acl\":                &NetworkACLGenerator{},\n\t\t\"ibm_is_public_gateway\":             &PublicGatewayGenerator{},\n\t\t\"ibm_is_volume\":                     &VolumeGenerator{},\n\t\t\"ibm_is_vpn_gateway\":                &VPNGatewayGenerator{},\n\t\t\"ibm_is_lb\":                         &LBGenerator{},\n\t\t\"ibm_is_ssh_key\":                    &SSHKeyGenerator{},\n\t\t\"ibm_is_floating_ip\":                &FloatingIPGenerator{},\n\t\t\"ibm_is_image\":                      &ImageGenerator{},\n\t\t\"ibm_is_ipsec_policy\":               &IpsecGenerator{},\n\t\t\"ibm_is_ike_policy\":                 &IkeGenerator{},\n\t\t\"ibm_is_flow_log\":                   &FlowLogGenerator{},\n\t\t\"ibm_is_instance_template\":          &InstanceTemplateGenerator{},\n\t\t\"ibm_function\":                      &CloudFunctionGenerator{},\n\t\t\"ibm_private_dns\":                   &privateDNSTemplateGenerator{},\n\t\t\"ibm_certificate_manager\":           &CMGenerator{},\n\t\t\"ibm_direct_link\":                   &DLGenerator{},\n\t\t\"ibm_transit_gateway\":               &TGGenerator{},\n\t\t\"ibm_vpe_gateway\":                   &VPEGenerator{},\n\t\t\"ibm_satellite_control_plane\":       &SatelliteControlPlaneGenerator{},\n\t\t\"ibm_satellite_data_plane\":          &SatelliteDataPlaneGenerator{},\n\t\t\"ibm_secrets_manager\":               &SecretsManagerGenerator{},\n\t\t\"ibm_continuous_delivery\":           &ContinuousDeliveryGenerator{},\n\t\t\"ibm_cd_toolchain\":                  &ToolchainGenerator{},\n\t\t\"ibm_cloud_sysdig_monitor\":          &MonitoringGenerator{},\n\t\t\"ibm_cloud_logdna\":                  &LogAnalysisGenerator{},\n\t\t\"ibm_cloud_atracker\":                &ActivityTrackerGenerator{},\n\t\t\"ibm_cloud_watson_studio\":           &WatsonStudioGenerator{},\n\t\t\"ibm_cloud_watson_machine_learning\": &WatsonMachineLearningGenerator{},\n\t\t\"ibm_cloudant\":                      &CloudantGenerator{},\n\t\t\"ibm_code_engine\":                   &CodeEngineGenerator{},\n\t}\n}\n\nfunc (p *IBMProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"IBM: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"resource_group\": p.ResourceGroup,\n\t\t\"region\":         p.Region,\n\t\t\"vpc\":            p.VPC,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_secret_manager.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev1/catalog\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/controllerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\ntype SecretsManagerGenerator struct {\n\tIBMService\n}\n\nfunc (g SecretsManagerGenerator) loadSM(smID, smName, servicePlan string, timeout map[string]string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tsmID,\n\t\tnormalizeResourceName(smName, true),\n\t\t\"ibm_resource_instance\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"plan\": servicePlan,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"timeouts\": timeout,\n\t\t})\n\treturn resources\n}\n\nfunc (g *SecretsManagerGenerator) InitResources() error {\n\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t}\n\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Client creation\n\tcatalogClient, err := catalog.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontrollerClient, err := controllerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Get ServiceID of secret manager service\n\tserviceID, err := catalogClient.ResourceCatalog().FindByName(\"secrets-manager\", true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tquery := controllerv2.ServiceInstanceQuery{\n\t\tServiceID: serviceID[0].ID,\n\t}\n\n\t// Get all Secret manager instances\n\tsmInstances, err := controllerClient.ResourceServiceInstanceV2().ListInstances(query)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, smInstance := range smInstances {\n\t\ttimeout := map[string]string{\"create\": \"15m\"}\n\t\tg.Resources = append(g.Resources, g.loadSM(smInstance.ID, smInstance.Name, smInstance.ServicePlanName, timeout))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/ibm_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype IBMService struct { //nolint\n\tterraformutils.Service\n}\n"
  },
  {
    "path": "providers/ibm/ibm_tg.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"time\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\ttg \"github.com/IBM/networking-go-sdk/transitgatewayapisv1\"\n)\n\n// TGGenerator ...\ntype TGGenerator struct {\n\tIBMService\n}\n\nfunc (g TGGenerator) createTransitGatewayResources(gatewayID, gatewayName string) terraformutils.Resource {\n\tresource := terraformutils.NewSimpleResource(\n\t\tgatewayID,\n\t\tnormalizeResourceName(gatewayName, false),\n\t\t\"ibm_tg_gateway\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resource\n}\n\nfunc (g TGGenerator) createTransitGatewayConnectionResources(gatewayID, connectionID, connectionName string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", gatewayID, connectionID),\n\t\tnormalizeResourceName(connectionName, false),\n\t\t\"ibm_tg_connection\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\nfunc (g TGGenerator) loadTransitGatewayRouterResource(gatewayID, routerID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", gatewayID, routerID),\n\t\tnormalizeResourceName(routerID, false),\n\t\t\"ibm_tg_route_report\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resource\n}\n\n// CreateVersionDate requires mandatory version attribute. Any date from 2019-12-13 up to the currentdate may be provided. Specify the current date to request the latest version.\nfunc CreateVersionDate() *string {\n\tversion := time.Now().Format(\"2006-01-02\")\n\treturn &version\n}\n\n// InitResources ...\nfunc (g *TGGenerator) InitResources() error {\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"no API key set\")\n\t}\n\ttgURL := \"https://transit.cloud.ibm.com/v1\"\n\ttransitgatewayOptions := &tg.TransitGatewayApisV1Options{\n\t\tURL: envFallBack([]string{\"IBMCLOUD_TG_API_ENDPOINT\"}, tgURL),\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t},\n\t\tVersion: CreateVersionDate(),\n\t}\n\n\ttgclient, err := tg.NewTransitGatewayApisV1(transitgatewayOptions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstart := \"\"\n\tallrecs := []tg.TransitGateway{}\n\tfor {\n\t\tlistTransitGatewaysOptions := &tg.ListTransitGatewaysOptions{}\n\t\tif start != \"\" {\n\t\t\tlistTransitGatewaysOptions.Start = &start\n\t\t}\n\n\t\tgateways, resp, err := tgclient.ListTransitGateways(listTransitGatewaysOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Listing Transit Gateways %s\\n%s\", err, resp)\n\t\t}\n\t\tstart = GetNext(gateways.Next)\n\t\tallrecs = append(allrecs, gateways.TransitGateways...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\tfor _, gateway := range allrecs {\n\t\tg.Resources = append(g.Resources, g.createTransitGatewayResources(*gateway.ID, *gateway.Name))\n\t\tresourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\t\tvar dependsOn []string\n\t\tdependsOn = append(dependsOn,\n\t\t\t\"ibm_tg_gateway.\"+resourceName)\n\t\tlistTransitGatewayConnectionsOptions := &tg.ListTransitGatewayConnectionsOptions{\n\t\t\tTransitGatewayID: gateway.ID,\n\t\t}\n\t\tconnections, response, err := tgclient.ListTransitGatewayConnections(listTransitGatewayConnectionsOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Listing Transit Gateway connections %s\\n%s\", err, response)\n\t\t}\n\t\tfor _, connection := range connections.Connections {\n\t\t\tg.Resources = append(g.Resources, g.createTransitGatewayConnectionResources(*gateway.ID, *connection.ID, *connection.Name, dependsOn))\n\t\t}\n\t\t// Trying to get Transit Gateway reports\n\t\tlistTransitGatewayRouteReportOptions := &tg.ListTransitGatewayRouteReportsOptions{\n\t\t\tTransitGatewayID: gateway.ID,\n\t\t}\n\t\trouteReports, response, err := tgclient.ListTransitGatewayRouteReports(listTransitGatewayRouteReportOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Listing Transit Gateway route reports %s\\n%s\", err, response)\n\t\t}\n\t\tfor _, routeReport := range routeReports.RouteReports {\n\t\t\tg.Resources = append(g.Resources, g.loadTransitGatewayRouterResource(*gateway.ID, *routeReport.ID, dependsOn))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/instance_groups.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"math/rand\"\n\t\"os\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM/go-sdk-core/v4/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\n// InstanceGroupGenerator ...\ntype InstanceGroupGenerator struct {\n\tIBMService\n\tfatalErrors chan error\n}\n\nfunc (g *InstanceGroupGenerator) loadInstanceGroup(instanceGroupID, instanceGroupName string) terraformutils.Resource {\n\tresources := terraformutils.NewSimpleResource(\n\t\tinstanceGroupID,\n\t\tinstanceGroupName,\n\t\t\"ibm_is_instance_group\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resources\n}\n\nfunc (g *InstanceGroupGenerator) loadInstanceGroupManger(instanceGroupID, instanceGroupManagerID, managerName string, dependsOn []string) terraformutils.Resource {\n\tif managerName == \"\" {\n\t\tmanagerName = fmt.Sprintf(\"manager-%d-%d\", rand.Intn(100), rand.Intn(50))\n\t}\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", instanceGroupID, instanceGroupManagerID),\n\t\tmanagerName,\n\t\t\"ibm_is_instance_group_manager\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resources\n}\n\nfunc (g *InstanceGroupGenerator) loadInstanceGroupMangerPolicy(instanceGroupID, instanceGroupManagerID, policyID, policyName string, dependsOn []string) terraformutils.Resource {\n\tif policyName == \"\" {\n\t\tpolicyName = fmt.Sprintf(\"manager-%d-%d\", rand.Intn(100), rand.Intn(50))\n\t}\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s/%s\", instanceGroupID, instanceGroupManagerID, policyID),\n\t\tpolicyName,\n\t\t\"ibm_is_instance_group_manager_policy\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\treturn resources\n}\n\nfunc (g *InstanceGroupGenerator) handlePolicies(sess *vpcv1.VpcV1, instanceGroupID, instanceGroupManagerID string, policies, dependsOn []string, waitGroup *sync.WaitGroup) {\n\tdefer waitGroup.Done()\n\tfor _, instanceGroupManagerPolicyID := range policies {\n\t\tgetInstanceGroupManagerPolicyOptions := vpcv1.GetInstanceGroupManagerPolicyOptions{\n\t\t\tID:                     &instanceGroupManagerPolicyID,\n\t\t\tInstanceGroupID:        &instanceGroupID,\n\t\t\tInstanceGroupManagerID: &instanceGroupManagerID,\n\t\t}\n\t\tdata, response, err := sess.GetInstanceGroupManagerPolicy(&getInstanceGroupManagerPolicyOptions)\n\t\tif err != nil {\n\t\t\tg.fatalErrors <- fmt.Errorf(\"Error Getting InstanceGroup Manager Policy: %s\\n%s\", err, response)\n\t\t}\n\t\tinstanceGroupManagerPolicy := data.(*vpcv1.InstanceGroupManagerPolicy)\n\t\tresourceMutex.Lock()\n\t\tg.Resources = append(g.Resources, g.loadInstanceGroupMangerPolicy(instanceGroupID,\n\t\t\tinstanceGroupManagerID,\n\t\t\tinstanceGroupManagerPolicyID,\n\t\t\t*instanceGroupManagerPolicy.Name,\n\t\t\tdependsOn))\n\t\tresourceMutex.Unlock()\n\t}\n}\n\nfunc (g *InstanceGroupGenerator) handleManagers(sess *vpcv1.VpcV1, instanceGroupID string, managers, dependsOn []string, waitGroup *sync.WaitGroup) {\n\tdefer waitGroup.Done()\n\tvar policiesWG sync.WaitGroup\n\tfor _, instanceGroupManagerID := range managers {\n\t\tgetInstanceGroupManagerOptions := vpcv1.GetInstanceGroupManagerOptions{\n\t\t\tID:              &instanceGroupManagerID,\n\t\t\tInstanceGroupID: &instanceGroupID,\n\t\t}\n\t\tinstanceGroupManagerIntf, response, err := sess.GetInstanceGroupManager(&getInstanceGroupManagerOptions)\n\t\tif err != nil {\n\t\t\tg.fatalErrors <- fmt.Errorf(\"Error Getting InstanceGroup Manager: %s\\n%s\", err, response)\n\t\t}\n\t\tinstanceGroupManager := instanceGroupManagerIntf.(*vpcv1.InstanceGroupManager)\n\t\tresourceMutex.Lock()\n\t\tg.Resources = append(g.Resources, g.loadInstanceGroupManger(instanceGroupID, instanceGroupManagerID, *instanceGroupManager.Name, dependsOn))\n\t\tresourceMutex.Unlock()\n\n\t\tpolicies := make([]string, 0)\n\n\t\tfor i := 0; i < len(instanceGroupManager.Policies); i++ {\n\t\t\tpolicies = append(policies, *(instanceGroupManager.Policies[i].ID))\n\t\t}\n\t\tpoliciesWG.Add(1)\n\t\tdependsOn1 := makeDependsOn(dependsOn,\n\t\t\t\"ibm_is_instance_group_manger.\"+terraformutils.TfSanitize(*instanceGroupManager.Name))\n\t\tgo g.handlePolicies(sess, instanceGroupID, instanceGroupManagerID, policies, dependsOn1, &policiesWG)\n\t}\n\tpoliciesWG.Wait()\n}\n\nfunc (g *InstanceGroupGenerator) handleInstanceGroups(sess *vpcv1.VpcV1, waitGroup *sync.WaitGroup) {\n\t// Support for pagination\n\tdefer waitGroup.Done()\n\tstart := \"\"\n\tvar allrecs []vpcv1.InstanceGroup\n\tfor {\n\t\tlistInstanceGroupOptions := vpcv1.ListInstanceGroupsOptions{}\n\t\tif start != \"\" {\n\t\t\tlistInstanceGroupOptions.Start = &start\n\t\t}\n\t\tinstanceGroupsCollection, response, err := sess.ListInstanceGroups(&listInstanceGroupOptions)\n\t\tif err != nil {\n\t\t\tg.fatalErrors <- fmt.Errorf(\"Error Fetching InstanceGroups %s\\n%s\", err, response)\n\t\t}\n\t\tstart = GetNext(instanceGroupsCollection.Next)\n\t\tallrecs = append(allrecs, instanceGroupsCollection.InstanceGroups...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tvar managersWG sync.WaitGroup\n\n\tfor _, instanceGroup := range allrecs {\n\t\tvar dependsOn []string\n\t\tdependsOn = append(dependsOn,\n\t\t\t\"ibm_is_instance_group.\"+terraformutils.TfSanitize(*instanceGroup.Name))\n\t\tinstanceGoupID := *instanceGroup.ID\n\t\tresourceMutex.Lock()\n\t\tg.Resources = append(g.Resources, g.loadInstanceGroup(instanceGoupID, *instanceGroup.Name))\n\t\tresourceMutex.Unlock()\n\t\tmanagers := make([]string, 0)\n\t\tfor i := 0; i < len(instanceGroup.Managers); i++ {\n\t\t\tmanagers = append(managers, *(instanceGroup.Managers[i].ID))\n\t\t}\n\t\tmanagersWG.Add(1)\n\t\tgo g.handleManagers(sess, instanceGoupID, managers, dependsOn, &managersWG)\n\t}\n\tmanagersWG.Wait()\n}\n\n// InitResources ...\nfunc (g *InstanceGroupGenerator) InitResources() error {\n\tapiKey := os.Getenv(\"IC_API_KEY\")\n\tif apiKey == \"\" {\n\t\treturn fmt.Errorf(\"no API key set\")\n\t}\n\n\t// Instantiate the service with an API key based IAM authenticator\n\tsess, err := vpcv1.NewVpcV1(&vpcv1.VpcV1Options{\n\t\tAuthenticator: &core.IamAuthenticator{\n\t\t\tApiKey: apiKey,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar instanceGroupWG sync.WaitGroup\n\tinstanceGroupWG.Add(1)\n\tgo g.handleInstanceGroups(sess, &instanceGroupWG)\n\n\tinstanceGroupWG.Wait() //nolint:govet\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/satellite_control_plane.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n\t\"github.com/IBM-Cloud/container-services-go-sdk/kubernetesserviceapiv1\"\n\n\t\"github.com/IBM/go-sdk-core/v3/core\"\n)\n\ntype SatelliteControlPlaneGenerator struct {\n\tIBMService\n}\n\nfunc (g SatelliteControlPlaneGenerator) loadLocations(locID, locName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tlocID,\n\t\tnormalizeResourceName(locName, false),\n\t\t\"ibm_satellite_location\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\t// Remove parameters\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^labels$\",\n\t)\n\n\treturn resource\n}\n\nfunc (g SatelliteControlPlaneGenerator) loadAssignHostControlPlane(locID, hostID string, labels []string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", locID, hostID),\n\t\tnormalizeResourceName(\"ibm_satellite_host\", true),\n\t\t\"ibm_satellite_host\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"labels\":     labels,\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\n\treturn resource\n}\n\nfunc (g SatelliteControlPlaneGenerator) loadROKSCluster(clusterName, locationID string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tclusterName,\n\t\tclusterName,\n\t\t\"ibm_satellite_cluster\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"location\":               locationID,\n\t\t\t\"wait_for_worker_update\": \"true\",\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\n\treturn resource\n}\n\nfunc (g *SatelliteControlPlaneGenerator) InitResources() error {\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t}\n\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = authenticateAPIKey(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbluemixToken := \"\"\n\tif strings.HasPrefix(sess.Config.IAMAccessToken, \"Bearer\") {\n\t\tbluemixToken = sess.Config.IAMAccessToken[7:len(sess.Config.IAMAccessToken)]\n\t} else {\n\t\tbluemixToken = sess.Config.IAMAccessToken\n\t}\n\n\tcontainerEndpoint := kubernetesserviceapiv1.DefaultServiceURL\n\tkubernetesServiceV1Options := &kubernetesserviceapiv1.KubernetesServiceApiV1Options{\n\t\tURL: envFallBack([]string{\"IBMCLOUD_SATELLITE_API_ENDPOINT\"}, containerEndpoint),\n\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\tBearerToken: bluemixToken,\n\t\t},\n\t}\n\n\tsatelliteClient, err := kubernetesserviceapiv1.NewKubernetesServiceApiV1(kubernetesServiceV1Options)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgetSatLocOpts := &kubernetesserviceapiv1.GetSatelliteLocationsOptions{}\n\tlocations, _, err := satelliteClient.GetSatelliteLocations(getSatLocOpts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, loc := range locations {\n\t\tvar locDependsOn []string\n\n\t\t// Location\n\t\tif loc.Deployments != nil && !strings.Contains(*loc.Deployments.Message, \"R0037\") {\n\t\t\tg.Resources = append(g.Resources, g.loadLocations(*loc.ID, *loc.Name))\n\t\t\tresourceName := g.Resources[len(g.Resources)-1:][0].ResourceName\n\t\t\tlocDependsOn = append(locDependsOn,\n\t\t\t\t\"ibm_satellite_location.\"+resourceName)\n\n\t\t\t// Assign Host - Control plane\n\t\t\tgetSatHostOpts := &kubernetesserviceapiv1.GetSatelliteHostsOptions{\n\t\t\t\tController: loc.ID,\n\t\t\t}\n\t\t\thosts, resp, err := satelliteClient.GetSatelliteHosts(getSatHostOpts)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error getting satellite control plane hosts %s\\n%s\", err, resp)\n\t\t\t}\n\n\t\t\tfor _, host := range hosts {\n\t\t\t\tif *host.Assignment.ClusterName == \"infrastructure\" {\n\t\t\t\t\thostLabels := []string{}\n\t\t\t\t\tfor key, value := range host.Labels {\n\t\t\t\t\t\thostLabels = append(hostLabels, fmt.Sprintf(\"%s=%s\", key, value))\n\t\t\t\t\t}\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadAssignHostControlPlane(*loc.ID, *host.ID, hostLabels, locDependsOn))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Cluster\n\t\t\tgetSatClusterOptions := &kubernetesserviceapiv1.GetSatelliteClustersOptions{}\n\t\t\tclusterFields, _, err := satelliteClient.GetSatelliteClusters(getSatClusterOptions)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error getting satellite cluster %s\", err)\n\t\t\t}\n\n\t\t\tfor _, cluster := range clusterFields {\n\t\t\t\tif *cluster.Location == *loc.Name {\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadROKSCluster(*cluster.Name, *loc.ID, locDependsOn))\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/satellite_data_plane.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"reflect\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n\n\t\"github.com/IBM/go-sdk-core/v3/core\"\n\t\"github.com/IBM/vpc-go-sdk/vpcv1\"\n)\n\ntype SatelliteDataPlaneGenerator struct {\n\tIBMService\n}\n\nfunc (g SatelliteDataPlaneGenerator) loadVPCResources(vpcID, vpcName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tvpcID,\n\t\tvpcName,\n\t\t\"ibm_is_vpc\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"address_prefix_management\": \"auto\",\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\treturn resource\n}\n\nfunc (g SatelliteDataPlaneGenerator) loadInstanceResources(instance vpcv1.Instance, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\t*instance.ID,\n\t\t*instance.Name,\n\t\t\"ibm_is_instance\",\n\t\t\"ibm\",\n\t\tmap[string]string{\n\t\t\t\"vpc\":                *instance.VPC.ID,\n\t\t\t\"wait_before_delete\": \"true\",\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t\t\"keys\":       []string{},\n\t\t})\n\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^port_speed$\",\n\t\t\"^primary_network_interface.[0-9].primary_ip.[0-9].address$\",\n\t\t\"^primary_network_interface.[0-9].primary_ip.[0-9].reserved_ip$\",\n\t)\n\n\treturn resource\n}\n\nfunc (g SatelliteDataPlaneGenerator) loadFloatingIPResources(floatingIPId, floatingIPName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfloatingIPId,\n\t\tfloatingIPName,\n\t\t\"ibm_is_floating_ip\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\t// Conflicts with proxied attribute\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^zone$\",\n\t)\n\n\treturn resource\n}\n\nfunc (g SatelliteDataPlaneGenerator) loadSecurityGroupResources(sgID, sgName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tsgID,\n\t\tsgName,\n\t\t\"ibm_is_security_group\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\n\treturn resource\n}\n\nfunc (g SatelliteDataPlaneGenerator) loadSecurityGroupRuleResources(sgID, sgRuleID string, dependsOn []string) terraformutils.Resource {\n\tresources := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s.%s\", sgID, sgRuleID),\n\t\tsgRuleID,\n\t\t\"ibm_is_security_group_rule\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\n\treturn resources\n}\n\nfunc (g SatelliteDataPlaneGenerator) loadSubnetResources(subnetID, subnetName string, dependsOn []string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tsubnetID,\n\t\tsubnetName,\n\t\t\"ibm_is_subnet\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"depends_on\": dependsOn,\n\t\t})\n\n\t// Conflicts with proxied attribute\n\tresource.IgnoreKeys = append(resource.IgnoreKeys,\n\t\t\"^total_ipv4_address_count$\",\n\t)\n\n\treturn resource\n}\n\nfunc contructEndpoint(subdomain, domain string) string {\n\tendpoint := fmt.Sprintf(\"https://%s.%s\", subdomain, domain)\n\treturn endpoint\n}\n\nfunc vpcClient(region string, sess *session.Session) (*vpcv1.VpcV1, error) {\n\tvar cloudEndpoint = \"cloud.ibm.com\"\n\n\tbluemixToken := \"\"\n\tif strings.HasPrefix(sess.Config.IAMAccessToken, \"Bearer\") {\n\t\tbluemixToken = sess.Config.IAMAccessToken[7:len(sess.Config.IAMAccessToken)]\n\t} else {\n\t\tbluemixToken = sess.Config.IAMAccessToken\n\t}\n\n\tvpcurl := contructEndpoint(fmt.Sprintf(\"%s.iaas\", region), fmt.Sprintf(\"%s/v1\", cloudEndpoint))\n\t// if sess.Config.Visibility == \"private\" {\n\t// \tif region == \"us-south\" || region == \"us-east\" {\n\t// \t\tvpcurl = contructEndpoint(fmt.Sprintf(\"%s.private.iaas\", region), fmt.Sprintf(\"%s/v1\", cloudEndpoint))\n\t// \t} else {\n\t// \t\treturn nil, fmt.Errorf(\"VPC supports private endpoints only in us-south and us-east\")\n\t// \t}\n\t// }\n\t// if sess.Config.Visibility == \"public-and-private\" {\n\t// \tif region == \"us-south\" || region == \"us-east\" {\n\t// \t\tvpcurl = contructEndpoint(fmt.Sprintf(\"%s.private.iaas\", region), fmt.Sprintf(\"%s/v1\", cloudEndpoint))\n\t// \t}\n\t// \tvpcurl = contructEndpoint(fmt.Sprintf(\"%s.iaas\", region), fmt.Sprintf(\"%s/v1\", cloudEndpoint))\n\t// }\n\n\tvpcoptions := &vpcv1.VpcV1Options{\n\t\tURL: envFallBack([]string{\"IBMCLOUD_IS_NG_API_ENDPOINT\"}, vpcurl),\n\t\tAuthenticator: &core.BearerTokenAuthenticator{\n\t\t\tBearerToken: bluemixToken,\n\t\t},\n\t}\n\tvpcclient, err := vpcv1.NewVpcV1(vpcoptions)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error occured while configuring vpc service: %v \", err)\n\t}\n\n\treturn vpcclient, nil\n}\n\nfunc (g *SatelliteDataPlaneGenerator) InitResources() error {\n\tvpcName := g.Args[\"vpc\"].(string)\n\tif len(vpcName) == 0 {\n\t\treturn fmt.Errorf(\"required VPC name missing, '-vpc=<vpcName>' flag not set\")\n\t}\n\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t}\n\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = authenticateAPIKey(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// VPC\n\tvpcObj, err := vpcClient(region, sess)\n\tif err != nil {\n\t\tlog.Println(\"Error building VPC object: \", err)\n\t\treturn err\n\t}\n\n\tstart := \"\"\n\tallVPCrecs := []vpcv1.VPC{}\n\tfor {\n\t\tlistVpcsOptions := &vpcv1.ListVpcsOptions{}\n\t\tif start != \"\" {\n\t\t\tlistVpcsOptions.Start = &start\n\t\t}\n\t\tvpcs, response, err := vpcObj.ListVpcs(listVpcsOptions)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error Fetching vpcs %s\\n%s\", err, response)\n\t\t}\n\n\t\tstart = GetNext(vpcs.Next)\n\t\tallVPCrecs = append(allVPCrecs, vpcs.Vpcs...)\n\t\tif start == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// VPC & Instances\n\tfor _, vpc := range allVPCrecs {\n\t\tif *vpc.Name == vpcName {\n\n\t\t\tvar vpcDependsOn []string\n\t\t\tvpcDependsOn = append(vpcDependsOn,\n\t\t\t\t\"ibm_is_vpc.\"+terraformutils.TfSanitize(*vpc.Name))\n\n\t\t\tg.Resources = append(g.Resources, g.loadVPCResources(*vpc.ID, *vpc.Name))\n\n\t\t\tstart = \"\"\n\t\t\tvar allrecs []vpcv1.Instance\n\t\t\tfor {\n\t\t\t\toptions := &vpcv1.ListInstancesOptions{}\n\t\t\t\tif start != \"\" {\n\t\t\t\t\toptions.Start = &start\n\t\t\t\t}\n\n\t\t\t\tinstances, response, err := vpcObj.ListInstances(options)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Error Fetching Instances %s\\n%s\", err, response)\n\t\t\t\t}\n\t\t\t\tstart = GetNext(instances.Next)\n\t\t\t\tallrecs = append(allrecs, instances.Instances...)\n\t\t\t\tif start == \"\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Floating IP\n\t\t\tstart := \"\"\n\t\t\tallFloatingIPs := []vpcv1.FloatingIP{}\n\t\t\tfor {\n\t\t\t\tfloatingIPOptions := &vpcv1.ListFloatingIpsOptions{}\n\t\t\t\tif start != \"\" {\n\t\t\t\t\tfloatingIPOptions.Start = &start\n\t\t\t\t}\n\t\t\t\tfloatingIPs, response, err := vpcObj.ListFloatingIps(floatingIPOptions)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Error Fetching floating IPs %s\\n%s\", err, response)\n\t\t\t\t}\n\t\t\t\tstart = GetNext(floatingIPs.Next)\n\t\t\t\tallFloatingIPs = append(allFloatingIPs, floatingIPs.FloatingIps...)\n\t\t\t\tif start == \"\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, instance := range allrecs {\n\t\t\t\tg.Resources = append(g.Resources, g.loadInstanceResources(instance, vpcDependsOn))\n\n\t\t\t\tfor _, ip := range allFloatingIPs {\n\t\t\t\t\ttarget, _ := ip.Target.(*vpcv1.FloatingIPTarget)\n\t\t\t\t\tif *target.ID == *instance.PrimaryNetworkInterface.ID {\n\t\t\t\t\t\tg.Resources = append(g.Resources, g.loadFloatingIPResources(*ip.ID, *ip.Name))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Security group\n\t\t\tstart = \"\"\n\t\t\tvar allSgRecs []vpcv1.SecurityGroup\n\t\t\tfor {\n\t\t\t\toptions := &vpcv1.ListSecurityGroupsOptions{\n\t\t\t\t\tVPCID: vpc.ID,\n\t\t\t\t}\n\t\t\t\tif start != \"\" {\n\t\t\t\t\toptions.Start = &start\n\t\t\t\t}\n\n\t\t\t\tsgs, response, err := vpcObj.ListSecurityGroups(options)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Error Fetching security Groups %s\\n%s\", err, response)\n\t\t\t\t}\n\t\t\t\tstart = GetNext(sgs.Next)\n\t\t\t\tallSgRecs = append(allSgRecs, sgs.SecurityGroups...)\n\t\t\t\tif start == \"\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, group := range allSgRecs {\n\t\t\t\tvar sgDependsOn []string\n\t\t\t\tsgDependsOn = append(sgDependsOn,\n\t\t\t\t\t\"ibm_is_security_group.\"+terraformutils.TfSanitize(*group.Name))\n\t\t\t\tg.Resources = append(g.Resources, g.loadSecurityGroupResources(*group.ID, *group.Name))\n\t\t\t\tlistSecurityGroupRulesOptions := &vpcv1.ListSecurityGroupRulesOptions{\n\t\t\t\t\tSecurityGroupID: group.ID,\n\t\t\t\t}\n\t\t\t\trules, response, err := vpcObj.ListSecurityGroupRules(listSecurityGroupRulesOptions)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Error Fetching security group rules %s\\n%s\", err, response)\n\t\t\t\t}\n\t\t\t\tfor _, sgrule := range rules.Rules {\n\t\t\t\t\tswitch reflect.TypeOf(sgrule).String() {\n\t\t\t\t\tcase \"*vpcv1.SecurityGroupRuleSecurityGroupRuleProtocolIcmp\":\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trule := sgrule.(*vpcv1.SecurityGroupRuleSecurityGroupRuleProtocolIcmp)\n\t\t\t\t\t\t\tg.Resources = append(g.Resources, g.loadSecurityGroupRuleResources(*group.ID, *rule.ID, sgDependsOn))\n\t\t\t\t\t\t}\n\n\t\t\t\t\tcase \"*vpcv1.SecurityGroupRuleSecurityGroupRuleProtocolAll\":\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trule := sgrule.(*vpcv1.SecurityGroupRuleSecurityGroupRuleProtocolAll)\n\t\t\t\t\t\t\tg.Resources = append(g.Resources, g.loadSecurityGroupRuleResources(*group.ID, *rule.ID, sgDependsOn))\n\t\t\t\t\t\t}\n\n\t\t\t\t\tcase \"*vpcv1.SecurityGroupRuleSecurityGroupRuleProtocolTcpudp\":\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trule := sgrule.(*vpcv1.SecurityGroupRuleSecurityGroupRuleProtocolTcpudp)\n\t\t\t\t\t\t\tg.Resources = append(g.Resources, g.loadSecurityGroupRuleResources(*group.ID, *rule.ID, sgDependsOn))\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Subnet\n\t\t\tstart = \"\"\n\t\t\tvar allSubNetRecs []vpcv1.Subnet\n\t\t\tfor {\n\t\t\t\toptions := &vpcv1.ListSubnetsOptions{}\n\t\t\t\tif start != \"\" {\n\t\t\t\t\toptions.Start = &start\n\t\t\t\t}\n\n\t\t\t\tsubnets, response, err := vpcObj.ListSubnets(options)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Error Fetching subnets %s\\n%s\", err, response)\n\t\t\t\t}\n\t\t\t\tstart = GetNext(subnets.Next)\n\t\t\t\tallSubNetRecs = append(allSubNetRecs, subnets.Subnets...)\n\t\t\t\tif start == \"\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, subnet := range allSubNetRecs {\n\t\t\t\tif *subnet.VPC.Name == vpcName {\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadSubnetResources(*subnet.ID, *subnet.Name, vpcDependsOn))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ibm/utils.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\tgohttp \"net/http\"\n\t\"net/url\"\n\t\"os\"\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\n\tbluemix \"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/authentication\"\n\t\"github.com/IBM-Cloud/bluemix-go/http\"\n\t\"github.com/IBM-Cloud/bluemix-go/rest\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n\t\"github.com/dgrijalva/jwt-go\"\n\n\t\"github.com/IBM-Cloud/bluemix-go/api/resource/resourcev2/managementv2\"\n)\n\n// UserConfig ...\ntype UserConfig struct {\n\tuserID      string\n\tuserEmail   string\n\tuserAccount string\n\tcloudName   string `default:\"bluemix\"`\n\tcloudType   string `default:\"public\"`\n\tgeneration  int    `default:\"2\"`\n}\n\n// EnvFallBack ...\nfunc envFallBack(envs []string, defaultValue string) string {\n\tfor _, k := range envs {\n\t\tif v := os.Getenv(k); v != \"\" {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn defaultValue\n}\n\nfunc fetchUserDetails(sess *session.Session, generation int) (*UserConfig, error) {\n\tconfig := sess.Config\n\tuser := UserConfig{}\n\tvar bluemixToken string\n\n\tif strings.HasPrefix(config.IAMAccessToken, \"Bearer\") {\n\t\tbluemixToken = config.IAMAccessToken[7:len(config.IAMAccessToken)]\n\t} else {\n\t\tbluemixToken = config.IAMAccessToken\n\t}\n\n\ttoken, err := jwt.Parse(bluemixToken, func(token *jwt.Token) (interface{}, error) {\n\t\treturn \"\", nil\n\t})\n\t// TODO validate with key\n\tif err != nil && !strings.Contains(err.Error(), \"key is of invalid type\") {\n\t\treturn &user, err\n\t}\n\tclaims := token.Claims.(jwt.MapClaims)\n\tif email, ok := claims[\"email\"]; ok {\n\t\tuser.userEmail = email.(string)\n\t}\n\tuser.userID = claims[\"id\"].(string)\n\tuser.userAccount = claims[\"account\"].(map[string]interface{})[\"bss\"].(string)\n\tiss := claims[\"iss\"].(string)\n\tif strings.Contains(iss, \"https://iam.cloud.ibm.com\") {\n\t\tuser.cloudName = \"bluemix\"\n\t} else {\n\t\tuser.cloudName = \"staging\"\n\t}\n\tuser.cloudType = \"public\"\n\n\tuser.generation = generation\n\treturn &user, nil\n}\n\nfunc authenticateAPIKey(sess *session.Session) error {\n\tconfig := sess.Config\n\ttokenRefresher, err := authentication.NewIAMAuthRepository(config, &rest.Client{\n\t\tDefaultHeader: gohttp.Header{\n\t\t\t\"User-Agent\": []string{http.UserAgent()},\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn tokenRefresher.AuthenticateAPIKey(config.BluemixAPIKey)\n}\n\nfunc authenticateCF(sess *session.Session) error {\n\tconfig := sess.Config\n\ttokenRefresher, err := authentication.NewUAARepository(config, &rest.Client{\n\t\tDefaultHeader: gohttp.Header{\n\t\t\t\"User-Agent\": []string{http.UserAgent()},\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn tokenRefresher.AuthenticateAPIKey(config.BluemixAPIKey)\n}\n\nfunc GetNext(next interface{}) string {\n\tif reflect.ValueOf(next).IsNil() {\n\t\treturn \"\"\n\t}\n\n\tu, err := url.Parse(reflect.ValueOf(next).Elem().FieldByName(\"Href\").Elem().String())\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\n\tq := u.Query()\n\treturn q.Get(\"start\")\n}\n\n// GetNextIAM ...\nfunc GetNextIAM(next interface{}) string {\n\tif reflect.ValueOf(next).IsNil() {\n\t\treturn \"\"\n\t}\n\n\tu, err := url.Parse(reflect.ValueOf(next).Elem().String())\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\tq := u.Query()\n\treturn q.Get(\"pagetoken\")\n}\n\nfunc GetResourceGroupID(apiKey, name, region string) (string, error) {\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: apiKey,\n\t\tRegion:        region,\n\t}\n\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\terr = authenticateAPIKey(sess)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tgeneration := envFallBack([]string{\"Generation\"}, \"2\")\n\tgen, err := strconv.Atoi(generation)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tuserInfo, err := fetchUserDetails(sess, gen)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\taccountID := userInfo.userAccount\n\trsManagementAPI, err := managementv2.New(sess)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\trsGroup := rsManagementAPI.ResourceGroup()\n\tresourceGroupQuery := &managementv2.ResourceGroupQuery{\n\t\tAccountID: accountID,\n\t}\n\tgrp, err := rsGroup.FindByName(resourceGroupQuery, name)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(grp) > 0 {\n\t\treturn grp[0].ID, nil\n\t}\n\n\treturn \"\", fmt.Errorf(\"Unable to get ID of resource group\")\n}\n\nfunc GetVPCEndPoint(region string) string {\n\tisURL := fmt.Sprintf(\"https://%s.iaas.cloud.ibm.com/v1\", region)\n\tisAPIEndpoint := os.Getenv(\"IBMCLOUD_IS_API_ENDPOINT\")\n\tif isAPIEndpoint != \"\" {\n\t\tisURL = isAPIEndpoint\n\t}\n\n\treturn isURL\n}\n\nfunc GetAuthEndPoint() string {\n\tiamURL := \"https://iam.cloud.ibm.com/identity/token\"\n\tiamAPIEndPoint := os.Getenv(\"IBMCLOUD_IAM_API_ENDPOINT\")\n\tif iamAPIEndPoint != \"\" {\n\t\tiamURL = fmt.Sprintf(\"%s/%s\", iamAPIEndPoint, \"identity/token\")\n\t}\n\n\treturn iamURL\n}\n\nfunc getAction(instanceStatus string) string {\n\treturn map[string]string{\n\t\t\"failed\":     \"start\",\n\t\t\"pending\":    \"start\",\n\t\t\"restarting\": \"reboot\",\n\t\t\"running\":    \"start\",\n\t\t\"starting\":   \"start\",\n\t\t\"stopped\":    \"stop\",\n\t\t\"stopping\":   \"stop\",\n\t}[instanceStatus]\n}\n"
  },
  {
    "path": "providers/ibm/vpc_cluster.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ibm\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/IBM-Cloud/bluemix-go\"\n\t\"github.com/IBM-Cloud/bluemix-go/api/container/containerv2\"\n\t\"github.com/IBM-Cloud/bluemix-go/session\"\n)\n\ntype VPCClusterGenerator struct {\n\tIBMService\n}\n\nfunc (g VPCClusterGenerator) loadcluster(clustersID, clusterName string) terraformutils.Resource {\n\tresource := terraformutils.NewSimpleResource(\n\t\tclustersID,\n\t\tnormalizeResourceName(clusterName, false),\n\t\t\"ibm_container_vpc_cluster\",\n\t\t\"ibm\",\n\t\t[]string{})\n\treturn resource\n}\n\nfunc (g VPCClusterGenerator) loadWorkerPools(clustersID, poolID, poolName string) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s/%s\", clustersID, poolID),\n\t\tnormalizeResourceName(poolName, true),\n\t\t\"ibm_container_vpc_worker_pool\",\n\t\t\"ibm\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{})\n\treturn resource\n}\n\nfunc (g *VPCClusterGenerator) InitResources() error {\n\tregion := g.Args[\"region\"].(string)\n\tbmxConfig := &bluemix.Config{\n\t\tBluemixAPIKey: os.Getenv(\"IC_API_KEY\"),\n\t}\n\tsess, err := session.New(bmxConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\tclient, err := containerv2.New(sess)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclusters, err := client.Clusters().List(containerv2.ClusterTargetHeader{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, cs := range clusters {\n\t\tif cs.Region == region {\n\t\t\tg.Resources = append(g.Resources, g.loadcluster(cs.ID, cs.Name))\n\t\t\tworkerPools, err := client.WorkerPools().ListWorkerPools(cs.ID, containerv2.ClusterTargetHeader{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, pool := range workerPools {\n\t\t\t\tif pool.PoolName != \"default\" {\n\t\t\t\t\tg.Resources = append(g.Resources, g.loadWorkerPools(cs.ID, pool.ID, pool.PoolName))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}\n\nfunc (g *VPCClusterGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"ibm_container_vpc_worker_pool\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, rt := range g.Resources {\n\t\t\tif rt.InstanceInfo.Type != \"ibm_container_vpc_cluster\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif r.InstanceState.Attributes[\"cluster\"] == rt.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"cluster\"] = \"${ibm_container_vpc_cluster.\" + rt.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/application_load_balancer.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype ApplicationLoadBalancerGenerator struct {\n\tService\n}\n\nfunc (g *ApplicationLoadBalancerGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_application_loadbalancer\"\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, datacenter := range datacenters {\n\t\tapplicationLoadBalancerResponse, _, err := cloudAPIClient.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersGet(context.TODO(), *datacenter.Id).Depth(1).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif applicationLoadBalancerResponse.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing application load balancers but received 'nil' instead, skipping search for datacenter with ID: %v.\\n\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tapplicationLoadBalancers := *applicationLoadBalancerResponse.Items\n\t\tfor _, applicationLoadBalancer := range applicationLoadBalancers {\n\t\t\tif applicationLoadBalancer.Properties == nil || applicationLoadBalancer.Properties.Name == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] 'nil' values in the response for application load balancer with ID %v, datacenter ID: %v, skipping this resource.\\n\",\n\t\t\t\t\t*applicationLoadBalancer.Id,\n\t\t\t\t\t*datacenter.Id,\n\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*applicationLoadBalancer.Id,\n\t\t\t\t*applicationLoadBalancer.Properties.Name+\"-\"+*applicationLoadBalancer.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.DcID: *datacenter.Id},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/application_load_balancer_forwarding_rule.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype ALBForwardingRuleGenerator struct {\n\tService\n}\n\nfunc (g *ALBForwardingRuleGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_application_loadbalancer_forwardingrule\"\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, datacenter := range datacenters {\n\t\tapplicationLoadBalancerResponse, _, err := cloudAPIClient.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersGet(context.TODO(), *datacenter.Id).Depth(1).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif applicationLoadBalancerResponse.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing application load balancers but received 'nil' instead, skipping search for datacenter with ID: %v\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tapplicationLoadBalancers := *applicationLoadBalancerResponse.Items\n\t\tfor _, applicationLoadBalancer := range applicationLoadBalancers {\n\t\t\tif applicationLoadBalancer.Properties == nil || applicationLoadBalancer.Properties.Name == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] 'nil' values in the response for application load balancer with ID %v, datacenter ID: %v, skipping this resource\",\n\t\t\t\t\t*applicationLoadBalancer.Id,\n\t\t\t\t\t*datacenter.Id,\n\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\talbForwardingRulesResponse, _, err := cloudAPIClient.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersForwardingrulesGet(context.TODO(), *datacenter.Id, *applicationLoadBalancer.Id).Depth(1).Execute()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif albForwardingRulesResponse.Items == nil {\n\t\t\t\tlog.Printf(\"[WARNING] expected a response containing ALB forwarding rules but received 'nil' instead, skipping search for ALB with ID: %v, datacenter ID: %v\", *applicationLoadBalancer.Id, *datacenter.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\talbForwardingRules := *albForwardingRulesResponse.Items\n\t\t\tfor _, albForwardingRule := range albForwardingRules {\n\t\t\t\tif albForwardingRule.Properties == nil || albForwardingRule.Properties.Name == nil {\n\t\t\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for ALB forwarding rule with ID: %v, ALB ID: %v, datacenter ID: %v, skipping this resource\", *albForwardingRule.Id, *applicationLoadBalancer.Id, *datacenter.Id)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\t*albForwardingRule.Id,\n\t\t\t\t\t*albForwardingRule.Properties.Name+\"-\"+*albForwardingRule.Id,\n\t\t\t\t\tresourceType,\n\t\t\t\t\thelpers.Ionos,\n\t\t\t\t\tmap[string]string{\"application_loadbalancer_id\": *applicationLoadBalancer.Id, helpers.DcID: *datacenter.Id},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/backup_unit.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype BackupUnitGenerator struct {\n\tService\n}\n\nfunc (g *BackupUnitGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_backup_unit\"\n\n\tbackupUnitResponse, _, err := cloudAPIClient.BackupUnitsApi.BackupunitsGet(context.TODO()).Depth(1).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif backupUnitResponse.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing backup units but received 'nil' instead.\")\n\t\treturn nil\n\t}\n\tbackupUnits := *backupUnitResponse.Items\n\tfor _, backupUnit := range backupUnits {\n\t\tif backupUnit.Properties == nil || backupUnit.Properties.Name == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] 'nil' values in the response for backup unit with ID %v, skipping this resource.\\n\",\n\t\t\t\t*backupUnit.Id)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*backupUnit.Id,\n\t\t\t*backupUnit.Properties.Name+\"-\"+*backupUnit.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/certificate.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype CertificateGenerator struct {\n\tService\n}\n\nfunc (g *CertificateGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcertManagerAPIClient := client.CertificateManagerAPIClient\n\tresourceType := \"ionoscloud_certificate\"\n\n\tresponse, _, err := certManagerAPIClient.CertificatesApi.CertificatesGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif response.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing certificates but received 'nil' instead.\")\n\t\treturn nil\n\t}\n\tcertificates := *response.Items\n\tfor _, certificate := range certificates {\n\t\tif certificate.Properties == nil || certificate.Properties.Name == nil {\n\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for the certificate with ID %v, skipping this resource.\", *certificate.Id)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*certificate.Id,\n\t\t\t*certificate.Properties.Name+\"-\"+*certificate.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/container_registry.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype ContainerRegistryGenerator struct {\n\tService\n}\n\nfunc (g *ContainerRegistryGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcontainerRegistryAPIClient := client.ContainerRegistryAPIClient\n\tresourceType := \"ionoscloud_container_registry\"\n\n\tresponse, _, err := containerRegistryAPIClient.RegistriesApi.RegistriesGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif response.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing registries but received 'nil' instead.\")\n\t\treturn nil\n\t}\n\tregistries := *response.Items\n\tfor _, registry := range registries {\n\t\tif registry.Properties == nil || registry.Properties.Name == nil {\n\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for the registry with ID %v, skipping this resource.\", *registry.Id)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*registry.Id,\n\t\t\t*registry.Properties.Name+\"-\"+*registry.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/container_registry_token.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype ContainerRegistryTokenGenerator struct {\n\tService\n}\n\nfunc (g *ContainerRegistryTokenGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcrClient := client.ContainerRegistryAPIClient\n\tresourceType := \"ionoscloud_container_registry_token\"\n\n\tregistriesResponse, _, err := crClient.RegistriesApi.RegistriesGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif registriesResponse.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing registries but received 'nil' instead\")\n\t\treturn nil\n\t}\n\tregistries := *registriesResponse.Items\n\tfor _, registry := range registries {\n\t\ttokensResponse, _, err := crClient.TokensApi.RegistriesTokensGet(context.TODO(), *registry.Id).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif tokensResponse.Items == nil {\n\t\t\tlog.Printf(\"[WARNING] expected a response containing container registry tokens, but received 'nil' instead\")\n\t\t\treturn nil\n\t\t}\n\t\tcrTokens := *tokensResponse.Items\n\t\tfor _, crToken := range crTokens {\n\t\t\tif crToken.Properties == nil || crToken.Properties.Name == nil {\n\t\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for the container registry token with ID: %v, skipping this resource\", *crToken.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*crToken.Id,\n\t\t\t\t*crToken.Properties.Name+\"-\"+*crToken.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{\"registry_id\": *registry.Id},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/datacenter.go",
    "content": "package ionoscloud\n\nimport (\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tionoscloud \"github.com/ionos-cloud/sdk-go/v6\"\n)\n\ntype DatacenterGenerator struct {\n\tService\n}\n\nfunc (g DatacenterGenerator) createResources(datacentersList []ionoscloud.Datacenter) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, datacenter := range datacentersList {\n\t\tif datacenter.Properties == nil || datacenter.Properties.Name == nil {\n\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for Datacenter with ID %v, skipping this resource.\\n\", *datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t*datacenter.Id,\n\t\t\t*datacenter.Properties.Name+\"-\"+*datacenter.Id,\n\t\t\t\"ionoscloud_datacenter\",\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn resources\n}\n\nfunc (g *DatacenterGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\toutput, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/dataplatform_cluster.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype DataPlatformClusterGenerator struct {\n\tService\n}\n\nfunc (g *DataPlatformClusterGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tdataPlatformClient := client.DataPlatformAPIClient\n\tresourceType := \"ionoscloud_dataplatform_cluster\"\n\n\tresponse, _, err := dataPlatformClient.DataPlatformClusterApi.ClustersGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif response.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing data platform clusters, but received 'nil' instead.\")\n\t\treturn nil\n\t}\n\tclusters := *response.Items\n\tfor _, cluster := range clusters {\n\t\tif cluster.Properties == nil || cluster.Properties.Name == nil {\n\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for data platform cluster with ID %v, skipping this resource.\", *cluster.Id)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*cluster.Id,\n\t\t\t*cluster.Properties.Name+\"-\"+*cluster.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/dataplatform_node_pool.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype DataPlatformNodePoolGenerator struct {\n\tService\n}\n\nfunc (g *DataPlatformNodePoolGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tdataPlatformClient := client.DataPlatformAPIClient\n\tresourceType := \"ionoscloud_dataplatform_node_pool\"\n\n\tdpClusters, _, err := dataPlatformClient.DataPlatformClusterApi.ClustersGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif dpClusters.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing data platform clusters but received 'nil' instead.\")\n\t\treturn nil\n\t}\n\tfor _, dpCluster := range *dpClusters.Items {\n\t\tdpNodePools, _, err := dataPlatformClient.DataPlatformNodePoolApi.ClustersNodepoolsGet(context.TODO(), *dpCluster.Id).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif dpNodePools.Items == nil {\n\t\t\tlog.Printf(\"[WARNING] expected a response containing data platform node pools but received 'nil' instead, skipping search for data platform cluster with ID: %v\", *dpCluster.Id)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, dpNodePool := range *dpNodePools.Items {\n\t\t\tif dpNodePool.Properties == nil || dpNodePool.Properties.Name == nil {\n\t\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for data platform node pool with ID %v, cluster ID: %v, skipping this resource\",\n\t\t\t\t\t*dpNodePool.Id,\n\t\t\t\t\t*dpCluster.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*dpNodePool.Id,\n\t\t\t\t*dpNodePool.Properties.Name+\"-\"+*dpNodePool.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.ClusterID: *dpCluster.Id},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/dbaas_mongo_cluster.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype DBaaSMongoClusterGenerator struct {\n\tService\n}\n\nfunc (g *DBaaSMongoClusterGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tdbaasMongoClient := client.DBaaSMongoAPIClient\n\tresourceType := \"ionoscloud_mongo_cluster\"\n\n\tresponse, _, err := dbaasMongoClient.ClustersApi.ClustersGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif response.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing Mongo DB clusters but received 'nil' instead\")\n\t}\n\tclusters := *response.Items\n\tfor _, cluster := range clusters {\n\t\tif cluster.Properties == nil || cluster.Properties.DisplayName == nil {\n\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for Mongo DB cluster with ID: %v, skipping search for this resource\", *cluster.Id)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*cluster.Id,\n\t\t\t*cluster.Properties.DisplayName+\"-\"+*cluster.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/dbaas_mongo_user.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype DBaaSMongoUserGenerator struct {\n\tService\n}\n\nfunc (g *DBaaSMongoUserGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tdbaasMongoClient := client.DBaaSMongoAPIClient\n\tresourceType := \"ionoscloud_mongo_user\"\n\n\tresponse, _, err := dbaasMongoClient.ClustersApi.ClustersGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif response.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing Mongo DB clusters but received 'nil' instead\")\n\t}\n\tclusters := *response.Items\n\tfor _, cluster := range clusters {\n\t\tusersResponse, _, err := dbaasMongoClient.UsersApi.ClustersUsersGet(context.TODO(), *cluster.Id).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif usersResponse.Items == nil {\n\t\t\tlog.Printf(\"[WARNING] expected a response containing Mongo users but received 'nil' instead, skipping search for Mongo cluster with ID: %v\", *cluster.Id)\n\t\t\tcontinue\n\t\t}\n\t\tusers := *usersResponse.Items\n\t\tfor _, user := range users {\n\t\t\tif user.Properties == nil || user.Properties.Username == nil {\n\t\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for Mongo user, skipping this resource\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tuserID := *cluster.Id + *user.Properties.Username\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tuserID,\n\t\t\t\tuserID,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.ClusterID: *cluster.Id, helpers.UsernameArg: *user.Properties.Username},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/dbaas_pgsql_cluster.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tdbaas \"github.com/ionos-cloud/sdk-go-dbaas-postgres\"\n)\n\ntype DBaaSPgSQLClusterGenerator struct {\n\tService\n}\n\nfunc (g DBaaSPgSQLClusterGenerator) createResources(\n\tclustersList []dbaas.ClusterResponse,\n) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, cluster := range clustersList {\n\t\tif cluster.Properties == nil || cluster.Properties.DisplayName == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] 'nil' values in the response for db cluster with ID %v, skipping this resource.\\n\",\n\t\t\t\t*cluster.Id,\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t*cluster.Id,\n\t\t\t*cluster.Properties.DisplayName+\"-\"+*cluster.Id,\n\t\t\t\"ionoscloud_pg_cluster\",\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn resources\n}\n\nfunc (g *DBaaSPgSQLClusterGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tdbaasAPIClient := client.DBaaSPgSQLApiClient\n\toutput, _, err := dbaasAPIClient.ClustersApi.ClustersGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif output.Items != nil {\n\t\tg.Resources = g.createResources(*output.Items)\n\t} else {\n\t\tlog.Printf(\"[WARNING] expected a response containing db clusters but received 'nil' instead.\")\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/dbaas_pgsql_database.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype DBaaSPgSQLDatabaseGenerator struct {\n\tService\n}\n\nfunc (g *DBaaSPgSQLDatabaseGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tdbaasPgSQLClient := client.DBaaSPgSQLApiClient\n\tresourceType := \"ionoscloud_pg_database\"\n\n\tresponse, _, err := dbaasPgSQLClient.ClustersApi.ClustersGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif response.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing PgSQL DB clusters but received 'nil' instead\")\n\t}\n\tclusters := *response.Items\n\tfor _, cluster := range clusters {\n\t\tdatabasesResponse, _, err := dbaasPgSQLClient.DatabasesApi.DatabasesList(context.TODO(), *cluster.Id).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif databasesResponse.Items == nil {\n\t\t\tlog.Printf(\"[WARNING] expected a response containing PgSQL databases but received 'nil' instead, skipping search for PgSQL cluster with ID: %v\", *cluster.Id)\n\t\t\tcontinue\n\t\t}\n\t\tdatabases := *databasesResponse.Items\n\t\tfor _, database := range databases {\n\t\t\tif database.Properties == nil || database.Properties.Name == nil {\n\t\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for PgSQL database with ID: %v, skipping this resource\", *database.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*database.Id,\n\t\t\t\t*database.Properties.Name+\"-\"+*database.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.ClusterID: *cluster.Id, helpers.NameArg: *database.Properties.Name},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/dbaas_pgsql_user.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype DBaaSPgSQLUserGenerator struct {\n\tService\n}\n\nfunc (g *DBaaSPgSQLUserGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tdbaasPgSQLClient := client.DBaaSPgSQLApiClient\n\tresourceType := \"ionoscloud_pg_user\"\n\n\tresponse, _, err := dbaasPgSQLClient.ClustersApi.ClustersGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif response.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing PgSQL DB clusters but received 'nil' instead\")\n\t}\n\tclusters := *response.Items\n\tfor _, cluster := range clusters {\n\t\tusersResponse, _, err := dbaasPgSQLClient.UsersApi.UsersList(context.TODO(), *cluster.Id).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif usersResponse.Items == nil {\n\t\t\tlog.Printf(\"[WARNING] expected a response containing PgSQL users but received 'nil' instead, skipping search for PgSQL cluster with ID: %v\", *cluster.Id)\n\t\t\tcontinue\n\t\t}\n\t\tusers := *usersResponse.Items\n\t\tfor _, user := range users {\n\t\t\tif user.Properties == nil || user.Properties.Username == nil {\n\t\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for PgSQL user, skipping this resource\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*user.Id,\n\t\t\t\t*user.Properties.Username+\"-\"+*user.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.ClusterID: *cluster.Id, helpers.UsernameArg: *user.Properties.Username},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/dns_record.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype DNSRecordGenerator struct {\n\tService\n}\n\nfunc (g *DNSRecordGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tdnsAPIClient := client.DNSAPIClient\n\tresourceType := \"ionoscloud_dns_record\"\n\n\tzonesResponse, _, err := dnsAPIClient.ZonesApi.ZonesGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif zonesResponse.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing DNS Zones, but received 'nil' instead\")\n\t\treturn nil\n\t}\n\tzones := *zonesResponse.Items\n\tfor _, zone := range zones {\n\t\trecordsResponse, _, err := dnsAPIClient.RecordsApi.ZonesRecordsGet(context.TODO(), *zone.Id).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif recordsResponse.Items == nil {\n\t\t\tlog.Printf(\"[WARNING] expected a response containing DNS Records, but received 'nil' instead, skipping search for DNS Zone with ID: %v\", *zone.Id)\n\t\t\tcontinue\n\t\t}\n\t\trecords := *recordsResponse.Items\n\t\tfor _, record := range records {\n\t\t\tif record.Properties == nil || record.Properties.Name == nil {\n\t\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for DNS Record with ID: %v, Zone ID: %v, skipping this resource\", *record.Id, *zone.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*record.Id,\n\t\t\t\t*record.Properties.Name+\"-\"+*record.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.ZoneID: *zone.Id},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/dns_zone.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype DNSZoneGenerator struct {\n\tService\n}\n\nfunc (g *DNSZoneGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tdnsAPIClient := client.DNSAPIClient\n\tresourceType := \"ionoscloud_dns_zone\"\n\n\tresponse, _, err := dnsAPIClient.ZonesApi.ZonesGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif response.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing DNS Zones, but received 'nil' instead\")\n\t\treturn nil\n\t}\n\tzones := *response.Items\n\tfor _, zone := range zones {\n\t\tif zone.Properties == nil || zone.Properties.ZoneName == nil {\n\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for the DNS Zone with ID: %v, skipping this resource\", *zone.Id)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*zone.Id,\n\t\t\t*zone.Properties.ZoneName+\"-\"+*zone.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/firewall.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype FirewallGenerator struct {\n\tService\n}\n\nfunc (g *FirewallGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_firewall\"\n\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, datacenter := range datacenters {\n\t\tservers, _, err := cloudAPIClient.ServersApi.DatacentersServersGet(context.TODO(), *datacenter.Id).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif servers.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing servers but received 'nil' instead, skipping search for datacenter with ID: %v.\\n\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, server := range *servers.Items {\n\t\t\tnics, _, err := cloudAPIClient.NetworkInterfacesApi.DatacentersServersNicsGet(context.TODO(), *datacenter.Id, *server.Id).Execute()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif nics.Items == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] expected a response containing NICs but received 'nil' instead, skipping search for server with ID: %v, datacenter ID: %v.\\n\",\n\t\t\t\t\t*server.Id,\n\t\t\t\t\t*datacenter.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlastNicIdx := len(*nics.Items) - 1\n\t\t\tfor nicIdx, nic := range *nics.Items {\n\t\t\t\tfirewalls, _, err := cloudAPIClient.FirewallRulesApi.DatacentersServersNicsFirewallrulesGet(context.TODO(), *datacenter.Id, *server.Id, *nic.Id).Depth(1).Execute()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif firewalls.Items == nil {\n\t\t\t\t\tlog.Printf(\n\t\t\t\t\t\t\"[WARNING] expected a response containing firewall rules but received 'nil' instead, skipping search for NIC with ID: %v, server ID: %v, datacenter ID: %v.\\n\",\n\t\t\t\t\t\t*nic.Id,\n\t\t\t\t\t\t*server.Id,\n\t\t\t\t\t\t*datacenter.Id)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tlastFirewallIdx := len(*firewalls.Items) - 1\n\t\t\t\tfor firewallIdx, firewall := range *firewalls.Items {\n\t\t\t\t\t// Skip the last firewall rule for the last NIC since this one will be added\n\t\t\t\t\t// to the server separately.\n\t\t\t\t\tif nicIdx == lastNicIdx && firewallIdx == lastFirewallIdx {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif firewall.Properties == nil || firewall.Properties.Name == nil {\n\t\t\t\t\t\tlog.Printf(\n\t\t\t\t\t\t\t\"[WARNING] 'nil' values in the response for the firewall rule with ID %v, NIC ID: %v, server ID: %v, datacenter ID: %v, skipping this resource.\\n\",\n\t\t\t\t\t\t\t*firewall.Id,\n\t\t\t\t\t\t\t*nic.Id,\n\t\t\t\t\t\t\t*server.Id,\n\t\t\t\t\t\t\t*datacenter.Id,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\t\t*firewall.Id,\n\t\t\t\t\t\t*firewall.Properties.Name+\"-\"+*firewall.Id,\n\t\t\t\t\t\tresourceType,\n\t\t\t\t\t\thelpers.Ionos,\n\t\t\t\t\t\tmap[string]string{helpers.DcID: *datacenter.Id, helpers.ServerID: *server.Id, helpers.NicID: *nic.Id},\n\t\t\t\t\t\t[]string{},\n\t\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/group.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype GroupGenerator struct {\n\tService\n}\n\nfunc (g *GroupGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_group\"\n\n\tgroupResponse, _, err := cloudAPIClient.UserManagementApi.UmGroupsGet(context.TODO()).Depth(1).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif groupResponse.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing groups but received 'nil' instead.\")\n\t\treturn nil\n\t}\n\tgroups := *groupResponse.Items\n\tfor _, group := range groups {\n\t\tif group.Properties == nil || group.Properties.Name == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] 'nil' values in the response for group with ID %v, skipping this resource.\\n\",\n\t\t\t\t*group.Id)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*group.Id,\n\t\t\t*group.Properties.Name+\"-\"+*group.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/helpers/constants.go",
    "content": "package helpers\n\nimport \"time\"\n\n// Provider Constants\nconst (\n\tProviderName = \"ionoscloud\"\n)\n\n// Config Constants\nconst (\n\tIonosDebug   = \"IONOS_DEBUG\"\n\tIonos        = \"ionoscloud\"\n\tDcID         = \"datacenter_id\"\n\tClusterID    = \"cluster_id\"\n\tServerID     = \"server_id\"\n\tNicID        = \"nic_id\"\n\tK8sClusterID = \"k8s_cluster_id\"\n\tUserID       = \"user_id\"\n\tGroupID      = \"group_id\"\n\tResourceID   = \"resource_id\"\n\tZoneID       = \"zone_id\"\n\n\tUsernameArg = \"username\"\n\tNameArg     = \"name\"\n\tPasswordArg = \"password\"\n\tTokenArg    = \"token\"\n\tURLArg      = \"url\"\n\t// MaxRetries - number of retries in case of rate-limit\n\tMaxRetries = 999\n\n\t// MaxWaitTime - waits 4 seconds before retry in case of rate limit\n\tMaxWaitTime = 4 * time.Second\n)\n\nconst (\n\tCredentialsError = \"set IONOS_USERNAME and IONOS_PASSWORD or IONOS_TOKEN env var\"\n)\n"
  },
  {
    "path": "providers/ionoscloud/helpers/helper_dependencies_list.go",
    "content": "package helpers\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\tionoscloud \"github.com/ionos-cloud/sdk-go/v6\"\n)\n\nfunc GetAllDatacenters(client ionoscloud.APIClient) ([]ionoscloud.Datacenter, error) {\n\tdatacenters, _, err := client.DataCentersApi.DatacentersGet(context.TODO()).Depth(1).Execute()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif datacenters.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing datacenters but received 'nil' instead.\")\n\t\treturn nil, nil\n\t}\n\treturn *datacenters.Items, nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/ionoscloud_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ionoscloud\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\tionoscloud \"github.com/ionos-cloud/sdk-go/v6\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype IonosCloudProvider struct { //nolint\n\tterraformutils.Provider\n\tusername string\n\tpassword string\n\ttoken    string\n\turl      string\n}\n\nfunc (p *IonosCloudProvider) Init(_ []string) error {\n\tusername := os.Getenv(ionoscloud.IonosUsernameEnvVar)\n\tpassword := os.Getenv(ionoscloud.IonosPasswordEnvVar)\n\ttoken := os.Getenv(ionoscloud.IonosTokenEnvVar)\n\turl := os.Getenv(ionoscloud.IonosApiUrlEnvVar)\n\n\tif (username == \"\" || password == \"\") && token == \"\" {\n\t\treturn errors.New(helpers.CredentialsError)\n\t}\n\n\tif username != \"\" && password != \"\" {\n\t\tp.username = username\n\t\tp.password = password\n\t}\n\n\tif token != \"\" {\n\t\tp.token = token\n\t}\n\n\tp.url = url\n\n\treturn nil\n}\n\nfunc (p *IonosCloudProvider) GetName() string {\n\treturn helpers.ProviderName\n}\n\nfunc (p *IonosCloudProvider) GetProviderData(_ ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (IonosCloudProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"server\": {\n\t\t\t\"datacenter\": []string{helpers.DcID, \"id\"},\n\t\t},\n\t\t\"nic\": {\n\t\t\t\"datacenter\": []string{helpers.DcID, \"id\"},\n\t\t\t\"server\":     []string{helpers.ServerID, \"id\"},\n\t\t},\n\t\t\"volume\": {\n\t\t\t\"datacenter\": []string{helpers.DcID, \"id\"},\n\t\t\t\"server\":     []string{helpers.ServerID, \"id\"},\n\t\t},\n\t\t\"firewall\": {\n\t\t\t\"datacenter\": []string{helpers.DcID, \"id\"},\n\t\t\t\"server\":     []string{helpers.ServerID, \"id\"},\n\t\t\t\"nic\":        []string{helpers.NicID, \"id\"},\n\t\t},\n\t\t\"k8s_node_pool\": {\n\t\t\t\"datacenter\":  []string{helpers.DcID, \"id\"},\n\t\t\t\"k8s_cluster\": []string{helpers.K8sClusterID, \"id\"},\n\t\t},\n\t\t\"networkloadbalancer\": {\n\t\t\t\"datacenter\": []string{helpers.DcID, \"id\"},\n\t\t},\n\t\t\"natgateway\": {\n\t\t\t\"datacenter\": []string{helpers.DcID, \"id\"},\n\t\t},\n\t\t\"application_loadbalancer\": {\n\t\t\t\"datacenter\": []string{helpers.DcID, \"id\"},\n\t\t},\n\t\t\"networkloadbalancer_forwardingrule\": {\n\t\t\t\"datacenter\":   []string{helpers.DcID, \"id\"},\n\t\t\t\"loadbalancer\": []string{\"networkloadbalancer_id\", \"id\"},\n\t\t},\n\t\t\"loadbalancer\": {\n\t\t\t\"datacenter\": []string{helpers.DcID, \"id\"},\n\t\t},\n\t\t\"natgateway_rule\": {\n\t\t\t\"datacenter\": []string{helpers.DcID, \"id\"},\n\t\t\t\"natgateway\": []string{\"natgateway_id\", \"id\"},\n\t\t},\n\t\t\"s3_key\": {\n\t\t\t\"user\": []string{helpers.UserID, \"id\"},\n\t\t},\n\t\t\"share\": {\n\t\t\t\"group\": []string{helpers.GroupID, \"id\"},\n\t\t},\n\t}\n}\n\nfunc (p *IonosCloudProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"datacenter\":               &DatacenterGenerator{},\n\t\t\"lan\":                      &LanGenerator{},\n\t\t\"nic\":                      &NicGenerator{},\n\t\t\"server\":                   &ServerGenerator{},\n\t\t\"volume\":                   &VolumeGenerator{},\n\t\t\"pg_cluster\":               &DBaaSPgSQLClusterGenerator{},\n\t\t\"pg_user\":                  &DBaaSPgSQLUserGenerator{},\n\t\t\"pg_database\":              &DBaaSPgSQLDatabaseGenerator{},\n\t\t\"mongo_cluster\":            &DBaaSMongoClusterGenerator{},\n\t\t\"mongo_user\":               &DBaaSMongoUserGenerator{},\n\t\t\"backup_unit\":              &BackupUnitGenerator{},\n\t\t\"ipblock\":                  &IPBlockGenerator{},\n\t\t\"k8s_cluster\":              &KubernetesClusterGenerator{},\n\t\t\"k8s_node_pool\":            &KubernetesNodePoolGenerator{},\n\t\t\"target_group\":             &TargetGroupGenerator{},\n\t\t\"networkloadbalancer\":      &NetworkLoadBalancerGenerator{},\n\t\t\"natgateway\":               &NATGatewayGenerator{},\n\t\t\"group\":                    &GroupGenerator{},\n\t\t\"application_loadbalancer\": &ApplicationLoadBalancerGenerator{},\n\t\t\"application_loadbalancer_forwardingrule\": &ALBForwardingRuleGenerator{},\n\t\t\"firewall\":                           &FirewallGenerator{},\n\t\t\"networkloadbalancer_forwardingrule\": &NetworkLoadBalancerForwardingRuleGenerator{},\n\t\t\"loadbalancer\":                       &LoadBalancerGenerator{},\n\t\t\"natgateway_rule\":                    &NATGatewayRuleGenerator{},\n\t\t\"certificate\":                        &CertificateGenerator{},\n\t\t\"private_crossconnect\":               &PrivateCrossConnectGenerator{},\n\t\t\"s3_key\":                             &S3KeyGenerator{},\n\t\t\"container_registry\":                 &ContainerRegistryGenerator{},\n\t\t\"dataplatform_cluster\":               &DataPlatformClusterGenerator{},\n\t\t\"dataplatform_node_pool\":             &DataPlatformNodePoolGenerator{},\n\t\t\"share\":                              &ShareGenerator{},\n\t\t\"user\":                               &UserGenerator{},\n\t\t\"container_registry_token\":           &ContainerRegistryTokenGenerator{},\n\t\t\"dns_zone\":                           &DNSZoneGenerator{},\n\t\t\"dns_record\":                         &DNSRecordGenerator{},\n\t\t\"logging_pipeline\":                   &LoggingPipelineGenerator{},\n\t\t\"ipfailover\":                         &IPFailoverGenerator{},\n\t}\n}\n\nfunc (p *IonosCloudProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(helpers.Ionos + \": \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"username\": p.username,\n\t\t\"password\": p.password,\n\t\t\"token\":    p.token,\n\t\t\"url\":      p.url,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/ionoscloud_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ionoscloud\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net\"\n\t\"net/http\"\n\t\"os\"\n\t\"runtime\"\n\t\"time\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tcertificateManager \"github.com/ionos-cloud/sdk-go-cert-manager\"\n\tcontainerRegistry \"github.com/ionos-cloud/sdk-go-container-registry\"\n\tdataPlatform \"github.com/ionos-cloud/sdk-go-dataplatform\"\n\tdbaasMongo \"github.com/ionos-cloud/sdk-go-dbaas-mongo\"\n\tdbaasPgSQL \"github.com/ionos-cloud/sdk-go-dbaas-postgres\"\n\tdns \"github.com/ionos-cloud/sdk-go-dns\"\n\tlogging \"github.com/ionos-cloud/sdk-go-logging\"\n\tionoscloud \"github.com/ionos-cloud/sdk-go/v6\"\n)\n\ntype Service struct {\n\tterraformutils.Service\n}\n\ntype Bundle struct {\n\tCloudAPIClient              *ionoscloud.APIClient\n\tDBaaSPgSQLApiClient         *dbaasPgSQL.APIClient\n\tDBaaSMongoAPIClient         *dbaasMongo.APIClient\n\tCertificateManagerAPIClient *certificateManager.APIClient\n\tContainerRegistryAPIClient  *containerRegistry.APIClient\n\tDataPlatformAPIClient       *dataPlatform.APIClient\n\tDNSAPIClient                *dns.APIClient\n\tLoggingAPIClient            *logging.APIClient\n}\n\ntype clientType int\n\nconst (\n\tionosClient clientType = iota\n\tdbaasPgSQLClient\n\tdbaasMongoClient\n\tcertificateManagerClient\n\tcontainerRegistryClient\n\tdataPlatformClient\n\tdnsClient\n\tloggingClient\n)\n\nfunc (s *Service) generateClient() *Bundle {\n\tusername := s.Args[helpers.UsernameArg].(string)\n\tpassword := s.Args[helpers.PasswordArg].(string)\n\ttoken := s.Args[helpers.TokenArg].(string)\n\turl := s.Args[helpers.URLArg].(string)\n\n\tcleanedURL := cleanURL(url)\n\n\tnewConfig := ionoscloud.NewConfiguration(username, password, token, cleanedURL)\n\n\tif os.Getenv(helpers.IonosDebug) != \"\" {\n\t\tnewConfig.Debug = true\n\t}\n\n\tnewConfig.MaxRetries = helpers.MaxRetries\n\tnewConfig.WaitTime = helpers.MaxWaitTime\n\n\tclients := map[clientType]interface{}{\n\t\tionosClient:              NewClientByType(username, password, token, cleanedURL, ionosClient),\n\t\tdbaasPgSQLClient:         NewClientByType(username, password, token, cleanedURL, dbaasPgSQLClient),\n\t\tdbaasMongoClient:         NewClientByType(username, password, token, cleanedURL, dbaasMongoClient),\n\t\tcertificateManagerClient: NewClientByType(username, password, token, cleanedURL, certificateManagerClient),\n\t\tcontainerRegistryClient:  NewClientByType(username, password, token, cleanedURL, containerRegistryClient),\n\t\tdataPlatformClient:       NewClientByType(username, password, token, cleanedURL, dataPlatformClient),\n\t\tdnsClient:                NewClientByType(username, password, token, cleanedURL, dnsClient),\n\t\tloggingClient:            NewClientByType(username, password, token, cleanedURL, loggingClient),\n\t}\n\n\treturn &Bundle{\n\t\tCloudAPIClient:              clients[ionosClient].(*ionoscloud.APIClient),\n\t\tDBaaSPgSQLApiClient:         clients[dbaasPgSQLClient].(*dbaasPgSQL.APIClient),\n\t\tDBaaSMongoAPIClient:         clients[dbaasMongoClient].(*dbaasMongo.APIClient),\n\t\tCertificateManagerAPIClient: clients[certificateManagerClient].(*certificateManager.APIClient),\n\t\tContainerRegistryAPIClient:  clients[containerRegistryClient].(*containerRegistry.APIClient),\n\t\tDataPlatformAPIClient:       clients[dataPlatformClient].(*dataPlatform.APIClient),\n\t\tDNSAPIClient:                clients[dnsClient].(*dns.APIClient),\n\t\tLoggingAPIClient:            clients[loggingClient].(*logging.APIClient),\n\t}\n}\n\nfunc NewClientByType(username, password, token, url string, clientType clientType) interface{} {\n\tswitch clientType {\n\tcase ionosClient:\n\t\t{\n\t\t\tnewConfig := ionoscloud.NewConfiguration(username, password, token, url)\n\n\t\t\tif os.Getenv(helpers.IonosDebug) != \"\" {\n\t\t\t\tnewConfig.Debug = true\n\t\t\t}\n\t\t\tnewConfig.MaxRetries = helpers.MaxRetries\n\t\t\tnewConfig.WaitTime = helpers.MaxWaitTime\n\t\t\tnewConfig.HTTPClient = &http.Client{Transport: CreateTransport()}\n\t\t\tnewConfig.UserAgent = fmt.Sprintf(\n\t\t\t\t\"terraformer_ionos-cloud-sdk-go/%s_os/%s_arch/%s\", ionoscloud.Version, runtime.GOOS, runtime.GOARCH)\n\t\t\treturn ionoscloud.NewAPIClient(newConfig)\n\t\t}\n\tcase dbaasPgSQLClient:\n\t\t{\n\t\t\tnewConfig := dbaasPgSQL.NewConfiguration(username, password, token, url)\n\n\t\t\tif os.Getenv(helpers.IonosDebug) != \"\" {\n\t\t\t\tnewConfig.Debug = true\n\t\t\t}\n\t\t\tnewConfig.MaxRetries = helpers.MaxRetries\n\t\t\tnewConfig.WaitTime = helpers.MaxWaitTime\n\t\t\tnewConfig.HTTPClient = &http.Client{Transport: CreateTransport()}\n\t\t\tnewConfig.UserAgent = fmt.Sprintf(\n\t\t\t\t\"terraformer_ionos-cloud-sdk-go-dbaas-postgres/%s_os/%s_arch/%s\", dbaasPgSQL.Version, runtime.GOOS, runtime.GOARCH)\n\t\t\treturn dbaasPgSQL.NewAPIClient(newConfig)\n\t\t}\n\tcase dbaasMongoClient:\n\t\t{\n\t\t\tnewConfig := dbaasMongo.NewConfiguration(username, password, token, url)\n\n\t\t\tif os.Getenv(helpers.IonosDebug) != \"\" {\n\t\t\t\tnewConfig.Debug = true\n\t\t\t}\n\t\t\tnewConfig.MaxRetries = helpers.MaxRetries\n\t\t\tnewConfig.WaitTime = helpers.MaxWaitTime\n\t\t\tnewConfig.HTTPClient = &http.Client{Transport: CreateTransport()}\n\t\t\tnewConfig.UserAgent = fmt.Sprintf(\n\t\t\t\t\"terraformer_ionos-cloud-sdk-go-dbaas-mongo/%s_os/%s_arch/%s\", dbaasMongo.Version, runtime.GOOS, runtime.GOARCH)\n\t\t\treturn dbaasMongo.NewAPIClient(newConfig)\n\t\t}\n\tcase certificateManagerClient:\n\t\t{\n\t\t\tnewConfig := certificateManager.NewConfiguration(username, password, token, url)\n\n\t\t\tif os.Getenv(helpers.IonosDebug) != \"\" {\n\t\t\t\tnewConfig.Debug = true\n\t\t\t}\n\t\t\tnewConfig.MaxRetries = helpers.MaxRetries\n\t\t\tnewConfig.WaitTime = helpers.MaxWaitTime\n\t\t\tnewConfig.HTTPClient = &http.Client{Transport: CreateTransport()}\n\t\t\tnewConfig.UserAgent = fmt.Sprintf(\n\t\t\t\t\"terraformer_ionos-cloud-sdk-go-cert-manager/%s_os/%s_arch/%s\", certificateManager.Version, runtime.GOOS, runtime.GOARCH)\n\t\t\treturn certificateManager.NewAPIClient(newConfig)\n\t\t}\n\tcase containerRegistryClient:\n\t\t{\n\t\t\tnewConfig := containerRegistry.NewConfiguration(username, password, token, url)\n\n\t\t\tif os.Getenv(helpers.IonosDebug) != \"\" {\n\t\t\t\tnewConfig.Debug = true\n\t\t\t}\n\t\t\tnewConfig.MaxRetries = helpers.MaxRetries\n\t\t\tnewConfig.WaitTime = helpers.MaxWaitTime\n\t\t\tnewConfig.HTTPClient = &http.Client{Transport: CreateTransport()}\n\t\t\tnewConfig.UserAgent = fmt.Sprintf(\n\t\t\t\t\"terraformer_ionos-cloud-sdk-go-container-registry/%s_os/%s_arch/%s\", containerRegistry.Version, runtime.GOOS, runtime.GOARCH)\n\t\t\treturn containerRegistry.NewAPIClient(newConfig)\n\t\t}\n\tcase dataPlatformClient:\n\t\t{\n\t\t\tnewConfig := dataPlatform.NewConfiguration(username, password, token, url)\n\n\t\t\tif os.Getenv(helpers.IonosDebug) != \"\" {\n\t\t\t\tnewConfig.Debug = true\n\t\t\t}\n\t\t\tnewConfig.MaxRetries = helpers.MaxRetries\n\t\t\tnewConfig.WaitTime = helpers.MaxWaitTime\n\t\t\tnewConfig.HTTPClient = &http.Client{Transport: CreateTransport()}\n\t\t\tnewConfig.UserAgent = fmt.Sprintf(\n\t\t\t\t\"terraformer_ionos-cloud-sdk-go-dataplatform/%s_os/%s_arch/%s\", dataPlatform.Version, runtime.GOOS, runtime.GOARCH)\n\t\t\treturn dataPlatform.NewAPIClient(newConfig)\n\t\t}\n\tcase dnsClient:\n\t\t{\n\t\t\tnewConfig := dns.NewConfiguration(username, password, token, url)\n\n\t\t\tif os.Getenv(helpers.IonosDebug) != \"\" {\n\t\t\t\tnewConfig.Debug = true\n\t\t\t}\n\t\t\tnewConfig.MaxRetries = helpers.MaxRetries\n\t\t\tnewConfig.WaitTime = helpers.MaxWaitTime\n\t\t\tnewConfig.HTTPClient = &http.Client{Transport: CreateTransport()}\n\t\t\tnewConfig.UserAgent = fmt.Sprintf(\n\t\t\t\t\"terraformer_ionos-cloud-sdk-go-dns/%s_os/%s_arch/%s\", dns.Version, runtime.GOOS, runtime.GOARCH)\n\t\t\treturn dns.NewAPIClient(newConfig)\n\t\t}\n\tcase loggingClient:\n\t\t{\n\t\t\tnewConfig := logging.NewConfiguration(username, password, token, url)\n\n\t\t\tif os.Getenv(helpers.IonosDebug) != \"\" {\n\t\t\t\tnewConfig.Debug = true\n\t\t\t}\n\t\t\tnewConfig.MaxRetries = helpers.MaxRetries\n\t\t\tnewConfig.WaitTime = helpers.MaxWaitTime\n\t\t\tnewConfig.HTTPClient = &http.Client{Transport: CreateTransport()}\n\t\t\tnewConfig.UserAgent = fmt.Sprintf(\n\t\t\t\t\"terraformer_ionos-cloud-sdk-go-logging/%s_os/%s_arch/%s\", logging.Version, runtime.GOOS, runtime.GOARCH)\n\t\t\treturn logging.NewAPIClient(newConfig)\n\t\t}\n\tdefault:\n\t\tlog.Printf(\"[ERROR] unknown client type %d\", clientType)\n\t}\n\treturn nil\n}\n\n// cleanURL makes sure trailing slash does not corrupt the state\nfunc cleanURL(url string) string {\n\tlength := len(url)\n\tif length > 1 && url[length-1] == '/' {\n\t\turl = url[:length-1]\n\t}\n\n\treturn url\n}\nfunc CreateTransport() *http.Transport {\n\tdialer := &net.Dialer{\n\t\tTimeout:   30 * time.Second,\n\t\tKeepAlive: 30 * time.Second,\n\t}\n\treturn &http.Transport{\n\t\tProxy:                 http.ProxyFromEnvironment,\n\t\tDialContext:           dialer.DialContext,\n\t\tDisableKeepAlives:     true,\n\t\tIdleConnTimeout:       30 * time.Second,\n\t\tTLSHandshakeTimeout:   15 * time.Second,\n\t\tExpectContinueTimeout: 1 * time.Second,\n\t\tMaxIdleConnsPerHost:   3,\n\t\tMaxConnsPerHost:       3,\n\t}\n}\n"
  },
  {
    "path": "providers/ionoscloud/ip_block.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype IPBlockGenerator struct {\n\tService\n}\n\nfunc (g *IPBlockGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_ipblock\"\n\n\tipBlockResponse, _, err := cloudAPIClient.IPBlocksApi.IpblocksGet(context.TODO()).Depth(1).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif ipBlockResponse.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing IP blocks but received 'nil' instead.\")\n\t\treturn nil\n\t}\n\tipBlocks := *ipBlockResponse.Items\n\tfor _, ipBlock := range ipBlocks {\n\t\tif ipBlock.Properties == nil || ipBlock.Properties.Name == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] 'nil' values in the response for IP block with ID %v, skipping this resource.\\n\",\n\t\t\t\t*ipBlock.Id)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*ipBlock.Id,\n\t\t\t*ipBlock.Properties.Name+\"-\"+*ipBlock.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/ipfailover.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tuuid \"github.com/gofrs/uuid/v3\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n)\n\ntype IPFailoverGenerator struct {\n\tService\n}\n\nfunc (g *IPFailoverGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tresourceType := \"ionoscloud_ipfailover\"\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, datacenter := range datacenters {\n\t\tlans, _, err := cloudAPIClient.LANsApi.DatacentersLansGet(context.TODO(), *datacenter.Id).Depth(1).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif lans.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing LANs but received 'nil' instead, skipping search for datacenter with ID: %v\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, lan := range *lans.Items {\n\t\t\tif lan.Properties == nil || lan.Properties.IpFailover == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] 'nil' values in the response for LAN with ID %v, datacenter ID: %v, skipping this resource\",\n\t\t\t\t\t*lan.Id,\n\t\t\t\t\t*datacenter.Id,\n\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, ipFailover := range *lan.Properties.IpFailover {\n\t\t\t\t// Generate the ID of the resource using the IP\n\t\t\t\tid := uuid.NewV5(uuid.NewV5(uuid.NamespaceURL, \"https://github.com/ionos-cloud/terraform-provider-ionoscloud\"), *ipFailover.Ip).String()\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\tid,\n\t\t\t\t\tid,\n\t\t\t\t\tresourceType,\n\t\t\t\t\thelpers.Ionos,\n\t\t\t\t\tmap[string]string{helpers.DcID: *datacenter.Id, \"lan_id\": *lan.Id, \"ip\": *ipFailover.Ip, \"nicuuid\": *ipFailover.NicUuid},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/kubernetes_cluster.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype KubernetesClusterGenerator struct {\n\tService\n}\n\nfunc (g *KubernetesClusterGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_k8s_cluster\"\n\n\tkubernetesClusterResponse, _, err := cloudAPIClient.KubernetesApi.K8sGet(context.TODO()).Depth(1).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif kubernetesClusterResponse.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing k8s clusters but received 'nil' instead.\")\n\t\treturn nil\n\t}\n\tkubernetesClusters := *kubernetesClusterResponse.Items\n\tfor _, kubernetesCluster := range kubernetesClusters {\n\t\tif kubernetesCluster.Properties == nil || kubernetesCluster.Properties.Name == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] 'nil' values in the response for k8s cluster with ID %v, skipping this resource.\\n\",\n\t\t\t\t*kubernetesCluster.Id)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*kubernetesCluster.Id,\n\t\t\t*kubernetesCluster.Properties.Name+\"-\"+*kubernetesCluster.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/kubernetes_node_pool.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype KubernetesNodePoolGenerator struct {\n\tService\n}\n\nfunc (g *KubernetesNodePoolGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_k8s_node_pool\"\n\n\tkubernetesClusters, _, err := cloudAPIClient.KubernetesApi.K8sGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif kubernetesClusters.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing k8s clusters but received 'nil' instead.\")\n\t\treturn nil\n\t}\n\tfor _, kubernetesCluster := range *kubernetesClusters.Items {\n\t\tkubernetesNodePools, _, err := cloudAPIClient.KubernetesApi.K8sNodepoolsGet(context.TODO(), *kubernetesCluster.Id).Depth(1).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif kubernetesNodePools.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing k8s node pools but received 'nil' instead, skipping search for k8s cluster with ID: %v.\\n\",\n\t\t\t\t*kubernetesCluster.Id)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, kubernetesNodePool := range *kubernetesNodePools.Items {\n\t\t\tif kubernetesNodePool.Properties == nil || kubernetesNodePool.Properties.Name == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] 'nil' values in the response for k8s node pool with ID %v, k8s cluster ID: %v, skipping this resource.\\n\",\n\t\t\t\t\t*kubernetesNodePool.Id,\n\t\t\t\t\t*kubernetesCluster.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*kubernetesNodePool.Id,\n\t\t\t\t*kubernetesNodePool.Properties.Name+\"-\"+*kubernetesNodePool.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.K8sClusterID: *kubernetesCluster.Id},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/lan.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype LanGenerator struct {\n\tService\n}\n\nfunc (g *LanGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, datacenter := range datacenters {\n\t\tlans, _, err := cloudAPIClient.LANsApi.DatacentersLansGet(context.TODO(), *datacenter.Id).Depth(1).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif lans.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing LANs but received 'nil' instead, skipping search for datacenter with ID: %v\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, lan := range *lans.Items {\n\t\t\tif lan.Properties == nil || lan.Properties.Name == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] 'nil' values in the response for LAN with ID %v, datacenter ID: %v, skipping this resource\",\n\t\t\t\t\t*lan.Id,\n\t\t\t\t\t*datacenter.Id,\n\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif lan.Properties != nil && lan.Properties.Name != nil {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\t*lan.Id,\n\t\t\t\t\t*lan.Properties.Name+\"-\"+*lan.Id,\n\t\t\t\t\t\"ionoscloud_lan\",\n\t\t\t\t\thelpers.Ionos,\n\t\t\t\t\tmap[string]string{helpers.DcID: *datacenter.Id},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/load_balancer.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype LoadBalancerGenerator struct {\n\tService\n}\n\nfunc (g *LoadBalancerGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_loadbalancer\"\n\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, datacenter := range datacenters {\n\t\tloadBalancerResponse, _, err := cloudAPIClient.LoadBalancersApi.DatacentersLoadbalancersGet(context.TODO(), *datacenter.Id).Depth(1).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif loadBalancerResponse.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing load balancers but received 'nil' instead, skipping search for datacenter with ID: %v\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tloadBalancers := *loadBalancerResponse.Items\n\t\tfor _, loadBalancer := range loadBalancers {\n\t\t\tif loadBalancer.Properties == nil || loadBalancer.Properties.Name == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] 'nil' values in the response for load balancer with ID %v, datacenter ID: %v, skipping this resource\",\n\t\t\t\t\t*loadBalancer.Id,\n\t\t\t\t\t*datacenter.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*loadBalancer.Id,\n\t\t\t\t*loadBalancer.Properties.Name+\"-\"+*loadBalancer.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.DcID: *datacenter.Id},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/logging_pipeline.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype LoggingPipelineGenerator struct {\n\tService\n}\n\nfunc (g *LoggingPipelineGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tloggingAPIClient := client.LoggingAPIClient\n\tresourceType := \"ionoscloud_logging_pipeline\"\n\n\tresponse, _, err := loggingAPIClient.PipelinesApi.PipelinesGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif response.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing pipelines, but received 'nil' instead\")\n\t\treturn nil\n\t}\n\tpipelines := *response.Items\n\tfor _, pipeline := range pipelines {\n\t\tif pipeline.Properties == nil || pipeline.Properties.Name == nil {\n\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for the pipeline with ID: %v, skipping this resource\", *pipeline.Id)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*pipeline.Id,\n\t\t\t*pipeline.Properties.Name+\"-\"+*pipeline.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/nat_gateway.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype NATGatewayGenerator struct {\n\tService\n}\n\nfunc (g *NATGatewayGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_natgateway\"\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, datacenter := range datacenters {\n\t\tnatGatewayResponse, _, err := cloudAPIClient.NATGatewaysApi.DatacentersNatgatewaysGet(context.TODO(), *datacenter.Id).Depth(1).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif natGatewayResponse.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing NAT gateways but received 'nil' instead, skipping search for datacenter with ID: %v.\\n\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tnatGateways := *natGatewayResponse.Items\n\t\tfor _, natGateway := range natGateways {\n\t\t\tif natGateway.Properties == nil || natGateway.Properties.Name == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] 'nil' values in the response for NAT gateway with ID %v, datacenter ID: %v, skipping this resource.\\n\",\n\t\t\t\t\t*natGateway.Id,\n\t\t\t\t\t*datacenter.Id,\n\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*natGateway.Id,\n\t\t\t\t*natGateway.Properties.Name+\"-\"+*natGateway.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.DcID: *datacenter.Id},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/nat_gateway_rule.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype NATGatewayRuleGenerator struct {\n\tService\n}\n\nfunc (g *NATGatewayRuleGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_natgateway_rule\"\n\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, datacenter := range datacenters {\n\t\tnatGatewaysResponse, _, err := cloudAPIClient.NATGatewaysApi.DatacentersNatgatewaysGet(context.TODO(), *datacenter.Id).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif natGatewaysResponse.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing NAT gateways but received 'nil' instead, skipping search for datacenter with ID: %v\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tnatGateways := *natGatewaysResponse.Items\n\t\tfor _, natGateway := range natGateways {\n\t\t\trulesResponse, _, err := cloudAPIClient.NATGatewaysApi.DatacentersNatgatewaysRulesGet(context.TODO(), *datacenter.Id, *natGateway.Id).Depth(1).Execute()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif rulesResponse.Items == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] expected a response containing NAT gateway rules but received 'nil' instead, skipping search for NAT Gateway with ID: %v, datacenter ID: %v.\",\n\t\t\t\t\t*natGateway.Id,\n\t\t\t\t\t*datacenter.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\trules := *rulesResponse.Items\n\t\t\tfor _, rule := range rules {\n\t\t\t\tif rule.Properties == nil || rule.Properties.Name == nil {\n\t\t\t\t\tlog.Printf(\n\t\t\t\t\t\t\"[WARNING] 'nil' values in the response for NAT gateway rule with ID: %v, NAT gateway ID: %v, datacenter ID: %v\",\n\t\t\t\t\t\t*rule.Id,\n\t\t\t\t\t\t*natGateway.Id,\n\t\t\t\t\t\t*datacenter.Id)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\t*rule.Id,\n\t\t\t\t\t*rule.Properties.Name+\"-\"+*rule.Id,\n\t\t\t\t\tresourceType,\n\t\t\t\t\thelpers.Ionos,\n\t\t\t\t\tmap[string]string{helpers.DcID: *datacenter.Id, \"natgateway_id\": *natGateway.Id},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/network_load_balancer.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype NetworkLoadBalancerGenerator struct {\n\tService\n}\n\nfunc (g *NetworkLoadBalancerGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_networkloadbalancer\"\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, datacenter := range datacenters {\n\t\tnetworkLoadBalancerResponse, _, err := cloudAPIClient.NetworkLoadBalancersApi.DatacentersNetworkloadbalancersGet(context.TODO(), *datacenter.Id).Depth(1).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif networkLoadBalancerResponse.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing network load balancers but received 'nil' instead, skipping search for datacenter with ID: %v.\\n\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tnetworkLoadBalancers := *networkLoadBalancerResponse.Items\n\t\tfor _, networkLoadBalancer := range networkLoadBalancers {\n\t\t\tif networkLoadBalancer.Properties == nil || networkLoadBalancer.Properties.Name == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] 'nil' values in the response for network load balancer with ID %v, datacenter ID: %v, skipping this resource.\\n\",\n\t\t\t\t\t*networkLoadBalancer.Id,\n\t\t\t\t\t*datacenter.Id,\n\t\t\t\t)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*networkLoadBalancer.Id,\n\t\t\t\t*networkLoadBalancer.Properties.Name+\"-\"+*networkLoadBalancer.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.DcID: *datacenter.Id},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/network_load_balancer_forwarding_rule.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype NetworkLoadBalancerForwardingRuleGenerator struct {\n\tService\n}\n\nfunc (g *NetworkLoadBalancerForwardingRuleGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_networkloadbalancer_forwardingrule\"\n\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, datacenter := range datacenters {\n\t\tnetworkLoadBalancerResponse, _, err := cloudAPIClient.NetworkLoadBalancersApi.DatacentersNetworkloadbalancersGet(context.TODO(), *datacenter.Id).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif networkLoadBalancerResponse.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing network load balancers but received 'nil' instead, skipping search for datacenter with ID: %v.\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tnetworkLoadBalancers := *networkLoadBalancerResponse.Items\n\t\tfor _, nlb := range networkLoadBalancers {\n\t\t\tforwardingRulesResponse, _, err := cloudAPIClient.NetworkLoadBalancersApi.DatacentersNetworkloadbalancersForwardingrulesGet(context.TODO(), *datacenter.Id, *nlb.Id).Depth(1).Execute()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif forwardingRulesResponse.Items == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] expected a response containing forwarding rules but received 'nil' instead, skipping search for NLB with ID: %v, datacenter ID: %v\",\n\t\t\t\t\t*nlb.Id,\n\t\t\t\t\t*datacenter.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tforwardingRules := *forwardingRulesResponse.Items\n\t\t\tfor _, fr := range forwardingRules {\n\t\t\t\tif fr.Properties == nil || fr.Properties.Name == nil {\n\t\t\t\t\tlog.Printf(\n\t\t\t\t\t\t\"[WARNING] 'nil' values in the response for the forwarding rule with ID %v, NLB ID: %v, datacenter ID: %v\",\n\t\t\t\t\t\t*fr.Id,\n\t\t\t\t\t\t*nlb.Id,\n\t\t\t\t\t\t*datacenter.Id)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\t*fr.Id,\n\t\t\t\t\t*fr.Properties.Name+\"-\"+*fr.Id,\n\t\t\t\t\tresourceType,\n\t\t\t\t\thelpers.Ionos,\n\t\t\t\t\tmap[string]string{helpers.DcID: *datacenter.Id, \"networkloadbalancer_id\": *nlb.Id},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/nic.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype NicGenerator struct {\n\tService\n}\n\nfunc (g *NicGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, datacenter := range datacenters {\n\t\tservers, _, err := cloudAPIClient.ServersApi.DatacentersServersGet(context.TODO(), *datacenter.Id).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif servers.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing servers but received 'nil' instead, skipping search for datacenter with ID: %v.\\n\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, server := range *servers.Items {\n\t\t\tnics, _, err := cloudAPIClient.NetworkInterfacesApi.DatacentersServersNicsGet(context.TODO(), *datacenter.Id, *server.Id).Depth(1).Execute()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif nics.Items == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] expected a response containing NICs but received 'nil' instead, skipping search for server with ID: %v, datacenter ID: %v.\\n\",\n\t\t\t\t\t*server.Id,\n\t\t\t\t\t*datacenter.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlastNicIdx := len(*nics.Items) - 1\n\t\t\tfor idx, nic := range *nics.Items {\n\t\t\t\t// skip the last nic from the list, as it will be added to the server separately.\n\t\t\t\tif idx == lastNicIdx {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif nic.Properties == nil || nic.Properties.Name == nil {\n\t\t\t\t\tlog.Printf(\n\t\t\t\t\t\t\"[WARNING] 'nil' values in the response for NIC with ID %v, server ID: %v, datacenter ID: %v, skipping this resource.\\n\",\n\t\t\t\t\t\t*nic.Id,\n\t\t\t\t\t\t*server.Id,\n\t\t\t\t\t\t*datacenter.Id,\n\t\t\t\t\t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\t*nic.Id,\n\t\t\t\t\t*nic.Properties.Name+\"-\"+*nic.Id,\n\t\t\t\t\t\"ionoscloud_nic\",\n\t\t\t\t\thelpers.Ionos,\n\t\t\t\t\tmap[string]string{helpers.DcID: *datacenter.Id,\n\t\t\t\t\t\thelpers.ServerID: *server.Id},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/private_crossconnect.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype PrivateCrossConnectGenerator struct {\n\tService\n}\n\nfunc (g *PrivateCrossConnectGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_private_crossconnect\"\n\n\tpccsResponse, _, err := cloudAPIClient.PrivateCrossConnectsApi.PccsGet(context.TODO()).Depth(1).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif pccsResponse.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing PCCs but received 'nil' instead.\\n\")\n\t\treturn nil\n\t}\n\tpccs := *pccsResponse.Items\n\tfor _, pcc := range pccs {\n\t\tif pcc.Properties == nil || pcc.Properties.Name == nil {\n\t\t\tlog.Printf(\"[WARNING] 'nil' values in the response for PCC with ID %v, skipping this resource.\\n\", *pcc.Id)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*pcc.Id,\n\t\t\t*pcc.Properties.Name+\"-\"+*pcc.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/s3_key.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype S3KeyGenerator struct {\n\tService\n}\n\nfunc (g *S3KeyGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_s3_key\"\n\n\tusersResponse, _, err := cloudAPIClient.UserManagementApi.UmUsersGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif usersResponse.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing users but received 'nil' instead\")\n\t\treturn nil\n\t}\n\tfor _, user := range *usersResponse.Items {\n\t\ts3KeysResponse, _, err := cloudAPIClient.UserS3KeysApi.UmUsersS3keysGet(context.TODO(), *user.Id).Depth(1).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif s3KeysResponse.Items == nil {\n\t\t\tlog.Printf(\"[WARNING] expected a response containing S3 keys but received 'nil' instead, skipping search for user with ID: %v.\\n\",\n\t\t\t\t*user.Id)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, s3Key := range *s3KeysResponse.Items {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*s3Key.Id,\n\t\t\t\t*s3Key.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.UserID: *user.Id},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/server.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tionoscloud \"github.com/ionos-cloud/sdk-go/v6\"\n)\n\ntype ServerGenerator struct {\n\tService\n}\n\nfunc (g *ServerGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, datacenter := range datacenters {\n\t\tservers, _, err := cloudAPIClient.ServersApi.DatacentersServersGet(context.TODO(), *datacenter.Id).Depth(4).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif servers.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing servers but received 'nil' instead, skipping search for datacenter with ID: %v.\\n\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tserversToAdd := *servers.Items\n\t\tfor _, server := range serversToAdd {\n\t\t\tif !isServerValid(server, *datacenter.Id) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t_, apiResponse, err := cloudAPIClient.LabelsApi.DatacentersServersLabelsFindByKey(context.TODO(), *datacenter.Id, *server.Id, \"managedexternally\").Execute()\n\t\t\tif err != nil {\n\t\t\t\tif !apiResponse.HttpNotFound() {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// The server is managed externally(eg : k8s nodepool).\n\t\t\t\t// This means we do not want to write the server to the tf plan.\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tresourceType := getServerResourceType(*server.Properties.Type)\n\t\t\tif resourceType == \"\" {\n\t\t\t\tlog.Printf(\"[WARNING] unknown server type: %v for server with ID: %v, skipping this server\", *server.Properties.Type, *server.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*server.Id,\n\t\t\t\t*server.Properties.Name+\"-\"+*server.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.DcID: *datacenter.Id},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n\n// isServerValid skips servers that would not create a valid tf plan.\nfunc isServerValid(server ionoscloud.Server, datacenterID string) bool {\n\n\tif server.Properties == nil || server.Properties.Name == nil {\n\t\tlog.Printf(\n\t\t\t\"[WARNING] 'nil' values in the response for server with ID %v, datacenter ID: %v, skipping this resource.\\n\",\n\t\t\t*server.Id,\n\t\t\tdatacenterID,\n\t\t)\n\t\treturn false\n\t}\n\tif server.Entities.Nics == nil || len(*server.Entities.Nics.Items) == 0 {\n\t\tlog.Printf(\"Server %s, datacenter ID: %v  contains no nics, moving on\", *server.Id, datacenterID)\n\t\treturn false\n\t}\n\tif server.Entities.Volumes == nil || len(*server.Entities.Volumes.Items) == 0 {\n\t\tlog.Printf(\"Server %s, datacenter ID: %v contains no volumes, moving on\", *server.Id, datacenterID)\n\t\treturn false\n\t}\n\tif server.Properties.BootVolume == nil {\n\t\tlog.Printf(\"Server %s, datacenter ID: %v  contains no boot volume, moving on\", *server.Id, datacenterID)\n\t\treturn false\n\t}\n\n\treturn true\n}\n\nfunc getServerResourceType(serverType string) string {\n\tresourceType := \"\"\n\tswitch serverType {\n\tcase \"ENTERPRISE\":\n\t\tresourceType = \"ionoscloud_server\"\n\tcase \"CUBE\":\n\t\tresourceType = \"ionoscloud_cube_server\"\n\tcase \"VCPU\":\n\t\tresourceType = \"ionoscloud_vcpu_server\"\n\t}\n\treturn resourceType\n}\n"
  },
  {
    "path": "providers/ionoscloud/share.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype ShareGenerator struct {\n\tService\n}\n\nfunc (g *ShareGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_share\"\n\n\tgroups, _, err := cloudAPIClient.UserManagementApi.UmGroupsGet(context.TODO()).Depth(1).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif groups.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing groups but received 'nil' instead.\")\n\t\treturn nil\n\t}\n\tfor _, group := range *groups.Items {\n\t\tshares, _, err := cloudAPIClient.UserManagementApi.UmGroupsSharesGet(context.TODO(), *group.Id).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif shares.Items == nil {\n\t\t\tlog.Printf(\"[WARNING] expected a response containing shares but received 'nil' instead, skipping search for group with ID: %s\", *group.Id)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, share := range *shares.Items {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t*share.Id,\n\t\t\t\t*share.Id,\n\t\t\t\tresourceType,\n\t\t\t\thelpers.Ionos,\n\t\t\t\tmap[string]string{helpers.GroupID: *group.Id, helpers.ResourceID: *share.Id},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/target_group.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype TargetGroupGenerator struct {\n\tService\n}\n\nfunc (g *TargetGroupGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_target_group\"\n\n\ttargetGroupResponse, _, err := cloudAPIClient.TargetGroupsApi.TargetgroupsGet(context.TODO()).Depth(1).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif targetGroupResponse.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing target groups but received 'nil' instead.\")\n\t\treturn nil\n\t}\n\ttargetGroups := *targetGroupResponse.Items\n\tfor _, targetGroup := range targetGroups {\n\t\tif targetGroup.Properties == nil || targetGroup.Properties.Name == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] 'nil' values in the response for target group with ID %v, skipping this resource.\\n\",\n\t\t\t\t*targetGroup.Id)\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*targetGroup.Id,\n\t\t\t*targetGroup.Properties.Name+\"-\"+*targetGroup.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/user.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype UserGenerator struct {\n\tService\n}\n\nfunc (g *UserGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tresourceType := \"ionoscloud_user\"\n\n\tusersResponse, _, err := cloudAPIClient.UserManagementApi.UmUsersGet(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif usersResponse.Items == nil {\n\t\tlog.Printf(\"[WARNING] expected a response containing users but received 'nil' instead\")\n\t\treturn nil\n\t}\n\tfor _, user := range *usersResponse.Items {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t*user.Id,\n\t\t\t*user.Id,\n\t\t\tresourceType,\n\t\t\thelpers.Ionos,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ionoscloud/volume.go",
    "content": "package ionoscloud\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/providers/ionoscloud/helpers\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype VolumeGenerator struct {\n\tService\n}\n\nfunc (g *VolumeGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tcloudAPIClient := client.CloudAPIClient\n\tdatacenters, err := helpers.GetAllDatacenters(*cloudAPIClient)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, datacenter := range datacenters {\n\t\tservers, _, err := cloudAPIClient.ServersApi.DatacentersServersGet(context.TODO(), *datacenter.Id).Depth(1).Execute()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif servers.Items == nil {\n\t\t\tlog.Printf(\n\t\t\t\t\"[WARNING] expected a response containing servers but received 'nil' instead, skipping search for datacenter with ID: %v.\\n\",\n\t\t\t\t*datacenter.Id)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, server := range *servers.Items {\n\t\t\tvolumes, _, err := cloudAPIClient.ServersApi.DatacentersServersVolumesGet(context.TODO(), *datacenter.Id, *server.Id).Depth(1).Execute()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif volumes.Items == nil {\n\t\t\t\tlog.Printf(\n\t\t\t\t\t\"[WARNING] expected a response containing volumes but received 'nil' instead, skipping search for server with ID: %v, datacenter ID: %v.\\n\",\n\t\t\t\t\t*server.Id,\n\t\t\t\t\t*datacenter.Id)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, volume := range *volumes.Items {\n\t\t\t\tif volume.Properties == nil || volume.Properties.Name == nil {\n\t\t\t\t\tlog.Printf(\n\t\t\t\t\t\t\"[WARNING] 'nil' values in the response for volume with ID %v, server ID: %v, datacenter ID: %v, skipping this resource.\\n\",\n\t\t\t\t\t\t*volume.Id,\n\t\t\t\t\t\t*server.Id,\n\t\t\t\t\t\t*datacenter.Id,\n\t\t\t\t\t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// bootVolume will be included in the server\n\t\t\t\tif server.Properties.BootVolume != nil && *server.Properties.BootVolume.Id != *volume.Id {\n\t\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\t\t*volume.Id,\n\t\t\t\t\t\t*volume.Properties.Name+\"-\"+*volume.Id,\n\t\t\t\t\t\t\"ionoscloud_volume\",\n\t\t\t\t\t\thelpers.Ionos,\n\t\t\t\t\t\tmap[string]string{helpers.DcID: *datacenter.Id,\n\t\t\t\t\t\t\thelpers.ServerID: *server.Id},\n\t\t\t\t\t\t[]string{},\n\t\t\t\t\t\tmap[string]interface{}{}))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/keycloak/authentication.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage keycloak\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mrparkers/terraform-provider-keycloak/keycloak\"\n)\n\nfunc (g RealmGenerator) createAuthenticationFlowResources(authenticationFlows []*keycloak.AuthenticationFlow) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, authenticationFlow := range authenticationFlows {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tauthenticationFlow.Id,\n\t\t\t\"authentication_flow_\"+normalizeResourceName(authenticationFlow.RealmId)+\"_\"+normalizeResourceName(authenticationFlow.Id),\n\t\t\t\"keycloak_authentication_flow\",\n\t\t\t\"keycloak\",\n\t\t\tmap[string]string{\n\t\t\t\t\"realm_id\": authenticationFlow.RealmId,\n\t\t\t\t\"alias\":    authenticationFlow.Alias,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g RealmGenerator) createAuthenticationSubFlowResource(authenticationSubFlow *keycloak.AuthenticationSubFlow) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tauthenticationSubFlow.Id,\n\t\t\"authentication_subflow_\"+normalizeResourceName(authenticationSubFlow.RealmId)+\"_\"+normalizeResourceName(authenticationSubFlow.Id),\n\t\t\"keycloak_authentication_subflow\",\n\t\t\"keycloak\",\n\t\tmap[string]string{\n\t\t\t\"realm_id\":          authenticationSubFlow.RealmId,\n\t\t\t\"parent_flow_alias\": authenticationSubFlow.ParentFlowAlias,\n\t\t\t\"alias\":             authenticationSubFlow.Alias,\n\t\t\t\"requirement\":       authenticationSubFlow.Requirement,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n\treturn resource\n}\n\nfunc (g RealmGenerator) createAuthenticationExecutionResource(authenticationExecution *keycloak.AuthenticationExecution) terraformutils.Resource {\n\tresource := terraformutils.NewResource(\n\t\tauthenticationExecution.Id,\n\t\t\"authentication_execution_\"+normalizeResourceName(authenticationExecution.RealmId)+\"_\"+normalizeResourceName(authenticationExecution.Id),\n\t\t\"keycloak_authentication_execution\",\n\t\t\"keycloak\",\n\t\tmap[string]string{\n\t\t\t\"realm_id\":          authenticationExecution.RealmId,\n\t\t\t\"parent_flow_alias\": authenticationExecution.ParentFlowAlias,\n\t\t\t\"authenticator\":     authenticationExecution.Authenticator,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n\treturn resource\n}\n\nfunc (g RealmGenerator) createAuthenticationExecutionConfigResource(authenticationExecutionConfig *keycloak.AuthenticationExecutionConfig) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tauthenticationExecutionConfig.Id,\n\t\t\"authentication_execution_config_\"+normalizeResourceName(authenticationExecutionConfig.RealmId)+\"_\"+normalizeResourceName(authenticationExecutionConfig.Id),\n\t\t\"keycloak_authentication_execution_config\",\n\t\t\"keycloak\",\n\t\tmap[string]string{\n\t\t\t\"realm_id\":     authenticationExecutionConfig.RealmId,\n\t\t\t\"execution_id\": authenticationExecutionConfig.ExecutionId,\n\t\t\t\"alias\":        authenticationExecutionConfig.Alias,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{\n\t\t\t\"config\": authenticationExecutionConfig.Config,\n\t\t},\n\t)\n}\n"
  },
  {
    "path": "providers/keycloak/generator.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage keycloak\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"sort\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mrparkers/terraform-provider-keycloak/keycloak\"\n)\n\ntype RealmGenerator struct {\n\tKeycloakService\n}\n\nfunc (g *RealmGenerator) InitResources() error {\n\tvar realms []*keycloak.Realm\n\tvar realmsGroups []*keycloak.Group\n\tctx := context.TODO()\n\n\t// Connect to keycloak instance\n\tuserAgent := \"GoogleCloudPlatform Terraformer/0.8.22 (+https://github.com/GoogleCloudPlatform/terraformer) Terraform Plugin SDK/2.10.1\"\n\tkck, err := keycloak.NewKeycloakClient(ctx, g.GetArgs()[\"url\"].(string), g.GetArgs()[\"base_path\"].(string), g.GetArgs()[\"client_id\"].(string), g.GetArgs()[\"client_secret\"].(string), g.GetArgs()[\"realm\"].(string), \"\", \"\", true, g.GetArgs()[\"client_timeout\"].(int), g.GetArgs()[\"root_ca_certificate\"].(string), g.GetArgs()[\"tls_insecure_skip_verify\"].(bool), userAgent, g.GetArgs()[\"red_hat_sso\"].(bool), make(map[string]string))\n\tif err != nil {\n\t\treturn errors.New(\"keycloak: could not connect to Keycloak\")\n\t}\n\n\t// Get realm resources\n\ttarget := g.GetArgs()[\"target\"].(string)\n\tif target == \"\" {\n\t\trealms, err = kck.GetRealms(ctx)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"keycloak: could not get realms attributes in Keycloak\")\n\t\t}\n\t} else {\n\t\trealm, err := kck.GetRealm(ctx, target)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"keycloak: could not get \" + target + \" realm attributes in Keycloak\")\n\t\t}\n\t\trealms = append(realms, realm)\n\t}\n\tg.Resources = append(g.Resources, g.createRealmResources(realms)...)\n\n\t// For each realm, get resources\n\tfor _, realm := range realms {\n\t\t// Get required actions resources\n\t\trequiredActions, err := kck.GetRequiredActions(ctx, realm.Realm)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"keycloak: could not get required actions of realm %s in Keycloak. err: %w\", realm.Realm, err)\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createRequiredActionResources(requiredActions)...)\n\n\t\t// Get top-level authentication flows resources\n\t\tauthenticationFlows, err := kck.ListAuthenticationFlows(ctx, realm.Realm)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"keycloak: could not get authentication flows of realm %s in Keycloak. err: %w\", realm.Realm, err)\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createAuthenticationFlowResources(authenticationFlows)...)\n\n\t\t// For each authentication flow, get subFlow, execution and execution config resources\n\t\tfor _, topLevelAuthenticationFlow := range authenticationFlows {\n\t\t\tauthenticationSubFlowOrExecutions, err := kck.ListAuthenticationExecutions(ctx, realm.Realm, topLevelAuthenticationFlow.Alias)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"keycloak: could not get authentication executions of authentication flow %s of realm %s in Keycloak. err: %w\",\n\t\t\t\t\ttopLevelAuthenticationFlow.Alias, realm.Realm, err)\n\t\t\t}\n\n\t\t\tvar stack []*keycloak.AuthenticationExecutionInfo\n\t\t\tparentFlowAlias := topLevelAuthenticationFlow.Alias\n\n\t\t\tfor _, authenticationSubFlowOrExecution := range authenticationSubFlowOrExecutions {\n\n\t\t\t\t// Find the parent flow alias\n\t\t\t\tif len(stack) > 0 {\n\t\t\t\t\tprevious := stack[len(stack)-1]\n\t\t\t\t\tif authenticationSubFlowOrExecution.Level < previous.Level {\n\t\t\t\t\t\t// Find the last sub flow/execution for the current level\n\t\t\t\t\t\tstack = stack[:authenticationSubFlowOrExecution.Level+1]\n\t\t\t\t\t\tprevious = stack[len(stack)-1]\n\t\t\t\t\t}\n\t\t\t\t\tif authenticationSubFlowOrExecution.Level == previous.Level {\n\t\t\t\t\t\t// Same level sub flow/execution, it means that the sub flow/execution has same parent flow of the last sub flow/execution\n\t\t\t\t\t\tparentFlowAlias = previous.ParentFlowAlias\n\n\t\t\t\t\t} else if authenticationSubFlowOrExecution.Level > previous.Level {\n\t\t\t\t\t\t// Deep level sub flow/execution, it means that the parent flow is the last sub flow/execution\n\t\t\t\t\t\tif previous.AuthenticationFlow {\n\t\t\t\t\t\t\tparentFlowAlias = previous.Alias\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn errors.New(\"keycloak: invalid parent sub flow, it should be a sub flow but it's an execution\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvar resource terraformutils.Resource\n\n\t\t\t\tswitch authenticationSubFlowOrExecution.AuthenticationFlow {\n\t\t\t\tcase true:\n\t\t\t\t\tauthenticationSubFlow, err := kck.GetAuthenticationSubFlow(ctx, realm.Realm, parentFlowAlias, authenticationSubFlowOrExecution.FlowId)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"keycloak: could not get authentication subflow %s of realm %s in Keycloak. err: %w\",\n\t\t\t\t\t\t\tauthenticationSubFlowOrExecution.FlowId, realm.Realm, err)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Need to store the alias and parent flow alias\n\t\t\t\t\tauthenticationSubFlowOrExecution.Alias = authenticationSubFlow.Alias\n\t\t\t\t\tauthenticationSubFlowOrExecution.ParentFlowAlias = parentFlowAlias\n\n\t\t\t\t\tresource = g.createAuthenticationSubFlowResource(authenticationSubFlow)\n\t\t\t\t\tg.Resources = append(g.Resources, resource)\n\n\t\t\t\tcase false:\n\t\t\t\t\tauthenticationExecution, err := kck.GetAuthenticationExecution(ctx, realm.Realm, parentFlowAlias, authenticationSubFlowOrExecution.Id)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"keycloak: could not get authentication execution %s of realm %s in Keycloak. err: %w\",\n\t\t\t\t\t\t\tauthenticationSubFlowOrExecution.Id, realm.Realm, err)\n\t\t\t\t\t}\n\n\t\t\t\t\t// Need to store the parent flow alias\n\t\t\t\t\tauthenticationSubFlowOrExecution.ParentFlowAlias = parentFlowAlias\n\n\t\t\t\t\tresource = g.createAuthenticationExecutionResource(authenticationExecution)\n\t\t\t\t\tg.Resources = append(g.Resources, resource)\n\n\t\t\t\t\tif authenticationSubFlowOrExecution.AuthenticationConfig != \"\" {\n\t\t\t\t\t\tauthenticationExecutionConfig := &keycloak.AuthenticationExecutionConfig{\n\t\t\t\t\t\t\tRealmId:     realm.Realm,\n\t\t\t\t\t\t\tId:          authenticationSubFlowOrExecution.AuthenticationConfig,\n\t\t\t\t\t\t\tExecutionId: authenticationSubFlowOrExecution.Id,\n\t\t\t\t\t\t}\n\t\t\t\t\t\terr := kck.GetAuthenticationExecutionConfig(ctx, authenticationExecutionConfig)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn fmt.Errorf(\"keycloak: could not get authentication execution config %s of realm %s in Keycloak. err: %w\",\n\t\t\t\t\t\t\t\tauthenticationExecutionConfig.Id, realm.Realm, err)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tg.Resources = append(g.Resources, g.createAuthenticationExecutionConfigResource(authenticationExecutionConfig))\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif len(stack) > 0 && authenticationSubFlowOrExecution.Index > 0 {\n\t\t\t\t\tprevious := stack[len(stack)-1]\n\t\t\t\t\tvar resourceType string\n\t\t\t\t\tvar resourceName string\n\t\t\t\t\tif previous.AuthenticationFlow {\n\t\t\t\t\t\tresourceType = \"keycloak_authentication_subflow\"\n\t\t\t\t\t\tresourceName = \"authentication_subflow_\" +\n\t\t\t\t\t\t\tnormalizeResourceName(realm.Realm) + \"_\" + normalizeResourceName(previous.FlowId)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tresourceType = \"keycloak_authentication_execution\"\n\t\t\t\t\t\tresourceName = \"authentication_execution_\" +\n\t\t\t\t\t\t\tnormalizeResourceName(realm.Realm) + \"_\" + normalizeResourceName(previous.Id)\n\t\t\t\t\t}\n\t\t\t\t\tresource.AdditionalFields[\"depends_on\"] = []string{resourceType + \".\" + terraformutils.TfSanitize(resourceName)}\n\t\t\t\t}\n\n\t\t\t\t// Stack the current sub flow/execution\n\t\t\t\tif len(stack) > 0 && stack[len(stack)-1].Level == authenticationSubFlowOrExecution.Level {\n\t\t\t\t\t// Replace it if it's same level\n\t\t\t\t\tstack[len(stack)-1] = authenticationSubFlowOrExecution\n\t\t\t\t} else {\n\t\t\t\t\tstack = append(stack, authenticationSubFlowOrExecution)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Get custom federations resources\n\t\t// TODO: support kerberos user federation\n\t\tcustomUserFederations, err := kck.GetCustomUserFederations(ctx, realm.Realm, realm.Id)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"keycloak: could not get custom user federations of realm \" + realm.Id + \" in Keycloak\")\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createCustomUserFederationResources(customUserFederations)...)\n\n\t\t// For each custom federation, get mappers resources\n\t\tfor _, customUserFederation := range *customUserFederations {\n\t\t\tif customUserFederation.ProviderId == \"ldap\" {\n\t\t\t\tmappers, err := kck.GetLdapUserFederationMappers(ctx, realm.Realm, customUserFederation.Id)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.New(\"keycloak: could not get mappers of ldap user federation \" + customUserFederation.Name + \" of realm \" + realm.Realm + \" in Keycloak\")\n\t\t\t\t}\n\t\t\t\tg.Resources = append(g.Resources, g.createLdapMapperResources(realm.Realm, customUserFederation.Name, mappers)...)\n\t\t\t}\n\t\t}\n\n\t\t// Get groups tree and default groups resources\n\t\trealmGroups, err := kck.GetGroups(ctx, realm.Realm)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"keycloak: could not get groups of realm \" + realm.Realm + \" in Keycloak\")\n\t\t}\n\t\trealmsGroups = append(realmsGroups, realmGroups...)\n\t\tg.Resources = append(g.Resources, g.createDefaultGroupResource(realm.Realm))\n\n\t\t// Get users resources\n\t\trealmUsers, err := kck.GetUsers(ctx, realm.Realm)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"keycloak: could not get users of realm \" + realm.Realm + \" in Keycloak\")\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createUserResources(realmUsers)...)\n\n\t\t// Get realm open id client scopes resources\n\t\trealmScopes, err := kck.ListOpenidClientScopesWithFilter(ctx, realm.Realm, func(scope *keycloak.OpenidClientScope) bool { return true })\n\t\tif err != nil {\n\t\t\treturn errors.New(\"keycloak: could not get realm scopes of realm \" + realm.Realm + \" in Keycloak\")\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createScopeResources(realm.Realm, realmScopes)...)\n\n\t\t// Get open id clients\n\t\trealmClients, err := kck.GetOpenidClients(ctx, realm.Realm, true)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"keycloak: could not get open id clients of realm \" + realm.Realm + \" in Keycloak\")\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createOpenIDClientResources(realmClients)...)\n\n\t\t// For each open id client, get resources\n\t\tmapServiceAccountIds := map[string]map[string]string{}\n\t\tmapContainerIDs := map[string]string{}\n\t\tmapClientIDs := map[string]string{}\n\t\tfor _, client := range realmClients {\n\t\t\tmapClientIDs[client.Id] = client.ClientId\n\t\t\tmapContainerIDs[client.Id] = \"_\" + client.ClientId\n\n\t\t\t// Get open id client protocol mappers resources\n\t\t\tclientMappers, err := kck.GetGenericProtocolMappers(ctx, realm.Realm, client.Id)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.New(\"keycloak: could not get protocol mappers of open id client \" + client.ClientId + \" of realm \" + realm.Realm + \" in Keycloak\")\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, g.createOpenIDProtocolMapperResources(client.ClientId, clientMappers)...)\n\n\t\t\t// Get open id client default scopes resources\n\t\t\tclientScopes, err := kck.GetOpenidDefaultClientScopes(ctx, realm.Realm, client.Id)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.New(\"keycloak: could not get default client scopes of open id client \" + client.ClientId + \" of realm \" + realm.Realm + \" in Keycloak\")\n\t\t\t}\n\t\t\tif len(*clientScopes) > 0 {\n\t\t\t\tg.Resources = append(g.Resources, g.createOpenidClientScopesResources(realm.Realm, client.Id, client.ClientId, \"default\", clientScopes))\n\t\t\t}\n\n\t\t\t// Get open id client optional scopes resources\n\t\t\tclientScopes, err = kck.GetOpenidOptionalClientScopes(ctx, realm.Realm, client.Id)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.New(\"keycloak: could not get optional client scopes of open id client \" + client.ClientId + \" of realm \" + realm.Realm + \" in Keycloak\")\n\t\t\t}\n\t\t\tif len(*clientScopes) > 0 {\n\t\t\t\tg.Resources = append(g.Resources, g.createOpenidClientScopesResources(realm.Realm, client.Id, client.ClientId, \"optional\", clientScopes))\n\t\t\t}\n\n\t\t\t// Prepare a slice to be able to link roles associated to service account roles to be associated to the open id client, only if service accounts are enabled\n\t\t\tif !client.ServiceAccountsEnabled {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tserviceAccountUser, err := kck.GetOpenidClientServiceAccountUserId(ctx, realm.Realm, client.Id)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.New(\"keycloak: could not get service account user associated to open id client \" + client.ClientId + \" of realm \" + realm.Realm + \" in Keycloak\")\n\t\t\t}\n\t\t\tmapServiceAccountIds[serviceAccountUser.Id] = map[string]string{}\n\t\t\tmapServiceAccountIds[serviceAccountUser.Id][\"Id\"] = client.Id\n\t\t\tmapServiceAccountIds[serviceAccountUser.Id][\"ClientId\"] = client.ClientId\n\t\t}\n\n\t\t// Get open id client roles\n\t\tclientRoles, err := kck.GetClientRoles(ctx, realm.Realm, realmClients)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"keycloak: could not get open id clients roles of realm \" + realm.Realm + \" in Keycloak\")\n\t\t}\n\n\t\t// Get roles\n\t\trealmRoles, err := kck.GetRealmRoles(ctx, realm.Realm)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"keycloak: could not get realm roles of realm \" + realm.Realm + \" in Keycloak\")\n\t\t}\n\n\t\t// Set ContainerId of the roles, for realm = \"\", for open id clients = \"_\" + client.ClientId\n\t\t// and get roles resources\n\t\tmapContainerIDs[realm.Realm] = \"\"\n\t\troles := append(clientRoles, realmRoles...)\n\t\tfor _, role := range roles {\n\t\t\trole.ContainerId = mapContainerIDs[role.ContainerId]\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createRoleResources(roles)...)\n\n\t\t// Get service account roles resources\n\t\tusersInRole, err := kck.GetClientRoleUsers(ctx, realm.Realm, clientRoles)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"keycloak: could not get users roles of realm \" + realm.Realm + \" in Keycloak\")\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createServiceAccountClientRolesResources(realm.Realm, clientRoles, *usersInRole, mapServiceAccountIds, mapClientIDs)...)\n\t}\n\n\t// Parse the groups trees, and get all the groups\n\t// Get groups resources\n\tgroups := g.flattenGroups(realmsGroups, \"\")\n\tg.Resources = append(g.Resources, g.createGroupResources(groups)...)\n\n\t// For each group, get group memberships and roles resources\n\tfor _, group := range groups {\n\t\t// Get group members resources\n\t\tmembers, err := kck.GetGroupMembers(ctx, group.RealmId, group.Id)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"keycloak: could not get group members of group \" + group.Name + \" in Keycloak\")\n\t\t}\n\t\tif len(members) > 0 {\n\t\t\tgroupMembers := make([]string, len(members))\n\t\t\tfor k, member := range members {\n\t\t\t\tgroupMembers[k] = member.Username\n\t\t\t}\n\t\t\tg.Resources = append(g.Resources, g.createGroupMembershipsResource(group.RealmId, group.Id, group.Name, groupMembers))\n\t\t}\n\n\t\t// Get group roles resources\n\t\t// For realm roles and open id clients roles\n\t\tgroupDetails, err := kck.GetGroup(ctx, group.RealmId, group.Id)\n\t\tif err != nil {\n\t\t\treturn errors.New(\"keycloak: could not get details about group \" + group.Name + \" in Keycloak\")\n\t\t}\n\t\tgroupRoles := []string{}\n\t\tif len(groupDetails.RealmRoles) > 0 {\n\t\t\tgroupRoles = append(groupRoles, groupDetails.RealmRoles...)\n\t\t}\n\t\tif len(groupDetails.ClientRoles) > 0 {\n\t\t\tfor _, clientRoles := range groupDetails.ClientRoles {\n\t\t\t\tgroupRoles = append(groupRoles, clientRoles...)\n\t\t\t}\n\t\t}\n\t\tif len(groupRoles) > 0 {\n\t\t\tg.Resources = append(g.Resources, g.createGroupRolesResource(group.RealmId, group.Id, group.Name, groupRoles))\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *RealmGenerator) PostConvertHook() error {\n\tmapRealmIDs := map[string]string{}\n\tmapUserFederationIDs := map[string]string{}\n\tmapGroupIDs := map[string]string{}\n\tmapClientIDs := map[string]string{}\n\tmapClientNames := map[string]string{}\n\tmapClientClientIDs := map[string]string{}\n\tmapClientClientNames := map[string]string{}\n\tmapServiceAccountUserIDs := map[string]string{}\n\tmapRoleIDs := map[string]string{}\n\tmapClientRoleNames := map[string]string{}\n\tmapClientRoleShortNames := map[string]string{}\n\tmapScopeNames := map[string]string{}\n\tmapUserNames := map[string]string{}\n\tmapGroupNames := map[string]string{}\n\tmapAuthenticationFlowAliases := map[string]string{}\n\tmapAuthenticationExecutionIDs := map[string]string{}\n\n\t// Set slices to be able to map IDs with Terraform variables\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"keycloak_realm\" &&\n\t\t\tr.InstanceInfo.Type != \"keycloak_ldap_user_federation\" &&\n\t\t\tr.InstanceInfo.Type != \"keycloak_group\" &&\n\t\t\tr.InstanceInfo.Type != \"keycloak_openid_client\" &&\n\t\t\tr.InstanceInfo.Type != \"keycloak_role\" &&\n\t\t\tr.InstanceInfo.Type != \"keycloak_openid_client_scope\" &&\n\t\t\tr.InstanceInfo.Type != \"keycloak_user\" &&\n\t\t\tr.InstanceInfo.Type != \"keycloak_authentication_flow\" &&\n\t\t\tr.InstanceInfo.Type != \"keycloak_authentication_subflow\" &&\n\t\t\tr.InstanceInfo.Type != \"keycloak_authentication_execution\" {\n\t\t\tcontinue\n\t\t}\n\t\tif r.InstanceInfo.Type == \"keycloak_realm\" {\n\t\t\tmapRealmIDs[r.InstanceState.ID] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".id}\"\n\t\t}\n\t\tif r.InstanceInfo.Type == \"keycloak_ldap_user_federation\" {\n\t\t\tmapUserFederationIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.InstanceState.ID] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".id}\"\n\t\t}\n\t\tif r.InstanceInfo.Type == \"keycloak_group\" {\n\t\t\tmapGroupIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.InstanceState.ID] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".id}\"\n\t\t\tmapGroupNames[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t}\n\t\tif r.InstanceInfo.Type == \"keycloak_openid_client\" {\n\t\t\tmapClientIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.InstanceState.ID] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".id}\"\n\t\t\tmapClientNames[r.Item[\"realm_id\"].(string)+\"_\"+r.InstanceState.ID] = r.Item[\"client_id\"].(string)\n\t\t\tmapClientClientNames[r.Item[\"realm_id\"].(string)+\"_\"+r.InstanceState.ID] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".client_id}\"\n\t\t\tmapClientClientIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.InstanceState.Attributes[\"client_id\"]] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".client_id}\"\n\t\t\tif _, exist := r.InstanceState.Attributes[\"service_account_user_id\"]; exist {\n\t\t\t\tmapServiceAccountUserIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.InstanceState.Attributes[\"service_account_user_id\"]] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".service_account_user_id}\"\n\t\t\t}\n\t\t}\n\t\tif r.InstanceInfo.Type == \"keycloak_openid_client_scope\" {\n\t\t\tmapScopeNames[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t}\n\t\tif r.InstanceInfo.Type == \"keycloak_user\" {\n\t\t\tmapUserNames[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"username\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".username}\"\n\t\t}\n\t\tif r.InstanceInfo.Type == \"keycloak_authentication_flow\" || r.InstanceInfo.Type == \"keycloak_authentication_subflow\" {\n\t\t\tmapAuthenticationFlowAliases[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"alias\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".alias}\"\n\t\t}\n\t\tif r.InstanceInfo.Type == \"keycloak_authentication_execution\" {\n\t\t\tmapAuthenticationExecutionIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.InstanceState.ID] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".id}\"\n\t\t}\n\t}\n\n\t// Set slices to be able to map IDs with Terraform variables\n\t// Separate loop for roles to avoid fetching with a key that is not present in the map\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"keycloak_role\" {\n\t\t\tmapRoleIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.InstanceState.ID] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".id}\"\n\t\t\tif _, exist := r.Item[\"client_id\"]; exist {\n\t\t\t\tmapClientRoleNames[r.Item[\"realm_id\"].(string)+\"_\"+mapClientNames[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"client_id\"].(string)]+\".\"+r.Item[\"name\"].(string)] = mapClientClientNames[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"client_id\"].(string)] + \".${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t\tmapClientRoleShortNames[r.Item[\"realm_id\"].(string)+\"_\"+mapClientNames[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"client_id\"].(string)]+\".\"+r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t} else {\n\t\t\t\tmapClientRoleNames[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t}\n\n\t// For each resource, modify import if needed...\n\tfor i, r := range g.Resources {\n\t\t// Escape keycloak text inputs not to get unpredictable results or errors when Terraform will try to interpret variables ($ vs $$)\n\t\t// TODO: ensure that we escape all existing fields\n\t\tif strings.Contains(r.InstanceState.Attributes[\"consent_screen_text\"], \"$\") {\n\t\t\tg.Resources[i].Item[\"consent_screen_text\"] = strings.ReplaceAll(r.InstanceState.Attributes[\"consent_screen_text\"], \"$\", \"$$\")\n\t\t}\n\t\tif strings.Contains(r.InstanceState.Attributes[\"name\"], \"$\") {\n\t\t\tg.Resources[i].Item[\"name\"] = strings.ReplaceAll(r.InstanceState.Attributes[\"name\"], \"$\", \"$$\")\n\t\t}\n\t\tif strings.Contains(r.InstanceState.Attributes[\"description\"], \"$\") {\n\t\t\tg.Resources[i].Item[\"description\"] = strings.ReplaceAll(r.InstanceState.Attributes[\"description\"], \"$\", \"$$\")\n\t\t}\n\t\tif strings.Contains(r.InstanceState.Attributes[\"root_url\"], \"$\") {\n\t\t\tg.Resources[i].Item[\"root_url\"] = strings.ReplaceAll(r.InstanceState.Attributes[\"root_url\"], \"$\", \"$$\")\n\t\t}\n\n\t\t// Sort supported_locales to get reproducible results for keycloak_realm resources\n\t\tif r.InstanceInfo.Type == \"keycloak_realm\" {\n\t\t\tif _, exist := r.Item[\"internationalization\"]; exist {\n\t\t\t\tfor _, v := range r.Item[\"internationalization\"].([]interface{}) {\n\t\t\t\t\tsortedSupportedLocales := make([]string, len(v.(map[string]interface{})[\"supported_locales\"].([]interface{})))\n\t\t\t\t\tfor k, vv := range v.(map[string]interface{})[\"supported_locales\"].([]interface{}) {\n\t\t\t\t\t\tsortedSupportedLocales[k] = vv.(string)\n\t\t\t\t\t}\n\t\t\t\t\tsort.Strings(sortedSupportedLocales)\n\t\t\t\t\tv.(map[string]interface{})[\"supported_locales\"] = sortedSupportedLocales\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Sort group_ids to get reproducible results for keycloak_default_groups resources\n\t\t// Set an empty string slice if the attribute doesn't exist as it is mandatory\n\t\tif r.InstanceInfo.Type == \"keycloak_default_groups\" {\n\t\t\tif _, exist := r.Item[\"group_ids\"]; exist {\n\t\t\t\trenamedGroupIDs := make([]string, len(r.Item[\"group_ids\"].([]interface{})))\n\t\t\t\tfor k, v := range r.Item[\"group_ids\"].([]interface{}) {\n\t\t\t\t\trenamedGroupIDs[k] = mapGroupIDs[r.Item[\"realm_id\"].(string)+\"_\"+v.(string)]\n\t\t\t\t}\n\t\t\t\tsort.Strings(renamedGroupIDs)\n\t\t\t\tg.Resources[i].Item[\"group_ids\"] = renamedGroupIDs\n\t\t\t} else {\n\t\t\t\tg.Resources[i].Item[\"group_ids\"] = []string{}\n\t\t\t}\n\t\t}\n\n\t\t// Sort valid_redirect_uris and web_origins to get reproducible results for keycloak_openid_client resources\n\t\tif r.InstanceInfo.Type == \"keycloak_openid_client\" {\n\t\t\tif _, exist := r.Item[\"valid_redirect_uris\"]; exist {\n\t\t\t\tsortedValidRedirectUris := make([]string, len(r.Item[\"valid_redirect_uris\"].([]interface{})))\n\t\t\t\tfor k, v := range r.Item[\"valid_redirect_uris\"].([]interface{}) {\n\t\t\t\t\tsortedValidRedirectUris[k] = v.(string)\n\t\t\t\t}\n\t\t\t\tsort.Strings(sortedValidRedirectUris)\n\t\t\t\tg.Resources[i].Item[\"valid_redirect_uris\"] = sortedValidRedirectUris\n\t\t\t}\n\n\t\t\tif _, exist := r.Item[\"web_origins\"]; exist {\n\t\t\t\tsortedWebOrigins := make([]string, len(r.Item[\"web_origins\"].([]interface{})))\n\t\t\t\tfor k, v := range r.Item[\"web_origins\"].([]interface{}) {\n\t\t\t\t\tsortedWebOrigins[k] = v.(string)\n\t\t\t\t}\n\t\t\t\tsort.Strings(sortedWebOrigins)\n\t\t\t\tg.Resources[i].Item[\"web_origins\"] = sortedWebOrigins\n\t\t\t}\n\t\t}\n\n\t\t// Sort composite_roles to get reproducible results for keycloak_role resources\n\t\tif _, exist := r.Item[\"composite_roles\"]; exist && r.InstanceInfo.Type == \"keycloak_role\" {\n\t\t\trenamedCompositeRoles := make([]string, len(r.Item[\"composite_roles\"].([]interface{})))\n\t\t\tfor k, v := range r.Item[\"composite_roles\"].([]interface{}) {\n\t\t\t\trenamedCompositeRoles[k] = mapRoleIDs[r.Item[\"realm_id\"].(string)+\"_\"+v.(string)]\n\t\t\t}\n\t\t\tsort.Strings(renamedCompositeRoles)\n\t\t\tg.Resources[i].Item[\"composite_roles\"] = renamedCompositeRoles\n\t\t}\n\n\t\t// Sort default_scopes to get reproducible results for keycloak_openid_client_default_scopes resources\n\t\tif _, exist := r.Item[\"default_scopes\"]; exist && r.InstanceInfo.Type == \"keycloak_openid_client_default_scopes\" {\n\t\t\trenamedScopes := make([]string, len(r.Item[\"default_scopes\"].([]interface{})))\n\t\t\tfor k, v := range r.Item[\"default_scopes\"].([]interface{}) {\n\t\t\t\trenamedScopes[k] = mapScopeNames[r.Item[\"realm_id\"].(string)+\"_\"+v.(string)]\n\t\t\t}\n\t\t\tsort.Strings(renamedScopes)\n\t\t\tg.Resources[i].Item[\"default_scopes\"] = renamedScopes\n\t\t}\n\n\t\t// Sort optional_scopes to get reproducible results for keycloak_openid_client_optional_scopes resources\n\t\tif _, exist := r.Item[\"optional_scopes\"]; exist && r.InstanceInfo.Type == \"keycloak_openid_client_optional_scopes\" {\n\t\t\trenamedScopes := make([]string, len(r.Item[\"optional_scopes\"].([]interface{})))\n\t\t\tfor k, v := range r.Item[\"optional_scopes\"].([]interface{}) {\n\t\t\t\trenamedScopes[k] = mapScopeNames[r.Item[\"realm_id\"].(string)+\"_\"+v.(string)]\n\t\t\t}\n\t\t\tsort.Strings(renamedScopes)\n\t\t\tg.Resources[i].Item[\"optional_scopes\"] = renamedScopes\n\t\t}\n\n\t\t// Sort role_ids to get reproducible results for keycloak_group_roles resources\n\t\tif r.InstanceInfo.Type == \"keycloak_group_roles\" {\n\t\t\tif roleIDs, ok := r.Item[\"role_ids\"].([]interface{}); ok {\n\t\t\t\tsortedRoles := make([]string, len(roleIDs))\n\t\t\t\tfor k, v := range roleIDs {\n\t\t\t\t\tsortedRoles[k] = mapRoleIDs[r.Item[\"realm_id\"].(string)+\"_\"+v.(string)]\n\t\t\t\t}\n\t\t\t\tsort.Strings(sortedRoles)\n\t\t\t\tg.Resources[i].Item[\"role_ids\"] = sortedRoles\n\t\t\t} else {\n\t\t\t\tg.Resources[i].Item[\"role_ids\"] = []string{}\n\t\t\t}\n\t\t}\n\n\t\t// Sort members to get reproducible results for keycloak_group_memberships resources\n\t\t// Map members to keycloak_user.foo.username Terraform variables\n\t\tif r.InstanceInfo.Type == \"keycloak_group_memberships\" {\n\t\t\tsortedMembers := make([]string, len(r.Item[\"members\"].([]interface{})))\n\t\t\tfor k, v := range r.Item[\"members\"].([]interface{}) {\n\t\t\t\tif mapUserNames[r.Item[\"realm_id\"].(string)+\"_\"+v.(string)] != \"\" {\n\t\t\t\t\tsortedMembers[k] = mapUserNames[r.Item[\"realm_id\"].(string)+\"_\"+v.(string)]\n\t\t\t\t} else {\n\t\t\t\t\tsortedMembers[k] = v.(string)\n\t\t\t\t}\n\t\t\t}\n\t\t\tsort.Strings(sortedMembers)\n\t\t\tg.Resources[i].Item[\"members\"] = sortedMembers\n\t\t}\n\n\t\t// Map ldap_user_federation_id attributes to keycloak_ldap_user_federation.foo.id Terraform variables for ldap mappers resources\n\t\tif r.InstanceInfo.Type == \"keycloak_ldap_full_name_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_ldap_group_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_ldap_role_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_ldap_hardcoded_group_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_ldap_hardcoded_role_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_ldap_msad_lds_user_account_control_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_ldap_msad_user_account_control_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_ldap_user_attribute_mapper\" {\n\t\t\tg.Resources[i].Item[\"ldap_user_federation_id\"] = mapUserFederationIDs[r.Item[\"realm_id\"].(string)+\"_\"+g.Resources[i].Item[\"ldap_user_federation_id\"].(string)]\n\t\t}\n\n\t\t// Map group to keycloak_group.foo.name Terraform variables for ldap hardcoded group mapper resources\n\t\tif r.InstanceInfo.Type == \"keycloak_ldap_hardcoded_group_mapper\" {\n\t\t\tg.Resources[i].Item[\"group\"] = mapGroupNames[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"group\"].(string)]\n\t\t}\n\n\t\t// Map role to Terraform variables for ldap hardcoded role mapper resources\n\t\tif r.InstanceInfo.Type == \"keycloak_ldap_hardcoded_role_mapper\" {\n\t\t\tg.Resources[i].Item[\"role\"] = mapClientRoleNames[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"role\"].(string)]\n\t\t}\n\n\t\t// Map parent_id to keycloak_group.foo.id Terraform variables for keycloak_group resources\n\t\tif _, exist := r.Item[\"parent_id\"]; exist && r.InstanceInfo.Type == \"keycloak_group\" {\n\t\t\tg.Resources[i].Item[\"parent_id\"] = mapGroupIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"parent_id\"].(string)]\n\t\t}\n\n\t\t// Map group_id to keycloak_group.foo.id Terraform variables for keycloak_group_memberships and keycloak_group_roles resources\n\t\tif r.InstanceInfo.Type == \"keycloak_group_memberships\" || r.InstanceInfo.Type == \"keycloak_group_roles\" {\n\t\t\tg.Resources[i].Item[\"group_id\"] = mapGroupIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"group_id\"].(string)]\n\t\t}\n\n\t\t// Map service_account_user_id to keycloak_openid_client.foo.service_account_user_id Terraform variables for service account role resources\n\t\tif r.InstanceInfo.Type == \"keycloak_openid_client_service_account_role\" {\n\t\t\tg.Resources[i].Item[\"service_account_user_id\"] = mapServiceAccountUserIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"service_account_user_id\"].(string)]\n\t\t\tg.Resources[i].Item[\"role\"] = mapClientRoleShortNames[r.Item[\"realm_id\"].(string)+\"_\"+mapClientNames[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"client_id\"].(string)]+\".\"+r.Item[\"role\"].(string)]\n\t\t}\n\n\t\t// Map client_id attributes to keycloak_openid_client.foo.id Terraform variables for open id mappers resources\n\t\tif _, exist := r.Item[\"client_id\"]; exist && (r.InstanceInfo.Type == \"keycloak_openid_client_service_account_role\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_audience_protocol_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_audience_resolve_protocol_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_full_name_protocol_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_group_membership_protocol_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_hardcoded_claim_protocol_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_hardcoded_role_protocol_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_script_protocol_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_user_attribute_protocol_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_user_client_role_protocol_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_user_property_protocol_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_user_realm_role_protocol_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_user_session_note_protocol_mapper\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_client_default_scopes\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_openid_client_optional_scopes\" ||\n\t\t\tr.InstanceInfo.Type == \"keycloak_role\") {\n\t\t\tg.Resources[i].Item[\"client_id\"] = mapClientIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"client_id\"].(string)]\n\t\t}\n\n\t\t// Map included_client_audience to keycloak_openid_client.foo.client_id Terraform variables for open id audience mapper resources\n\t\tif _, exist := r.Item[\"included_client_audience\"]; exist && r.InstanceInfo.Type == \"keycloak_openid_audience_protocol_mapper\" {\n\t\t\tg.Resources[i].Item[\"included_client_audience\"] = mapClientClientIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"included_client_audience\"].(string)]\n\t\t}\n\n\t\t// Map parent_flow_alias attributes to keycloak_authentication_(sub)flow.foo.alias Terraform variables for authentication subflow and execution resources\n\t\tif r.InstanceInfo.Type == \"keycloak_authentication_subflow\" || r.InstanceInfo.Type == \"keycloak_authentication_execution\" {\n\t\t\tg.Resources[i].Item[\"parent_flow_alias\"] = mapAuthenticationFlowAliases[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"parent_flow_alias\"].(string)]\n\t\t}\n\n\t\t// Map execution_id attributes to keycloak_authentication_execution_config.foo.execution_id Terraform variables for authentication execution config resources\n\t\tif r.InstanceInfo.Type == \"keycloak_authentication_execution_config\" {\n\t\t\tg.Resources[i].Item[\"execution_id\"] = mapAuthenticationExecutionIDs[r.Item[\"realm_id\"].(string)+\"_\"+r.Item[\"execution_id\"].(string)]\n\t\t}\n\n\t\t// Map realm_id attributes to keycloak_realm.foo.id Terraform variables for all the resources (almost all resources have this attribute)\n\t\tif _, exist := r.Item[\"realm_id\"]; exist {\n\t\t\tg.Resources[i].Item[\"realm_id\"] = mapRealmIDs[r.Item[\"realm_id\"].(string)]\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/keycloak/group.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage keycloak\n\nimport (\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mrparkers/terraform-provider-keycloak/keycloak\"\n)\n\nfunc (g RealmGenerator) createGroupResources(groups []*keycloak.Group) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, group := range groups {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tgroup.Id,\n\t\t\t\"group_\"+normalizeResourceName(group.RealmId)+\"_\"+normalizeResourceName(group.Name),\n\t\t\t\"keycloak_group\",\n\t\t\t\"keycloak\",\n\t\t\tmap[string]string{\n\t\t\t\t\"realm_id\": group.RealmId,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g RealmGenerator) createDefaultGroupResource(realmID string) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\trealmID+\"/default-groups\",\n\t\t\"default_groups_\"+normalizeResourceName(realmID),\n\t\t\"keycloak_default_groups\",\n\t\t\"keycloak\",\n\t\tmap[string]string{\n\t\t\t\"realm_id\": realmID,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc (g RealmGenerator) createGroupMembershipsResource(realmID, groupID, groupName string, members []string) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\trealmID+\"/group-memberships/\"+groupID,\n\t\t\"group_memberships_\"+normalizeResourceName(realmID)+\"_\"+normalizeResourceName(groupName),\n\t\t\"keycloak_group_memberships\",\n\t\t\"keycloak\",\n\t\tmap[string]string{\n\t\t\t\"realm_id\": realmID,\n\t\t\t\"group_id\": groupID,\n\t\t\t\"members\":  strings.Join(members, \",\"),\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc (g RealmGenerator) createGroupRolesResource(realmID, groupID, groupName string, roles []string) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\trealmID+\"/\"+groupID,\n\t\t\"group_roles_\"+normalizeResourceName(realmID)+\"_\"+normalizeResourceName(groupName),\n\t\t\"keycloak_group_roles\",\n\t\t\"keycloak\",\n\t\tmap[string]string{\n\t\t\t\"realm_id\":  realmID,\n\t\t\t\"group_id\":  groupID,\n\t\t\t\"roles_ids\": strings.Join(roles, \",\"),\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc (g *RealmGenerator) flattenGroups(groups []*keycloak.Group, realmID string) []*keycloak.Group {\n\tvar flattenedGroups []*keycloak.Group\n\tfor _, group := range groups {\n\t\tif realmID != \"\" {\n\t\t\tgroup.RealmId = realmID\n\t\t}\n\t\tflattenedGroups = append(flattenedGroups, group)\n\t\tif len(group.SubGroups) > 0 {\n\t\t\tsubGroups := g.flattenGroups(group.SubGroups, group.RealmId)\n\t\t\tflattenedGroups = append(flattenedGroups, subGroups...)\n\t\t}\n\t}\n\treturn flattenedGroups\n}\n"
  },
  {
    "path": "providers/keycloak/helpers.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage keycloak\n\nimport (\n\t\"strings\"\n\t\"unicode\"\n\n\t\"golang.org/x/text/secure/precis\"\n\t\"golang.org/x/text/transform\"\n\t\"golang.org/x/text/unicode/norm\"\n)\n\nfunc normalizeResourceName(s string) string {\n\tnormalize := precis.NewIdentifier(\n\t\tprecis.AdditionalMapping(func() transform.Transformer {\n\t\t\treturn transform.Chain(norm.NFD, transform.RemoveFunc(func(r rune) bool { //nolint\n\t\t\t\treturn unicode.Is(unicode.Mn, r)\n\t\t\t}))\n\t\t}),\n\t\tprecis.Norm(norm.NFC),\n\t)\n\tr := strings.NewReplacer(\" \", \"_\",\n\t\t\"!\", \"_\",\n\t\t\"\\\"\", \"_\",\n\t\t\"#\", \"_\",\n\t\t\"%\", \"_\",\n\t\t\"&\", \"_\",\n\t\t\"'\", \"_\",\n\t\t\"(\", \"_\",\n\t\t\")\", \"_\",\n\t\t\"{\", \"_\",\n\t\t\"}\", \"_\",\n\t\t\"*\", \"_\",\n\t\t\"+\", \"_\",\n\t\t\",\", \"_\",\n\t\t\"-\", \"_\",\n\t\t\".\", \"_\",\n\t\t\"/\", \"slash\",\n\t\t\"|\", \"_\",\n\t\t\"\\\\\", \"_\",\n\t\t\":\", \"_\",\n\t\t\";\", \"_\",\n\t\t\">\", \"_\",\n\t\t\"=\", \"_\",\n\t\t\"<\", \"_\",\n\t\t\"?\", \"_\",\n\t\t\"[\", \"_\",\n\t\t\"]\", \"_\",\n\t\t\"^\", \"_\",\n\t\t\"`\", \"_\",\n\t\t\"~\", \"_\",\n\t\t\"$\", \"_\",\n\t\t\"@\", \"_at_\")\n\tnormalizedString, _ := normalize.String(r.Replace(strings.ToLower(s)))\n\treturn normalizedString\n}\n"
  },
  {
    "path": "providers/keycloak/keycloak_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage keycloak\n\nimport (\n\t\"errors\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype KeycloakProvider struct { //nolint\n\tterraformutils.Provider\n\turl                   string\n\tbasePath              string\n\tclientID              string\n\tclientSecret          string\n\trealm                 string\n\tclientTimeout         int\n\tcaCert                string\n\ttlsInsecureSkipVerify bool\n\tredHatSSO             bool\n\ttarget                string\n}\n\nfunc getArg(arg string) string {\n\tif arg == \"-\" {\n\t\treturn \"\"\n\t}\n\treturn arg\n}\n\nfunc (p *KeycloakProvider) Init(args []string) error {\n\tp.url = args[0]\n\tp.basePath = args[1]\n\tp.clientID = args[2]\n\tp.clientSecret = args[3]\n\tp.realm = args[4]\n\tp.clientTimeout, _ = strconv.Atoi(args[5])\n\tp.caCert = getArg(args[6])\n\tp.tlsInsecureSkipVerify, _ = strconv.ParseBool(args[7])\n\tp.redHatSSO, _ = strconv.ParseBool(args[8])\n\tp.target = getArg(args[9])\n\treturn nil\n}\n\nfunc (p *KeycloakProvider) GetName() string {\n\treturn \"keycloak\"\n}\n\nfunc (p *KeycloakProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (p *KeycloakProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"url\":                      cty.StringVal(p.url),\n\t\t\"base_path\":                cty.StringVal(p.basePath),\n\t\t\"client_id\":                cty.StringVal(p.clientID),\n\t\t\"client_secret\":            cty.StringVal(p.clientSecret),\n\t\t\"realm\":                    cty.StringVal(p.realm),\n\t\t\"client_timeout\":           cty.NumberIntVal(int64(p.clientTimeout)),\n\t\t\"root_ca_certificate\":      cty.StringVal(p.caCert),\n\t\t\"tls_insecure_skip_verify\": cty.BoolVal(p.tlsInsecureSkipVerify),\n\t\t\"red_hat_sso\":              cty.BoolVal(p.redHatSSO),\n\t})\n}\n\nfunc (p *KeycloakProvider) GetBasicConfig() cty.Value {\n\treturn p.GetConfig()\n}\n\nfunc (p *KeycloakProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"url\":                      p.url,\n\t\t\"base_path\":                p.basePath,\n\t\t\"client_id\":                p.clientID,\n\t\t\"client_secret\":            p.clientSecret,\n\t\t\"realm\":                    p.realm,\n\t\t\"client_timeout\":           p.clientTimeout,\n\t\t\"root_ca_certificate\":      p.caCert,\n\t\t\"tls_insecure_skip_verify\": p.tlsInsecureSkipVerify,\n\t\t\"red_hat_sso\":              p.redHatSSO,\n\t\t\"target\":                   p.target,\n\t})\n\treturn nil\n}\n\nfunc (p *KeycloakProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"realms\": &RealmGenerator{},\n\t}\n}\n\nfunc (KeycloakProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n"
  },
  {
    "path": "providers/keycloak/keycloak_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage keycloak\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype KeycloakService struct { //nolint\n\tterraformutils.Service\n}\n"
  },
  {
    "path": "providers/keycloak/openid_client.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage keycloak\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mrparkers/terraform-provider-keycloak/keycloak\"\n)\n\nfunc (g RealmGenerator) createOpenIDClientResources(openIDClients []*keycloak.OpenidClient) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, openIDClient := range openIDClients {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\topenIDClient.Id,\n\t\t\t\"openid_client_\"+normalizeResourceName(openIDClient.RealmId)+\"_\"+normalizeResourceName(openIDClient.ClientId),\n\t\t\t\"keycloak_openid_client\",\n\t\t\t\"keycloak\",\n\t\t\tmap[string]string{\n\t\t\t\t\"realm_id\": openIDClient.RealmId,\n\t\t\t},\n\t\t\t[]string{\"web_origins\"},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g RealmGenerator) createServiceAccountClientRolesResources(realmID string, clientRoles []*keycloak.Role, usersInRole []keycloak.UsersInRole, mapServiceAccountIds map[string]map[string]string, mapClientIDs map[string]string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, role := range clientRoles {\n\t\tfor _, users := range usersInRole {\n\t\t\tif len(*users.Users) == 0 || role.Id != users.Role.Id {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, user := range *users.Users {\n\t\t\t\t// Test if role is mapped to a User, and not a ServiceAccountUser\n\t\t\t\tif mapServiceAccountIds[user.Id] == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\trealmID+\"/\"+user.Id+\"/\"+role.ClientId+\"/\"+role.Name,\n\t\t\t\t\t\"openid_client_service_account_role_\"+normalizeResourceName(realmID)+\"_\"+normalizeResourceName(mapServiceAccountIds[user.Id][\"ClientId\"])+\"_\"+normalizeResourceName(mapClientIDs[role.ClientId])+\"_\"+normalizeResourceName(role.Name),\n\t\t\t\t\t\"keycloak_openid_client_service_account_role\",\n\t\t\t\t\t\"keycloak\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"realm_id\":                realmID,\n\t\t\t\t\t\t\"service_account_user_id\": user.Id,\n\t\t\t\t\t\t\"client_id\":               role.ClientId,\n\t\t\t\t\t\t\"role\":                    role.Name,\n\t\t\t\t\t},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g RealmGenerator) createOpenIDGenericProtocolMapperResource(protocolMapperType, protocolMapperID, protocolMapperName, realmID, clientID, clientName string) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tprotocolMapperID,\n\t\t\"openid_\"+protocolMapperType+\"_protocol_mapper_\"+normalizeResourceName(realmID)+\"_\"+normalizeResourceName(clientName)+\"_\"+normalizeResourceName(protocolMapperName),\n\t\t\"keycloak_openid_\"+protocolMapperType+\"_protocol_mapper\",\n\t\t\"keycloak\",\n\t\tmap[string]string{\n\t\t\t\"realm_id\":  realmID,\n\t\t\t\"client_id\": clientID,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc (g RealmGenerator) createOpenIDProtocolMapperResources(clientID string, openidClient *keycloak.OpenidClientWithGenericProtocolMappers) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, protocolMapper := range openidClient.ProtocolMappers {\n\t\tswitch protocolMapper.ProtocolMapper {\n\t\tcase \"oidc-audience-mapper\":\n\t\t\tresources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"audience\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\tcase \"oidc-audience-resolve-mapper\":\n\t\t\tresources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"audience_resolve\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\tcase \"oidc-full-name-mapper\":\n\t\t\tresources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"full_name\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\tcase \"oidc-group-membership-mapper\":\n\t\t\tresources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"group_membership\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\tcase \"oidc-hardcoded-claim-mapper\":\n\t\t\tresources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"hardcoded_claim\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\tcase \"oidc-hardcoded-role-mapper\":\n\t\t\t// Only works with client roles\n\t\t\tresources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"hardcoded_role\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\tcase \"oidc-script-based-protocol-mapper\":\n\t\t\t// Support for this protocol mapper was removed in Keycloak 18\n\t\t\tresources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"script\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\tcase \"oidc-usermodel-attribute-mapper\":\n\t\t\tresources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"user_attribute\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\tcase \"oidc-usermodel-property-mapper\":\n\t\t\tresources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"user_property\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\tcase \"oidc-usermodel-realm-role-mapper\":\n\t\t\tresources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"user_realm_role\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\tcase \"oidc-usermodel-client-role-mapper\":\n\t\t\tresources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"user_client_role\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\tcase \"oidc-usersessionmodel-note-mapper\":\n\t\t\tresources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"user_session_note\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\tcase \"oidc-address-mapper\":\n\t\t\t// Not supported for the moment\n\t\t\t// resources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"address\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\t\tcontinue\n\t\tcase \"oidc-role-name-mapper\":\n\t\t\t// Not supported for the moment\n\t\t\t// resources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"role_name\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\t\tcontinue\n\t\tcase \"oidc-sha256-pairwise-sub-mapper\":\n\t\t\t// Not supported for the moment\n\t\t\t// resources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"pairwise_subject_identifier\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\t\tcontinue\n\t\tcase \"oidc-allowed-origins-mapper\":\n\t\t\t// Not supported for the moment\n\t\t\t// resources = append(resources, g.createOpenIDGenericProtocolMapperResource(\"allowed_web_origins\", protocolMapper.Id, protocolMapper.Name, openidClient.RealmId, openidClient.ClientId, clientID))\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn resources\n}\n"
  },
  {
    "path": "providers/keycloak/realm.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage keycloak\n\nimport (\n\t\"reflect\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mrparkers/terraform-provider-keycloak/keycloak\"\n)\n\nfunc (g RealmGenerator) createRealmResources(realms []*keycloak.Realm) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, realm := range realms {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\trealm.Realm,\n\t\t\t\"realm_\"+normalizeResourceName(realm.Realm),\n\t\t\t\"keycloak_realm\",\n\t\t\t\"keycloak\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g RealmGenerator) createRequiredActionResources(requiredActions []*keycloak.RequiredAction) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, requiredAction := range requiredActions {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\trequiredAction.RealmId+\"/\"+requiredAction.Alias,\n\t\t\t\"required_action_\"+normalizeResourceName(requiredAction.RealmId)+\"_\"+normalizeResourceName(requiredAction.Alias),\n\t\t\t\"keycloak_required_action\",\n\t\t\t\"keycloak\",\n\t\t\tmap[string]string{\n\t\t\t\t\"realm_id\": requiredAction.RealmId,\n\t\t\t\t\"alias\":    requiredAction.Alias,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g RealmGenerator) createCustomUserFederationResources(customUserFederations *[]keycloak.CustomUserFederation) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, customUserFederation := range *customUserFederations {\n\t\tif customUserFederation.ProviderId == \"ldap\" {\n\t\t\tif customUserFederation.Config[\"bindCredential\"][0] != \"\" {\n\t\t\t\tvar bindDn string\n\t\t\t\tfor _, i := range strings.Split(customUserFederation.Config[\"bindDn\"][0], \",\") {\n\t\t\t\t\tattrib := strings.Split(i, \"=\")\n\t\t\t\t\tif strings.ToLower(attrib[0]) == \"cn\" {\n\t\t\t\t\t\tbindDn = attrib[1]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\tcustomUserFederation.Id,\n\t\t\t\t\t\"ldap_user_federation_\"+normalizeResourceName(customUserFederation.RealmId)+\"_\"+normalizeResourceName(customUserFederation.Name)+\"_\"+normalizeResourceName(bindDn),\n\t\t\t\t\t\"keycloak_ldap_user_federation\",\n\t\t\t\t\t\"keycloak\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"realm_id\":    customUserFederation.RealmId,\n\t\t\t\t\t\t\"provider_id\": customUserFederation.ProviderId,\n\t\t\t\t\t\t\"bind_dn\":     bindDn,\n\t\t\t\t\t},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t))\n\t\t\t} else {\n\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\tcustomUserFederation.Id,\n\t\t\t\t\t\"ldap_user_federation_\"+normalizeResourceName(customUserFederation.RealmId)+\"_\"+normalizeResourceName(customUserFederation.Name),\n\t\t\t\t\t\"keycloak_ldap_user_federation\",\n\t\t\t\t\t\"keycloak\",\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"realm_id\":    customUserFederation.RealmId,\n\t\t\t\t\t\t\"provider_id\": customUserFederation.ProviderId,\n\t\t\t\t\t},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g RealmGenerator) createLdapMapperResources(realmID, providerName string, mappers *[]interface{}) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tvar providerID string\n\tvar mapperID string\n\tvar mapperName string\n\tvar mapperType string\n\tvar name string\n\tmapperNames := make(map[string]int)\n\tfor _, mapper := range *mappers {\n\t\tswitch reflect.TypeOf(mapper).String() {\n\t\tcase \"*keycloak.LdapFullNameMapper\":\n\t\t\tproviderID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapFullNameMapper).LdapUserFederationId\n\t\t\tmapperID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapFullNameMapper).Id\n\t\t\tmapperName = reflect.ValueOf(mapper).Interface().(*keycloak.LdapFullNameMapper).Name\n\t\t\tmapperType = \"full_name\"\n\t\tcase \"*keycloak.LdapGroupMapper\":\n\t\t\tproviderID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapGroupMapper).LdapUserFederationId\n\t\t\tmapperID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapGroupMapper).Id\n\t\t\tmapperName = reflect.ValueOf(mapper).Interface().(*keycloak.LdapGroupMapper).Name\n\t\t\tmapperType = \"group\"\n\t\tcase \"*keycloak.LdapRoleMapper\":\n\t\t\tproviderID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapRoleMapper).LdapUserFederationId\n\t\t\tmapperID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapRoleMapper).Id\n\t\t\tmapperName = reflect.ValueOf(mapper).Interface().(*keycloak.LdapRoleMapper).Name\n\t\t\tmapperType = \"role\"\n\t\tcase \"*keycloak.LdapHardcodedGroupMapper\":\n\t\t\tproviderID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapHardcodedGroupMapper).LdapUserFederationId\n\t\t\tmapperID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapHardcodedGroupMapper).Id\n\t\t\tmapperName = reflect.ValueOf(mapper).Interface().(*keycloak.LdapHardcodedGroupMapper).Name\n\t\t\tmapperType = \"hardcoded_group\"\n\t\tcase \"*keycloak.LdapHardcodedRoleMapper\":\n\t\t\tproviderID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapHardcodedRoleMapper).LdapUserFederationId\n\t\t\tmapperID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapHardcodedRoleMapper).Id\n\t\t\tmapperName = reflect.ValueOf(mapper).Interface().(*keycloak.LdapHardcodedRoleMapper).Name\n\t\t\tmapperType = \"hardcoded_role\"\n\t\tcase \"*keycloak.LdapMsadLdsUserAccountControlMapper\":\n\t\t\tproviderID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapMsadLdsUserAccountControlMapper).LdapUserFederationId\n\t\t\tmapperID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapMsadLdsUserAccountControlMapper).Id\n\t\t\tmapperName = reflect.ValueOf(mapper).Interface().(*keycloak.LdapMsadLdsUserAccountControlMapper).Name\n\t\t\tmapperType = \"msad_lds_user_account_control\"\n\t\tcase \"*keycloak.LdapMsadUserAccountControlMapper\":\n\t\t\tproviderID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapMsadUserAccountControlMapper).LdapUserFederationId\n\t\t\tmapperID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapMsadUserAccountControlMapper).Id\n\t\t\tmapperName = reflect.ValueOf(mapper).Interface().(*keycloak.LdapMsadUserAccountControlMapper).Name\n\t\t\tmapperType = \"msad_user_account_control\"\n\t\tcase \"*keycloak.LdapUserAttributeMapper\":\n\t\t\tproviderID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapUserAttributeMapper).LdapUserFederationId\n\t\t\tmapperID = reflect.ValueOf(mapper).Interface().(*keycloak.LdapUserAttributeMapper).Id\n\t\t\tmapperName = reflect.ValueOf(mapper).Interface().(*keycloak.LdapUserAttributeMapper).Name\n\t\t\tmapperType = \"user_attribute\"\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\t\tname = \"ldap_\" + mapperType + \"_mapper_\" + normalizeResourceName(realmID) + \"_\" + normalizeResourceName(providerName) + \"_\" + normalizeResourceName(mapperName)\n\t\tfor k, v := range mapperNames {\n\t\t\tif k == name {\n\t\t\t\tv++\n\t\t\t\tname += strconv.Itoa(v)\n\t\t\t}\n\t\t}\n\t\tif name == \"ldap_\"+mapperType+\"_mapper_\"+normalizeResourceName(realmID)+\"_\"+normalizeResourceName(providerName)+\"_\"+normalizeResourceName(mapperName) {\n\t\t\tmapperNames[name] = 1\n\t\t}\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tmapperID,\n\t\t\tname,\n\t\t\t\"keycloak_ldap_\"+mapperType+\"_mapper\",\n\t\t\t\"keycloak\",\n\t\t\tmap[string]string{\n\t\t\t\t\"realm_id\":    realmID,\n\t\t\t\t\"provider_id\": providerID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n"
  },
  {
    "path": "providers/keycloak/role.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage keycloak\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mrparkers/terraform-provider-keycloak/keycloak\"\n)\n\nfunc (g RealmGenerator) createRoleResources(roles []*keycloak.Role) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, role := range roles {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\trole.Id,\n\t\t\t\"role_\"+normalizeResourceName(role.RealmId)+normalizeResourceName(role.ContainerId)+\"_\"+normalizeResourceName(role.Name),\n\t\t\t\"keycloak_role\",\n\t\t\t\"keycloak\",\n\t\t\tmap[string]string{\n\t\t\t\t\"realm_id\": role.RealmId,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n"
  },
  {
    "path": "providers/keycloak/scope.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage keycloak\n\nimport (\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mrparkers/terraform-provider-keycloak/keycloak\"\n)\n\nfunc (g RealmGenerator) createScopeResources(realmID string, openidClientScopes []*keycloak.OpenidClientScope) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, openidClientScope := range openidClientScopes {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\topenidClientScope.Id,\n\t\t\t\"openid_client_scope_\"+normalizeResourceName(realmID)+\"_\"+normalizeResourceName(openidClientScope.Name),\n\t\t\t\"keycloak_openid_client_scope\",\n\t\t\t\"keycloak\",\n\t\t\tmap[string]string{\n\t\t\t\t\"realm_id\": realmID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g RealmGenerator) createOpenidClientScopesResources(realmID, clientID, clientClientID, t string, openidClientScopes *[]keycloak.OpenidClientScope) terraformutils.Resource {\n\tvar scopes []string\n\tfor _, openidClientScope := range *openidClientScopes {\n\t\tscopes = append(scopes, openidClientScope.Name)\n\t}\n\treturn terraformutils.NewResource(\n\t\trealmID+\"/\"+clientID,\n\t\t\"openid_client_\"+t+\"_scopes_\"+normalizeResourceName(realmID)+\"_\"+normalizeResourceName(clientClientID),\n\t\t\"keycloak_openid_client_\"+t+\"_scopes\",\n\t\t\"keycloak\",\n\t\tmap[string]string{\n\t\t\t\"realm_id\":    realmID,\n\t\t\t\"client_id\":   clientID,\n\t\t\tt + \"_scopes\": strings.Join(scopes, \",\"),\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n"
  },
  {
    "path": "providers/keycloak/user.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage keycloak\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mrparkers/terraform-provider-keycloak/keycloak\"\n)\n\nfunc (g RealmGenerator) createUserResources(users []*keycloak.User) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, user := range users {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tuser.Id,\n\t\t\t\"user_\"+normalizeResourceName(user.RealmId)+\"_\"+normalizeResourceName(user.Username),\n\t\t\t\"keycloak_user\",\n\t\t\t\"keycloak\",\n\t\t\tmap[string]string{\n\t\t\t\t\"realm_id\": user.RealmId,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n"
  },
  {
    "path": "providers/kubernetes/kind.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage kubernetes\n\nimport (\n\t\"context\"\n\t\"reflect\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\tmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\t\"k8s.io/client-go/kubernetes\"\n)\n\ntype Kind struct {\n\tKubernetesService\n\tName       string\n\tGroup      string\n\tVersion    string\n\tNamespaced bool\n}\n\n// Generate TerraformResources from Kubernetes API,\n// from each kubernetes object 1 TerraformResource.\n// Use UID as the resource IDs.\nfunc (k *Kind) InitResources() error {\n\tconfig, _, err := initClientAndConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgroup := reflect.ValueOf(clientset).MethodByName(\n\t\textractClientSetFuncGroupName(k.Group, k.Version)).Call(\n\t\t[]reflect.Value{})[0]\n\n\tparam := []reflect.Value{}\n\tnamespace := \"\"\n\tif k.Namespaced {\n\t\tparam = append(param, reflect.ValueOf(namespace))\n\t}\n\n\tresource := group.MethodByName(extractClientSetFuncTypeName(k.Name)).Call(param)[0]\n\n\tresults := resource.MethodByName(\"List\").Call([]reflect.Value{reflect.ValueOf(context.Background()),\n\t\treflect.ValueOf(metav1.ListOptions{})})\n\n\tif !results[1].IsNil() {\n\t\treturn results[1].Interface().(error)\n\t}\n\titems := reflect.Indirect(results[0]).FieldByName(\"Items\")\n\n\tfor i := 0; i < items.Len(); i++ {\n\t\titem := items.Index(i)\n\t\t// Filter to resources that aren't owned by any other resource\n\t\tif item.FieldByName(\"OwnerReferences\").Len() > 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tname := \"\"\n\t\tif k.Namespaced {\n\t\t\tname = item.FieldByName(\"Namespace\").String() + \"/\" + item.FieldByName(\"Name\").String()\n\t\t} else {\n\t\t\tname = item.FieldByName(\"Name\").String()\n\t\t}\n\n\t\tk.Resources = append(k.Resources, terraformutils.NewSimpleResource(\n\t\t\tname,\n\t\t\tname,\n\t\t\textractTfResourceName(k.Name),\n\t\t\t\"kubernetes\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/kubernetes/kubernetes_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage kubernetes\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"runtime\"\n\t\"time\"\n\n\trestclient \"k8s.io/client-go/rest\"\n\t\"k8s.io/client-go/tools/clientcmd\"\n\tclientcmdapi \"k8s.io/client-go/tools/clientcmd/api\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/providerwrapper\"\n\t\"github.com/zclconf/go-cty/cty\"\n\n\t\"github.com/pkg/errors\"\n\t\"k8s.io/apimachinery/pkg/runtime/schema\"\n\t\"k8s.io/apimachinery/pkg/util/sets\"\n\t\"k8s.io/client-go/discovery\"\n\t_ \"k8s.io/client-go/plugin/pkg/client/auth/gcp\" // GKE support\n)\n\ntype KubernetesProvider struct { //nolint\n\tterraformutils.Provider\n\tverbose string\n}\n\nfunc (p KubernetesProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p KubernetesProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (p *KubernetesProvider) Init(args []string) error {\n\tp.verbose = args[0]\n\treturn nil\n}\n\nfunc (p *KubernetesProvider) GetName() string {\n\treturn \"kubernetes\"\n}\n\nfunc (p *KubernetesProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"kubernetes: \" + serviceName + \" not supported resource\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\treturn nil\n}\n\n// GetSupportService return map of supported resource for Kubernetes\nfunc (p *KubernetesProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\tresources := make(map[string]terraformutils.ServiceGenerator)\n\n\tconfig, _, err := initClientAndConfig()\n\tif err != nil {\n\t\treturn resources\n\t}\n\n\tdc, err := discovery.NewDiscoveryClientForConfig(config)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn resources\n\t}\n\n\tlists, err := dc.ServerPreferredResources()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn resources\n\t}\n\tprovider, err := providerwrapper.NewProviderWrapper(\"kubernetes\", cty.Value{}, p.verbose == \"true\")\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn resources\n\t}\n\tresp := provider.GetSchema()\n\tfor _, list := range lists {\n\t\tif len(list.APIResources) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tgv, err := schema.ParseGroupVersion(list.GroupVersion)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, resource := range list.APIResources {\n\t\t\tif len(resource.Verbs) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// filter to resources that support list\n\t\t\tif len(resource.Verbs) > 0 && !sets.NewString(resource.Verbs...).Has(\"list\") {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// filter to resource that are supported by terraform kubernetes provider\n\t\t\tif _, ok := resp.ResourceTypes[extractTfResourceName(resource.Kind)]; !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tresources[resource.Name] = &Kind{\n\t\t\t\tGroup:      gv.Group,\n\t\t\t\tVersion:    gv.Version,\n\t\t\t\tName:       resource.Kind,\n\t\t\t\tNamespaced: resource.Namespaced,\n\t\t\t}\n\t\t}\n\t}\n\treturn resources\n}\n\n// InitClientAndConfig uses the KUBECONFIG environment variable to create\n// a new rest client and config object based on the existing kubectl config\n// and options passed from the plugin framework via environment variables\nfunc initClientAndConfig() (*restclient.Config, clientcmd.ClientConfig, error) { //nolint\n\t// resolve kubeconfig location, prioritizing the --config global flag,\n\t// then the value of the KUBECONFIG env var (if any), and defaulting\n\t// to ~/.kube/config as a last resort.\n\thome := os.Getenv(\"HOME\")\n\tif runtime.GOOS == \"windows\" {\n\t\thome = os.Getenv(\"HOMEDRIVE\") + os.Getenv(\"HOMEPATH\")\n\t\tif home == \"\" {\n\t\t\thome = os.Getenv(\"USERPROFILE\")\n\t\t}\n\t}\n\tkubeconfig := filepath.Join(home, \".kube\", \"config\")\n\n\tkubeconfigEnv := os.Getenv(\"KUBECONFIG\")\n\tif len(kubeconfigEnv) > 0 {\n\t\tkubeconfig = kubeconfigEnv\n\t}\n\n\tconfigFile := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_CONFIG\")\n\tkubeConfigFile := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_KUBECONFIG\")\n\tif len(configFile) > 0 {\n\t\tkubeconfig = configFile\n\t} else if len(kubeConfigFile) > 0 {\n\t\tkubeconfig = kubeConfigFile\n\t}\n\n\tif len(kubeconfig) == 0 {\n\t\treturn nil, nil, fmt.Errorf(\"error initializing config. The KUBECONFIG environment variable must be defined\")\n\t}\n\n\tconfig, err := configFromPath(kubeconfig)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"error obtaining kubectl config: %v\", err)\n\t}\n\tclient, err := config.ClientConfig()\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"the provided credentials %q could not be used: %v\", kubeconfig, err)\n\t}\n\n\terr = applyGlobalOptionsToConfig(client)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"error processing global plugin options: %v\", err)\n\t}\n\n\treturn client, config, nil\n}\n\nfunc configFromPath(path string) (clientcmd.ClientConfig, error) {\n\trules := &clientcmd.ClientConfigLoadingRules{ExplicitPath: path}\n\tcredentials, err := rules.Load()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"the provided credentials %q could not be loaded: %v\", path, err)\n\t}\n\n\toverrides := &clientcmd.ConfigOverrides{\n\t\tContext: clientcmdapi.Context{\n\t\t\tNamespace: os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_NAMESPACE\"),\n\t\t},\n\t}\n\n\tvar cfg clientcmd.ClientConfig\n\tcontext := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_CONTEXT\")\n\tif len(context) > 0 {\n\t\trules := clientcmd.NewDefaultClientConfigLoadingRules()\n\t\tcfg = clientcmd.NewNonInteractiveClientConfig(*credentials, context, overrides, rules)\n\t} else {\n\t\tcfg = clientcmd.NewDefaultClientConfig(*credentials, overrides)\n\t}\n\n\treturn cfg, nil\n}\n\nfunc applyGlobalOptionsToConfig(config *restclient.Config) error {\n\t// impersonation config\n\timpersonateUser := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_AS\")\n\tif len(impersonateUser) > 0 {\n\t\tconfig.Impersonate.UserName = impersonateUser\n\t}\n\n\timpersonateGroup := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_AS_GROUP\")\n\tif len(impersonateGroup) > 0 {\n\t\timpersonateGroupJSON := []string{}\n\t\terr := json.Unmarshal([]byte(impersonateGroup), &impersonateGroupJSON)\n\t\tif err != nil {\n\t\t\treturn errors.New(fmt.Sprintf(\"error parsing global option %q: %v\", \"--as-group\", err))\n\t\t}\n\t\tif len(impersonateGroupJSON) > 0 {\n\t\t\tconfig.Impersonate.Groups = impersonateGroupJSON\n\t\t}\n\t}\n\n\t// tls config\n\tcaFile := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_CERTIFICATE_AUTHORITY\")\n\tif len(caFile) > 0 {\n\t\tconfig.TLSClientConfig.CAFile = caFile\n\t}\n\n\tclientCertFile := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_CLIENT_CERTIFICATE\")\n\tif len(clientCertFile) > 0 {\n\t\tconfig.TLSClientConfig.CertFile = clientCertFile\n\t}\n\n\tclientKey := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_CLIENT_KEY\")\n\tif len(clientKey) > 0 {\n\t\tconfig.TLSClientConfig.KeyFile = clientKey\n\t}\n\n\t// user / misc request config\n\trequestTimeout := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_REQUEST_TIMEOUT\")\n\tif len(requestTimeout) > 0 {\n\t\tt, err := time.ParseDuration(requestTimeout)\n\t\tif err != nil {\n\t\t\treturn errors.New(fmt.Sprintf(\"%v\", err))\n\t\t}\n\t\tconfig.Timeout = t\n\t}\n\n\tserver := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_SERVER\")\n\tif len(server) > 0 {\n\t\tconfig.ServerName = server\n\t}\n\n\ttoken := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_TOKEN\")\n\tif len(token) > 0 {\n\t\tconfig.BearerToken = token\n\t}\n\n\tusername := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_USERNAME\")\n\tif len(username) > 0 {\n\t\tconfig.Username = username\n\t}\n\n\tpassword := os.Getenv(\"KUBECTL_PLUGINS_GLOBAL_FLAG_PASSWORD\")\n\tif len(password) > 0 {\n\t\tconfig.Password = password\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/kubernetes/kubernetes_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage kubernetes\n\nimport \"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\ntype KubernetesService struct { //nolint\n\tterraformutils.Service\n}\n"
  },
  {
    "path": "providers/kubernetes/utils.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage kubernetes\n\nimport (\n\t\"strings\"\n\n\t\"github.com/iancoleman/strcase\"\n)\n\nfunc extractClientSetFuncGroupName(group, version string) string {\n\tv := strings.Title(version)\n\tif len(group) > 0 {\n\t\treturn strings.Title(strings.Split(group, \".\")[0]) + v\n\t}\n\treturn \"Core\" + v\n}\n\nfunc extractClientSetFuncTypeName(kind string) string {\n\tswitch string(kind[len(kind)-1]) {\n\tcase \"s\":\n\t\treturn kind + \"es\"\n\tcase \"y\":\n\t\treturn strings.TrimSuffix(kind, \"y\") + \"ies\"\n\t}\n\treturn kind + \"s\"\n}\n\nfunc extractTfResourceName(kind string) string {\n\treturn \"kubernetes_\" + strcase.ToSnake(kind)\n}\n"
  },
  {
    "path": "providers/launchdarkly/feature_flags.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage launchdarkly\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tlaunchdarkly \"github.com/launchdarkly/api-client-go\"\n)\n\nvar featureFlagsAllowEmptyValues = []string{\"variations.*.value\"}\n\ntype FeatureFlagsGenerator struct {\n\tLaunchDarklyService\n}\n\nfunc (g *FeatureFlagsGenerator) loadFeatureFlagEnv(ctx context.Context, client *launchdarkly.APIClient, projectKey, flagKey string) error {\n\tff, _, err := client.FeatureFlagsApi.GetFeatureFlag(ctx, projectKey, flagKey, &launchdarkly.FeatureFlagsApiGetFeatureFlagOpts{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor envKey := range ff.Environments {\n\t\tresource := terraformutils.NewResource(\n\t\t\tprojectKey+\"/\"+envKey+\"/\"+flagKey,\n\t\t\tprojectKey+\"-\"+envKey+\"-\"+flagKey,\n\t\t\t\"launchdarkly_feature_flag_environment\",\n\t\t\t\"launchdarkly\",\n\t\t\tmap[string]string{\n\t\t\t\t\"env_key\": envKey,\n\t\t\t\t\"flag_id\": projectKey + \"/\" + flagKey,\n\t\t\t},\n\t\t\tfeatureFlagsAllowEmptyValues,\n\t\t\tmap[string]interface{}{})\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\treturn nil\n}\n\nfunc (g *FeatureFlagsGenerator) loadFeatureFlags(ctx context.Context, client *launchdarkly.APIClient, project string) error {\n\tfeatureFlags, _, err := client.FeatureFlagsApi.GetFeatureFlags(ctx, project, &launchdarkly.FeatureFlagsApiGetFeatureFlagsOpts{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, featureFlag := range featureFlags.Items {\n\t\tresource := terraformutils.NewResource(\n\t\t\tfeatureFlag.Key,\n\t\t\tproject+\"-\"+featureFlag.Name,\n\t\t\t\"launchdarkly_feature_flag\",\n\t\t\t\"launchdarkly\",\n\t\t\tmap[string]string{\n\t\t\t\t\"key\":         featureFlag.Key,\n\t\t\t\t\"project_key\": project,\n\t\t\t},\n\t\t\tfeatureFlagsAllowEmptyValues,\n\t\t\tmap[string]interface{}{})\n\t\tresource.IgnoreKeys = append(resource.IgnoreKeys, \"include_in_snippet\")\n\t\terr = g.loadFeatureFlagEnv(ctx, client, project, featureFlag.Key)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\treturn nil\n}\n\nfunc (g *FeatureFlagsGenerator) InitResources() error {\n\tprojects, err := getProjects(g.GetArgs()[\"ctx\"].(context.Context), g.GetArgs()[\"client\"].(*launchdarkly.APIClient))\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, project := range projects.Items {\n\t\tif err := g.loadFeatureFlags(g.GetArgs()[\"ctx\"].(context.Context), g.GetArgs()[\"client\"].(*launchdarkly.APIClient), project.Key); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/launchdarkly/launchdarkly_provider.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage launchdarkly\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tlaunchdarkly \"github.com/launchdarkly/api-client-go\"\n)\n\ntype LaunchDarklyProvider struct { //nolint\n\tterraformutils.Provider\n\tapiKey string\n\tclient *launchdarkly.APIClient\n\tctx    context.Context\n}\n\nconst (\n\tbasePath   = \"https://app.launchdarkly.com/api/v2\"\n\tversion    = \"0.0.1\"\n\tAPIVersion = \"20191212\"\n)\n\nfunc (p *LaunchDarklyProvider) Init(args []string) error {\n\tif os.Getenv(\"LAUNCHDARKLY_ACCESS_TOKEN\") == \"\" {\n\t\treturn errors.New(\"set LAUNCHDARKLY_ACCESS_TOKEN env var\")\n\t}\n\tp.apiKey = os.Getenv(\"LAUNCHDARKLY_ACCESS_TOKEN\")\n\n\tcfg := &launchdarkly.Configuration{\n\t\tBasePath:      basePath,\n\t\tDefaultHeader: make(map[string]string),\n\t\tUserAgent:     fmt.Sprintf(\"launchdarkly-terraformer/%s\", version),\n\t}\n\tcfg.AddDefaultHeader(\"LD-API-Version\", APIVersion)\n\n\tp.client = launchdarkly.NewAPIClient(cfg)\n\n\tp.ctx = context.WithValue(context.Background(), launchdarkly.ContextAPIKey, launchdarkly.APIKey{\n\t\tKey: p.apiKey,\n\t})\n\treturn nil\n}\n\nfunc (p *LaunchDarklyProvider) GetName() string {\n\treturn \"launchdarkly\"\n}\n\nfunc (p *LaunchDarklyProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"launchdarkly\": map[string]interface{}{\n\t\t\t\t\"access_token\": p.apiKey,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (LaunchDarklyProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *LaunchDarklyProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"project\":     &ProjectGenerator{},\n\t\t\"featureFlag\": &FeatureFlagsGenerator{},\n\t\t\"segment\":     &SegmentGenerator{},\n\t}\n}\n\nfunc (p *LaunchDarklyProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"launchdarkly: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"api_key\": p.apiKey,\n\t\t\"client\":  p.client,\n\t\t\"ctx\":     p.ctx,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/launchdarkly/launchdarkly_service.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage launchdarkly\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype LaunchDarklyService struct { //nolint\n\tterraformutils.Service\n}\n"
  },
  {
    "path": "providers/launchdarkly/project.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage launchdarkly\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tlaunchdarkly \"github.com/launchdarkly/api-client-go\"\n)\n\ntype ProjectGenerator struct {\n\tLaunchDarklyService\n}\n\nfunc getProjects(ctx context.Context, client *launchdarkly.APIClient) (launchdarkly.Projects, error) {\n\tprojects, _, err := client.ProjectsApi.GetProjects(ctx)\n\treturn projects, err\n}\n\nfunc (g *ProjectGenerator) loadProjects(ctx context.Context, client *launchdarkly.APIClient) error {\n\tprojects, err := getProjects(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, project := range projects.Items {\n\t\tresource := terraformutils.NewResource(\n\t\t\tproject.Key,\n\t\t\tproject.Key,\n\t\t\t\"launchdarkly_project\",\n\t\t\t\"launchdarkly\",\n\t\t\tmap[string]string{\n\t\t\t\t\"key\": project.Key,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{})\n\t\tresource.IgnoreKeys = append(resource.IgnoreKeys, \"include_in_snippet\")\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\treturn nil\n}\n\nfunc (g *ProjectGenerator) InitResources() error {\n\tif err := g.loadProjects(g.GetArgs()[\"ctx\"].(context.Context), g.GetArgs()[\"client\"].(*launchdarkly.APIClient)); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/launchdarkly/segment.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage launchdarkly\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tlaunchdarkly \"github.com/launchdarkly/api-client-go\"\n)\n\ntype SegmentGenerator struct {\n\tLaunchDarklyService\n}\n\nfunc (g *SegmentGenerator) loadSegment(ctx context.Context, client *launchdarkly.APIClient, project, envKey string) error {\n\tsegments, _, err := client.UserSegmentsApi.GetUserSegments(ctx, project, envKey, &launchdarkly.UserSegmentsApiGetUserSegmentsOpts{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, segment := range segments.Items {\n\t\tresource := terraformutils.NewResource(\n\t\t\tsegment.Key,\n\t\t\tproject+\"-\"+envKey+\"-\"+segment.Name,\n\t\t\t\"launchdarkly_segment\",\n\t\t\t\"launchdarkly\",\n\t\t\tmap[string]string{\n\t\t\t\t\"key\":         segment.Key,\n\t\t\t\t\"project_key\": project,\n\t\t\t\t\"env_key\":     envKey,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{})\n\t\tresource.IgnoreKeys = append(resource.IgnoreKeys, \"include_in_snippet\")\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\treturn nil\n}\n\nfunc (g *SegmentGenerator) InitResources() error {\n\tprojects, err := getProjects(g.GetArgs()[\"ctx\"].(context.Context), g.GetArgs()[\"client\"].(*launchdarkly.APIClient))\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, project := range projects.Items {\n\t\tfor _, env := range project.Environments {\n\t\t\tif err := g.loadSegment(g.GetArgs()[\"ctx\"].(context.Context), g.GetArgs()[\"client\"].(*launchdarkly.APIClient), project.Key, env.Key); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/linode/domain.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage linode\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/linode/linodego\"\n)\n\ntype DomainGenerator struct {\n\tLinodeService\n}\n\nfunc (g *DomainGenerator) loadDomains(client linodego.Client) ([]linodego.Domain, error) {\n\tdomainList, err := client.ListDomains(context.Background(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, domain := range domainList {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tstrconv.Itoa(domain.ID),\n\t\t\tstrconv.Itoa(domain.ID),\n\t\t\t\"linode_domain\",\n\t\t\t\"linode\",\n\t\t\t[]string{}))\n\t}\n\treturn domainList, nil\n}\n\nfunc (g *DomainGenerator) loadDomainRecords(client linodego.Client, domainID int) error {\n\tdomainRecordList, err := client.ListDomainRecords(context.Background(), domainID, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, domainRecord := range domainRecordList {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tstrconv.Itoa(domainRecord.ID),\n\t\t\tstrconv.Itoa(domainRecord.ID),\n\t\t\t\"linode_domain_record\",\n\t\t\t\"linode\",\n\t\t\tmap[string]string{\"domain_id\": strconv.Itoa(domainID)},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n\nfunc (g *DomainGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tdomainList, err := g.loadDomains(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, domain := range domainList {\n\t\terr := g.loadDomainRecords(client, domain.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/linode/image.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage linode\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/linode/linodego\"\n)\n\ntype ImageGenerator struct {\n\tLinodeService\n}\n\nfunc (g ImageGenerator) createResources(imageList []linodego.Image) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, image := range imageList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\timage.ID,\n\t\t\timage.ID,\n\t\t\t\"linode_image\",\n\t\t\t\"linode\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *ImageGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.ListImages(context.Background(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/linode/instance.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage linode\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/linode/linodego\"\n)\n\ntype InstanceGenerator struct {\n\tLinodeService\n}\n\nfunc (g InstanceGenerator) createResources(instanceList []linodego.Instance) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, instance := range instanceList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tstrconv.Itoa(instance.ID),\n\t\t\tstrconv.Itoa(instance.ID),\n\t\t\t\"linode_instance\",\n\t\t\t\"linode\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *InstanceGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.ListInstances(context.Background(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/linode/linode_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage linode\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype LinodeProvider struct { //nolint\n\tterraformutils.Provider\n\ttoken string\n}\n\nfunc (p *LinodeProvider) Init(args []string) error {\n\tif os.Getenv(\"LINODE_TOKEN\") == \"\" {\n\t\treturn errors.New(\"set LINODE_TOKEN env var\")\n\t}\n\tp.token = os.Getenv(\"LINODE_TOKEN\")\n\n\treturn nil\n}\n\nfunc (p *LinodeProvider) GetName() string {\n\treturn \"linode\"\n}\n\nfunc (p *LinodeProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (LinodeProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *LinodeProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"domain\":       &DomainGenerator{},\n\t\t\"image\":        &ImageGenerator{},\n\t\t\"instance\":     &InstanceGenerator{},\n\t\t\"nodebalancer\": &NodeBalancerGenerator{},\n\t\t\"rdns\":         &RDNSGenerator{},\n\t\t\"sshkey\":       &SSHKeyGenerator{},\n\t\t\"stackscript\":  &StackScriptGenerator{},\n\t\t\"token\":        &TokenGenerator{},\n\t\t\"volume\":       &VolumeGenerator{},\n\t}\n}\n\nfunc (p *LinodeProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"linode: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"token\": p.token,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/linode/linode_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage linode\n\nimport (\n\t\"net/http\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/linode/linodego\"\n\t\"golang.org/x/oauth2\"\n)\n\ntype LinodeService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *LinodeService) generateClient() linodego.Client {\n\ttokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: s.Args[\"token\"].(string)})\n\toauth2Client := &http.Client{\n\t\tTransport: &oauth2.Transport{\n\t\t\tSource: tokenSource,\n\t\t},\n\t}\n\tlinodeClient := linodego.NewClient(oauth2Client)\n\tlinodeClient.SetDebug(s.Verbose)\n\treturn linodeClient\n}\n"
  },
  {
    "path": "providers/linode/nodebalancer.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage linode\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/linode/linodego\"\n)\n\ntype NodeBalancerGenerator struct {\n\tLinodeService\n}\n\nfunc (g *NodeBalancerGenerator) loadNodeBalancers(client linodego.Client) ([]linodego.NodeBalancer, error) {\n\tnodeBalancerList, err := client.ListNodeBalancers(context.Background(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, nodeBalancer := range nodeBalancerList {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tstrconv.Itoa(nodeBalancer.ID),\n\t\t\tstrconv.Itoa(nodeBalancer.ID),\n\t\t\t\"linode_nodebalancer\",\n\t\t\t\"linode\",\n\t\t\t[]string{}))\n\t}\n\treturn nodeBalancerList, nil\n}\n\nfunc (g *NodeBalancerGenerator) loadNodeBalancerConfigs(client linodego.Client, nodebalancerID int) ([]linodego.NodeBalancerConfig, error) {\n\tnodeBalancerConfigList, err := client.ListNodeBalancerConfigs(context.Background(), nodebalancerID, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, nodeBalancerConfig := range nodeBalancerConfigList {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tstrconv.Itoa(nodeBalancerConfig.ID),\n\t\t\tstrconv.Itoa(nodeBalancerConfig.ID),\n\t\t\t\"linode_nodebalancer_config\",\n\t\t\t\"linode\",\n\t\t\tmap[string]string{\"nodebalancer_id\": strconv.Itoa(nodebalancerID)},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nodeBalancerConfigList, nil\n}\n\nfunc (g *NodeBalancerGenerator) loadNodeBalancerNodes(client linodego.Client, nodebalancerID int, nodebalancerConfigID int) error {\n\tnodeBalancerNodeList, err := client.ListNodeBalancerNodes(context.Background(), nodebalancerID, nodebalancerConfigID, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, nodeBalancerNode := range nodeBalancerNodeList {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tstrconv.Itoa(nodeBalancerNode.ID),\n\t\t\tstrconv.Itoa(nodeBalancerNode.ID),\n\t\t\t\"linode_nodebalancer_node\",\n\t\t\t\"linode\",\n\t\t\tmap[string]string{\n\t\t\t\t\"nodebalancer_id\": strconv.Itoa(nodebalancerID),\n\t\t\t\t\"config_id\":       strconv.Itoa(nodebalancerConfigID),\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n\nfunc (g *NodeBalancerGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tnodeBalancerList, err := g.loadNodeBalancers(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, nodeBalancer := range nodeBalancerList {\n\t\tnodeBalancerConfigList, err := g.loadNodeBalancerConfigs(client, nodeBalancer.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, nodeBalancerConfig := range nodeBalancerConfigList {\n\t\t\terr := g.loadNodeBalancerNodes(client, nodeBalancer.ID, nodeBalancerConfig.ID)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/linode/rdns.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage linode\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/linode/linodego\"\n)\n\ntype RDNSGenerator struct {\n\tLinodeService\n}\n\nfunc (g RDNSGenerator) createResources(instanceIPList []linodego.InstanceIP) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, instanceIP := range instanceIPList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tinstanceIP.Address,\n\t\t\tinstanceIP.Address,\n\t\t\t\"linode_rdns\",\n\t\t\t\"linode\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *RDNSGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.ListIPAddresses(context.Background(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/linode/sshkey.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage linode\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/linode/linodego\"\n)\n\ntype SSHKeyGenerator struct {\n\tLinodeService\n}\n\nfunc (g SSHKeyGenerator) createResources(keyList []linodego.SSHKey) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, key := range keyList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tstrconv.Itoa(key.ID),\n\t\t\tstrconv.Itoa(key.ID),\n\t\t\t\"linode_sshkey\",\n\t\t\t\"linode\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *SSHKeyGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.ListSSHKeys(context.Background(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/linode/stackscript.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage linode\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/linode/linodego\"\n)\n\ntype StackScriptGenerator struct {\n\tLinodeService\n}\n\nfunc (g StackScriptGenerator) createResources(stackscriptList []linodego.Stackscript) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, stackscript := range stackscriptList {\n\t\t// Avoid importing all community stackscripts\n\t\tif !stackscript.IsPublic {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tstrconv.Itoa(stackscript.ID),\n\t\t\t\tstrconv.Itoa(stackscript.ID),\n\t\t\t\t\"linode_stackscript\",\n\t\t\t\t\"linode\",\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *StackScriptGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.ListStackscripts(context.Background(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/linode/token.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage linode\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/linode/linodego\"\n)\n\ntype TokenGenerator struct {\n\tLinodeService\n}\n\nfunc (g TokenGenerator) createResources(tokenList []linodego.Token) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, token := range tokenList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tstrconv.Itoa(token.ID),\n\t\t\tstrconv.Itoa(token.ID),\n\t\t\t\"linode_token\",\n\t\t\t\"linode\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *TokenGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.ListTokens(context.Background(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/linode/volume.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage linode\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/linode/linodego\"\n)\n\ntype VolumeGenerator struct {\n\tLinodeService\n}\n\nfunc (g VolumeGenerator) createResources(volumeList []linodego.Volume) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, volume := range volumeList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tstrconv.Itoa(volume.ID),\n\t\t\tstrconv.Itoa(volume.ID),\n\t\t\t\"linode_volume\",\n\t\t\t\"linode\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *VolumeGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.ListVolumes(context.Background(), nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/logzio/alert_notification_endpoints.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage logzio\n\nimport (\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/jonboydell/logzio_client/endpoints\"\n)\n\ntype AlertNotificationEndpointsGenerator struct {\n\tLogzioService\n}\n\n// Generate Terraform Resources from Logzio API,\nfunc (g *AlertNotificationEndpointsGenerator) InitResources() error {\n\tvar client *endpoints.EndpointsClient\n\tclient, _ = endpoints.New(g.Args[\"api_token\"].(string), g.Args[\"base_url\"].(string))\n\n\tendpoints, err := client.ListEndpoints()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, endpoint := range endpoints {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tstrconv.FormatInt(endpoint.Id, 10),\n\t\t\tcreateSlug(endpoint.Title+\"-\"+string(endpoint.EndpointType)+\"-\"+strconv.FormatInt(endpoint.Id, 10)),\n\t\t\t\"logzio_endpoint\",\n\t\t\t\"logzio\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/logzio/alerts.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage logzio\n\nimport (\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\t\"github.com/jonboydell/logzio_client/alerts\"\n)\n\ntype AlertsGenerator struct {\n\tLogzioService\n}\n\n// Generate Terraform Resources from Logzio API,\nfunc (g *AlertsGenerator) InitResources() error {\n\tvar client *alerts.AlertsClient\n\tclient, _ = alerts.New(g.Args[\"api_token\"].(string), g.Args[\"base_url\"].(string))\n\n\talerts, err := client.ListAlerts()\n\tif err != nil {\n\t\treturn err\n\t}\n\tallowedEmptyValues := []string{\"alert_notification_endpoints.#\", \"notification_emails.#\"}\n\tfor _, alert := range alerts {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tstrconv.FormatInt(alert.AlertId, 10),\n\t\t\tcreateSlug(alert.Title+\"-\"+strconv.FormatInt(alert.AlertId, 10)),\n\t\t\t\"logzio_alert\",\n\t\t\t\"logzio\",\n\t\t\tallowedEmptyValues,\n\t\t))\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/logzio/logzio_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage logzio\n\nimport (\n\t\"regexp\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/pkg/errors\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype LogzioProvider struct { //nolint\n\tterraformutils.Provider\n\tapiToken string\n\tbaseURL  string\n}\n\nvar (\n\tdisallowedChars = regexp.MustCompile(`[^A-Za-z0-9-]`)\n)\n\nfunc (p LogzioProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"alerts\": {\"alert_notification_endpoints\": []string{\"alert_notification_endpoints\", \"id\"}},\n\t}\n}\n\nfunc (p LogzioProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (p *LogzioProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"api_token\": cty.StringVal(p.apiToken),\n\t\t\"base_url\":  cty.StringVal(p.baseURL),\n\t})\n}\n\n// Init LogzioProvider with API apiToken\nfunc (p *LogzioProvider) Init(args []string) error {\n\tp.apiToken = args[0]\n\tp.baseURL = args[1]\n\treturn nil\n}\n\nfunc (p *LogzioProvider) GetName() string {\n\treturn \"logzio\"\n}\n\nfunc (p *LogzioProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"api_token\": p.apiToken,\n\t\t\"base_url\":  p.baseURL,\n\t})\n\treturn nil\n}\n\n// GetSupportedService return map of support service for Logzio\nfunc (p *LogzioProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"alerts\":                       &AlertsGenerator{},\n\t\t\"alert_notification_endpoints\": &AlertNotificationEndpointsGenerator{},\n\t}\n}\n\nfunc createSlug(s string) string {\n\ts = strings.ToLower(s)\n\n\treturn disallowedChars.ReplaceAllString(s, \"-\")\n}\n"
  },
  {
    "path": "providers/logzio/logzio_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage logzio\n\nimport \"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\ntype LogzioService struct { //nolint\n\tterraformutils.Service\n}\n"
  },
  {
    "path": "providers/mackerel/alert_group_setting.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage mackerel\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mackerelio/mackerel-client-go\"\n)\n\n// AlertGroupSettingGenerator ...\ntype AlertGroupSettingGenerator struct {\n\tMackerelService\n}\n\nfunc (g *AlertGroupSettingGenerator) createResources(alertGroupSettings []*mackerel.AlertGroupSetting) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, alertGroupSetting := range alertGroupSettings {\n\t\tresources = append(resources, g.createResource(alertGroupSetting.ID))\n\t}\n\treturn resources\n}\n\nfunc (g *AlertGroupSettingGenerator) createResource(alertGroupSettingID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\talertGroupSettingID,\n\t\tfmt.Sprintf(\"alert_group_setting_%s\", alertGroupSettingID),\n\t\t\"mackerel_alert_group_setting\",\n\t\t\"mackerel\",\n\t\t[]string{},\n\t)\n}\n\n// InitResources Generate TerraformResources from Mackerel API,\n// from each alert group setting create 1 TerraformResource.\n// Need Alert Group Setting ID as ID for terraform resource\nfunc (g *AlertGroupSettingGenerator) InitResources() error {\n\tclient := g.Args[\"mackerelClient\"].(*mackerel.Client)\n\talertGroupSettings, err := client.FindAlertGroupSettings()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = append(g.Resources, g.createResources(alertGroupSettings)...)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/mackerel/aws_integration.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage mackerel\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mackerelio/mackerel-client-go\"\n)\n\n// AWSIntegrationGenerator ...\ntype AWSIntegrationGenerator struct {\n\tMackerelService\n}\n\nfunc (g *AWSIntegrationGenerator) createResources(awsIntegrations []*mackerel.AWSIntegration) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, awsIntegration := range awsIntegrations {\n\t\tresources = append(resources, g.createResource(awsIntegration.ID))\n\t}\n\treturn resources\n}\n\nfunc (g *AWSIntegrationGenerator) createResource(awsIntegrationID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tawsIntegrationID,\n\t\tfmt.Sprintf(\"aws_integration_%s\", awsIntegrationID),\n\t\t\"mackerel_aws_integration\",\n\t\t\"mackerel\",\n\t\t[]string{},\n\t)\n}\n\n// InitResources Generate TerraformResources from Mackerel API,\n// from each aws integration create 1 TerraformResource.\n// Need AWS Integration ID as ID for terraform resource\nfunc (g *AWSIntegrationGenerator) InitResources() error {\n\tclient := g.Args[\"mackerelClient\"].(*mackerel.Client)\n\tawsIntegrations, err := client.FindAWSIntegrations()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = append(g.Resources, g.createResources(awsIntegrations)...)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/mackerel/channel.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage mackerel\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mackerelio/mackerel-client-go\"\n)\n\n// ChannelGenerator ...\ntype ChannelGenerator struct {\n\tMackerelService\n}\n\nfunc (g *ChannelGenerator) createResources(channels []*mackerel.Channel) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, channel := range channels {\n\t\tif channel.Type != \"email\" && channel.Type != \"slack\" && channel.Type != \"webhook\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif channel.Type == \"email\" {\n\t\t\tif channel.Events != nil {\n\t\t\t\tevents := *channel.Events\n\t\t\t\tfor _, event := range events {\n\t\t\t\t\tif event != \"alert\" && event != \"alertGroup\" {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tresources = append(resources, g.createResource(channel.ID))\n\t}\n\treturn resources\n}\n\nfunc (g *ChannelGenerator) createResource(channelID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tchannelID,\n\t\tfmt.Sprintf(\"channel_%s\", channelID),\n\t\t\"mackerel_channel\",\n\t\t\"mackerel\",\n\t\t[]string{},\n\t)\n}\n\n// InitResources Generate TerraformResources from Mackerel API,\n// from each channel create 1 TerraformResource.\n// Need Channel ID as ID for terraform resource\nfunc (g *ChannelGenerator) InitResources() error {\n\tclient := g.Args[\"mackerelClient\"].(*mackerel.Client)\n\tchannels, err := client.FindChannels()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = append(g.Resources, g.createResources(channels)...)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/mackerel/downtime.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage mackerel\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mackerelio/mackerel-client-go\"\n)\n\n// DowntimeGenerator ...\ntype DowntimeGenerator struct {\n\tMackerelService\n}\n\nfunc (g *DowntimeGenerator) createResources(downtimes []*mackerel.Downtime) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, downtime := range downtimes {\n\t\tresources = append(resources, g.createResource(downtime.ID))\n\t}\n\treturn resources\n}\n\nfunc (g *DowntimeGenerator) createResource(downtimeID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tdowntimeID,\n\t\tfmt.Sprintf(\"downtime_%s\", downtimeID),\n\t\t\"mackerel_downtime\",\n\t\t\"mackerel\",\n\t\t[]string{},\n\t)\n}\n\n// InitResources Generate TerraformResources from Mackerel API,\n// from each downtime create 1 TerraformResource.\n// Need Downtime ID as ID for terraform resource\nfunc (g *DowntimeGenerator) InitResources() error {\n\tclient := g.Args[\"mackerelClient\"].(*mackerel.Client)\n\tdowntimes, err := client.FindDowntimes()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = append(g.Resources, g.createResources(downtimes)...)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/mackerel/mackerel_provider.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage mackerel\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tmackerel \"github.com/mackerelio/mackerel-client-go\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype MackerelProvider struct { //nolint\n\tterraformutils.Provider\n\tapiKey         string\n\tmackerelClient *mackerel.Client\n}\n\n// Init check env params and initialize API Client\nfunc (p *MackerelProvider) Init(args []string) error {\n\tif args[0] != \"\" {\n\t\tp.apiKey = args[0]\n\t} else {\n\t\tif apiKey := os.Getenv(\"MACKEREL_API_KEY\"); apiKey != \"\" {\n\t\t\tp.apiKey = apiKey\n\t\t} else {\n\t\t\treturn errors.New(\"api-key requirement\")\n\t\t}\n\t}\n\t// Initialize the Mackerel API client\n\tp.mackerelClient = mackerel.NewClient(p.apiKey)\n\treturn nil\n}\n\n// InitService ...\nfunc (p *MackerelProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"api-key\":        p.apiKey,\n\t\t\"mackerelClient\": p.mackerelClient,\n\t})\n\treturn nil\n}\n\n// GetName return string of provider name for Mackerel\nfunc (p *MackerelProvider) GetName() string {\n\treturn \"mackerel\"\n}\n\n// GetConfig return map of provider config for Mackerel\nfunc (p *MackerelProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"api_key\": cty.StringVal(p.apiKey),\n\t})\n}\n\n// GetSupportedService return map of support service for Mackerel\nfunc (p *MackerelProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"alert_group_setting\": &AlertGroupSettingGenerator{},\n\t\t\"aws_integration\":     &AWSIntegrationGenerator{},\n\t\t\"channel\":             &ChannelGenerator{},\n\t\t\"downtime\":            &DowntimeGenerator{},\n\t\t\"monitor\":             &MonitorGenerator{},\n\t\t\"notification_group\":  &NotificationGroupGenerator{},\n\t\t\"role\":                &RoleGenerator{},\n\t\t\"service\":             &ServiceGenerator{},\n\t}\n}\n\n// GetProviderData return map of provider data for Mackerel\nfunc (p MackerelProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\n// GetResourceConnections return map of resource connections for Mackerel\nfunc (p *MackerelProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n"
  },
  {
    "path": "providers/mackerel/mackerel_service.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage mackerel\n\nimport \"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\ntype MackerelService struct { // nolint\n\tterraformutils.Service\n}\n"
  },
  {
    "path": "providers/mackerel/monitor.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage mackerel\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mackerelio/mackerel-client-go\"\n)\n\n// MonitorGenerator ...\ntype MonitorGenerator struct {\n\tMackerelService\n}\n\nfunc (g *MonitorGenerator) createResources(monitors []mackerel.Monitor) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, monitor := range monitors {\n\t\tresources = append(resources, g.createResource(monitor.MonitorID()))\n\t}\n\treturn resources\n}\n\nfunc (g *MonitorGenerator) createResource(monitorID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tmonitorID,\n\t\tfmt.Sprintf(\"monitor_%s\", monitorID),\n\t\t\"mackerel_monitor\",\n\t\t\"mackerel\",\n\t\t[]string{},\n\t)\n}\n\n// InitResources Generate TerraformResources from Mackerel API,\n// from each monitor create 1 TerraformResource.\n// Need Monitor ID as ID for terraform resource\nfunc (g *MonitorGenerator) InitResources() error {\n\tclient := g.Args[\"mackerelClient\"].(*mackerel.Client)\n\tmonitors, err := client.FindMonitors()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = append(g.Resources, g.createResources(monitors)...)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/mackerel/notification_group.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage mackerel\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mackerelio/mackerel-client-go\"\n)\n\n// NotificationGroupGenerator ...\ntype NotificationGroupGenerator struct {\n\tMackerelService\n}\n\nfunc (g *NotificationGroupGenerator) createResources(notificationGroups []*mackerel.NotificationGroup) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, notificationGroup := range notificationGroups {\n\t\tresources = append(resources, g.createResource(notificationGroup.ID))\n\t}\n\treturn resources\n}\n\nfunc (g *NotificationGroupGenerator) createResource(notificationGroupID string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tnotificationGroupID,\n\t\tfmt.Sprintf(\"notification_group_%s\", notificationGroupID),\n\t\t\"mackerel_notification_group\",\n\t\t\"mackerel\",\n\t\t[]string{},\n\t)\n}\n\n// InitResources Generate TerraformResources from Mackerel API,\n// from each notification group create 1 TerraformResource.\n// Need Notification Group ID as ID for terraform resource\nfunc (g *NotificationGroupGenerator) InitResources() error {\n\tclient := g.Args[\"mackerelClient\"].(*mackerel.Client)\n\tnotificationGroups, err := client.FindNotificationGroups()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = append(g.Resources, g.createResources(notificationGroups)...)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/mackerel/role.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage mackerel\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mackerelio/mackerel-client-go\"\n)\n\n// RoleGenerator ...\ntype RoleGenerator struct {\n\tMackerelService\n}\n\nfunc (g *RoleGenerator) createResources(serviceName string, roles []*mackerel.Role) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, role := range roles {\n\t\tresources = append(resources, g.createResource(serviceName, role.Name))\n\t}\n\treturn resources\n}\n\nfunc (g *RoleGenerator) createResource(serviceName string, roleName string) terraformutils.Resource {\n\treturn terraformutils.NewResource(\n\t\tfmt.Sprintf(\"%s:%s\", serviceName, roleName),\n\t\tfmt.Sprintf(\"role_%s_%s\", serviceName, roleName),\n\t\t\"mackerel_role\",\n\t\t\"mackerel\",\n\t\tmap[string]string{\n\t\t\t\"service\": serviceName,\n\t\t\t\"name\":    roleName,\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n}\n\n// InitResources Generate TerraformResources from Mackerel API,\n// from each role create 1 TerraformResource.\n// Need Service Name And Role Name as ID for terraform resource\nfunc (g *RoleGenerator) InitResources() error {\n\tclient := g.Args[\"mackerelClient\"].(*mackerel.Client)\n\n\tservices, err := client.FindServices()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, service := range services {\n\t\troles, err := client.FindRoles(service.Name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tg.Resources = append(g.Resources, g.createResources(service.Name, roles)...)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/mackerel/service.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage mackerel\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mackerelio/mackerel-client-go\"\n)\n\n// ServiceGenerator ...\ntype ServiceGenerator struct {\n\tMackerelService\n}\n\nfunc (g *ServiceGenerator) createResources(services []*mackerel.Service) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, service := range services {\n\t\tresources = append(resources, g.createResource(service.Name))\n\t}\n\treturn resources\n}\n\nfunc (g *ServiceGenerator) createResource(serviceName string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tserviceName,\n\t\tfmt.Sprintf(\"service_%s\", serviceName),\n\t\t\"mackerel_service\",\n\t\t\"mackerel\",\n\t\t[]string{},\n\t)\n}\n\n// InitResources Generate TerraformResources from Mackerel API,\n// from each service create 1 TerraformResource.\n// Need Service Name as ID for terraform resource\nfunc (g *ServiceGenerator) InitResources() error {\n\tclient := g.Args[\"mackerelClient\"].(*mackerel.Client)\n\tservices, err := client.FindServices()\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = append(g.Resources, g.createResources(services)...)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/mikrotik/dhcp_leases.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage mikrotik\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/ddelnano/terraform-provider-mikrotik/client\"\n)\n\ntype DhcpLeaseGenerator struct {\n\tMikrotikService\n}\n\nfunc (g DhcpLeaseGenerator) createResources(leases []client.DhcpLease) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, lease := range leases {\n\t\tresourceName := lease.Id\n\t\tif lease.Hostname != \"\" {\n\t\t\tresourceName = fmt.Sprintf(\"%s-%s\", lease.Hostname, lease.Id)\n\t\t}\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tlease.Id,\n\t\t\tresourceName,\n\t\t\t\"mikrotik_dhcp_lease\",\n\t\t\t\"mikrotik\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *DhcpLeaseGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tleases, err := client.ListDhcpLeases()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(leases)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/mikrotik/mikrotik_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage mikrotik\n\nimport (\n\t\"errors\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/ddelnano/terraform-provider-mikrotik/client\"\n)\n\ntype MikrotikProvider struct { //nolint\n\tterraformutils.Provider\n\tclient.Mikrotik\n}\n\nfunc (p *MikrotikProvider) Init(args []string) error {\n\t// The mikrotik provider gets its credentials through environment variables\n\t// and therefore nothing needs to be done here\n\treturn nil\n}\n\nfunc (p *MikrotikProvider) GetName() string {\n\treturn \"mikrotik\"\n}\n\nfunc (p *MikrotikProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"mikrotik\": map[string]interface{}{\n\t\t\t\t\"host\": p.Host,\n\t\t\t\t\"user\": p.Username,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (MikrotikProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *MikrotikProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"dhcp_lease\": &DhcpLeaseGenerator{},\n\t}\n}\n\nfunc (p *MikrotikProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"mikrotik: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"host\":           p.Host,\n\t\t\"user\":           p.Username,\n\t\t\"password\":       p.Password,\n\t\t\"tls\":            p.TLS,\n\t\t\"ca_certificate\": p.CA,\n\t\t\"insecure\":       p.Insecure,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/mikrotik/mikrotik_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage mikrotik\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/ddelnano/terraform-provider-mikrotik/client\"\n)\n\ntype MikrotikService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (m *MikrotikService) generateClient() client.Mikrotik {\n\treturn client.NewClient(\n\t\tclient.GetConfigFromEnv(),\n\t)\n}\n"
  },
  {
    "path": "providers/myrasec/cache_setting.go",
    "content": "package myrasec\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tmgo \"github.com/Myra-Security-GmbH/myrasec-go/v2\"\n)\n\n//\n// CacheSettingGenerator\n//\ntype CacheSettingGenerator struct {\n\tMyrasecService\n}\n\n//\n// createCacheSettingResources\n//\nfunc (g *CacheSettingGenerator) createCacheSettingResources(api *mgo.API, domainId int, vhost mgo.VHost, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\n\tpage := 1\n\tpageSize := 250\n\tparams := map[string]string{\n\t\t\"pageSize\": strconv.Itoa(pageSize),\n\t\t\"page\":     strconv.Itoa(page),\n\t}\n\n\tfor {\n\t\tparams[\"page\"] = strconv.Itoa(page)\n\n\t\tsettings, err := api.ListCacheSettings(domainId, vhost.Label, params)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, s := range settings {\n\t\t\tr := terraformutils.NewResource(\n\t\t\t\tstrconv.Itoa(s.ID),\n\t\t\t\tfmt.Sprintf(\"%s_%d\", vhost.Label, s.ID),\n\t\t\t\t\"myrasec_cache_setting\",\n\t\t\t\t\"myrasec\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"subdomain_name\": vhost.Label,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tr.IgnoreKeys = append(r.IgnoreKeys, \"^Metadata\")\n\t\t\tg.Resources = append(g.Resources, r)\n\t\t}\n\t\tif len(settings) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\treturn nil\n}\n\n//\n// InitResources\n//\nfunc (g *CacheSettingGenerator) InitResources() error {\n\twg := sync.WaitGroup{}\n\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*mgo.API, int, mgo.VHost, *sync.WaitGroup) error{\n\t\tg.createCacheSettingResources,\n\t}\n\terr = createResourcesPerSubDomain(api, funcs, &wg, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twg.Wait()\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/myrasec/dns_record.go",
    "content": "package myrasec\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tmgo \"github.com/Myra-Security-GmbH/myrasec-go/v2\"\n)\n\n//\n// DNSGenerator\n//\ntype DNSGenerator struct {\n\tMyrasecService\n}\n\n//\n// createDnsResources\n//\nfunc (g *DNSGenerator) createDnsResources(api *mgo.API, domain mgo.Domain, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\n\tpage := 1\n\tpageSize := 250\n\tparams := map[string]string{\n\t\t\"pageSize\": strconv.Itoa(pageSize),\n\t\t\"page\":     strconv.Itoa(page),\n\t}\n\n\tfor {\n\t\tparams[\"page\"] = strconv.Itoa(page)\n\n\t\trecords, err := api.ListDNSRecords(domain.ID, params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, d := range records {\n\t\t\tr := terraformutils.NewResource(\n\t\t\t\tstrconv.Itoa(d.ID),\n\t\t\t\tfmt.Sprintf(\"%s_%d\", domain.Name, d.ID),\n\t\t\t\t\"myrasec_dns_record\",\n\t\t\t\t\"myrasec\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"domain_name\": domain.Name,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\n\t\t\tr.IgnoreKeys = append(r.IgnoreKeys, \"^metadata\")\n\t\t\tg.Resources = append(g.Resources, r)\n\t\t}\n\t\tif len(records) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\n\treturn nil\n}\n\n//\n// InitResources\n//\nfunc (g *DNSGenerator) InitResources() error {\n\twg := sync.WaitGroup{}\n\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*mgo.API, mgo.Domain, *sync.WaitGroup) error{\n\t\tg.createDnsResources,\n\t}\n\n\terr = createResourcesPerDomain(api, funcs, &wg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twg.Wait()\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/myrasec/domain.go",
    "content": "package myrasec\n\nimport (\n\t\"fmt\"\n\t\"runtime\"\n\t\"strconv\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tmgo \"github.com/Myra-Security-GmbH/myrasec-go/v2\"\n)\n\n//\n// DomainGenerator\n//\ntype DomainGenerator struct {\n\tMyrasecService\n}\n\n//\n// createDomainResource\n//\nfunc (g *DomainGenerator) createDomainResource(api *mgo.API, domain mgo.Domain, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\n\td := terraformutils.NewResource(\n\t\tstrconv.Itoa(domain.ID),\n\t\tfmt.Sprintf(\"%s_%d\", domain.Name, domain.ID),\n\t\t\"myrasec_domain\",\n\t\t\"myrasec\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n\n\td.IgnoreKeys = append(d.IgnoreKeys, \"^metadata\")\n\tg.Resources = append(g.Resources, d)\n\n\treturn nil\n}\n\n//\n// InitResources\n//\nfunc (g *DomainGenerator) InitResources() error {\n\tvar wg = sync.WaitGroup{}\n\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*mgo.API, mgo.Domain, *sync.WaitGroup) error{\n\t\tg.createDomainResource,\n\t}\n\n\terr = createResourcesPerDomain(api, funcs, &wg)\n\tif err != nil {\n\t\treturn err\n\t}\n\twg.Wait()\n\n\treturn nil\n}\n\n//\n// createResourcesPerDomain\n//\nfunc createResourcesPerDomain(api *mgo.API, funcs []func(*mgo.API, mgo.Domain, *sync.WaitGroup) error, wg *sync.WaitGroup) error {\n\n\tpage := 1\n\tpageSize := 250\n\tparams := map[string]string{\n\t\t\"pageSize\": strconv.Itoa(pageSize),\n\t\t\"page\":     strconv.Itoa(page),\n\t}\n\n\tfor {\n\t\tparams[\"page\"] = strconv.Itoa(page)\n\n\t\tdomains, err := api.ListDomains(params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\twg.Add(len(domains) * len(funcs))\n\t\tfor _, d := range domains {\n\t\t\tfor _, f := range funcs {\n\t\t\t\tf(api, d, wg)\n\t\t\t}\n\t\t}\n\t\tif len(domains) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\treturn nil\n}\n\nfunc getWaitChannel() chan struct{} {\n\treturn make(chan struct{}, runtime.NumCPU()/2)\n}\n\n//\n// createResourcesPerSubDomain\n//\nfunc createResourcesPerSubDomain(api *mgo.API, funcs []func(*mgo.API, int, mgo.VHost, *sync.WaitGroup) error, wg *sync.WaitGroup, onDomainLevel bool) error {\n\tpage := 1\n\tpageSize := 250\n\tparams := map[string]string{\n\t\t\"pageSize\": strconv.Itoa(pageSize),\n\t\t\"page\":     strconv.Itoa(page),\n\t}\n\n\twaitChan := getWaitChannel()\n\tcount := 0\n\n\tfor {\n\t\tparams[\"page\"] = strconv.Itoa(page)\n\n\t\tdomains, err := api.ListDomains(params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\twg.Add(len(domains))\n\t\tfor _, d := range domains {\n\t\t\t// try to load data for ALL-{domainId}.\n\t\t\tif onDomainLevel {\n\t\t\t\twg.Add(len(funcs))\n\t\t\t\tfor _, f := range funcs {\n\t\t\t\t\tgo f(api, d.ID, mgo.VHost{\n\t\t\t\t\t\tLabel: fmt.Sprintf(\"ALL-%d.\", d.ID),\n\t\t\t\t\t}, wg)\n\t\t\t\t}\n\n\t\t\t}\n\t\t\twaitChan <- struct{}{}\n\t\t\tcount++\n\t\t\tgo func(count int, d mgo.Domain) {\n\t\t\t\tcreateResourcesPerVHost(api, d, funcs, wg)\n\t\t\t\t<-waitChan\n\t\t\t}(count, d)\n\t\t}\n\t\tif len(domains) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\treturn nil\n}\n\n//\n// createResourcesPerVHost\n//\nfunc createResourcesPerVHost(api *mgo.API, domain mgo.Domain, funcs []func(*mgo.API, int, mgo.VHost, *sync.WaitGroup) error, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\n\tpage := 1\n\tpageSize := 250\n\tparams := map[string]string{\n\t\t\"pageSize\": strconv.Itoa(pageSize),\n\t\t\"page\":     strconv.Itoa(page),\n\t}\n\n\twaitChan := getWaitChannel()\n\tcount := 0\n\n\tfor {\n\t\tparams[\"page\"] = strconv.Itoa(page)\n\n\t\tvhosts, err := api.ListAllSubdomainsForDomain(domain.ID, params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\twg.Add(len(vhosts) * len(funcs))\n\t\tfor _, v := range vhosts {\n\t\t\tfor _, f := range funcs {\n\t\t\t\twaitChan <- struct{}{}\n\t\t\t\tcount++\n\t\t\t\tgo func(count int, v mgo.VHost, f func(*mgo.API, int, mgo.VHost, *sync.WaitGroup) error) {\n\t\t\t\t\tf(api, domain.ID, v, wg)\n\t\t\t\t\t<-waitChan\n\t\t\t\t}(count, v, f)\n\t\t\t}\n\t\t}\n\t\tif len(vhosts) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/myrasec/error_page.go",
    "content": "package myrasec\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tmgo \"github.com/Myra-Security-GmbH/myrasec-go/v2\"\n)\n\n//\n// ErrorPageGenerator\n//\ntype ErrorPageGenerator struct {\n\tMyrasecService\n}\n\n//\n// createErrorPageResources\n//\nfunc (g *ErrorPageGenerator) createErrorPageResources(api *mgo.API, domain mgo.Domain, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\n\tpage := 1\n\tpageSize := 250\n\tparams := map[string]string{\n\t\t\"pageSize\": strconv.Itoa(pageSize),\n\t\t\"page\":     strconv.Itoa(page),\n\t}\n\n\tfor {\n\t\tparams[\"page\"] = strconv.Itoa(page)\n\n\t\tpages, err := api.ListErrorPages(domain.ID, params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, p := range pages {\n\t\t\tr := terraformutils.NewResource(\n\t\t\t\tstrconv.Itoa(p.ID),\n\t\t\t\tfmt.Sprintf(\"%s_%d\", p.SubDomainName, p.ID),\n\t\t\t\t\"myrasec_error_page\",\n\t\t\t\t\"myrasec\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"subdomain_name\": p.SubDomainName,\n\t\t\t\t\t\"error_code\":     strconv.Itoa(p.ErrorCode),\n\t\t\t\t\t\"content\":        p.Content,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tr.IgnoreKeys = append(r.IgnoreKeys, \"^metadata\")\n\t\t\tg.Resources = append(g.Resources, r)\n\t\t}\n\t\tif len(pages) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\treturn nil\n}\n\n//\n// InitResources\n//\nfunc (g *ErrorPageGenerator) InitResources() error {\n\twg := sync.WaitGroup{}\n\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*mgo.API, mgo.Domain, *sync.WaitGroup) error{\n\t\tg.createErrorPageResources,\n\t}\n\terr = createResourcesPerDomain(api, funcs, &wg)\n\tif err != nil {\n\t\treturn err\n\t}\n\twg.Wait()\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/myrasec/ip_filter.go",
    "content": "package myrasec\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tmgo \"github.com/Myra-Security-GmbH/myrasec-go/v2\"\n)\n\n//\n// IPFilterGenerator\n//\ntype IPFilterGenerator struct {\n\tMyrasecService\n}\n\n//\n// createIPFilterResources\n//\nfunc (g *IPFilterGenerator) createIPFilterResources(api *mgo.API, domainId int, vhost mgo.VHost, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\n\tpage := 1\n\tpageSize := 250\n\tparams := map[string]string{\n\t\t\"page\":     strconv.Itoa(page),\n\t\t\"pageSize\": strconv.Itoa(pageSize),\n\t}\n\n\tfor {\n\t\tparams[\"page\"] = strconv.Itoa(page)\n\n\t\tfilters, err := api.ListIPFilters(domainId, vhost.Label, params)\n\t\tif err != err {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, f := range filters {\n\t\t\tr := terraformutils.NewResource(\n\t\t\t\tstrconv.Itoa(f.ID),\n\t\t\t\tfmt.Sprintf(\"%s_%d\", vhost.Label, f.ID),\n\t\t\t\t\"myrasec_ip_filter\",\n\t\t\t\t\"myrasec\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"subdomain_name\": vhost.Label,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tg.Resources = append(g.Resources, r)\n\t\t}\n\t\tif len(filters) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\treturn nil\n}\n\n//\n// InitResources\n//\nfunc (g *IPFilterGenerator) InitResources() error {\n\twg := sync.WaitGroup{}\n\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*mgo.API, int, mgo.VHost, *sync.WaitGroup) error{\n\t\tg.createIPFilterResources,\n\t}\n\n\terr = createResourcesPerSubDomain(api, funcs, &wg, true)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\twg.Wait()\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/myrasec/maintenance.go",
    "content": "package myrasec\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tmgo \"github.com/Myra-Security-GmbH/myrasec-go/v2\"\n)\n\n//\n// MaintenanceGenerator\n//\ntype MaintenanceGenerator struct {\n\tMyrasecService\n}\n\n//\n// createMaintenanceResources\n//\nfunc (g *MaintenanceGenerator) createMaintenanceResources(api *mgo.API, domainId int, vhost mgo.VHost, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\n\tpage := 1\n\tpageSize := 250\n\tparams := map[string]string{\n\t\t\"page\":     strconv.Itoa(page),\n\t\t\"pageSize\": strconv.Itoa(pageSize),\n\t}\n\n\tfor {\n\t\tparams[\"page\"] = strconv.Itoa(page)\n\n\t\tmaintenance, err := api.ListMaintenances(domainId, vhost.Label, params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, m := range maintenance {\n\t\t\tr := terraformutils.NewResource(\n\t\t\t\tstrconv.Itoa(m.ID),\n\t\t\t\tfmt.Sprintf(\"%s_%d\", vhost.Label, m.ID),\n\t\t\t\t\"myrasec_maintenance\",\n\t\t\t\t\"myrasec\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"subdomain_name\": vhost.Label,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tg.Resources = append(g.Resources, r)\n\t\t}\n\t\tif len(maintenance) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\treturn nil\n}\n\n//\n// InitResources\n//\nfunc (g *MaintenanceGenerator) InitResources() error {\n\twg := sync.WaitGroup{}\n\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*mgo.API, int, mgo.VHost, *sync.WaitGroup) error{\n\t\tg.createMaintenanceResources,\n\t}\n\n\terr = createResourcesPerSubDomain(api, funcs, &wg, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twg.Wait()\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/myrasec/myrasec_provider.go",
    "content": "package myrasec\n\nimport (\n\t\"errors\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\n//\n// MyrasecProvider\n//\ntype MyrasecProvider struct {\n\tterraformutils.Provider\n}\n\n//\n// Init\n//\nfunc (p *MyrasecProvider) Init(args []string) error {\n\treturn nil\n}\n\n//\n// GetName\n//\nfunc (p *MyrasecProvider) GetName() string {\n\treturn \"myrasec\"\n}\n\n//\n// GetProviderData\n//\nfunc (p *MyrasecProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\n//\n// GetResourceConnections\n//\nfunc (MyrasecProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\n//\n// GetSupportedService\n//\nfunc (p *MyrasecProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"domain\":        &DomainGenerator{},\n\t\t\"dns_record\":    &DNSGenerator{},\n\t\t\"cache_setting\": &CacheSettingGenerator{},\n\t\t\"redirect\":      &RedirectGenerator{},\n\t\t\"ratelimit\":     &RatelimitGenerator{},\n\t\t\"ip_filter\":     &IPFilterGenerator{},\n\t\t\"settings\":      &SettingsGenerator{},\n\t\t\"waf_rule\":      &WafRuleGenerator{},\n\t\t\"maintenance\":   &MaintenanceGenerator{},\n\t\t\"error_page\":    &ErrorPageGenerator{},\n\t}\n}\n\n//\n// InitService\n//\nfunc (p *MyrasecProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"myrasec: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/myrasec/myrasec_service.go",
    "content": "package myrasec\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tmgo \"github.com/Myra-Security-GmbH/myrasec-go/v2\"\n)\n\n// MyrasecService ...\ntype MyrasecService struct {\n\tterraformutils.Service\n}\n\n// initializeAPI ...\nfunc (s *MyrasecService) initializeAPI() (*mgo.API, error) {\n\tapiKey := os.Getenv(\"MYRASEC_API_KEY\")\n\tapiSecret := os.Getenv(\"MYRASEC_API_SECRET\")\n\tapiURL, urlPresent := os.LookupEnv(\"MYRASEC_API_BASE_URL\")\n\n\tif apiKey == \"\" || apiSecret == \"\" {\n\t\terr := errors.New(\"missing API credentials\")\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\treturn nil, err\n\t}\n\n\tapi, err := mgo.New(apiKey, apiSecret)\n\tif urlPresent {\n\t\tapi.BaseURL = apiURL\n\t}\n\tapi.EnableCaching()\n\tapi.SetCachingTTL(3600)\n\n\treturn api, err\n}\n"
  },
  {
    "path": "providers/myrasec/ratelimit.go",
    "content": "package myrasec\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tmgo \"github.com/Myra-Security-GmbH/myrasec-go/v2\"\n)\n\n//\n// RateLimitGenerator\n//\ntype RatelimitGenerator struct {\n\tMyrasecService\n}\n\n//\n// createRatelimitResources\n//\nfunc (g *RatelimitGenerator) createRatelimitResources(api *mgo.API, domainId int, vhost mgo.VHost, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\n\tpage := 1\n\tpageSize := 250\n\tparams := map[string]string{\n\t\t\"page\":     strconv.Itoa(page),\n\t\t\"pageSize\": strconv.Itoa(pageSize),\n\t}\n\n\tfor {\n\t\tparams[\"page\"] = strconv.Itoa(page)\n\n\t\tratelimits, err := api.ListRateLimits(domainId, vhost.Label, params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, rl := range ratelimits {\n\t\t\tr := terraformutils.NewResource(\n\t\t\t\tstrconv.Itoa(rl.ID),\n\t\t\t\tfmt.Sprintf(\"%s_%d\", vhost.Label, rl.ID),\n\t\t\t\t\"myrasec_ratelimit\",\n\t\t\t\t\"myrasec\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"subdomain_name\": rl.SubDomainName,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tg.Resources = append(g.Resources, r)\n\t\t}\n\t\tif len(ratelimits) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\treturn nil\n}\n\n//\n// InitResources\n//\nfunc (g *RatelimitGenerator) InitResources() error {\n\twg := sync.WaitGroup{}\n\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*mgo.API, int, mgo.VHost, *sync.WaitGroup) error{\n\t\tg.createRatelimitResources,\n\t}\n\n\terr = createResourcesPerSubDomain(api, funcs, &wg, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twg.Wait()\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/myrasec/redirect.go",
    "content": "package myrasec\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tmgo \"github.com/Myra-Security-GmbH/myrasec-go/v2\"\n)\n\n//\n// RedirectGenerator\n//\ntype RedirectGenerator struct {\n\tMyrasecService\n}\n\n//\n// createRedirectResources\n//\nfunc (g *RedirectGenerator) createRedirectResources(api *mgo.API, domainId int, vhost mgo.VHost, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\n\tpage := 1\n\tpageSize := 250\n\tparams := map[string]string{\n\t\t\"pageSize\": strconv.Itoa(pageSize),\n\t\t\"page\":     strconv.Itoa(page),\n\t}\n\n\tfor {\n\t\tparams[\"page\"] = strconv.Itoa(page)\n\n\t\tredirects, err := api.ListRedirects(domainId, vhost.Label, params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, redirect := range redirects {\n\t\t\tr := terraformutils.NewResource(\n\t\t\t\tstrconv.Itoa(redirect.ID),\n\t\t\t\tfmt.Sprintf(\"%s_%d\", redirect.SubDomainName, redirect.ID),\n\t\t\t\t\"myrasec_redirect\",\n\t\t\t\t\"myrasec\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"subdomain_name\": redirect.SubDomainName,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tg.Resources = append(g.Resources, r)\n\t\t}\n\t\tif len(redirects) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\treturn nil\n}\n\n//\n// InitResources\n//\nfunc (g *RedirectGenerator) InitResources() error {\n\twg := sync.WaitGroup{}\n\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*mgo.API, int, mgo.VHost, *sync.WaitGroup) error{\n\t\tg.createRedirectResources,\n\t}\n\terr = createResourcesPerSubDomain(api, funcs, &wg, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twg.Wait()\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/myrasec/settings.go",
    "content": "package myrasec\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tmgo \"github.com/Myra-Security-GmbH/myrasec-go/v2\"\n)\n\n//\n// SettingGenerator\n//\ntype SettingsGenerator struct {\n\tMyrasecService\n}\n\n//\n// createSettingResources\n//\nfunc (g *SettingsGenerator) createSettingResources(api *mgo.API, domainId int, vhost mgo.VHost, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\n\tparams := map[string]string{}\n\n\ts, err := api.ListSettings(domainId, vhost.Label, params)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr := terraformutils.NewResource(\n\t\tstrconv.Itoa(vhost.ID),\n\t\tfmt.Sprintf(\"%s_%d\", vhost.Label, vhost.ID),\n\t\t\"myrasec_settings\",\n\t\t\"myrasec\",\n\t\tmap[string]string{\n\t\t\t\"subdomain_name\": vhost.Label,\n\t\t\t\"only_https\":     strconv.FormatBool(s.OnlyHTTPS),\n\t\t},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n\tg.Resources = append(g.Resources, r)\n\treturn nil\n}\n\n//\n// InitResources\n//\nfunc (g *SettingsGenerator) InitResources() error {\n\twg := sync.WaitGroup{}\n\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\tfuncs := []func(*mgo.API, int, mgo.VHost, *sync.WaitGroup) error{\n\t\tg.createSettingResources,\n\t}\n\n\terr = createResourcesPerSubDomain(api, funcs, &wg, true)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\twg.Wait()\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/myrasec/waf_rule.go",
    "content": "package myrasec\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tmgo \"github.com/Myra-Security-GmbH/myrasec-go/v2\"\n)\n\n//\n// WafRuleGenerator\n//\ntype WafRuleGenerator struct {\n\tMyrasecService\n}\n\n//\n// createWafRuleResources\n//\nfunc (g *WafRuleGenerator) createWafRuleResources(api *mgo.API, domainId int, vhost mgo.VHost, wg *sync.WaitGroup) error {\n\tdefer wg.Done()\n\n\tpage := 1\n\tpageSize := 250\n\tparams := map[string]string{\n\t\t\"page\":     strconv.Itoa(page),\n\t\t\"pageSize\": strconv.Itoa(pageSize),\n\t}\n\n\tfor {\n\t\tparams[\"page\"] = strconv.Itoa(page)\n\t\tif vhost.Label != \"\" {\n\t\t\tparams[\"subDomain\"] = vhost.Label\n\t\t}\n\n\t\twaf, err := api.ListWAFRules(domainId, params)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, w := range waf {\n\t\t\tr := terraformutils.NewResource(\n\t\t\t\tstrconv.Itoa(w.ID),\n\t\t\t\tfmt.Sprintf(\"%s_%d\", w.SubDomainName, w.ID),\n\t\t\t\t\"myrasec_waf_rule\",\n\t\t\t\t\"myrasec\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"subdomain_name\": w.SubDomainName,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tg.Resources = append(g.Resources, r)\n\t\t}\n\n\t\tif len(waf) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\tpage++\n\t}\n\n\treturn nil\n}\n\n//\n// InitResources\n//\nfunc (g *WafRuleGenerator) InitResources() error {\n\twg := sync.WaitGroup{}\n\n\tapi, err := g.initializeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*mgo.API, int, mgo.VHost, *sync.WaitGroup) error{\n\t\tg.createWafRuleResources,\n\t}\n\n\terr = createResourcesPerSubDomain(api, funcs, &wg, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twg.Wait()\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/newrelic/alert.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage newrelic\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tnewrelic \"github.com/newrelic/newrelic-client-go/newrelic\"\n)\n\ntype AlertGenerator struct {\n\tNewRelicService\n}\n\nfunc (g *AlertGenerator) createAlertChannelResources(client *newrelic.NewRelic) error {\n\talertChannels, err := client.Alerts.ListChannels()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, channel := range alertChannels {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tfmt.Sprintf(\"%d\", channel.ID),\n\t\t\tfmt.Sprintf(\"%s-%d\", normalizeResourceName(channel.Name), channel.ID),\n\t\t\t\"newrelic_alert_channel\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn nil\n}\n\nfunc (g *AlertGenerator) createAlertConditionResources(client *newrelic.NewRelic) error {\n\talertPolicies, err := client.Alerts.ListPolicies(nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, alertPolicy := range alertPolicies {\n\t\talertConditions, err := client.Alerts.ListConditions(alertPolicy.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, alertCondition := range alertConditions {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%d:%d\", alertPolicy.ID, alertCondition.ID),\n\t\t\t\tfmt.Sprintf(\"%s-%d\", normalizeResourceName(alertCondition.Name), alertCondition.ID),\n\t\t\t\t\"newrelic_alert_condition\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *AlertGenerator) createAlertNrqlConditionResources(client *newrelic.NewRelic) error {\n\talertPolicies, err := client.Alerts.ListPolicies(nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, alertPolicy := range alertPolicies {\n\t\tnrqlConditions, err := client.Alerts.ListNrqlConditions(alertPolicy.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, nrqlCondition := range nrqlConditions {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%d:%d\", alertPolicy.ID, nrqlCondition.ID),\n\t\t\t\tfmt.Sprintf(\"%s-%d\", normalizeResourceName(nrqlCondition.Name), nrqlCondition.ID),\n\t\t\t\t\"newrelic_nrql_alert_condition\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *AlertGenerator) createAlertPolicyResources(client *newrelic.NewRelic) error {\n\talertPolicies, err := client.Alerts.ListPolicies(nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, alertPolicy := range alertPolicies {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tfmt.Sprintf(\"%d\", alertPolicy.ID),\n\t\t\tfmt.Sprintf(\"%s-%d\", normalizeResourceName(alertPolicy.Name), alertPolicy.ID),\n\t\t\t\"newrelic_alert_policy\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\t}\n\n\treturn nil\n}\n\nfunc (g *AlertGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*newrelic.NewRelic) error{\n\t\tg.createAlertChannelResources,\n\t\tg.createAlertConditionResources,\n\t\tg.createAlertNrqlConditionResources,\n\t\tg.createAlertPolicyResources,\n\t}\n\n\tfor _, f := range funcs {\n\t\terr := f(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *AlertGenerator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"newrelic_alert_condition\" {\n\t\t\tif resource.Item[\"violation_close_timer\"] == \"0\" {\n\t\t\t\tdelete(g.Resources[i].Item, \"violation_close_timer\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/newrelic/alertchannel.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage newrelic\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tnewrelic \"github.com/newrelic/newrelic-client-go/newrelic\"\n)\n\ntype AlertChannelGenerator struct {\n\tNewRelicService\n}\n\nfunc (g *AlertChannelGenerator) createAlertChannelResources(client *newrelic.NewRelic) error {\n\talertChannels, err := client.Alerts.ListChannels()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, channel := range alertChannels {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tfmt.Sprintf(\"%d\", channel.ID),\n\t\t\tfmt.Sprintf(\"%s-%d\", normalizeResourceName(channel.Name), channel.ID),\n\t\t\t\"newrelic_alert_channel\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn nil\n}\n\nfunc (g *AlertChannelGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.createAlertChannelResources(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/newrelic/alertcondition.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage newrelic\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tnewrelic \"github.com/newrelic/newrelic-client-go/newrelic\"\n)\n\ntype AlertConditionGenerator struct {\n\tNewRelicService\n}\n\nfunc (g *AlertConditionGenerator) createAlertConditionResources(client *newrelic.NewRelic) error {\n\talertPolicies, err := client.Alerts.ListPolicies(nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, alertPolicy := range alertPolicies {\n\t\talertConditions, err := client.Alerts.ListConditions(alertPolicy.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, alertCondition := range alertConditions {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%d:%d\", alertPolicy.ID, alertCondition.ID),\n\t\t\t\tfmt.Sprintf(\"%s-%d\", normalizeResourceName(alertCondition.Name), alertCondition.ID),\n\t\t\t\t\"newrelic_alert_condition\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *AlertConditionGenerator) createAlertNrqlConditionResources(client *newrelic.NewRelic) error {\n\talertPolicies, err := client.Alerts.ListPolicies(nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, alertPolicy := range alertPolicies {\n\t\tnrqlConditions, err := client.Alerts.ListNrqlConditions(alertPolicy.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, nrqlCondition := range nrqlConditions {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprintf(\"%d:%d\", alertPolicy.ID, nrqlCondition.ID),\n\t\t\t\tfmt.Sprintf(\"%s-%d\", normalizeResourceName(nrqlCondition.Name), nrqlCondition.ID),\n\t\t\t\t\"newrelic_nrql_alert_condition\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *AlertConditionGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*newrelic.NewRelic) error{\n\t\tg.createAlertConditionResources,\n\t\tg.createAlertNrqlConditionResources,\n\t}\n\n\tfor _, f := range funcs {\n\t\terr := f(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *AlertConditionGenerator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"newrelic_alert_condition\" {\n\t\t\tif resource.Item[\"violation_close_timer\"] == \"0\" {\n\t\t\t\tdelete(g.Resources[i].Item, \"violation_close_timer\")\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/newrelic/alertpolicy.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage newrelic\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tnewrelic \"github.com/newrelic/newrelic-client-go/newrelic\"\n)\n\ntype AlertPolicyGenerator struct {\n\tNewRelicService\n}\n\nfunc (g *AlertPolicyGenerator) createAlertPolicyResources(client *newrelic.NewRelic) error {\n\talertPolicies, err := client.Alerts.ListPolicies(nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, alertPolicy := range alertPolicies {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tfmt.Sprintf(\"%d\", alertPolicy.ID),\n\t\t\tfmt.Sprintf(\"%s-%d\", normalizeResourceName(alertPolicy.Name), alertPolicy.ID),\n\t\t\t\"newrelic_alert_policy\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\t}\n\n\treturn nil\n}\n\nfunc (g *AlertPolicyGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.createAlertPolicyResources(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/newrelic/helpers.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage newrelic\n\nimport (\n\t\"regexp\"\n\t\"strings\"\n)\n\nfunc removeDuplicate(s string) string {\n\tif len(s) < 2 {\n\t\treturn s\n\t}\n\n\tsrc := []byte(s)\n\tdest := make([]byte, len(src))\n\tdest[0] = src[0]\n\n\tj := 0\n\tfor i := 1; i < len(s); i++ {\n\t\tif dest[j] != src[i] {\n\t\t\tj++\n\t\t\tdest[j] = src[i]\n\t\t}\n\t}\n\n\treturn string(dest[:j+1])\n}\n\n// Making resource's name less ugly\nfunc normalizeResourceName(s string) string {\n\tspecialChars := `<>()*#{}[]|@_ .%'\",&`\n\tfor _, c := range specialChars {\n\t\ts = strings.ReplaceAll(s, string(c), \"-\")\n\t}\n\n\ts = regexp.MustCompile(`^[^a-zA-Z_]+`).ReplaceAllLiteralString(s, \"\")\n\ts = strings.TrimSuffix(s, \"-\")\n\ts = removeDuplicate(s)\n\n\treturn strings.ToLower(s)\n}\n"
  },
  {
    "path": "providers/newrelic/infra.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage newrelic\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tnewrelic \"github.com/newrelic/newrelic-client-go/newrelic\"\n)\n\ntype InfraGenerator struct {\n\tNewRelicService\n}\n\nfunc (g *InfraGenerator) createAlertInfraConditionResources(client *newrelic.NewRelic) error {\n\talertPolicies, err := client.Alerts.ListPolicies(nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, alertPolicy := range alertPolicies {\n\t\talertInfraConditions, err := client.Alerts.ListInfrastructureConditions(alertPolicy.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, alertInfraCondition := range alertInfraConditions {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\tfmt.Sprintf(\"%d:%d\", alertPolicy.ID, alertInfraCondition.ID),\n\t\t\t\tfmt.Sprintf(\"%s-%d\", normalizeResourceName(alertInfraCondition.Name), alertInfraCondition.ID),\n\t\t\t\t\"newrelic_infra_alert_condition\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"type\": alertInfraCondition.Type,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{}))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *InfraGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.createAlertInfraConditionResources(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/newrelic/newrelic_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage newrelic\n\nimport (\n\t\"errors\"\n\t\"os\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype NewRelicProvider struct { //nolint\n\tterraformutils.Provider\n\taccountID int\n\tAPIKey    string\n\tRegion    string\n}\n\nfunc (p *NewRelicProvider) Init(args []string) error {\n\tif apiKey := os.Getenv(\"NEW_RELIC_API_KEY\"); apiKey != \"\" {\n\t\tp.APIKey = os.Getenv(\"NEW_RELIC_API_KEY\")\n\t}\n\tif accountIDs := os.Getenv(\"NEW_RELIC_ACCOUNT_ID\"); accountIDs != \"\" {\n\t\taccountID, err := strconv.Atoi(accountIDs)\n\t\tif err != nil {\n\t\t\treturn err\n\n\t\t}\n\t\tp.accountID = accountID\n\t}\n\tif len(args) > 0 {\n\t\tp.APIKey = args[0]\n\t}\n\tif len(args) > 1 {\n\t\taccountID, err := strconv.Atoi(args[1])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tp.accountID = accountID\n\t}\n\tif len(args) > 1 {\n\t\tp.Region = args[2]\n\t}\n\tif p.Region == \"\" {\n\t\tp.Region = \"US\"\n\t}\n\treturn nil\n}\n\nfunc (p *NewRelicProvider) GetName() string {\n\treturn \"newrelic\"\n}\n\nfunc (p *NewRelicProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"account_id\": cty.NumberIntVal(int64(p.accountID)),\n\t\t\"api_key\":    cty.StringVal(p.APIKey),\n\t\t\"region\":     cty.StringVal(p.Region),\n\t})\n}\n\nfunc (p *NewRelicProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (NewRelicProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *NewRelicProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"alert\":      &AlertGenerator{},\n\t\t\"alert_channel\": &AlertChannelGenerator{},\n\t\t\"alert_condition\": &AlertConditionGenerator{},\n\t\t\"alert_policy\":    &AlertPolicyGenerator{},\n\t\t\"infra\":           &InfraGenerator{},\n\t\t\"synthetics\":      &SyntheticsGenerator{},\n\t\t\"tags\":            &TagsGenerator{},\n\t}\n}\n\nfunc (p *NewRelicProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"newrelic: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetArgs(map[string]interface{}{\"apiKey\": p.APIKey})\n\tp.Service.SetProviderName(p.GetName())\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/newrelic/newrelic_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage newrelic\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tnewrelic \"github.com/newrelic/newrelic-client-go/newrelic\"\n)\n\ntype NewRelicService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *NewRelicService) Client() (*newrelic.NewRelic, error) {\n\treturn newrelic.New(newrelic.ConfigPersonalAPIKey(s.GetArgs()[\"apiKey\"].(string)))\n}\n"
  },
  {
    "path": "providers/newrelic/synthetics.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage newrelic\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tnewrelic \"github.com/newrelic/newrelic-client-go/newrelic\"\n)\n\ntype SyntheticsGenerator struct {\n\tNewRelicService\n}\n\nfunc (g *SyntheticsGenerator) createSyntheticsMonitorResources(client *newrelic.NewRelic) error {\n\tallMonitors, err := client.Synthetics.ListMonitors()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, monitor := range allMonitors {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tfmt.Sprint(monitor.ID),\n\t\t\tfmt.Sprintf(\"%s-%s\", normalizeResourceName(monitor.Name), monitor.ID),\n\t\t\t\"newrelic_synthetics_monitor\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{}))\n\t}\n\n\treturn nil\n}\n\nfunc (g *SyntheticsGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = g.createSyntheticsMonitorResources(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/newrelic/tags.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage newrelic\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tnewrelic \"github.com/newrelic/newrelic-client-go/newrelic\"\n\t\"github.com/newrelic/newrelic-client-go/pkg/common\"\n)\n\ntype TagsGenerator struct {\n\tNewRelicService\n}\n\nfunc (g *TagsGenerator) createSyntheticsMonitorTagResources(client *newrelic.NewRelic) error {\n\tallMonitors, err := client.Synthetics.ListMonitors()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, monitor := range allMonitors {\n\t\tallTags, err := client.Entities.GetTagsForEntityMutable(common.EntityGUID(monitor.ID))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor range allTags {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tfmt.Sprint(monitor.ID),\n\t\t\t\tfmt.Sprintf(\"%s-%s\", normalizeResourceName(monitor.Name), monitor.ID),\n\t\t\t\t\"newrelic_entity_tags\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *TagsGenerator) createAlertConditionTagResources(client *newrelic.NewRelic) error {\n\talertPolicies, err := client.Alerts.ListPolicies(nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, alertPolicy := range alertPolicies {\n\t\talertConditions, err := client.Alerts.ListConditions(alertPolicy.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnrqlConditions, err := client.Alerts.ListNrqlConditions(alertPolicy.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, alertCondition := range alertConditions {\n\t\t\tallAlertConditionTags, err := client.Entities.GetTagsForEntityMutable(common.EntityGUID(fmt.Sprint(alertCondition.ID)))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor range allAlertConditionTags {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\tfmt.Sprintf(\"%d:%d\", alertPolicy.ID, alertCondition.ID),\n\t\t\t\t\tfmt.Sprintf(\"%s-%d\", normalizeResourceName(alertCondition.Name), alertCondition.ID),\n\t\t\t\t\t\"newrelic_entity_tags\",\n\t\t\t\t\tg.ProviderName,\n\t\t\t\t\t[]string{}))\n\t\t\t}\n\t\t}\n\n\t\tfor _, nrqlCondition := range nrqlConditions {\n\t\t\tallNRQLConditionTags, err := client.Entities.GetTagsForEntityMutable(common.EntityGUID(fmt.Sprint(nrqlCondition.ID)))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfor range allNRQLConditionTags {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\tfmt.Sprintf(\"%d:%d\", alertPolicy.ID, nrqlCondition.ID),\n\t\t\t\t\tfmt.Sprintf(\"%s-%d\", normalizeResourceName(nrqlCondition.Name), nrqlCondition.ID),\n\t\t\t\t\t\"newrelic_entity_tags\",\n\t\t\t\t\tg.ProviderName,\n\t\t\t\t\t[]string{}))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *TagsGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*newrelic.NewRelic) error{\n\t\tg.createSyntheticsMonitorTagResources,\n\t\tg.createAlertConditionTagResources,\n\t}\n\n\tfor _, f := range funcs {\n\t\terr := f(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ns1/monitoringjob.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ns1\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tns1 \"gopkg.in/ns1/ns1-go.v2/rest\"\n\t\"net/http\"\n\t\"time\"\n)\n\ntype MonitoringJobGenerator struct {\n\tNs1Service\n}\n\nfunc (g *MonitoringJobGenerator) createMonitoringJobResources(client *ns1.Client) error {\n\tjobs, _, err := client.Jobs.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, j := range jobs {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tj.ID,\n\t\t\tj.ID,\n\t\t\t\"ns1_monitoringjob\",\n\t\t\t\"ns1\",\n\t\t\t[]string{}))\n\t}\n\n\treturn nil\n}\n\nfunc (g *MonitoringJobGenerator) InitResources() error {\n\thttpClient := &http.Client{Timeout: time.Second * 10}\n\tclient := ns1.NewClient(httpClient, ns1.SetAPIKey(g.Args[\"api_key\"].(string)))\n\n\tif err := g.createMonitoringJobResources(client); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ns1/ns1_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ns1\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype Ns1Provider struct { //nolint\n\tterraformutils.Provider\n\tapiKey string\n}\n\nfunc (p *Ns1Provider) Init(args []string) error {\n\tif os.Getenv(\"NS1_APIKEY\") == \"\" {\n\t\treturn errors.New(\"set NS1_APIKEY env var\")\n\t}\n\tp.apiKey = os.Getenv(\"NS1_APIKEY\")\n\n\treturn nil\n}\n\nfunc (p *Ns1Provider) GetName() string {\n\treturn \"ns1\"\n}\n\nfunc (p *Ns1Provider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (Ns1Provider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *Ns1Provider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"monitoringjob\": &MonitoringJobGenerator{},\n\t\t\"team\":          &TeamGenerator{},\n\t\t\"zone\":          &ZoneGenerator{},\n\t}\n}\n\nfunc (p *Ns1Provider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"ns1: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"api_key\": p.apiKey,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ns1/ns1_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ns1\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype Ns1Service struct { //nolint\n\tterraformutils.Service\n}\n"
  },
  {
    "path": "providers/ns1/team.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ns1\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tns1 \"gopkg.in/ns1/ns1-go.v2/rest\"\n\t\"net/http\"\n\t\"time\"\n)\n\ntype TeamGenerator struct {\n\tNs1Service\n}\n\nfunc (g *TeamGenerator) createTeamResources(client *ns1.Client) error {\n\tteams, _, err := client.Teams.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, t := range teams {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tt.ID,\n\t\t\tt.ID,\n\t\t\t\"ns1_team\",\n\t\t\t\"ns1\",\n\t\t\t[]string{}))\n\t}\n\n\treturn nil\n}\n\nfunc (g *TeamGenerator) InitResources() error {\n\thttpClient := &http.Client{Timeout: time.Second * 10}\n\tclient := ns1.NewClient(httpClient, ns1.SetAPIKey(g.Args[\"api_key\"].(string)))\n\n\tif err := g.createTeamResources(client); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/ns1/zone.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage ns1\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tns1 \"gopkg.in/ns1/ns1-go.v2/rest\"\n\t\"gopkg.in/ns1/ns1-go.v2/rest/model/dns\"\n\t\"net/http\"\n\t\"time\"\n)\n\ntype ZoneGenerator struct {\n\tNs1Service\n}\n\nfunc (g *ZoneGenerator) createZoneRecordResources(client *ns1.Client, zone_name string) error {\n\n\tzone, _, err := client.Zones.Get(zone_name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, record := range zone.Records {\n\t\tr, _, err := client.Records.Get(zone_name, record.Domain, record.Type)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tr.ID,\n\t\t\tr.ID,\n\t\t\t\"ns1_record\",\n\t\t\t\"ns1\",\n\t\t\tmap[string]string{\"zone\": r.Zone, \"domain\": r.Domain, \"type\": r.Type},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\n\t}\n\n\treturn nil\n}\n\nfunc (g *ZoneGenerator) createZoneResources(client *ns1.Client, includeZones []string) error {\n\n\tvar zones []*dns.Zone\n\n\tif len(includeZones) > 0 {\n\t\tfor _, filter := range includeZones {\n\t\t\tvar z *dns.Zone\n\t\t\tz, _, err := client.Zones.Get(filter)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tzones = append(zones, z)\n\t\t}\n\t} else {\n\t\tvar err error\n\t\tzones, _, err = client.Zones.List()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfor _, zone := range zones {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tzone.ID,\n\t\t\tzone.Zone,\n\t\t\t\"ns1_zone\",\n\t\t\t\"ns1\",\n\t\t\tmap[string]string{\"zone\": zone.Zone},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\n\t\tg.createZoneRecordResources(client, zone.Zone)\n\t}\n\n\treturn nil\n}\n\nfunc (g *ZoneGenerator) InitResources() error {\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"zone\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\thttpClient := &http.Client{Timeout: time.Second * 10}\n\tclient := ns1.NewClient(httpClient, ns1.SetAPIKey(g.Args[\"api_key\"].(string)))\n\n\tif err := g.createZoneResources(client, filters); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/octopusdeploy/generic_resources.go",
    "content": "package octopusdeploy\n\nimport (\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/OctopusDeploy/go-octopusdeploy/octopusdeploy\"\n)\n\ntype GenericGenerator struct {\n\tOctopusDeployService\n\tAPIService string\n}\n\n// InitResources initialize the process to generate the Terraform resources from the\n// Octopus Deploy API.\nfunc (g *GenericGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*octopusdeploy.Client) error{\n\t\tg.createResources,\n\t}\n\n\tfor _, f := range funcs {\n\t\terr := f(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *GenericGenerator) createResources(client *octopusdeploy.Client) error {\n\tswitch strings.ToLower(g.APIService) {\n\tcase \"accounts\":\n\t\tresources, err := client.Account.GetAll()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, ressource := range *resources {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tressource.ID,\n\t\t\t\tressource.Name,\n\t\t\t\t\"octopusdeploy_account\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\tcase \"certificates\":\n\t\tresources, err := client.Certificate.GetAll()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, ressource := range *resources {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tressource.ID,\n\t\t\t\tressource.Name,\n\t\t\t\t\"octopusdeploy_certificate\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t// case \"channels\":\n\t// TODO: Somehow there is an issue with the channels:\n\t//    2020/02/24 16:35:55 octopusdeploy importing... channels\n\t//    2020/02/24 16:35:55 cannot find the item\n\n\t// \tresources, err := client.Channel.GetAll()\n\t// \tif err != nil {\n\t// \t\treturn err\n\t// \t}\n\n\t// \tfor _, ressource := range *resources {\n\t// \t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t// \t\t\tressource.ID,\n\t// \t\t\tressource.Name\n\t// \t\t\t\"octopusdeploy_channel\",\n\t// \t\t\tg.ProviderName,\n\t// \t\t\t[]string{},\n\t// \t\t))\n\t// \t}\n\tcase \"environments\":\n\t\tresources, err := client.Environment.GetAll()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, ressource := range *resources {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tressource.ID,\n\t\t\t\tressource.Name,\n\t\t\t\t\"octopusdeploy_environment\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\tcase \"feeds\":\n\t\tresources, err := client.Feed.GetAll()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, ressource := range *resources {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tressource.ID,\n\t\t\t\tressource.Name,\n\t\t\t\t\"octopusdeploy_feed\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\tcase \"libraryvariablesets\":\n\t\tresources, err := client.LibraryVariableSet.GetAll()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, ressource := range *resources {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tressource.ID,\n\t\t\t\tressource.Name,\n\t\t\t\t\"octopusdeploy_library_variable_set\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\tcase \"lifecycles\":\n\t\tresources, err := client.Lifecycle.GetAll()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, ressource := range *resources {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tressource.ID,\n\t\t\t\tressource.Name,\n\t\t\t\t\"octopusdeploy_lifecycle\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\tcase \"projects\":\n\t\tresources, err := client.Project.GetAll()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, ressource := range *resources {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tressource.ID,\n\t\t\t\tressource.Name,\n\t\t\t\t\"octopusdeploy_project\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\tcase \"projectgroups\":\n\t\tresources, err := client.ProjectGroup.GetAll()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, ressource := range *resources {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tressource.ID,\n\t\t\t\tressource.Name,\n\t\t\t\t\"octopusdeploy_project_group\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\tcase \"projecttriggers\":\n\t\tresources, err := client.ProjectTrigger.GetAll()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, ressource := range *resources {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tressource.ID,\n\t\t\t\tressource.Name,\n\t\t\t\t\"octopusdeploy_project_deployment_target_trigger\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\tcase \"tagsets\":\n\t\tresources, err := client.TagSet.GetAll()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, ressource := range *resources {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tressource.ID,\n\t\t\t\tressource.Name,\n\t\t\t\t\"octopusdeploy_tag_set\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t\t// case \"variables\":\n\t\t// TODO: This cannot generate a `variables.tf` file as there is already one.\n\n\t\t// projects, err := client.Project.GetAll()\n\t\t// if err != nil {\n\t\t// \treturn err\n\t\t// }\n\n\t\t// for _, project := range *projects {\n\t\t// \t// Variable.GetAll() returns all the variables for a specific project ID.\n\t\t// \tresources, err := client.Variable.GetAll(project.ID)\n\t\t// \tif err != nil {\n\t\t// \t\treturn err\n\t\t// \t}\n\n\t\t// \tfor _, ressource := range resources.Variables {\n\t\t// \t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t// \t\t\tressource.ID,\n\t\t// \t\t\tressource.Name\n\t\t// \t\t\t\"octopusdeploy_variable\",\n\t\t// \t\t\tg.ProviderName,\n\t\t// \t\t\t[]string{},\n\t\t// \t\t))\n\t\t// \t}\n\t\t// }\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/octopusdeploy/octopusdeploy_provider.go",
    "content": "package octopusdeploy\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype OctopusDeployProvider struct { //nolint\n\tterraformutils.Provider\n\taddress string\n\tapiKey  string\n}\n\nfunc (p *OctopusDeployProvider) Init(args []string) error {\n\tif args[0] != \"\" {\n\t\tp.address = args[0]\n\t} else {\n\t\tif address := os.Getenv(\"OCTOPUS_CLI_SERVER\"); address != \"\" {\n\t\t\tp.address = address\n\t\t} else {\n\t\t\treturn errors.New(\"server requirement\")\n\t\t}\n\t}\n\n\tif args[1] != \"\" {\n\t\tp.apiKey = args[1]\n\t} else {\n\t\tif apiKey := os.Getenv(\"OCTOPUS_CLI_API_KEY\"); apiKey != \"\" {\n\t\t\tp.apiKey = apiKey\n\t\t} else {\n\t\t\treturn errors.New(\"api-key requirement\")\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (p *OctopusDeployProvider) GetName() string {\n\treturn \"octopusdeploy\"\n}\n\nfunc (p *OctopusDeployProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"octopusdeploy\": map[string]interface{}{\n\t\t\t\t\"address\": p.address,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (OctopusDeployProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *OctopusDeployProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"accounts\": &GenericGenerator{APIService: \"accounts\"},\n\t\t// \"channels\":      &GenericGenerator{APIService: \"channels\"},\n\t\t\"certificates\":        &GenericGenerator{APIService: \"certificates\"},\n\t\t\"environments\":        &GenericGenerator{APIService: \"environments\"},\n\t\t\"feeds\":               &GenericGenerator{APIService: \"feeds\"},\n\t\t\"libraryvariablesets\": &GenericGenerator{APIService: \"libraryvariablesets\"},\n\t\t\"lifecycles\":          &GenericGenerator{APIService: \"lifecycles\"},\n\t\t\"projects\":            &GenericGenerator{APIService: \"projects\"},\n\t\t\"projectgroups\":       &GenericGenerator{APIService: \"projectgroups\"},\n\t\t\"projecttriggers\":     &GenericGenerator{APIService: \"projecttriggers\"},\n\t\t\"tagsets\":             &GenericGenerator{APIService: \"tagsets\"},\n\t\t// \"variables\":           &GenericGenerator{APIService: \"variables\"},\n\t}\n}\n\nfunc (p *OctopusDeployProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"octopusdeploy: \" + serviceName + \" not supported service, see list sub-command\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"api_key\": p.apiKey,\n\t\t\"address\": p.address,\n\t})\n\n\treturn nil\n}\n\n// GetConfig return map of provider config for OctopusDeployProvider\nfunc (p *OctopusDeployProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"api_key\": cty.StringVal(p.apiKey),\n\t\t\"address\": cty.StringVal(p.address),\n\t})\n}\n\nfunc (p *OctopusDeployProvider) GetBasicConfig() cty.Value {\n\treturn p.GetConfig()\n}\n"
  },
  {
    "path": "providers/octopusdeploy/octopusdeploy_service.go",
    "content": "package octopusdeploy\n\nimport (\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/OctopusDeploy/go-octopusdeploy/octopusdeploy\"\n)\n\ntype OctopusDeployService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *OctopusDeployService) Client() (*octopusdeploy.Client, error) {\n\toctopusURL := s.Args[\"address\"].(string)\n\toctopusAPIKey := s.Args[\"api_key\"].(string)\n\n\tif octopusURL == \"\" || octopusAPIKey == \"\" {\n\t\terr := errors.New(\"Please make sure to set the env variables 'OCTOPUS_CLI_SERVER' and 'OCTOPUS_CLI_API_KEY'\")\n\t\treturn nil, err\n\t}\n\n\thttpClient := http.Client{}\n\tclient := octopusdeploy.NewClient(&httpClient, octopusURL, octopusAPIKey)\n\n\treturn client, nil\n}\n"
  },
  {
    "path": "providers/okta/app.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta/query\"\n)\n\n//NOTE: Okta SDK v2.6.1 ListApplications() method does not support applications by type at this time. So\n//\t\twe have to create the application filter by our self.\nfunc getApplications(ctx context.Context, client *okta.Client, signOnMode string) ([]*okta.Application, error) {\n\tsupportedApps, err := getAllApplications(ctx, client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar filterApps []*okta.Application\n\tfor _, app := range supportedApps {\n\t\tif app.SignOnMode == signOnMode {\n\t\t\tfilterApps = append(filterApps, app)\n\t\t}\n\t}\n\treturn filterApps, nil\n}\n\nfunc getAllApplications(ctx context.Context, client *okta.Client) ([]*okta.Application, error) {\n\tvar apps []*okta.Application\n\tdata, resp, err := client.Application.ListApplications(ctx, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextAppSet []*okta.Application\n\t\tresp, err = resp.Next(ctx, &nextAppSet)\n\t\tif err != nil {\n\t\t\tlog.Println(\"fff\")\n\t\t\treturn nil, err\n\t\t}\n\t\tapps = append(apps, nextAppSet...)\n\t}\n\tfor _, a := range data {\n\t\tapps = append(apps, a.(*okta.Application))\n\t}\n\n\tvar supportedApps []*okta.Application\n\tfor _, app := range apps {\n\t\t//NOTE: Okta provider does not support the following app type/name\n\t\tif app.Name == \"template_wsfed\" ||\n\t\t\tapp.Name == \"template_swa_two_page\" ||\n\t\t\tapp.Name == \"okta_enduser\" ||\n\t\t\tapp.Name == \"okta_browser_plugin\" ||\n\t\t\tapp.Name == \"saasure\" {\n\t\t\tcontinue\n\t\t}\n\t\tsupportedApps = append(supportedApps, app)\n\t}\n\n\treturn supportedApps, nil\n}\n\nfunc listApplicationGroupsIDs(ctx context.Context, client *okta.Client, id string) ([]string, error) {\n\tvar groupIDs []string\n\tgroups, resp, err := client.Application.ListApplicationGroupAssignments(ctx, id, &query.Params{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor {\n\t\tfor _, groupID := range groups {\n\t\t\tgroupIDs = append(groupIDs, groupID.Id)\n\t\t}\n\t\tif resp.HasNextPage() {\n\t\t\tresp, err = resp.Next(ctx, &groups)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcontinue\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn groupIDs, nil\n}\n"
  },
  {
    "path": "providers/okta/app_auto_login.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype AppAutoLoginGenerator struct {\n\tOktaService\n}\n\nfunc (g AppAutoLoginGenerator) createResources(appList []*okta.Application) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, app := range appList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tapp.Id,\n\t\t\tnormalizeResourceName(app.Id+\"_\"+app.Name),\n\t\t\t\"okta_app_auto_login\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *AppAutoLoginGenerator) InitResources() error {\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tapps, err := getAutoLoginApplications(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(apps)\n\treturn nil\n}\n\nfunc getAutoLoginApplications(ctx context.Context, client *okta.Client) ([]*okta.Application, error) {\n\tsignOnMode := \"AUTO_LOGIN\"\n\tapps, err := getApplications(ctx, client, signOnMode)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn apps, nil\n}\n"
  },
  {
    "path": "providers/okta/app_basic_auth.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype AppBasicAuthGenerator struct {\n\tOktaService\n}\n\nfunc (g AppBasicAuthGenerator) createResources(appList []*okta.Application) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, app := range appList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tapp.Id,\n\t\t\tnormalizeResourceName(app.Id+\"_\"+app.Name),\n\t\t\t\"okta_app_basic_auth\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *AppBasicAuthGenerator) InitResources() error {\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tapps, err := getBasicAuthApplications(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(apps)\n\treturn nil\n}\n\nfunc getBasicAuthApplications(ctx context.Context, client *okta.Client) ([]*okta.Application, error) {\n\tsignOnMode := \"BASIC_AUTH\"\n\tapps, err := getApplications(ctx, client, signOnMode)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn apps, nil\n}\n"
  },
  {
    "path": "providers/okta/app_bookmark.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v5/okta\"\n)\n\ntype AppBookmarkGenerator struct {\n\tOktaService\n}\n\nfunc (g *AppBookmarkGenerator) createResources(appList []okta.ListApplications200ResponseInner) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, app := range appList {\n\t\tif app.BookmarkApplication != nil {\n\t\t\tif id, label := app.BookmarkApplication.Id, app.BookmarkApplication.Label; id != nil && label != \"\" {\n\t\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t\t*id,\n\t\t\t\t\tnormalizeResourceName(*id+\"_\"+label),\n\t\t\t\t\t\"okta_app_bookmark\",\n\t\t\t\t\t\"okta\",\n\t\t\t\t\t[]string{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *AppBookmarkGenerator) InitResources() error {\n\tctx, client, err := g.ClientV5()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tappList, resp, err := client.ApplicationAPI.ListApplications(ctx).Execute()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error listing applications: %w\", err)\n\t}\n\n\tallApplications := appList\n\n\tfor resp.HasNextPage() {\n\t\tvar nextAppList []okta.ListApplications200ResponseInner\n\t\tresp, err = resp.Next(&nextAppList)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error fetching next page: %w\", err)\n\t\t}\n\t\tallApplications = append(allApplications, nextAppList...)\n\t}\n\n\tg.Resources = g.createResources(allApplications)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/app_oauth.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v5/okta\"\n)\n\ntype AppOAuthGenerator struct {\n\tOktaService\n}\n\nfunc (g *AppOAuthGenerator) createResources(appList []okta.ListApplications200ResponseInner) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, app := range appList {\n\t\tif app.OpenIdConnectApplication != nil {\n\t\t\tif id, label := app.OpenIdConnectApplication.Id, app.OpenIdConnectApplication.Label; id != nil && label != \"\" {\n\t\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t\t*id,\n\t\t\t\t\tnormalizeResourceName(*id+\"_\"+label),\n\t\t\t\t\t\"okta_app_oauth\",\n\t\t\t\t\t\"okta\",\n\t\t\t\t\t[]string{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *AppOAuthGenerator) InitResources() error {\n\tctx, client, err := g.ClientV5()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tappList, resp, err := client.ApplicationAPI.ListApplications(ctx).Filter(\"name eq \\\"oidc_client\\\"\").Execute()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error listing OAuth applications: %w\", err)\n\t}\n\n\tallApplications := appList\n\n\tfor resp.HasNextPage() {\n\t\tvar nextAppList []okta.ListApplications200ResponseInner\n\t\tresp, err = resp.Next(&nextAppList)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error fetching next page: %w\", err)\n\t\t}\n\t\tallApplications = append(allApplications, nextAppList...)\n\t}\n\n\tg.Resources = g.createResources(allApplications)\n\treturn nil\n}\n\nfunc (g *AppOAuthGenerator) PostConvertHook() error {\n\tfor i := range g.Resources {\n\t\tg.Resources[i].Item = escapeDollar(g.Resources[i].Item)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/app_saml.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v5/okta\"\n)\n\ntype AppSamlGenerator struct {\n\tOktaService\n}\n\nfunc (g *AppSamlGenerator) createResources(appList []okta.ListApplications200ResponseInner) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, app := range appList {\n\t\tif app.SamlApplication != nil && app.SamlApplication.Id != nil && app.SamlApplication.Label != \"\" {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*app.SamlApplication.Id,\n\t\t\t\tnormalizeResourceName(*app.SamlApplication.Id+\"_\"+app.SamlApplication.Label),\n\t\t\t\t\"okta_app_saml\",\n\t\t\t\t\"okta\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\n\t\tif app.Saml11Application != nil && app.Saml11Application.Id != nil && app.Saml11Application.Label != \"\" {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*app.Saml11Application.Id,\n\t\t\t\tnormalizeResourceName(*app.Saml11Application.Id+\"_\"+app.Saml11Application.Label),\n\t\t\t\t\"okta_app_saml\",\n\t\t\t\t\"okta\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *AppSamlGenerator) InitResources() error {\n\tctx, client, err := g.ClientV5()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tappList, resp, err := client.ApplicationAPI.ListApplications(ctx).Execute()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error listing applications: %w\", err)\n\t}\n\n\tallApplications := appList\n\n\tfor resp.HasNextPage() {\n\t\tvar nextAppList []okta.ListApplications200ResponseInner\n\t\tresp, err = resp.Next(&nextAppList)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error fetching next page: %w\", err)\n\t\t}\n\t\tallApplications = append(allApplications, nextAppList...)\n\t}\n\n\tg.Resources = g.createResources(allApplications)\n\treturn nil\n}\n\nfunc (g *AppSamlGenerator) PostConvertHook() error {\n\tfor i := range g.Resources {\n\t\tg.Resources[i].Item = escapeDollar(g.Resources[i].Item)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/app_secure_password_store.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype AppSecurePasswordStoreGenerator struct {\n\tOktaService\n}\n\nfunc (g AppSecurePasswordStoreGenerator) createResources(appList []*okta.Application) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, app := range appList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tapp.Id,\n\t\t\tnormalizeResourceName(app.Id+\"_\"+app.Name),\n\t\t\t\"okta_app_secure_password_store\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *AppSecurePasswordStoreGenerator) InitResources() error {\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tapps, err := getSecurePasswordStoreApplications(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(apps)\n\treturn nil\n}\n\nfunc getSecurePasswordStoreApplications(ctx context.Context, client *okta.Client) ([]*okta.Application, error) {\n\tsignOnMode := \"SECURE_PASSWORD_STORE\"\n\tapps, err := getApplications(ctx, client, signOnMode)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn apps, nil\n}\n"
  },
  {
    "path": "providers/okta/app_signon_policy.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v5/okta\"\n)\n\ntype AppSignOnPolicyGenerator struct {\n\tOktaService\n}\n\nfunc (g AppSignOnPolicyGenerator) createResources(policies []okta.ListPolicies200ResponseInner) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, policy := range policies {\n\t\tif policy.AccessPolicy == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tresourceName := normalizeResourceNameWithRandom(policy.AccessPolicy.GetName(), true)\n\t\tresourceID := policy.AccessPolicy.GetId()\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceID,\n\t\t\tresourceName,\n\t\t\t\"okta_app_signon_policy\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *AppSignOnPolicyGenerator) InitResources() error {\n\tctx, client, err := g.ClientV5()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpolicies, err := getAppSignOnPolicies(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(policies)\n\treturn nil\n}\n\nfunc getAppSignOnPolicies(ctx context.Context, client *okta.APIClient) ([]okta.ListPolicies200ResponseInner, error) {\n\tpolicies, _, err := client.PolicyAPI.ListPolicies(ctx).Type_(\"ACCESS_POLICY\").Execute()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn policies, nil\n}\n"
  },
  {
    "path": "providers/okta/app_signon_policy_rule.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v5/okta\"\n)\n\ntype AppSignOnPolicyRuleGenerator struct {\n\tOktaService\n}\n\nfunc (g AppSignOnPolicyRuleGenerator) createResources(signOnPolicyRuleList []okta.ListPolicyRules200ResponseInner, policyID string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, policyRule := range signOnPolicyRuleList {\n\t\tif policyRule.AccessPolicyRule == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tresourceName := normalizeResourceNameWithRandom(policyRule.AccessPolicyRule.GetName(), true)\n\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tpolicyRule.AccessPolicyRule.GetId(),\n\t\t\tresourceName,\n\t\t\t\"okta_app_signon_policy_rule\",\n\t\t\t\"okta\",\n\t\t\tmap[string]string{\n\t\t\t\t\"policy_id\": policyID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *AppSignOnPolicyRuleGenerator) InitResources() error {\n\tctx, client, err := g.ClientV5()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpolicies, err := getAppSignOnPolicies(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar allResources []terraformutils.Resource\n\n\tfor _, policy := range policies {\n\t\tif policy.AccessPolicy == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tpolicyID := policy.AccessPolicy.GetId()\n\n\t\tpolicyRules, err := getAppSignOnPolicyRules(ctx, client, policyID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresources := g.createResources(policyRules, policyID)\n\n\t\tallResources = append(allResources, resources...)\n\t}\n\n\tg.Resources = allResources\n\n\treturn nil\n}\n\nfunc getAppSignOnPolicyRules(ctx context.Context, client *okta.APIClient, policyID string) ([]okta.ListPolicyRules200ResponseInner, error) {\n\tpolicyRules, _, err := client.PolicyAPI.ListPolicyRules(ctx, policyID).Execute()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn policyRules, nil\n}\n"
  },
  {
    "path": "providers/okta/app_swa.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v5/okta\"\n)\n\ntype AppSWAGenerator struct {\n\tOktaService\n}\n\nfunc (g *AppSWAGenerator) createResources(appList []okta.ListApplications200ResponseInner) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, app := range appList {\n\t\tif app.BrowserPluginApplication != nil && app.BrowserPluginApplication.Id != nil && app.BrowserPluginApplication.Label != \"\" {\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\t*app.BrowserPluginApplication.Id,\n\t\t\t\tnormalizeResourceName(*app.BrowserPluginApplication.Id+\"_\"+app.BrowserPluginApplication.Label),\n\t\t\t\t\"okta_app_swa\",\n\t\t\t\t\"okta\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *AppSWAGenerator) InitResources() error {\n\tctx, client, err := g.ClientV5()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tappList, resp, err := client.ApplicationAPI.ListApplications(ctx).Execute()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error listing applications: %w\", err)\n\t}\n\n\tallApplications := appList\n\n\tfor resp.HasNextPage() {\n\t\tvar nextAppList []okta.ListApplications200ResponseInner\n\t\tresp, err = resp.Next(&nextAppList)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error fetching next page: %w\", err)\n\t\t}\n\n\t\tallApplications = append(allApplications, nextAppList...)\n\t}\n\n\tg.Resources = g.createResources(allApplications)\n\treturn nil\n}\n\nfunc (g *AppSWAGenerator) PostConvertHook() error {\n\tfor i := range g.Resources {\n\t\tg.Resources[i].Item = escapeDollar(g.Resources[i].Item)\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/app_three_field.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype AppThreeFieldGenerator struct {\n\tOktaService\n}\n\nfunc (g AppThreeFieldGenerator) createResources(appList []*okta.Application) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, app := range appList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tapp.Id,\n\t\t\tnormalizeResourceName(app.Id+\"_\"+app.Name),\n\t\t\t\"okta_app_three_field\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *AppThreeFieldGenerator) InitResources() error {\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tapps, err := getThreeFieldApplications(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(apps)\n\treturn nil\n}\n\nfunc getThreeFieldApplications(ctx context.Context, client *okta.Client) ([]*okta.Application, error) {\n\tsignOnMode := \"BROWSER_PLUGIN\"\n\tapps, err := getApplications(ctx, client, signOnMode)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tthreeFieldApps := []*okta.Application{}\n\tfor _, app := range apps {\n\t\tif app.Name == \"template_swa3field\" {\n\t\t\tthreeFieldApps = append(threeFieldApps, app)\n\t\t}\n\t}\n\n\treturn threeFieldApps, nil\n}\n"
  },
  {
    "path": "providers/okta/app_user_schema.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype AppUserSchemaPropertyGenerator struct {\n\tOktaService\n}\n\nfunc (g AppUserSchemaPropertyGenerator) createResources(appUserSchema *okta.UserSchema, appID string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor index := range appUserSchema.Definitions.Custom.Properties {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tindex,\n\t\t\tnormalizeResourceName(appID)+\"_property_\"+normalizeResourceName(index),\n\t\t\t\"okta_app_user_schema_property\",\n\t\t\t\"okta\",\n\t\t\tmap[string]string{\n\t\t\t\t\"app_id\": appID,\n\t\t\t\t\"index\":  index,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\tfor index := range appUserSchema.Definitions.Base.Properties {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tindex,\n\t\t\tnormalizeResourceName(appID)+\"_property_\"+normalizeResourceName(index),\n\t\t\t\"okta_app_user_base_schema_property\",\n\t\t\t\"okta\",\n\t\t\tmap[string]string{\n\t\t\t\t\"app_id\": appID,\n\t\t\t\t\"index\":  index,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *AppUserSchemaPropertyGenerator) InitResources() error {\n\tvar resources []terraformutils.Resource\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tapps, err := getAllApplications(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, app := range apps {\n\t\tappUserSchema, _, err := client.UserSchema.GetApplicationUserSchema(ctx, app.Id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresources = append(resources, g.createResources(appUserSchema, app.Id)...)\n\t}\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/authenticator.go",
    "content": "// Copyright 2025 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v5/okta\"\n)\n\ntype AuthenticatorGenerator struct {\n\tOktaService\n}\n\nfunc (g AuthenticatorGenerator) createResources(authenticators []okta.ListAuthenticators200ResponseInner) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, authenticator := range authenticators {\n\t\tinstance := authenticator.GetActualInstance()\n\t\tif instance == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar resourceID, resourceName string\n\t\tswitch inst := instance.(type) {\n\t\tcase *okta.AuthenticatorKeyPassword:\n\t\t\tresourceID = inst.GetId()\n\t\t\tresourceName = normalizeResourceNameWithRandom(inst.GetName(), true)\n\t\tcase *okta.AuthenticatorKeyEmail:\n\t\t\tresourceID = inst.GetId()\n\t\t\tresourceName = normalizeResourceNameWithRandom(inst.GetName(), true)\n\t\tcase *okta.AuthenticatorKeyPhone:\n\t\t\tresourceID = inst.GetId()\n\t\t\tresourceName = normalizeResourceNameWithRandom(inst.GetName(), true)\n\t\tcase *okta.AuthenticatorKeyGoogleOtp:\n\t\t\tresourceID = inst.GetId()\n\t\t\tresourceName = normalizeResourceNameWithRandom(inst.GetName(), true)\n\t\tcase *okta.AuthenticatorKeyOktaVerify:\n\t\t\tresourceID = inst.GetId()\n\t\t\tresourceName = normalizeResourceNameWithRandom(inst.GetName(), true)\n\t\tcase *okta.AuthenticatorKeyWebauthn:\n\t\t\tresourceID = inst.GetId()\n\t\t\tresourceName = normalizeResourceNameWithRandom(inst.GetName(), true)\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tresourceID,\n\t\t\tresourceName,\n\t\t\t\"okta_authenticator\",\n\t\t\t\"okta\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *AuthenticatorGenerator) InitResources() error {\n\tctx, client, err := g.ClientV5()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tauthenticators, _, err := client.AuthenticatorAPI.ListAuthenticators(ctx).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(authenticators)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/authorization_server.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype AuthorizationServerGenerator struct {\n\tOktaService\n}\n\nfunc (g AuthorizationServerGenerator) createResources(authorizationServerList []*okta.AuthorizationServer) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, authorizationServer := range authorizationServerList {\n\t\tresourceType := \"okta_auth_server\"\n\t\tif authorizationServer.Name == \"default\" {\n\t\t\tresourceType = \"okta_auth_server_default\"\n\t\t}\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tauthorizationServer.Id,\n\t\t\t\"auth_server_\"+authorizationServer.Name,\n\t\t\tresourceType,\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *AuthorizationServerGenerator) InitResources() error {\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\toutput, err := getAuthorizationServers(ctx, client)\n\tif err != nil {\n\t\treturn e\n\t}\n\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n\nfunc getAuthorizationServers(ctx context.Context, client *okta.Client) ([]*okta.AuthorizationServer, error) {\n\toutput, resp, err := client.AuthorizationServer.ListAuthorizationServers(ctx, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextAuthorizationServerSet []*okta.AuthorizationServer\n\t\tresp, _ = resp.Next(ctx, &nextAuthorizationServerSet)\n\t\toutput = append(output, nextAuthorizationServerSet...)\n\t}\n\n\treturn output, nil\n}\n"
  },
  {
    "path": "providers/okta/authorization_server_claim.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype AuthorizationServerClaimGenerator struct {\n\tOktaService\n}\n\nfunc (g AuthorizationServerClaimGenerator) createResources(authorizationServerClaimList []*okta.OAuth2Claim, authorizationServerID string, authorizationServerName string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, authorizationServerClaim := range authorizationServerClaimList {\n\t\tresourceType := \"okta_auth_server_claim\"\n\t\tif authorizationServerClaim.Name == \"sub\" {\n\t\t\tresourceType = \"okta_auth_server_claim_default\"\n\t\t}\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tauthorizationServerClaim.Id,\n\t\t\tnormalizeResourceName(\"auth_server_\"+authorizationServerName+\"_claim_\"+authorizationServerClaim.Id),\n\t\t\tresourceType,\n\t\t\t\"okta\",\n\t\t\tmap[string]string{\n\t\t\t\t\"auth_server_id\": authorizationServerID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *AuthorizationServerClaimGenerator) InitResources() error {\n\tvar resources []terraformutils.Resource\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tauthorizationServers, err := getAuthorizationServers(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, authorizationServer := range authorizationServers {\n\t\toutput, _, err := client.AuthorizationServer.ListOAuth2Claims(ctx, authorizationServer.Id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresources = append(resources, g.createResources(output, authorizationServer.Id, authorizationServer.Name)...)\n\t}\n\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/authorization_server_policy.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype AuthorizationServerPolicyGenerator struct {\n\tOktaService\n}\n\nfunc (g AuthorizationServerPolicyGenerator) createResources(authorizationServerPolicyList []*okta.AuthorizationServerPolicy, authorizationServerID string, authorizationServerName string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, authorizationServerPolicy := range authorizationServerPolicyList {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tauthorizationServerPolicy.Id,\n\t\t\tnormalizeResourceName(\"auth_server_\"+authorizationServerName+\"_policy_\"+authorizationServerPolicy.Name),\n\t\t\t\"okta_auth_server_policy\",\n\t\t\t\"okta\",\n\t\t\tmap[string]string{\n\t\t\t\t\"auth_server_id\": authorizationServerID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *AuthorizationServerPolicyGenerator) InitResources() error {\n\tvar resources []terraformutils.Resource\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tauthorizationServers, err := getAuthorizationServers(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, authorizationServer := range authorizationServers {\n\t\toutput, _, err := client.AuthorizationServer.ListAuthorizationServerPolicies(ctx, authorizationServer.Id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresources = append(resources, g.createResources(output, authorizationServer.Id, authorizationServer.Name)...)\n\t}\n\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/authorization_server_policy_rule.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype AuthorizationServerPolicyRuleGenerator struct {\n\tOktaService\n}\n\nfunc (g AuthorizationServerPolicyRuleGenerator) createResources(authorizationServerPolicyRuleList []*okta.AuthorizationServerPolicyRule, authorizationServerID string, authorizationServerName string, authorizationServerPolicyID string, authorizationServerPolicyName string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, authorizationServerPolicyRule := range authorizationServerPolicyRuleList {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tauthorizationServerPolicyRule.Id,\n\t\t\tnormalizeResourceName(\"auth_server_\"+authorizationServerName+\"_policy_\"+authorizationServerPolicyName+\"_rule_\"+authorizationServerPolicyRule.Name),\n\t\t\t\"okta_auth_server_policy_rule\",\n\t\t\t\"okta\",\n\t\t\tmap[string]string{\n\t\t\t\t\"auth_server_id\": authorizationServerID,\n\t\t\t\t\"policy_id\":      authorizationServerPolicyID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *AuthorizationServerPolicyRuleGenerator) InitResources() error {\n\tvar resources []terraformutils.Resource\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tauthorizationServers, err := getAuthorizationServers(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, authorizationServer := range authorizationServers {\n\n\t\tauthorizationServerPolicies, _, err := client.AuthorizationServer.ListAuthorizationServerPolicies(ctx, authorizationServer.Id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, authorizationServerPolicy := range authorizationServerPolicies {\n\t\t\toutput, _, err := client.AuthorizationServer.ListAuthorizationServerPolicyRules(ctx, authorizationServer.Id, authorizationServerPolicy.Id)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tresources = append(resources, g.createResources(output, authorizationServer.Id, authorizationServer.Name, authorizationServerPolicy.Id, authorizationServerPolicy.Name)...)\n\t\t}\n\t}\n\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/authorization_server_scope.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype AuthorizationServerScopeGenerator struct {\n\tOktaService\n}\n\nfunc (g AuthorizationServerScopeGenerator) createResources(authorizationServerScopeList []*okta.OAuth2Scope, authorizationServerID string, authorizationServerName string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, authorizationServerScope := range authorizationServerScopeList {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tauthorizationServerScope.Id,\n\t\t\tnormalizeResourceName(\"auth_server_\"+authorizationServerName+\"_scope_\"+authorizationServerScope.Name),\n\t\t\t\"okta_auth_server_scope\",\n\t\t\t\"okta\",\n\t\t\tmap[string]string{\n\t\t\t\t\"auth_server_id\": authorizationServerID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *AuthorizationServerScopeGenerator) InitResources() error {\n\tvar resources []terraformutils.Resource\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tauthorizationServers, err := getAuthorizationServers(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, authorizationServer := range authorizationServers {\n\t\toutput, _, err := client.AuthorizationServer.ListOAuth2Scopes(ctx, authorizationServer.Id, nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresources = append(resources, g.createResources(output, authorizationServer.Id, authorizationServer.Name)...)\n\t}\n\n\tg.Resources = resources\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/event_hook.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype EventHookGenerator struct {\n\tOktaService\n}\n\nfunc (g EventHookGenerator) createResources(eventHookList []*okta.EventHook) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, eventHook := range eventHookList {\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\teventHook.Id,\n\t\t\t\"event_hook_\"+eventHook.Name,\n\t\t\t\"okta_event_hook\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *EventHookGenerator) InitResources() error {\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\toutput, resp, err := client.EventHook.ListEventHooks(ctx)\n\tif err != nil {\n\t\treturn e\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextEventHookSet []*okta.EventHook\n\t\tresp, _ = resp.Next(ctx, &nextEventHookSet)\n\t\toutput = append(output, nextEventHookSet...)\n\t}\n\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/factor.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n\t\"github.com/okta/terraform-provider-okta/sdk\"\n)\n\ntype FactorGenerator struct {\n\tOktaService\n}\n\nfunc (g FactorGenerator) createResources(ctx context.Context, factorList []*okta.UserFactor, client *sdk.APISupplement) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, factor := range factorList {\n\t\tif factor.Status == \"ACTIVE\" {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tfactor.Id,\n\t\t\t\t\"factor_\"+normalizeResourceNameWithRandom(factor.Id, true),\n\t\t\t\t\"okta_factor\",\n\t\t\t\t\"okta\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"provider_id\": factor.Id,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\n\t\t\tif factor.FactorType == \"token:hotp\" {\n\t\t\t\thotpFactorProfiles, _, _ := getHotpFactorProfiles(ctx, client)\n\n\t\t\t\tfor _, factorProfile := range hotpFactorProfiles {\n\t\t\t\t\tif factorProfile != nil {\n\t\t\t\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\t\t\t\tfactorProfile.ID,\n\t\t\t\t\t\t\t\"factor_totp_\"+normalizeResourceNameWithRandom(factorProfile.Name, true),\n\t\t\t\t\t\t\t\"okta_factor_totp\",\n\t\t\t\t\t\t\t\"okta\",\n\t\t\t\t\t\t\tmap[string]string{},\n\t\t\t\t\t\t\t[]string{},\n\t\t\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\t\t\"name\":                   factorProfile.Name,\n\t\t\t\t\t\t\t\t\"otp_length\":             factorProfile.Settings.OtpLength,\n\t\t\t\t\t\t\t\t\"time_step\":              factorProfile.Settings.TimeStep,\n\t\t\t\t\t\t\t\t\"clock_drift_interval\":   factorProfile.Settings.AcceptableAdjacentIntervals,\n\t\t\t\t\t\t\t\t\"shared_secret_encoding\": factorProfile.Settings.Encoding,\n\t\t\t\t\t\t\t\t\"hmac_algorithm\":         factorProfile.Settings.TimeStep,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *FactorGenerator) InitResources() error {\n\tvar factors []*okta.UserFactor\n\n\tctx, client, err := g.APISupplementClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutput, _, err := getListFactors(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfactors = append(factors, output...)\n\n\tg.Resources = g.createResources(ctx, factors, client)\n\treturn nil\n}\n\nfunc getListFactors(ctx context.Context, m *sdk.APISupplement) ([]*okta.UserFactor, *okta.Response, error) {\n\t//NOTE: Okta SDK does not support general ListFactors method so we got to manually implement the REST calls.\n\turl := \"/api/v1/org/factors\"\n\treq, err := m.RequestExecutor.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tvar factors []*okta.UserFactor\n\tresp, err := m.RequestExecutor.Do(ctx, req, &factors)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn factors, resp, nil\n}\n\nfunc getHotpFactorProfiles(ctx context.Context, m *sdk.APISupplement) ([]*sdk.HotpFactorProfile, *okta.Response, error) {\n\turl := \"/api/v1/org/factors/hotp/profiles\"\n\treq, err := m.RequestExecutor.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tvar factors []*sdk.HotpFactorProfile\n\tresp, err := m.RequestExecutor.Do(ctx, req, &factors)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn factors, resp, nil\n}\n"
  },
  {
    "path": "providers/okta/group.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta/query\"\n)\n\ntype GroupGenerator struct {\n\tOktaService\n}\n\nfunc (g GroupGenerator) createResources(groupList []*okta.Group) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, group := range groupList {\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tgroup.Id,\n\t\t\t\"group_\"+group.Profile.Name,\n\t\t\t\"okta_group\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *GroupGenerator) InitResources() error {\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tfilter := query.NewQueryParams(query.WithFilter(\"type eq \\\"OKTA_GROUP\\\"\"))\n\toutput, resp, err := client.Group.ListGroups(ctx, filter)\n\tif err != nil {\n\t\treturn e\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextGroupSet []*okta.Group\n\t\tresp, _ = resp.Next(ctx, &nextGroupSet)\n\t\toutput = append(output, nextGroupSet...)\n\t}\n\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/group_rule.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype GroupRuleGenerator struct {\n\tOktaService\n}\n\nfunc (g GroupRuleGenerator) createResources(groupRuleList []*okta.GroupRule) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, groupRule := range groupRuleList {\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tgroupRule.Id,\n\t\t\t\"grouprule_\"+groupRule.Name,\n\t\t\t\"okta_group_rule\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *GroupRuleGenerator) InitResources() error {\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\toutput, resp, err := client.Group.ListGroupRules(ctx, nil)\n\tif err != nil {\n\t\treturn e\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextGroupRuleSet []*okta.GroupRule\n\t\tresp, _ = resp.Next(ctx, &nextGroupRuleSet)\n\t\toutput = append(output, nextGroupRuleSet...)\n\t}\n\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/helpers.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"fmt\"\n\t\"math/rand\"\n\t\"regexp\"\n\t\"strings\"\n)\n\n// Making resource's name less ugly\nfunc normalizeResourceName(s string) string {\n\tspecialChars := `<>()*#{}[]|@_ .%'\",&`\n\tfor _, c := range specialChars {\n\t\ts = strings.ReplaceAll(s, string(c), \"-\")\n\t}\n\n\ts = regexp.MustCompile(`^[^a-zA-Z_]+`).ReplaceAllLiteralString(s, \"\")\n\ts = strings.TrimSuffix(s, \"-\")\n\n\treturn strings.ToLower(s)\n}\n\nfunc normalizeResourceNameWithRandom(s string, rand bool) string {\n\tspecialChars := `-<>()*#{}[]|@_ .%'\",&`\n\tfor _, c := range specialChars {\n\t\ts = strings.ReplaceAll(s, string(c), \"_\")\n\t}\n\ts = regexp.MustCompile(`^[^a-zA-Z_]+`).ReplaceAllLiteralString(s, \"\")\n\ts = strings.TrimSuffix(s, \"`_\")\n\tif rand {\n\t\trandString := RandStringBytes(4)\n\t\treturn fmt.Sprintf(\"%s_%s\", strings.ToLower(s), randString)\n\t}\n\treturn strings.ToLower(s)\n}\n\nconst letterBytes = \"abcdefghijklmnopqrstuvwxyz0123456789\"\n\nfunc RandStringBytes(n int) string {\n\tb := make([]byte, n)\n\tfor i := range b {\n\t\tb[i] = letterBytes[rand.Intn(len(letterBytes))]\n\t}\n\treturn string(b)\n}\n\n// escapeDollar modifies ${ into $${ recursively\nfunc escapeDollar(item map[string]interface{}) map[string]interface{} {\n\tfor k, f := range item {\n\t\tswitch v := f.(type) {\n\t\tcase string:\n\t\t\titem[k] = strings.ReplaceAll(v, \"${\", \"$${\")\n\t\tcase map[string]interface{}:\n\t\t\titem[k] = escapeDollar(v)\n\t\tcase []interface{}:\n\t\t\tfor i, s := range v {\n\t\t\t\tif str, ok := s.(string); ok {\n\t\t\t\t\tv[i] = strings.ReplaceAll(str, \"${\", \"$${\")\n\t\t\t\t}\n\t\t\t}\n\t\t\titem[k] = v\n\t\t}\n\t}\n\treturn item\n}\n"
  },
  {
    "path": "providers/okta/idp_oidc.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta/query\"\n)\n\ntype IdpOIDCGenerator struct {\n\tOktaService\n}\n\nfunc (g IdpOIDCGenerator) createResources(idpOIDCList []*okta.IdentityProvider) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, idp := range idpOIDCList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tidp.Id,\n\t\t\t\"idp_\"+normalizeResourceName(idp.Type+\"_\"+idp.Name),\n\t\t\t\"okta_idp_oidc\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\n\t}\n\treturn resources\n}\n\nfunc (g *IdpOIDCGenerator) InitResources() error {\n\tctx, client, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tidentityProviders, err := getIdpOIDC(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(identityProviders)\n\treturn nil\n}\n\nfunc getIdpOIDC(ctx context.Context, client *okta.Client) ([]*okta.IdentityProvider, error) {\n\tqp := &query.Params{Type: \"OIDC\", Limit: 1}\n\toutput, resp, err := client.IdentityProvider.ListIdentityProviders(ctx, qp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextIdpOIDCSet []*okta.IdentityProvider\n\t\tresp, _ = resp.Next(ctx, &nextIdpOIDCSet)\n\t\toutput = append(output, nextIdpOIDCSet...)\n\t}\n\n\treturn output, nil\n}\n"
  },
  {
    "path": "providers/okta/idp_saml.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta/query\"\n)\n\ntype IdpSAMLGenerator struct {\n\tOktaService\n}\n\nfunc (g IdpSAMLGenerator) createResources(idpSAMLList []*okta.IdentityProvider) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, idp := range idpSAMLList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tidp.Id,\n\t\t\t\"idp_\"+normalizeResourceName(idp.Type+\"_\"+idp.Name),\n\t\t\t\"okta_idp_saml\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\n\t}\n\treturn resources\n}\n\nfunc (g *IdpSAMLGenerator) InitResources() error {\n\tctx, client, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tidentityProviders, err := getIdpSAML(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(identityProviders)\n\treturn nil\n}\n\nfunc getIdpSAML(ctx context.Context, client *okta.Client) ([]*okta.IdentityProvider, error) {\n\tqp := &query.Params{Type: \"SAML2\", Limit: 1}\n\toutput, resp, err := client.IdentityProvider.ListIdentityProviders(ctx, qp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextIdpSAMLSet []*okta.IdentityProvider\n\t\tresp, err = resp.Next(ctx, &nextIdpSAMLSet)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\toutput = append(output, nextIdpSAMLSet...)\n\t}\n\n\treturn output, nil\n}\n"
  },
  {
    "path": "providers/okta/idp_social.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta/query\"\n)\n\ntype IdpSocialGenerator struct {\n\tOktaService\n}\n\nfunc (g IdpSocialGenerator) createResources(idpSocialList []*okta.IdentityProvider) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, idp := range idpSocialList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tidp.Id,\n\t\t\t\"idp_\"+normalizeResourceName(idp.Type+\"_\"+idp.Name),\n\t\t\t\"okta_idp_social\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\n\t}\n\treturn resources\n}\n\n// Generate Terraform Resources from Okta API,\nfunc (g *IdpSocialGenerator) InitResources() error {\n\tctx, client, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tidentityProviders, err := getIdpSocials(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(identityProviders)\n\treturn nil\n}\n\nfunc getIdpSocials(ctx context.Context, client *okta.Client) ([]*okta.IdentityProvider, error) {\n\tidpSocialTypes := []string{\"APPLE\", \"FACEBOOK\", \"GOOGLE\", \"LINKEDIN\", \"MICROSOFT\"}\n\tvar allIDPSocials []*okta.IdentityProvider\n\n\tfor _, idpSocialType := range idpSocialTypes {\n\t\tqp := &query.Params{Type: idpSocialType, Limit: 1}\n\t\toutput, resp, err := client.IdentityProvider.ListIdentityProviders(ctx, qp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor resp.HasNextPage() {\n\t\t\tvar nextIdpSocialSet []*okta.IdentityProvider\n\t\t\tresp, _ = resp.Next(ctx, &nextIdpSocialSet)\n\t\t\toutput = append(output, nextIdpSocialSet...)\n\t\t}\n\n\t\tallIDPSocials = append(allIDPSocials, output...)\n\t}\n\n\treturn allIDPSocials, nil\n}\n"
  },
  {
    "path": "providers/okta/inline_hook.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype InlineHookGenerator struct {\n\tOktaService\n}\n\nfunc (g InlineHookGenerator) createResources(inlineHookList []*okta.InlineHook) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, inlineHook := range inlineHookList {\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tinlineHook.Id,\n\t\t\t\"inline_hook_\"+inlineHook.Name,\n\t\t\t\"okta_inline_hook\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *InlineHookGenerator) InitResources() error {\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\toutput, resp, err := client.InlineHook.ListInlineHooks(ctx, nil)\n\tif err != nil {\n\t\treturn e\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextInlineHookSet []*okta.InlineHook\n\t\tresp, _ = resp.Next(ctx, &nextInlineHookSet)\n\t\toutput = append(output, nextInlineHookSet...)\n\t}\n\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/network_zone.go",
    "content": "// Copyright 2021 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v5/okta\"\n)\n\ntype NetworkZoneGenerator struct {\n\tOktaService\n}\n\nfunc (g *NetworkZoneGenerator) createResources(networkZoneList []okta.ListNetworkZones200ResponseInner) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, networkZone := range networkZoneList {\n\t\tvar id, name, zoneType *string\n\n\t\t// Handle each type of network zone\n\t\tswitch {\n\t\tcase networkZone.DynamicNetworkZone != nil:\n\t\t\tid = networkZone.DynamicNetworkZone.Id\n\t\t\tname = &networkZone.DynamicNetworkZone.Name\n\t\t\tzoneType = &networkZone.DynamicNetworkZone.Type\n\t\tcase networkZone.EnhancedDynamicNetworkZone != nil:\n\t\t\tid = networkZone.EnhancedDynamicNetworkZone.Id\n\t\t\tname = &networkZone.EnhancedDynamicNetworkZone.Name\n\t\t\tzoneType = &networkZone.EnhancedDynamicNetworkZone.Type\n\t\tcase networkZone.IPNetworkZone != nil:\n\t\t\tid = networkZone.IPNetworkZone.Id\n\t\t\tname = &networkZone.IPNetworkZone.Name\n\t\t\tzoneType = &networkZone.IPNetworkZone.Type\n\t\tdefault:\n\t\t\tfmt.Println(\"Unknown or unsupported network zone type encountered\")\n\t\t\tcontinue\n\t\t}\n\n\t\t// Ensure all required fields are present before creating the resource\n\t\tif id != nil && *name != \"\" && *zoneType != \"\" {\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\t*id,\n\t\t\t\tnormalizeResourceName(*id+\"_\"+*name),\n\t\t\t\t\"okta_network_zone\",\n\t\t\t\t\"okta\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresources = append(resources, resource)\n\t\t}\n\t}\n\treturn resources\n}\n\nfunc (g *NetworkZoneGenerator) InitResources() error {\n\tctx, client, err := g.ClientV5()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create Okta client: %w\", err)\n\t}\n\n\tnetworkZoneList, resp, err := client.NetworkZoneAPI.ListNetworkZones(ctx).Execute()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error listing network zones: %w\", err)\n\t}\n\n\tallZones := networkZoneList\n\n\tfor resp.HasNextPage() {\n\t\tvar nextZoneSet []okta.ListNetworkZones200ResponseInner\n\t\tresp, err = resp.Next(&nextZoneSet)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error fetching next page of network zones: %w\", err)\n\t\t}\n\t\tallZones = append(allZones, nextZoneSet...)\n\t}\n\n\tg.Resources = g.createResources(allZones)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/okta_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/providerwrapper\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype OktaProvider struct { //nolint\n\tterraformutils.Provider\n\torgName  string\n\tbaseURL  string\n\tapiToken string\n}\n\nfunc (p *OktaProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"okta\": map[string]interface{}{\n\t\t\t\t\"version\": providerwrapper.GetProviderVersion(p.GetName()),\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (p *OktaProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"alerts\": {\"alert_notification_endpoints\": []string{\"alert_notification_endpoints\", \"id\"}},\n\t}\n}\n\nfunc (p *OktaProvider) Init(args []string) error {\n\torgName := os.Getenv(\"OKTA_ORG_NAME\")\n\tif orgName == \"\" {\n\t\treturn errors.New(\"set OKTA_ORG_NAME env var\")\n\t}\n\tp.orgName = orgName\n\n\tbaseURL := os.Getenv(\"OKTA_BASE_URL\")\n\tif baseURL == \"\" {\n\t\treturn errors.New(\"set OKTA_BASE_URL env var\")\n\t}\n\tp.baseURL = baseURL\n\n\tapiToken := os.Getenv(\"OKTA_API_TOKEN\")\n\tif apiToken == \"\" {\n\t\treturn errors.New(\"set OKTA_API_TOKEN env var\")\n\t}\n\tp.apiToken = apiToken\n\n\treturn nil\n}\n\nfunc (p *OktaProvider) GetName() string {\n\treturn \"okta\"\n}\n\nfunc (p *OktaProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" is not a supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"org_name\":  p.orgName,\n\t\t\"base_url\":  p.baseURL,\n\t\t\"api_token\": p.apiToken,\n\t})\n\treturn nil\n}\n\nfunc (p *OktaProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"okta_app_three_field\":           &AppThreeFieldGenerator{},\n\t\t\"okta_app_swa\":                   &AppSWAGenerator{},\n\t\t\"okta_app_secure_password_store\": &AppSecurePasswordStoreGenerator{},\n\t\t\"okta_app_basic_auth\":            &AppBasicAuthGenerator{},\n\t\t\"okta_app_auto_login\":            &AppAutoLoginGenerator{},\n\t\t\"okta_app_bookmark\":              &AppBookmarkGenerator{},\n\t\t\"okta_app_saml\":                  &AppSamlGenerator{},\n\t\t\"okta_app_oauth\":                 &AppOAuthGenerator{},\n\t\t\"okta_app_signon_policy\":         &AppSignOnPolicyGenerator{},\n\t\t\"okta_app_signon_policy_rule\":    &AppSignOnPolicyRuleGenerator{},\n\t\t\"okta_idp_oidc\":                  &IdpOIDCGenerator{},\n\t\t\"okta_idp_saml\":                  &IdpSAMLGenerator{},\n\t\t\"okta_idp_social\":                &IdpSocialGenerator{},\n\t\t\"okta_factor\":                    &FactorGenerator{},\n\t\t\"okta_network_zone\":              &NetworkZoneGenerator{},\n\t\t\"okta_trusted_origin\":            &TrustedOriginGenerator{},\n\t\t\"okta_user\":                      &UserGenerator{},\n\t\t\"okta_template_sms\":              &SMSTemplateGenerator{},\n\t\t\"okta_user_type\":                 &UserTypeGenerator{},\n\t\t\"okta_group\":                     &GroupGenerator{},\n\t\t\"okta_group_rule\":                &GroupRuleGenerator{},\n\t\t\"okta_event_hook\":                &EventHookGenerator{},\n\t\t\"okta_inline_hook\":               &EventHookGenerator{},\n\t\t\"okta_policy_password\":           &PasswordPolicyGenerator{},\n\t\t\"okta_policy_rule_password\":      &PasswordPolicyRuleGenerator{},\n\t\t\"okta_policy_signon\":             &SignOnPolicyGenerator{},\n\t\t\"okta_policy_rule_signon\":        &SignOnPolicyRuleGenerator{},\n\t\t\"okta_policy_mfa\":                &MFAPolicyGenerator{},\n\t\t\"okta_policy_rule_mfa\":           &MFAPolicyRuleGenerator{},\n\t\t\"okta_auth_server\":               &AuthorizationServerGenerator{},\n\t\t\"okta_auth_server_scope\":         &AuthorizationServerScopeGenerator{},\n\t\t\"okta_auth_server_claim\":         &AuthorizationServerClaimGenerator{},\n\t\t\"okta_auth_server_policy\":        &AuthorizationServerPolicyGenerator{},\n\t\t\"okta_auth_server_policy_rule\":   &AuthorizationServerPolicyRuleGenerator{},\n\t\t\"okta_user_schema\":               &UserSchemaPropertyGenerator{},\n\t\t\"okta_app_user_schema\":           &AppUserSchemaPropertyGenerator{},\n\t\t\"okta_authenticator\":             &AuthenticatorGenerator{},\n\t}\n}\n\n// GetConfig returns the provider configuration for Okta\nfunc (p *OktaProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"base_url\":  cty.StringVal(p.baseURL),\n\t\t\"api_token\": cty.StringVal(p.apiToken),\n\t\t\"org_name\":  cty.StringVal(p.orgName),\n\t})\n}\n"
  },
  {
    "path": "providers/okta/okta_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//\thttp://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\toktaV2 \"github.com/okta/okta-sdk-golang/v2/okta\"\n\toktaV5 \"github.com/okta/okta-sdk-golang/v5/okta\"\n\t\"github.com/okta/terraform-provider-okta/sdk\"\n)\n\ntype OktaService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *OktaService) Client() (context.Context, *oktaV2.Client, error) {\n\torgName := s.Args[\"org_name\"].(string)\n\tbaseURL := s.Args[\"base_url\"].(string)\n\tapiToken := s.Args[\"api_token\"].(string)\n\n\torgURL := fmt.Sprintf(\"https://%v.%v\", orgName, baseURL)\n\n\tctx, client, err := oktaV2.NewClient(\n\t\tcontext.Background(),\n\t\toktaV2.WithOrgUrl(orgURL),\n\t\toktaV2.WithToken(apiToken),\n\t)\n\tif err != nil {\n\t\treturn ctx, nil, err\n\t}\n\n\treturn ctx, client, nil\n}\n\nfunc (s *OktaService) ClientV5() (context.Context, *oktaV5.APIClient, error) {\n\torgName := s.Args[\"org_name\"].(string)\n\tbaseURL := s.Args[\"base_url\"].(string)\n\tapiToken := s.Args[\"api_token\"].(string)\n\n\torgURL := fmt.Sprintf(\"https://%v.%v\", orgName, baseURL)\n\n\tconfig, err := oktaV5.NewConfiguration(\n\t\toktaV5.WithOrgUrl(orgURL),\n\t\toktaV5.WithToken(apiToken),\n\t)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tclient := oktaV5.NewAPIClient(config)\n\n\treturn context.Background(), client, nil\n}\n\nfunc (s *OktaService) APISupplementClient() (context.Context, *sdk.APISupplement, error) {\n\tbaseURL := s.Args[\"base_url\"].(string)\n\torgName := s.Args[\"org_name\"].(string)\n\tapiToken := s.Args[\"api_token\"].(string)\n\n\torgURL := fmt.Sprintf(\"https://%v.%v\", orgName, baseURL)\n\n\tctx, client, err := oktaV2.NewClient(\n\t\tcontext.Background(),\n\t\toktaV2.WithOrgUrl(orgURL),\n\t\toktaV2.WithToken(apiToken),\n\t)\n\tif err != nil {\n\t\treturn ctx, nil, err\n\t}\n\n\tapiSupplementClient := &sdk.APISupplement{\n\t\tRequestExecutor: client.CloneRequestExecutor(),\n\t}\n\n\treturn ctx, apiSupplementClient, nil\n}\n"
  },
  {
    "path": "providers/okta/policy_mfa.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta/query\"\n)\n\ntype MFAPolicyGenerator struct {\n\tOktaService\n}\n\nfunc (g MFAPolicyGenerator) createResources(mfaPolicyList []*okta.Policy) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, mfaPolicy := range mfaPolicyList {\n\t\tresourceName := normalizeResourceName(mfaPolicy.Name)\n\t\tresourceType := \"okta_policy_mfa\"\n\t\tif mfaPolicy.Name == \"Default Policy\" {\n\t\t\tresourceType = \"okta_policy_mfa_default\"\n\t\t}\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tmfaPolicy.Id,\n\t\t\t\"policy_mfa_\"+resourceName,\n\t\t\tresourceType,\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *MFAPolicyGenerator) InitResources() error {\n\tvar output []*okta.Policy\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\toutput, _ = getMFAPolicies(ctx, client)\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n\nfunc getMFAPolicies(ctx context.Context, client *okta.Client) ([]*okta.Policy, error) {\n\tqp := query.NewQueryParams(query.WithType(\"MFA_ENROLL\"))\n\tvar policies []*okta.Policy\n\tdata, resp, err := client.Policy.ListPolicies(ctx, qp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextPolicies []*okta.Policy\n\t\tresp, _ = resp.Next(ctx, &nextPolicies)\n\t\tpolicies = append(policies, nextPolicies...)\n\t}\n\tfor _, p := range data {\n\t\tpolicies = append(policies, p.(*okta.Policy))\n\t}\n\n\treturn policies, nil\n}\n"
  },
  {
    "path": "providers/okta/policy_password.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta/query\"\n)\n\ntype PasswordPolicyGenerator struct {\n\tOktaService\n}\n\nfunc (g PasswordPolicyGenerator) createResources(passwordPolicyList []*okta.Policy) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, passwordPolicy := range passwordPolicyList {\n\t\tresourceName := normalizeResourceName(passwordPolicy.Name)\n\t\tresourceType := \"okta_policy_password\"\n\t\tif passwordPolicy.Name == \"Default Policy\" {\n\t\t\tresourceType = \"okta_policy_password_default\"\n\t\t}\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tpasswordPolicy.Id,\n\t\t\t\"policy_password_\"+resourceName,\n\t\t\tresourceType,\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *PasswordPolicyGenerator) InitResources() error {\n\tvar output []*okta.Policy\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\toutput, _ = getPasswordPolicies(ctx, client)\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n\nfunc getPasswordPolicies(ctx context.Context, client *okta.Client) ([]*okta.Policy, error) {\n\tqp := query.NewQueryParams(query.WithType(\"PASSWORD\"))\n\tvar policies []*okta.Policy\n\tdata, resp, err := client.Policy.ListPolicies(ctx, qp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextPolicies []*okta.Policy\n\t\tresp, _ = resp.Next(ctx, &nextPolicies)\n\t\tpolicies = append(policies, nextPolicies...)\n\t}\n\tfor _, p := range data {\n\t\tpolicies = append(policies, p.(*okta.Policy))\n\t}\n\n\treturn policies, nil\n}\n"
  },
  {
    "path": "providers/okta/policy_rule_mfa.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/terraform-provider-okta/sdk\"\n)\n\ntype MFAPolicyRuleGenerator struct {\n\tOktaService\n}\n\nfunc (g MFAPolicyRuleGenerator) createResources(mfaPolicyRuleList []sdk.PolicyRule, policyID string, policyName string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, policyRule := range mfaPolicyRuleList {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tpolicyRule.Id,\n\t\t\t\"policyrule_mfa_\"+normalizeResourceName(policyName+\"_\"+policyRule.Name),\n\t\t\t\"okta_policy_rule_mfa\",\n\t\t\t\"okta\",\n\t\t\tmap[string]string{\n\t\t\t\t\"policy_id\": policyID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *MFAPolicyRuleGenerator) InitResources() error {\n\tvar resources []terraformutils.Resource\n\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tmfaPolicies, err := getMFAPolicies(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, policy := range mfaPolicies {\n\t\toutput, err := getMFAPolicyRules(g, policy.Id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresources = append(resources, g.createResources(output, policy.Id, policy.Name)...)\n\t}\n\n\tg.Resources = resources\n\treturn nil\n}\n\nfunc getMFAPolicyRules(g *MFAPolicyRuleGenerator, policyID string) ([]sdk.PolicyRule, error) {\n\tctx, client, e := g.APISupplementClient()\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\toutput, resp, err := client.ListPolicyRules(ctx, policyID)\n\tif err != nil {\n\t\treturn nil, e\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextPolicySet []sdk.PolicyRule\n\t\tresp, _ = resp.Next(ctx, &nextPolicySet)\n\t\toutput = append(output, nextPolicySet...)\n\t}\n\n\treturn output, nil\n}\n"
  },
  {
    "path": "providers/okta/policy_rule_password.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/terraform-provider-okta/sdk\"\n)\n\ntype PasswordPolicyRuleGenerator struct {\n\tOktaService\n}\n\nfunc (g PasswordPolicyRuleGenerator) createResources(passwordPolicyRuleList []sdk.PolicyRule, policyID string, policyName string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, policyRule := range passwordPolicyRuleList {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tpolicyRule.Id,\n\t\t\t\"policyrule_password_\"+normalizeResourceName(policyName+\"_\"+policyRule.Name),\n\t\t\t\"okta_policy_rule_password\",\n\t\t\t\"okta\",\n\t\t\tmap[string]string{\n\t\t\t\t\"policy_id\": policyID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PasswordPolicyRuleGenerator) InitResources() error {\n\tvar resources []terraformutils.Resource\n\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tpasswordPolicies, err := getPasswordPolicies(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, policy := range passwordPolicies {\n\t\toutput, err := getPasswordPolicyRules(g, policy.Id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresources = append(resources, g.createResources(output, policy.Id, policy.Name)...)\n\t}\n\n\tg.Resources = resources\n\treturn nil\n}\n\nfunc getPasswordPolicyRules(g *PasswordPolicyRuleGenerator, policyID string) ([]sdk.PolicyRule, error) {\n\tctx, client, e := g.APISupplementClient()\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\toutput, resp, err := client.ListPolicyRules(ctx, policyID)\n\tif err != nil {\n\t\treturn nil, e\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextPolicySet []sdk.PolicyRule\n\t\tresp, _ = resp.Next(ctx, &nextPolicySet)\n\t\toutput = append(output, nextPolicySet...)\n\t}\n\n\treturn output, nil\n}\n"
  },
  {
    "path": "providers/okta/policy_rule_signon.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/terraform-provider-okta/sdk\"\n)\n\ntype SignOnPolicyRuleGenerator struct {\n\tOktaService\n}\n\nfunc (g SignOnPolicyRuleGenerator) createResources(signOnPolicyRuleList []sdk.PolicyRule, policyID string, policyName string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, policyRule := range signOnPolicyRuleList {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tpolicyRule.Id,\n\t\t\t\"policyrule_signon_\"+normalizeResourceName(policyName+\"_\"+policyRule.Name),\n\t\t\t\"okta_policy_rule_signon\",\n\t\t\t\"okta\",\n\t\t\tmap[string]string{\n\t\t\t\t\"policy_id\": policyID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *SignOnPolicyRuleGenerator) InitResources() error {\n\tvar resources []terraformutils.Resource\n\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tsignOnPolicies, err := getSignOnPolicies(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, policy := range signOnPolicies {\n\t\toutput, err := getSignOnPolicyRules(g, policy.Id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tresources = append(resources, g.createResources(output, policy.Id, policy.Name)...)\n\t}\n\n\tg.Resources = resources\n\treturn nil\n}\n\nfunc getSignOnPolicyRules(g *SignOnPolicyRuleGenerator, policyID string) ([]sdk.PolicyRule, error) {\n\tctx, client, e := g.APISupplementClient()\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\toutput, resp, err := client.ListPolicyRules(ctx, policyID)\n\tif err != nil {\n\t\treturn nil, e\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextPolicySet []sdk.PolicyRule\n\t\tresp, _ = resp.Next(ctx, &nextPolicySet)\n\t\toutput = append(output, nextPolicySet...)\n\t}\n\n\treturn output, nil\n}\n"
  },
  {
    "path": "providers/okta/policy_signon.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta/query\"\n)\n\ntype SignOnPolicyGenerator struct {\n\tOktaService\n}\n\nfunc (g SignOnPolicyGenerator) createResources(signOnPolicyList []*okta.Policy) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, signOnPolicy := range signOnPolicyList {\n\t\tresourceName := normalizeResourceName(signOnPolicy.Name)\n\t\tresourceType := \"okta_policy_signon\"\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tsignOnPolicy.Id,\n\t\t\t\"policy_signon_\"+resourceName,\n\t\t\tresourceType,\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *SignOnPolicyGenerator) InitResources() error {\n\tvar output []*okta.Policy\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\toutput, _ = getSignOnPolicies(ctx, client)\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n\nfunc getSignOnPolicies(ctx context.Context, client *okta.Client) ([]*okta.Policy, error) {\n\tqp := query.NewQueryParams(query.WithType(\"OKTA_SIGN_ON\"))\n\tvar policies []*okta.Policy\n\tdata, resp, err := client.Policy.ListPolicies(ctx, qp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextPolicies []*okta.Policy\n\t\tresp, _ = resp.Next(ctx, &nextPolicies)\n\t\tpolicies = append(policies, nextPolicies...)\n\t}\n\tfor _, p := range data {\n\t\tpolicies = append(policies, p.(*okta.Policy))\n\t}\n\n\treturn policies, nil\n}\n"
  },
  {
    "path": "providers/okta/template_sms.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype SMSTemplateGenerator struct {\n\tOktaService\n}\n\nfunc (g SMSTemplateGenerator) createResources(smsTemplateList []*okta.SmsTemplate) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, smsTemplate := range smsTemplateList {\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tsmsTemplate.Id,\n\t\t\t\"template_sms_\"+smsTemplate.Name,\n\t\t\t\"okta_template_sms\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *SMSTemplateGenerator) InitResources() error {\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\toutput, resp, err := client.SmsTemplate.ListSmsTemplates(ctx, nil)\n\tif err != nil {\n\t\treturn e\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextSmsTemplateSet []*okta.SmsTemplate\n\t\tresp, _ = resp.Next(ctx, &nextSmsTemplateSet)\n\t\toutput = append(output, nextSmsTemplateSet...)\n\t}\n\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/trusted_origin.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype TrustedOriginGenerator struct {\n\tOktaService\n}\n\nfunc (g TrustedOriginGenerator) createResources(trustedOriginList []*okta.TrustedOrigin) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, trustedOrigin := range trustedOriginList {\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\ttrustedOrigin.Id,\n\t\t\t\"trusted_origin_\"+trustedOrigin.Id,\n\t\t\t\"okta_trusted_origin\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *TrustedOriginGenerator) InitResources() error {\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\toutput, resp, err := client.TrustedOrigin.ListOrigins(ctx, nil)\n\tif err != nil {\n\t\treturn e\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextTrustedOriginSet []*okta.TrustedOrigin\n\t\tresp, _ = resp.Next(ctx, &nextTrustedOriginSet)\n\t\toutput = append(output, nextTrustedOriginSet...)\n\t}\n\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/user.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v5/okta\"\n)\n\ntype UserGenerator struct {\n\tOktaService\n}\n\nfunc (g UserGenerator) createResources(userList []okta.User) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, user := range userList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tuser.GetId(),\n\t\t\t\"user_\"+user.GetId(),\n\t\t\t\"okta_user\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *UserGenerator) InitResources() error {\n\tctx, client, err := g.ClientV5()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toutput, resp, err := client.UserAPI.ListUsers(ctx).Execute()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextUserSet []okta.User\n\t\tresp, _ = resp.Next(&nextUserSet)\n\t\toutput = append(output, nextUserSet...)\n\t}\n\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/okta/user_schema.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"context\"\n\t\"net/url\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype UserSchemaPropertyGenerator struct {\n\tOktaService\n}\n\nfunc (g UserSchemaPropertyGenerator) createResources(userSchema *okta.UserSchema, userTypeID string, userTypeName string) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor index := range userSchema.Definitions.Custom.Properties {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tindex,\n\t\t\tnormalizeResourceName(userTypeName)+\"_property_\"+normalizeResourceName(index),\n\t\t\t\"okta_user_schema_property\",\n\t\t\t\"okta\",\n\t\t\tmap[string]string{\n\t\t\t\t\"index\":     index,\n\t\t\t\t\"user_type\": userTypeID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\tfor index := range userSchema.Definitions.Base.Properties {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tindex,\n\t\t\tnormalizeResourceName(userTypeName)+\"_property_\"+normalizeResourceName(index),\n\t\t\t\"okta_user_base_schema_property\",\n\t\t\t\"okta\",\n\t\t\tmap[string]string{\n\t\t\t\t\"index\":     index,\n\t\t\t\t\"user_type\": userTypeID,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *UserSchemaPropertyGenerator) InitResources() error {\n\tvar resources []terraformutils.Resource\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\tuserTypes, err := getUserTypes(ctx, client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, userType := range userTypes {\n\t\tschemaID := getUserTypeSchemaID(userType)\n\t\tif schemaID != \"\" {\n\t\t\tschema, _, err := client.UserSchema.GetUserSchema(ctx, schemaID)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tuserTypeID := \"default\"\n\t\t\tif userType.Name != \"user\" {\n\t\t\t\tuserTypeID = userType.Id\n\t\t\t}\n\n\t\t\tresources = append(resources, g.createResources(schema, userTypeID, userType.Name)...)\n\t\t}\n\t}\n\n\tg.Resources = resources\n\treturn nil\n}\n\nfunc getUserTypes(ctx context.Context, client *okta.Client) ([]*okta.UserType, error) {\n\toutput, resp, err := client.UserType.ListUserTypes(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextUserTypeSet []*okta.UserType\n\t\tresp, _ = resp.Next(ctx, &nextUserTypeSet)\n\t\toutput = append(output, nextUserTypeSet...)\n\t}\n\n\treturn output, nil\n}\n\nfunc getUserTypeSchemaID(ut *okta.UserType) string {\n\tfm, ok := ut.Links.(map[string]interface{})\n\tif ok {\n\t\tsm, ok := fm[\"schema\"].(map[string]interface{})\n\t\tif ok {\n\t\t\thref, ok := sm[\"href\"].(string)\n\t\t\tif ok {\n\t\t\t\tu, _ := url.Parse(href)\n\t\t\t\treturn strings.TrimPrefix(u.EscapedPath(), \"/api/v1/meta/schemas/user/\")\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\"\n}\n"
  },
  {
    "path": "providers/okta/user_type.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage okta\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/okta/okta-sdk-golang/v2/okta\"\n)\n\ntype UserTypeGenerator struct {\n\tOktaService\n}\n\nfunc (g UserTypeGenerator) createResources(userTypeList []*okta.UserType) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, userType := range userTypeList {\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tuserType.Id,\n\t\t\t\"usertype_\"+userType.Name,\n\t\t\t\"okta_user_type\",\n\t\t\t\"okta\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *UserTypeGenerator) InitResources() error {\n\tctx, client, e := g.Client()\n\tif e != nil {\n\t\treturn e\n\t}\n\n\toutput, resp, err := client.UserType.ListUserTypes(ctx)\n\tif err != nil {\n\t\treturn e\n\t}\n\n\tfor resp.HasNextPage() {\n\t\tvar nextUserTypeSet []*okta.UserType\n\t\tresp, _ = resp.Next(ctx, &nextUserTypeSet)\n\t\toutput = append(output, nextUserTypeSet...)\n\t}\n\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/opal/group.go",
    "content": "package opal\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype GroupGenerator struct {\n\tOpalService\n}\n\nfunc (g *GroupGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list opal groups: %v\", err)\n\t}\n\n\tgroups, _, err := client.GroupsApi.GetGroups(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list opal groups: %v\", err)\n\t}\n\n\tcountByName := make(map[string]int)\n\n\tfor {\n\t\tfor _, group := range groups.Results {\n\t\t\tname := normalizeResourceName(*group.Name)\n\t\t\tif count, ok := countByName[name]; ok {\n\t\t\t\tcountByName[name] = count + 1\n\t\t\t\tname = normalizeResourceName(fmt.Sprintf(\"%s_%d\", *group.Name, count+1))\n\t\t\t} else {\n\t\t\t\tcountByName[name] = 1\n\t\t\t}\n\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tgroup.GroupId,\n\t\t\t\tname,\n\t\t\t\t\"opal_group\",\n\t\t\t\t\"opal\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\n\t\tif !groups.HasNext() || groups.Next.Get() == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tgroups, _, err = client.GroupsApi.GetGroups(context.TODO()).Cursor(*groups.Next.Get()).Execute()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to list opal groups: %v\", err)\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/opal/helpers.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage opal\n\nimport (\n\t\"strings\"\n\t\"unicode\"\n\n\t\"golang.org/x/text/secure/precis\"\n\t\"golang.org/x/text/transform\"\n\t\"golang.org/x/text/unicode/norm\"\n)\n\nfunc normalizeResourceName(s string) string {\n\tnormalize := precis.NewIdentifier(\n\t\tprecis.AdditionalMapping(func() transform.Transformer {\n\t\t\treturn transform.Chain(norm.NFD, transform.RemoveFunc(func(r rune) bool { //nolint\n\t\t\t\treturn unicode.Is(unicode.Mn, r)\n\t\t\t}))\n\t\t}),\n\t\tprecis.Norm(norm.NFC),\n\t)\n\tr := strings.NewReplacer(\" \", \"_\",\n\t\t\"!\", \"_\",\n\t\t\"\\\"\", \"_\",\n\t\t\"#\", \"_\",\n\t\t\"%\", \"_\",\n\t\t\"&\", \"_\",\n\t\t\"'\", \"_\",\n\t\t\"(\", \"_\",\n\t\t\")\", \"_\",\n\t\t\"{\", \"_\",\n\t\t\"}\", \"_\",\n\t\t\"*\", \"_\",\n\t\t\"+\", \"_\",\n\t\t\",\", \"_\",\n\t\t\"-\", \"_\",\n\t\t\".\", \"_\",\n\t\t\"/\", \"slash\",\n\t\t\"|\", \"_\",\n\t\t\"\\\\\", \"_\",\n\t\t\":\", \"_\",\n\t\t\";\", \"_\",\n\t\t\">\", \"_\",\n\t\t\"=\", \"_\",\n\t\t\"<\", \"_\",\n\t\t\"?\", \"_\",\n\t\t\"[\", \"_\",\n\t\t\"]\", \"_\",\n\t\t\"^\", \"_\",\n\t\t\"`\", \"_\",\n\t\t\"~\", \"_\",\n\t\t\"$\", \"_\",\n\t\t\"@\", \"_at_\")\n\tnormalizedString, _ := normalize.String(r.Replace(strings.ToLower(s)))\n\treturn normalizedString\n}\n"
  },
  {
    "path": "providers/opal/message_channel.go",
    "content": "package opal\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype MessageChannelGenerator struct {\n\tOpalService\n}\n\nfunc (g *MessageChannelGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list opal message channels: %v\", err)\n\t}\n\n\tmessageChannels, _, err := client.MessageChannelsApi.GetMessageChannels(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list opal message channels: %v\", err)\n\t}\n\n\tcountByName := make(map[string]int)\n\n\tfor _, channel := range messageChannels.Channels {\n\t\tname := normalizeResourceName(*channel.Name)\n\t\tif count, ok := countByName[name]; ok {\n\t\t\tcountByName[name] = count + 1\n\t\t\tname = normalizeResourceName(fmt.Sprintf(\"%s_%d\", *channel.Name, count+1))\n\t\t} else {\n\t\t\tcountByName[name] = 1\n\t\t}\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tchannel.MessageChannelId,\n\t\t\tname,\n\t\t\t\"opal_message_channel\",\n\t\t\t\"opal\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/opal/on_call_schedule.go",
    "content": "package opal\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype OnCallScheduleGenerator struct {\n\tOpalService\n}\n\nfunc (g *OnCallScheduleGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list opal on call schedules: %v\", err)\n\t}\n\n\tonCallSchedules, _, err := client.OnCallSchedulesApi.GetOnCallSchedules(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list opal on call schedules: %v\", err)\n\t}\n\n\tcountByName := make(map[string]int)\n\n\tfor _, onCallSchedule := range onCallSchedules.OnCallSchedules {\n\t\tname := normalizeResourceName(*onCallSchedule.Name)\n\t\tif count, ok := countByName[name]; ok {\n\t\t\tcountByName[name] = count + 1\n\t\t\tname = normalizeResourceName(fmt.Sprintf(\"%s_%d\", *onCallSchedule.Name, count+1))\n\t\t} else {\n\t\t\tcountByName[name] = 1\n\t\t}\n\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t*onCallSchedule.OnCallScheduleId,\n\t\t\tname,\n\t\t\t\"opal_on_call_schedule\",\n\t\t\t\"opal\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/opal/opal_provider.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage opal\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\nconst opalDefaultURL = \"https://api.opal.dev\"\n\ntype OpalProvider struct { //nolint\n\tterraformutils.Provider\n\ttoken   string\n\tbaseURL string\n}\n\nfunc (p OpalProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"opal\": map[string]interface{}{\n\t\t\t\t\"base_url\": p.baseURL,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (p *OpalProvider) GetName() string {\n\treturn \"opal\"\n}\n\nfunc (p *OpalProvider) GetSource() string {\n\treturn \"opalsecurity/opal\"\n}\n\nfunc (p OpalProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"resource\": {\n\t\t\t\"owner\": {\n\t\t\t\t\"admin_owner_id\", \"id\",\n\t\t\t\t\"reviewer_stage.reviewer.id\", \"id\",\n\t\t\t},\n\t\t\t\"group\": {\"visibility_group.id\", \"id\"},\n\t\t},\n\t\t\"group\": {\n\t\t\t\"owner\": {\n\t\t\t\t\"admin_owner_id\", \"id\",\n\t\t\t\t\"reviewer_stage.reviewer.id\", \"id\",\n\t\t\t},\n\t\t\t\"group\": {\"visibility_group.id\", \"id\"},\n\t\t\t\"message_channel\": {\n\t\t\t\t\"audit_message_channel.id\", \"id\",\n\t\t\t},\n\t\t\t\"on_call_schedule\": {\n\t\t\t\t\"on_call_schedule.id\", \"id\",\n\t\t\t},\n\t\t},\n\t\t\"owner\": {\n\t\t\t\"message_channel\": {\n\t\t\t\t\"reviewer_message_channel_id\", \"id\",\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (p *OpalProvider) Init(args []string) error {\n\tp.token = os.Getenv(\"OPAL_AUTH_TOKEN\")\n\tif p.token == \"\" {\n\t\treturn errors.New(\"the Opal API key must be set via `OPAL_AUTH_TOKEN` env var\")\n\t}\n\tp.baseURL = os.Getenv(\"OPAL_BASE_URL\")\n\tif p.baseURL == \"\" {\n\t\tp.baseURL = opalDefaultURL\n\t}\n\n\treturn nil\n}\n\nfunc (p *OpalProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"token\":    cty.StringVal(p.token),\n\t\t\"base_url\": cty.StringVal(p.baseURL),\n\t})\n}\n\nfunc (p *OpalProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"opal: \" + serviceName + \" is not a supported resource type\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"token\":    p.token,\n\t\t\"base_url\": p.baseURL,\n\t})\n\treturn nil\n}\n\nfunc (p *OpalProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"owner\":            &OwnerGenerator{},\n\t\t\"resource\":         &ResourceGenerator{},\n\t\t\"group\":            &GroupGenerator{},\n\t\t\"message_channel\":  &MessageChannelGenerator{},\n\t\t\"on_call_schedule\": &OnCallScheduleGenerator{},\n\t}\n}\n"
  },
  {
    "path": "providers/opal/opal_service.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage opal\n\nimport (\n\t\"fmt\"\n\t\"net/url\"\n\t\"path\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/opalsecurity/opal-go\"\n)\n\ntype OpalService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *OpalService) newClient() (*opal.APIClient, error) {\n\tconf := opal.NewConfiguration()\n\n\tconf.DefaultHeader[\"Authorization\"] = fmt.Sprintf(\"Bearer %s\", s.GetArgs()[\"token\"].(string))\n\tu, err := url.Parse(s.GetArgs()[\"base_url\"].(string))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu.Path = path.Join(u.Path, \"/v1\")\n\tconf.Servers = opal.ServerConfigurations{{\n\t\tURL: u.String(),\n\t}}\n\n\treturn opal.NewAPIClient(conf), nil\n}\n"
  },
  {
    "path": "providers/opal/owner.go",
    "content": "package opal\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype OwnerGenerator struct {\n\tOpalService\n}\n\nfunc (g *OwnerGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list opal owners: %v\", err)\n\t}\n\n\towners, _, err := client.OwnersApi.GetOwners(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list opal owners: %v\", err)\n\t}\n\n\tcountByName := make(map[string]int)\n\n\tfor {\n\t\tfor _, owner := range owners.Results {\n\t\t\tname := normalizeResourceName(*owner.Name)\n\t\t\tif count, ok := countByName[name]; ok {\n\t\t\t\tcountByName[name] = count + 1\n\t\t\t\tname = normalizeResourceName(fmt.Sprintf(\"%s_%d\", *owner.Name, count+1))\n\t\t\t} else {\n\t\t\t\tcountByName[name] = 1\n\t\t\t}\n\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\towner.OwnerId,\n\t\t\t\tname,\n\t\t\t\t\"opal_owner\",\n\t\t\t\t\"opal\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\n\t\tif !owners.HasNext() || owners.Next.Get() == nil {\n\t\t\tbreak\n\t\t}\n\n\t\towners, _, err = client.OwnersApi.GetOwners(context.TODO()).Cursor(*owners.Next.Get()).Execute()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to list opal owners: %v\", err)\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/opal/resource.go",
    "content": "package opal\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/opalsecurity/opal-go\"\n)\n\ntype ResourceGenerator struct {\n\tOpalService\n}\n\nfunc (g *ResourceGenerator) InitResources() error {\n\tclient, err := g.newClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list opal resources: %v\", err)\n\t}\n\n\tresources, _, err := client.ResourcesApi.GetResources(context.TODO()).Execute()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to list opal resources: %v\", err)\n\t}\n\n\tvar opalResources []*opal.Resource\n\tfor {\n\t\tfor _, resource := range resources.Results {\n\t\t\tresourceRef := resource\n\t\t\topalResources = append(opalResources, &resourceRef)\n\t\t}\n\n\t\tif !resources.HasNext() || resources.Next.Get() == nil {\n\t\t\tbreak\n\t\t}\n\n\t\tresources, _, err = client.ResourcesApi.GetResources(context.TODO()).Cursor(*resources.Next.Get()).Execute()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to list opal resources: %v\", err)\n\t\t}\n\t}\n\n\topalResourceByID := make(map[string]*opal.Resource)\n\tfor _, resource := range opalResources {\n\t\topalResourceByID[resource.ResourceId] = resource\n\t}\n\n\tseenNames := make(map[string]bool)\n\tfor _, resource := range opalResources {\n\t\ttfname := *resource.Name\n\t\tif resource.ResourceType != nil &&\n\t\t\t*resource.ResourceType == opal.RESOURCETYPEENUM_AWS_SSO_PERMISSION_SET &&\n\t\t\tresource.ParentResourceId != nil {\n\t\t\tparentAccount, ok := opalResourceByID[*resource.ParentResourceId]\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"could not find account for permission set: %#v\", resource)\n\t\t\t}\n\t\t\ttfname = fmt.Sprintf(\"%s_%s\", *parentAccount.Name, *resource.Name)\n\t\t}\n\n\t\tif seenNames[tfname] {\n\t\t\ttfname = tfname + \"_\" + resource.ResourceId[:8]\n\t\t} else {\n\t\t\tseenNames[tfname] = true\n\t\t}\n\n\t\ttfname = normalizeResourceName(tfname)\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tresource.ResourceId,\n\t\t\ttfname,\n\t\t\t\"opal_resource\",\n\t\t\t\"opal\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/openstack/blockstorage.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage openstack\n\nimport (\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/gophercloud/gophercloud\"\n\t\"github.com/gophercloud/gophercloud/openstack\"\n\t\"github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes\"\n\t\"github.com/gophercloud/gophercloud/pagination\"\n\t\"github.com/pkg/errors\"\n)\n\nvar resourceType = map[string]string{\n\t\"volumev3\": \"openstack_blockstorage_volume_v3\",\n\t\"volumev2\": \"openstack_blockstorage_volume_v2\",\n\t\"volume\":   \"openstack_blockstorage_volume_v1\",\n}\n\ntype BlockStorageGenerator struct {\n\tOpenStackService\n}\n\n// createResources iterate on all openstack_blockstorage_volume\nfunc (g *BlockStorageGenerator) createResources(list *pagination.Pager, clientType string) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\n\terr := list.EachPage(func(page pagination.Page) (bool, error) {\n\t\tvolumes, err := volumes.ExtractVolumes(page)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tfor _, v := range volumes {\n\t\t\t// Use volume ID as a name if the volume doesn't have a name\n\t\t\tname := v.Name\n\t\t\tif v.Name == \"\" {\n\t\t\t\tname = v.ID\n\t\t\t}\n\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tv.ID,\n\t\t\t\tname,\n\t\t\t\tresourceType[clientType],\n\t\t\t\t\"openstack\",\n\t\t\t\t[]string{},\n\t\t\t)\n\n\t\t\tresources = append(resources, resource)\n\t\t}\n\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn resources\n}\n\n// Creates a BlockStorage ServiceClient\nfunc newBlockStorageClent(provider *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) {\n\t// Choose v3 client firstly\n\tif client, err := openstack.NewBlockStorageV3(provider, eo); err == nil {\n\t\tlog.Println(\"Using BlockStorage API v3\")\n\t\treturn client, nil\n\t}\n\n\t// if it can't initialize v3 client, try to initialize v2 client\n\tif client, err := openstack.NewBlockStorageV2(provider, eo); err == nil {\n\t\tlog.Println(\"Using BlockStorage API v2\")\n\t\treturn client, nil\n\t}\n\n\t// if it can't initialize v2 client, try to initialize v1 client\n\tif client, err := openstack.NewBlockStorageV1(provider, eo); err == nil {\n\t\tlog.Println(\"Using BlockStorage API v1\")\n\t\treturn client, nil\n\t}\n\n\treturn nil, errors.New(\"Failed to initialize BlockStorage client\")\n}\n\n// Generate TerraformResources from OpenStack API,\nfunc (g *BlockStorageGenerator) InitResources() error {\n\topts, err := openstack.AuthOptionsFromEnv()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprovider, err := openstack.AuthenticatedClient(opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\teo := gophercloud.EndpointOpts{\n\t\tRegion: g.GetArgs()[\"region\"].(string),\n\t}\n\n\tclient, err := newBlockStorageClent(provider, eo)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlist := volumes.List(client, nil)\n\n\tg.Resources = g.createResources(&list, client.Type)\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/openstack/compute.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage openstack\n\nimport (\n\t\"log\"\n\t\"sort\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/gophercloud/gophercloud\"\n\t\"github.com/gophercloud/gophercloud/openstack\"\n\t\"github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes\"\n\t\"github.com/gophercloud/gophercloud/openstack/compute/v2/servers\"\n\t\"github.com/gophercloud/gophercloud/pagination\"\n)\n\ntype ComputeGenerator struct {\n\tOpenStackService\n}\n\n// createResources iterate on all openstack_compute_instance_v2\nfunc (g *ComputeGenerator) createResources(list *pagination.Pager, volclient *gophercloud.ServiceClient) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\n\terr := list.EachPage(func(page pagination.Page) (bool, error) {\n\t\tservers, err := servers.ExtractServers(page)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tfor _, s := range servers {\n\t\t\tvar bds = []map[string]interface{}{}\n\t\t\tvar vol []volumes.Volume\n\t\t\tt := map[string]interface{}{}\n\t\t\tif volclient != nil {\n\t\t\t\tfor _, av := range s.AttachedVolumes {\n\t\t\t\t\tonevol, err := volumes.Get(volclient, av.ID).Extract()\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\tvol = append(vol, *onevol)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsort.SliceStable(vol, func(i, j int) bool {\n\t\t\t\t\treturn vol[i].Attachments[0].Device < vol[j].Attachments[0].Device\n\t\t\t\t})\n\n\t\t\t\tvar bindex = 0\n\t\t\t\tvar dependsOn = \"\"\n\t\t\t\tfor _, v := range vol {\n\t\t\t\t\tif v.Bootable == \"true\" && v.VolumeImageMetadata != nil {\n\t\t\t\t\t\tbds = append(bds, map[string]interface{}{\n\t\t\t\t\t\t\t\"source_type\":           \"image\",\n\t\t\t\t\t\t\t\"uuid\":                  v.VolumeImageMetadata[\"image_id\"],\n\t\t\t\t\t\t\t\"volume_size\":           strconv.Itoa(v.Size),\n\t\t\t\t\t\t\t\"boot_index\":            strconv.Itoa(bindex),\n\t\t\t\t\t\t\t\"destination_type\":      \"volume\",\n\t\t\t\t\t\t\t\"delete_on_termination\": \"false\",\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbindex++\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttv := map[string]interface{}{}\n\t\t\t\t\t\tif dependsOn != \"\" {\n\t\t\t\t\t\t\ttv[\"depends_on\"] = []string{dependsOn}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tname := s.Name + strings.ReplaceAll(v.Attachments[0].Device, \"/dev/\", \"\")\n\t\t\t\t\t\trid := s.ID + \"/\" + v.ID\n\t\t\t\t\t\tresource := terraformutils.NewResource(\n\t\t\t\t\t\t\trid,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\"openstack_compute_volume_attach_v2\",\n\t\t\t\t\t\t\t\"openstack\",\n\t\t\t\t\t\t\tmap[string]string{},\n\t\t\t\t\t\t\t[]string{},\n\t\t\t\t\t\t\ttv,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tdependsOn = \"openstack_compute_volume_attach_v2.\" + terraformutils.TfSanitize(name)\n\t\t\t\t\t\ttv[\"instance_name\"] = terraformutils.TfSanitize(s.Name)\n\t\t\t\t\t\tif v.Name == \"\" {\n\t\t\t\t\t\t\tv.Name = v.ID\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttv[\"volume_name\"] = terraformutils.TfSanitize(v.Name)\n\t\t\t\t\t\tresources = append(resources, resource)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif len(bds) > 0 {\n\t\t\t\tt = map[string]interface{}{\"block_device\": bds}\n\t\t\t}\n\n\t\t\tresource := terraformutils.NewResource(\n\t\t\t\ts.ID,\n\t\t\t\ts.Name,\n\t\t\t\t\"openstack_compute_instance_v2\",\n\t\t\t\t\"openstack\",\n\t\t\t\tmap[string]string{},\n\t\t\t\t[]string{},\n\t\t\t\tt,\n\t\t\t)\n\n\t\t\tresources = append(resources, resource)\n\t\t}\n\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from OpenStack API,\nfunc (g *ComputeGenerator) InitResources() error {\n\topts, err := openstack.AuthOptionsFromEnv()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprovider, err := openstack.AuthenticatedClient(opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient, err := openstack.NewComputeV2(provider, gophercloud.EndpointOpts{\n\t\tRegion: g.GetArgs()[\"region\"].(string),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlist := servers.List(client, nil)\n\tvolclient, err := openstack.NewBlockStorageV3(provider, gophercloud.EndpointOpts{\n\t\tRegion: g.GetArgs()[\"region\"].(string)})\n\tif err != nil {\n\t\tlog.Println(\"VolumeImageMetadata requires blockStorage API v3\")\n\t\tvolclient = nil\n\t}\n\tg.Resources = g.createResources(&list, volclient)\n\n\treturn nil\n}\n\nfunc (g *ComputeGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"openstack_compute_volume_attach_v2\" {\n\t\t\tg.Resources[i].Item[\"volume_id\"] = \"${openstack_blockstorage_volume_v3.\" + r.AdditionalFields[\"volume_name\"].(string) + \".id}\"\n\t\t\tg.Resources[i].Item[\"instance_id\"] = \"${openstack_compute_instance_v2.\" + r.AdditionalFields[\"instance_name\"].(string) + \".id}\"\n\t\t\tdelete(g.Resources[i].Item, \"volume_name\")\n\t\t\tdelete(g.Resources[i].Item, \"instance_name\")\n\t\t\tdelete(g.Resources[i].Item, \"device\")\n\t\t}\n\t\tif r.InstanceInfo.Type != \"openstack_compute_instance_v2\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Copy \"all_metadata.%\" to \"metadata.%\"\n\t\tfor k, v := range g.Resources[i].InstanceState.Attributes {\n\t\t\tif strings.HasPrefix(k, \"all_metadata\") {\n\t\t\t\tnewKey := strings.Replace(k, \"all_metadata\", \"metadata\", 1)\n\t\t\t\tg.Resources[i].InstanceState.Attributes[newKey] = v\n\t\t\t}\n\t\t}\n\t\t// Replace \"all_metadata\" to \"metadata\"\n\t\t// because \"all_metadata\" field cannot be set as resource argument\n\t\tfor k, v := range g.Resources[i].Item {\n\t\t\tif strings.HasPrefix(k, \"all_metadata\") {\n\t\t\t\tnewKey := strings.Replace(k, \"all_metadata\", \"metadata\", 1)\n\t\t\t\tg.Resources[i].Item[newKey] = v\n\t\t\t\tdelete(g.Resources[i].Item, k)\n\t\t\t}\n\t\t}\n\t\tif r.AdditionalFields[\"block_device\"] != nil {\n\t\t\tbds := r.AdditionalFields[\"block_device\"].([]map[string]interface{})\n\t\t\tfor bi, bd := range bds {\n\t\t\t\tfor k, v := range bd {\n\t\t\t\t\tg.Resources[i].InstanceState.Attributes[\"block_device.\"+strconv.Itoa(bi)+\".\"+k] = v.(string)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tg.Resources[i].InstanceState.Attributes[\"block_device.#\"] = strconv.Itoa(len(bds))\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/openstack/networking.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage openstack\n\nimport (\n\t\"log\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/gophercloud/gophercloud\"\n\t\"github.com/gophercloud/gophercloud/openstack\"\n\t\"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/security/groups\"\n\t\"github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/security/rules\"\n\t\"github.com/gophercloud/gophercloud/pagination\"\n)\n\ntype NetworkingGenerator struct {\n\tOpenStackService\n}\n\n// createResources iterate on all openstack_networking_secgroup_v2\nfunc (g *NetworkingGenerator) createSecgroupResources(list *pagination.Pager) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\n\terr := list.EachPage(func(page pagination.Page) (bool, error) {\n\t\tgroups, err := groups.ExtractGroups(page)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tfor _, grp := range groups {\n\t\t\tresource := terraformutils.NewSimpleResource(\n\t\t\t\tgrp.ID,\n\t\t\t\tgrp.Name,\n\t\t\t\t\"openstack_networking_secgroup_v2\",\n\t\t\t\t\"openstack\",\n\t\t\t\t[]string{},\n\t\t\t)\n\t\t\tresources = append(resources, resource)\n\t\t\tresources = append(resources, g.createSecgroupRuleResources(grp.Rules)...)\n\t\t}\n\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn resources\n}\n\n// createResources iterate on all openstack_networking_secgroup_v2\nfunc (g *NetworkingGenerator) createSecgroupRuleResources(rules []rules.SecGroupRule) []terraformutils.Resource {\n\tresources := []terraformutils.Resource{}\n\tfor _, r := range rules {\n\t\tresource := terraformutils.NewSimpleResource(\n\t\t\tr.ID,\n\t\t\tr.ID,\n\t\t\t\"openstack_networking_secgroup_rule_v2\",\n\t\t\t\"openstack\",\n\t\t\t[]string{},\n\t\t)\n\t\tresources = append(resources, resource)\n\t}\n\treturn resources\n}\n\n// Generate TerraformResources from OpenStack API,\nfunc (g *NetworkingGenerator) InitResources() error {\n\topts, err := openstack.AuthOptionsFromEnv()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprovider, err := openstack.AuthenticatedClient(opts)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient, err := openstack.NewNetworkV2(provider, gophercloud.EndpointOpts{\n\t\tRegion: g.GetArgs()[\"region\"].(string),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlist := groups.List(client, groups.ListOpts{})\n\n\tg.Resources = g.createSecgroupResources(&list)\n\n\treturn nil\n}\n\nfunc (g *NetworkingGenerator) PostConvertHook() error {\n\tfor i, r := range g.Resources {\n\t\tif r.InstanceInfo.Type != \"openstack_networking_secgroup_rule_v2\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, sg := range g.Resources {\n\t\t\tif sg.InstanceInfo.Type != \"openstack_networking_secgroup_v2\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif r.InstanceState.Attributes[\"security_group_id\"] == sg.InstanceState.Attributes[\"id\"] {\n\t\t\t\tg.Resources[i].Item[\"security_group_id\"] = \"${openstack_networking_secgroup_v2.\" + sg.ResourceName + \".id}\"\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/openstack/openstack_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage openstack\n\nimport (\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/pkg/errors\"\n)\n\ntype OpenStackProvider struct { //nolint\n\tterraformutils.Provider\n\tregion string\n}\n\nfunc (p OpenStackProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p OpenStackProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"openstack\": map[string]interface{}{\n\t\t\t\t\"region\": p.region,\n\t\t\t},\n\t\t},\n\t}\n}\n\n// check projectName in env params\nfunc (p *OpenStackProvider) Init(args []string) error {\n\tp.region = args[0]\n\t// terraform work with env param OS_REGION_NAME\n\terr := os.Setenv(\"OS_REGION_NAME\", p.region)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\nfunc (p *OpenStackProvider) GetName() string {\n\treturn \"openstack\"\n}\n\nfunc (p *OpenStackProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"openstack: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"region\": p.region,\n\t})\n\treturn nil\n}\n\n// GetOpenStackSupportService return map of support service for OpenStack\nfunc (p *OpenStackProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"blockstorage\": &BlockStorageGenerator{},\n\t\t\"compute\":      &ComputeGenerator{},\n\t\t\"networking\":   &NetworkingGenerator{},\n\t}\n}\n"
  },
  {
    "path": "providers/openstack/openstack_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage openstack\n\nimport \"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\ntype OpenStackService struct { //nolint\n\tterraformutils.Service\n}\n"
  },
  {
    "path": "providers/opsgenie/opsgenie_provider.go",
    "content": "package opsgenie\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/zclconf/go-cty/cty\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype OpsgenieProvider struct { //nolint\n\tterraformutils.Provider\n\n\tAPIKey string\n}\n\nfunc (p *OpsgenieProvider) Init(args []string) error {\n\tif apiKey := os.Getenv(\"OPSGENIE_API_KEY\"); apiKey != \"\" {\n\t\tp.APIKey = os.Getenv(\"OPSGENIE_API_KEY\")\n\t}\n\tif args[0] != \"\" {\n\t\tp.APIKey = args[0]\n\t}\n\tif p.APIKey == \"\" {\n\t\treturn errors.New(\"required API Key missing\")\n\t}\n\n\treturn nil\n}\n\nfunc (p *OpsgenieProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"api-key\": p.APIKey,\n\t})\n\treturn nil\n}\n\nfunc (p *OpsgenieProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"api_key\": cty.StringVal(p.APIKey),\n\t})\n}\n\nfunc (p *OpsgenieProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (p *OpsgenieProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *OpsgenieProvider) GetName() string {\n\treturn \"opsgenie\"\n}\n\nfunc (p *OpsgenieProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"user\":    &UserGenerator{},\n\t\t\"team\":    &TeamGenerator{},\n\t\t\"service\": &ServiceGenerator{},\n\t}\n}\n"
  },
  {
    "path": "providers/opsgenie/opsgenie_service.go",
    "content": "package opsgenie\n\nimport (\n\t\"github.com/opsgenie/opsgenie-go-sdk-v2/client\"\n\t\"github.com/opsgenie/opsgenie-go-sdk-v2/service\"\n\t\"github.com/opsgenie/opsgenie-go-sdk-v2/team\"\n\t\"github.com/opsgenie/opsgenie-go-sdk-v2/user\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype OpsgenieService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *OpsgenieService) UserClient() (*user.Client, error) {\n\treturn user.NewClient(&client.Config{ApiKey: s.GetArgs()[\"api-key\"].(string)})\n}\n\nfunc (s *OpsgenieService) TeamClient() (*team.Client, error) {\n\treturn team.NewClient(&client.Config{ApiKey: s.GetArgs()[\"api-key\"].(string)})\n}\n\nfunc (s *OpsgenieService) ServiceClient() (*service.Client, error) {\n\treturn service.NewClient(&client.Config{ApiKey: s.GetArgs()[\"api-key\"].(string)})\n}\n"
  },
  {
    "path": "providers/opsgenie/service.go",
    "content": "package opsgenie\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/opsgenie/opsgenie-go-sdk-v2/service\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype ServiceGenerator struct {\n\tOpsgenieService\n}\n\nfunc (g *ServiceGenerator) InitResources() error {\n\tclient, err := g.ServiceClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlimit := 50\n\toffset := 0\n\n\tvar services []service.Service\n\n\tfor {\n\t\tresult, err := func(limit, offset int) (*service.ListResult, error) {\n\t\t\tctx, cancelFunc := context.WithTimeout(context.Background(), 2*time.Second)\n\t\t\tdefer cancelFunc()\n\n\t\t\treturn client.List(ctx, &service.ListRequest{Limit: limit, Offset: offset})\n\t\t}(limit, offset)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(result.Services) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tservices = append(services, result.Services...)\n\t\toffset += limit\n\t}\n\n\tg.Resources = g.createResources(services)\n\treturn nil\n}\n\nfunc (g *ServiceGenerator) createResources(services []service.Service) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, s := range services {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\ts.Id,\n\t\t\tfmt.Sprintf(\"%s-%s\", s.Id, s.Name),\n\t\t\t\"opsgenie_service\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n"
  },
  {
    "path": "providers/opsgenie/team.go",
    "content": "package opsgenie\n\nimport (\n\t\"context\"\n\t\"time\"\n\n\t\"github.com/opsgenie/opsgenie-go-sdk-v2/team\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype TeamGenerator struct {\n\tOpsgenieService\n}\n\nfunc (g *TeamGenerator) InitResources() error {\n\tclient, err := g.TeamClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, cancelFunc := context.WithTimeout(context.Background(), 2*time.Second)\n\tdefer cancelFunc()\n\n\tresult, err := client.List(ctx, &team.ListTeamRequest{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(result.Teams)\n\treturn nil\n}\n\nfunc (g *TeamGenerator) createResources(teams []team.ListedTeams) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, t := range teams {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tt.Id,\n\t\t\tt.Name,\n\t\t\t\"opsgenie_team\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n"
  },
  {
    "path": "providers/opsgenie/user.go",
    "content": "package opsgenie\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/opsgenie/opsgenie-go-sdk-v2/user\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype UserGenerator struct {\n\tOpsgenieService\n}\n\nfunc (g *UserGenerator) InitResources() error {\n\tclient, err := g.UserClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlimit := 50\n\toffset := 0\n\n\tvar users []user.User\n\n\tfor {\n\t\tresult, err := func(limit, offset int) (*user.ListResult, error) {\n\t\t\tctx, cancelFunc := context.WithTimeout(context.Background(), 2*time.Second)\n\t\t\tdefer cancelFunc()\n\n\t\t\treturn client.List(ctx, &user.ListRequest{Limit: limit, Offset: offset})\n\t\t}(limit, offset)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tusers = append(users, result.Users...)\n\t\toffset += limit\n\n\t\tif offset >= result.TotalCount {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tg.Resources = g.createResources(users)\n\treturn nil\n}\n\nfunc (g *UserGenerator) createResources(users []user.User) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\n\tfor _, u := range users {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tu.Id,\n\t\t\tfmt.Sprintf(\"%s-%s\", u.Id, u.Username),\n\t\t\t\"opsgenie_user\",\n\t\t\tg.ProviderName,\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n"
  },
  {
    "path": "providers/pagerduty/business_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage pagerduty\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tpagerduty \"github.com/heimweh/go-pagerduty/pagerduty\"\n)\n\ntype BusinessServiceGenerator struct {\n\tPagerDutyService\n}\n\nfunc (g *BusinessServiceGenerator) createBusinessServiceResources(client *pagerduty.Client) error {\n\tresp, _, err := client.BusinessServices.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, service := range resp.BusinessServices {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tservice.ID,\n\t\t\tservice.Name,\n\t\t\t\"pagerduty_business_service\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn nil\n}\n\nfunc (g *BusinessServiceGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*pagerduty.Client) error{\n\t\tg.createBusinessServiceResources,\n\t}\n\n\tfor _, f := range funcs {\n\t\terr := f(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/pagerduty/escalation_policy.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage pagerduty\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tpagerduty \"github.com/heimweh/go-pagerduty/pagerduty\"\n)\n\ntype EscalationPolicyGenerator struct {\n\tPagerDutyService\n}\n\nfunc (g *EscalationPolicyGenerator) createEscalationPolicyResources(client *pagerduty.Client) error {\n\tvar offset = 0\n\toptions := pagerduty.ListEscalationPoliciesOptions{}\n\tfor {\n\t\toptions.Offset = offset\n\t\tresp, _, err := client.EscalationPolicies.List(&options)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, policy := range resp.EscalationPolicies {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tpolicy.ID,\n\t\t\t\tpolicy.Name,\n\t\t\t\t\"pagerduty_escalation_policy\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\n\t\tif !resp.More {\n\t\t\tbreak\n\t\t}\n\n\t\toffset += resp.Limit\n\t}\n\treturn nil\n}\n\nfunc (g *EscalationPolicyGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*pagerduty.Client) error{\n\t\tg.createEscalationPolicyResources,\n\t}\n\n\tfor _, f := range funcs {\n\t\terr := f(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/pagerduty/pagerduty_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage pagerduty\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype PagerDutyProvider struct { //nolint\n\tterraformutils.Provider\n\ttoken string\n}\n\nfunc (p *PagerDutyProvider) Init(args []string) error {\n\tif token := os.Getenv(\"PAGERDUTY_TOKEN\"); token != \"\" {\n\t\tp.token = os.Getenv(\"PAGERDUTY_TOKEN\")\n\t}\n\tif len(args) > 0 && args[0] != \"\" {\n\t\tp.token = args[0]\n\t}\n\treturn nil\n}\n\nfunc (p *PagerDutyProvider) GetName() string {\n\treturn \"pagerduty\"\n}\n\nfunc (p *PagerDutyProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"token\": cty.StringVal(p.token),\n\t})\n}\n\nfunc (p *PagerDutyProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"pagerduty\": map[string]interface{}{\n\t\t\t\t\"token\": p.token,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (PagerDutyProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *PagerDutyProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"business_service\":  &BusinessServiceGenerator{},\n\t\t\"escalation_policy\": &EscalationPolicyGenerator{},\n\t\t\"ruleset\":           &RulesetGenerator{},\n\t\t\"schedule\":          &ScheduleGenerator{},\n\t\t\"service\":           &ServiceGenerator{},\n\t\t\"team\":              &TeamGenerator{},\n\t\t\"user\":              &UserGenerator{},\n\t}\n}\n\nfunc (p *PagerDutyProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"token\": p.token,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/pagerduty/pagerduty_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage pagerduty\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tpagerduty \"github.com/heimweh/go-pagerduty/pagerduty\"\n)\n\ntype PagerDutyService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *PagerDutyService) Client() (*pagerduty.Client, error) {\n\tclient, err := pagerduty.NewClient(&pagerduty.Config{Token: s.GetArgs()[\"token\"].(string)})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}\n"
  },
  {
    "path": "providers/pagerduty/ruleset.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage pagerduty\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tpagerduty \"github.com/heimweh/go-pagerduty/pagerduty\"\n)\n\ntype RulesetGenerator struct {\n\tPagerDutyService\n}\n\nfunc (g *RulesetGenerator) createRulesetResources(client *pagerduty.Client) error {\n\tresp, _, err := client.Rulesets.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, ruleset := range resp.Rulesets {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\truleset.ID,\n\t\t\truleset.Name,\n\t\t\t\"pagerduty_ruleset\",\n\t\t\tg.ProviderName,\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn nil\n}\n\n// golangci-lint says this function isn't used anywhere. Do we need it? Commenting it out to make the linter happy\n\nfunc (g *RulesetGenerator) createRulesetRuleResources(client *pagerduty.Client) error {\n\tresp, _, err := client.Rulesets.List()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, ruleset := range resp.Rulesets {\n\t\trules, _, err := client.Rulesets.ListRules(ruleset.ID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, rule := range rules.Rules {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\trule.ID,\n\t\t\t\trule.ID,\n\t\t\t\t\"pagerduty_ruleset_rule\",\n\t\t\t\tg.ProviderName,\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"ruleset\": ruleset.ID,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *RulesetGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*pagerduty.Client) error{\n\t\tg.createRulesetResources,\n\t\tg.createRulesetRuleResources,\n\t}\n\n\tfor _, f := range funcs {\n\t\terr := f(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/pagerduty/schedule.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage pagerduty\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tpagerduty \"github.com/heimweh/go-pagerduty/pagerduty\"\n)\n\ntype ScheduleGenerator struct {\n\tPagerDutyService\n}\n\nfunc (g *ScheduleGenerator) createScheduleResources(client *pagerduty.Client) error {\n\tvar offset = 0\n\toptions := pagerduty.ListSchedulesOptions{}\n\tfor {\n\t\toptions.Offset = offset\n\t\tresp, _, err := client.Schedules.List(&options)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, schedule := range resp.Schedules {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tschedule.ID,\n\t\t\t\tfmt.Sprintf(\"schedule_%s\", schedule.Name),\n\t\t\t\t\"pagerduty_schedule\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t\tif !resp.More {\n\t\t\tbreak\n\t\t}\n\n\t\toffset += resp.Limit\n\t}\n\n\treturn nil\n}\n\nfunc (g *ScheduleGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*pagerduty.Client) error{\n\t\tg.createScheduleResources,\n\t}\n\n\tfor _, f := range funcs {\n\t\terr := f(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/pagerduty/service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage pagerduty\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tpagerduty \"github.com/heimweh/go-pagerduty/pagerduty\"\n)\n\ntype ServiceGenerator struct {\n\tPagerDutyService\n}\n\nfunc (g *ServiceGenerator) createServiceResources(client *pagerduty.Client) error {\n\tvar offset = 0\n\toptions := pagerduty.ListServicesOptions{}\n\tfor {\n\t\toptions.Offset = offset\n\t\tresp, _, err := client.Services.List(&options)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, service := range resp.Services {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tservice.ID,\n\t\t\t\tfmt.Sprintf(\"service_%s\", service.Name),\n\t\t\t\t\"pagerduty_service\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\n\t\tif !resp.More {\n\t\t\tbreak\n\t\t}\n\t\toffset += resp.Limit\n\t}\n\n\treturn nil\n}\n\nfunc (g *ServiceGenerator) createServiceEventRuleResources(client *pagerduty.Client) error {\n\tvar offset = 0\n\toptions := pagerduty.ListServicesOptions{}\n\toptionsEventRules := pagerduty.ListServiceEventRuleOptions{}\n\tfor {\n\t\toptions.Offset = offset\n\t\toptionsEventRules.Offset = offset\n\t\tresp, _, err := client.Services.List(&options)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, service := range resp.Services {\n\t\t\trules, _, err := client.Services.ListEventRules(service.ID, &optionsEventRules)\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, rule := range rules.EventRules {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\t\t\trule.ID,\n\t\t\t\t\tfmt.Sprintf(\"%s_%s\", service.Name, rule.ID),\n\t\t\t\t\t\"pagerduty_service_event_rule\",\n\t\t\t\t\tg.ProviderName,\n\t\t\t\t\tmap[string]string{\n\t\t\t\t\t\t\"service\": service.ID,\n\t\t\t\t\t},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\n\t\tif !resp.More {\n\t\t\tbreak\n\t\t}\n\t\toffset += resp.Limit\n\t}\n\treturn nil\n}\n\nfunc (g *ServiceGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*pagerduty.Client) error{\n\t\tg.createServiceResources,\n\t\tg.createServiceEventRuleResources,\n\t}\n\n\tfor _, f := range funcs {\n\t\terr := f(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/pagerduty/team.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage pagerduty\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tpagerduty \"github.com/heimweh/go-pagerduty/pagerduty\"\n)\n\ntype TeamGenerator struct {\n\tPagerDutyService\n}\n\nfunc (g *TeamGenerator) createTeamResources(client *pagerduty.Client) error {\n\tvar offset = 0\n\toptions := pagerduty.ListTeamsOptions{}\n\tfor {\n\t\toptions.Offset = offset\n\t\tresp, _, err := client.Teams.List(&options)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, team := range resp.Teams {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tteam.ID,\n\t\t\t\tfmt.Sprintf(\"Team_%s\", team.Name),\n\t\t\t\t\"pagerduty_team\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t\tif !resp.More {\n\t\t\tbreak\n\t\t}\n\n\t\toffset += resp.Limit\n\t}\n\n\treturn nil\n}\n\nfunc (g *TeamGenerator) createTeamMembershipResources(client *pagerduty.Client) error {\n\tvar teamOffset = 0\n\tteamOptions := pagerduty.ListTeamsOptions{}\n\n\tfor {\n\t\tteamOptions.Offset = teamOffset\n\t\tresp, _, err := client.Teams.List(&teamOptions)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmemberOptions := pagerduty.GetMembersOptions{}\n\t\tfor _, team := range resp.Teams {\n\t\t\tmembers, _, err := client.Teams.GetMembers(team.ID, &memberOptions)\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, member := range members.Members {\n\t\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\t\tfmt.Sprintf(\"%s:%s\", member.User.ID, team.ID),\n\t\t\t\t\tfmt.Sprintf(\"%s_%s\", member.User.ID, team.Name),\n\t\t\t\t\t\"pagerduty_team_membership\",\n\t\t\t\t\tg.ProviderName,\n\t\t\t\t\t[]string{},\n\t\t\t\t))\n\t\t\t}\n\t\t}\n\n\t\tif !resp.More {\n\t\t\tbreak\n\t\t}\n\n\t\tteamOffset += resp.Limit\n\t}\n\n\treturn nil\n}\n\nfunc (g *TeamGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*pagerduty.Client) error{\n\t\tg.createTeamResources,\n\t\tg.createTeamMembershipResources,\n\t}\n\n\tfor _, f := range funcs {\n\t\terr := f(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/pagerduty/user.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage pagerduty\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tpagerduty \"github.com/heimweh/go-pagerduty/pagerduty\"\n)\n\ntype UserGenerator struct {\n\tPagerDutyService\n}\n\nfunc (g *UserGenerator) createUserResources(client *pagerduty.Client) error {\n\tvar offset = 0\n\toptions := pagerduty.ListUsersOptions{}\n\tfor {\n\t\toptions.Offset = offset\n\t\tresp, _, err := client.Users.List(&options)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, user := range resp.Users {\n\t\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\t\tuser.ID,\n\t\t\t\tfmt.Sprintf(\"user_%s\", user.ID),\n\t\t\t\t\"pagerduty_user\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\n\t\tif !resp.More {\n\t\t\tbreak\n\t\t}\n\n\t\toffset += resp.Limit\n\t}\n\n\treturn nil\n}\n\nfunc (g *UserGenerator) InitResources() error {\n\tclient, err := g.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfuncs := []func(*pagerduty.Client) error{\n\t\tg.createUserResources,\n\t}\n\n\tfor _, f := range funcs {\n\t\terr := f(client)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/panos/firewall_device_config.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage panos\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/PaloAltoNetworks/pango\"\n)\n\ntype FirewallDeviceConfigGenerator struct {\n\tPanosService\n}\n\nfunc (g *FirewallDeviceConfigGenerator) createResourcesFromList(o getGeneric, idPrefix, terraformResourceName string) (resources []terraformutils.Resource) {\n\tl, err := o.i.(getListWithOneArg).GetList(o.params[0])\n\tif err != nil || len(l) == 0 {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, r := range l {\n\t\tid := idPrefix + r\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(r),\n\t\t\tterraformResourceName,\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallDeviceConfigGenerator) createGeneralSettingsResource(hostname string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\thostname,\n\t\tnormalizeResourceName(hostname),\n\t\t\"panos_general_settings\",\n\t\t\"panos\",\n\t\t[]string{},\n\t)\n}\n\nfunc (g *FirewallDeviceConfigGenerator) createTelemetryResource(ipAddress, hostname string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tipAddress,\n\t\tnormalizeResourceName(hostname),\n\t\t\"panos_telemetry\",\n\t\t\"panos\",\n\t\t[]string{},\n\t)\n}\n\nfunc (g *FirewallDeviceConfigGenerator) createEmailServerProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(getGeneric{g.client.(*pango.Firewall).Device.EmailServerProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_email_server_profile\",\n\t)\n}\n\nfunc (g *FirewallDeviceConfigGenerator) createHTTPServerProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(getGeneric{g.client.(*pango.Firewall).Device.HttpServerProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_http_server_profile\",\n\t)\n}\n\nfunc (g *FirewallDeviceConfigGenerator) createSNMPTrapServerProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(getGeneric{g.client.(*pango.Firewall).Device.SnmpServerProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_snmptrap_server_profile\",\n\t)\n}\n\nfunc (g *FirewallDeviceConfigGenerator) createSyslogServerProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(getGeneric{g.client.(*pango.Firewall).Device.SyslogServerProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_syslog_server_profile\",\n\t)\n}\n\nfunc (g *FirewallDeviceConfigGenerator) InitResources() error {\n\tif err := g.Initialize(); err != nil {\n\t\treturn err\n\t}\n\n\tif g.vsys == \"vsys1\" {\n\t\tg.vsys = \"shared\"\n\t}\n\n\tgeneralConfig, err := g.client.(*pango.Firewall).Device.GeneralSettings.Get()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = append(g.Resources, g.createGeneralSettingsResource(generalConfig.Hostname))\n\tg.Resources = append(g.Resources, g.createTelemetryResource(generalConfig.IpAddress, generalConfig.Hostname))\n\tg.Resources = append(g.Resources, g.createEmailServerProfileResources()...)\n\tg.Resources = append(g.Resources, g.createHTTPServerProfileResources()...)\n\tg.Resources = append(g.Resources, g.createSNMPTrapServerProfileResources()...)\n\tg.Resources = append(g.Resources, g.createSyslogServerProfileResources()...)\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/panos/firewall_networking.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage panos\n\nimport (\n\t\"encoding/base64\"\n\t\"fmt\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/PaloAltoNetworks/pango\"\n\t\"github.com/PaloAltoNetworks/pango/netw/interface/eth\"\n\t\"github.com/PaloAltoNetworks/pango/netw/interface/subinterface/layer2\"\n\t\"github.com/PaloAltoNetworks/pango/netw/interface/subinterface/layer3\"\n\t\"github.com/PaloAltoNetworks/pango/util\"\n)\n\ntype FirewallNetworkingGenerator struct {\n\tPanosService\n}\n\nfunc (g *FirewallNetworkingGenerator) createResourcesFromList(o getGeneric, idPrefix string, useIDForResourceName bool, terraformResourceName string, checkIfIsVsys bool, checkType string) (resources []terraformutils.Resource) {\n\tvar l []string\n\tvar err error\n\n\tswitch f := o.i.(type) {\n\tcase getListWithoutArg:\n\t\tl, err = f.GetList()\n\tcase getListWithOneArg:\n\t\tl, err = f.GetList(o.params[0])\n\tcase getListWithTwoArgs:\n\t\tl, err = f.GetList(o.params[0], o.params[1])\n\tcase getListWithThreeArgs:\n\t\tl, err = f.GetList(o.params[0], o.params[1], o.params[2])\n\tdefault:\n\t\terr = fmt.Errorf(\"not supported\")\n\t}\n\tif err != nil || len(l) == 0 {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, r := range l {\n\t\tif checkIfIsVsys {\n\t\t\trv, err := g.client.(*pango.Firewall).IsImported(checkType, \"\", \"\", g.vsys, r)\n\t\t\tif err != nil || !rv {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tid := idPrefix + r\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(func() string {\n\t\t\t\tif useIDForResourceName {\n\t\t\t\t\treturn id\n\t\t\t\t}\n\n\t\t\t\treturn r\n\t\t\t}()),\n\t\t\tterraformResourceName,\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createAggregateInterfaceResources() (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Firewall).Network.AggregateInterface.GetList()\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, aggregateInterface := range l {\n\t\trv, err := g.client.(*pango.Firewall).IsImported(util.InterfaceImport, \"\", \"\", g.vsys, aggregateInterface)\n\t\tif err != nil || !rv {\n\t\t\tcontinue\n\t\t}\n\n\t\tid := g.vsys + \":\" + aggregateInterface\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(aggregateInterface),\n\t\t\t\"panos_aggregate_interface\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\te, err := g.client.(*pango.Firewall).Network.AggregateInterface.Get(aggregateInterface)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif e.Mode == eth.ModeLayer2 || e.Mode == eth.ModeVirtualWire {\n\t\t\tg.Resources = append(g.Resources, g.createLayer2SubInterfaceResources(layer2.AggregateInterface, aggregateInterface, e.Mode)...)\n\t\t}\n\n\t\tif e.Mode == eth.ModeLayer3 {\n\t\t\tg.Resources = append(g.Resources, g.createLayer3SubInterfaceResources(layer3.AggregateInterface, aggregateInterface)...)\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createBFDProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.BfdProfile, []string{}},\n\t\t\"\", false, \"panos_bfd_profile\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPResource(virtualRouter string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\tvirtualRouter,\n\t\tnormalizeResourceName(virtualRouter),\n\t\t\"panos_bgp\",\n\t\t\"panos\",\n\t\t[]string{},\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPAggregateResources(virtualRouter string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Firewall).Network.BgpAggregate.GetList(virtualRouter)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, bgpAggregate := range l {\n\t\tid := virtualRouter + \":\" + bgpAggregate\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_bgp_aggregate\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\tresources = append(resources, g.createBGPAggregateAdvertiseFilterResources(virtualRouter, bgpAggregate)...)\n\t\tresources = append(resources, g.createBGPAggregateSuppressFilterResources(virtualRouter, bgpAggregate)...)\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPAggregateAdvertiseFilterResources(virtualRouter, bgpAggregate string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.BgpAggAdvertiseFilter, []string{virtualRouter, bgpAggregate}},\n\t\tvirtualRouter+\":\"+bgpAggregate+\":\", true, \"panos_bgp_aggregate_advertise_filter\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPAggregateSuppressFilterResources(virtualRouter, bgpAggregate string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.BgpAggSuppressFilter, []string{virtualRouter, bgpAggregate}},\n\t\tvirtualRouter+\":\"+bgpAggregate+\":\", true, \"panos_bgp_aggregate_suppress_filter\", false, \"\",\n\t)\n}\n\n// The secret argument will contain \"(incorrect)\", not the real value\nfunc (g *FirewallNetworkingGenerator) createBGPAuthProfileResources(virtualRouter string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.BgpAuthProfile, []string{virtualRouter}},\n\t\tvirtualRouter+\":\", true, \"panos_bgp_auth_profile\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPConditionalAdvertisementResources(virtualRouter string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Firewall).Network.BgpConditionalAdv.GetList(virtualRouter)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, bgpConditionalAdv := range l {\n\t\tid := virtualRouter + \":\" + bgpConditionalAdv\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_bgp_conditional_adv\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\tresources = append(resources, g.createBGPConditionalAdvertisementAdvertiseFilterResources(virtualRouter, bgpConditionalAdv)...)\n\t\tresources = append(resources, g.createBGPConditionalAdvertisementNonExistFilterResources(virtualRouter, bgpConditionalAdv)...)\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPConditionalAdvertisementAdvertiseFilterResources(virtualRouter, bgpConditionalAdv string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.BgpConAdvAdvertiseFilter, []string{virtualRouter, bgpConditionalAdv}},\n\t\tvirtualRouter+\":\"+bgpConditionalAdv+\":\", true, \"panos_bgp_conditional_adv_advertise_filter\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPConditionalAdvertisementNonExistFilterResources(virtualRouter, bgpConditionalAdv string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.BgpConAdvNonExistFilter, []string{virtualRouter, bgpConditionalAdv}},\n\t\tvirtualRouter+\":\"+bgpConditionalAdv+\":\", true, \"panos_bgp_conditional_adv_non_exist_filter\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPDampeningProfileResources(virtualRouter string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.BgpDampeningProfile, []string{virtualRouter}},\n\t\tvirtualRouter+\":\", true, \"panos_bgp_dampening_profile\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPRuleGroupResourcesFromList(o getGeneric, terraformResourceName string) (resources []terraformutils.Resource) {\n\tl, err := o.i.(getListWithOneArg).GetList(o.params[0])\n\tif err != nil || len(l) == 0 {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tvar positionReference string\n\tid := o.params[0] + \":\" + strconv.Itoa(util.MoveTop) + \"::\"\n\n\tfor k, r := range l {\n\t\tif k > 0 {\n\t\t\tid = o.params[0] + \":\" + strconv.Itoa(util.MoveAfter) + \":\" + positionReference + \":\"\n\t\t}\n\n\t\tid += base64.StdEncoding.EncodeToString([]byte(r))\n\t\tpositionReference = r\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(r),\n\t\t\tterraformResourceName,\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPExportRuleGroupResources(virtualRouter string) []terraformutils.Resource {\n\treturn g.createBGPRuleGroupResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.BgpExport, []string{virtualRouter}},\n\t\t\"panos_bgp_export_rule_group\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPImportRuleGroupResources(virtualRouter string) []terraformutils.Resource {\n\treturn g.createBGPRuleGroupResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.BgpImport, []string{virtualRouter}},\n\t\t\"panos_bgp_import_rule_group\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPPeerGroupResources(virtualRouter string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Firewall).Network.BgpPeerGroup.GetList(virtualRouter)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, bgpPeerGroup := range l {\n\t\tid := virtualRouter + \":\" + bgpPeerGroup\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_bgp_peer_group\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\tresources = append(resources, g.createBGPPeerResources(virtualRouter, bgpPeerGroup)...)\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPPeerResources(virtualRouter, bgpPeerGroup string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.BgpPeer, []string{virtualRouter, bgpPeerGroup}},\n\t\tvirtualRouter+\":\"+bgpPeerGroup+\":\", true, \"panos_bgp_peer\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createBGPRedistResources(virtualRouter string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.BgpRedistRule, []string{virtualRouter}},\n\t\tvirtualRouter+\":\", true, \"panos_bgp_redist_rule\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createEthernetInterfaceResources() (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Firewall).Network.EthernetInterface.GetList()\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, ethernetInterface := range l {\n\t\trv, err := g.client.(*pango.Firewall).IsImported(util.InterfaceImport, \"\", \"\", g.vsys, ethernetInterface)\n\t\tif err != nil || !rv {\n\t\t\tcontinue\n\t\t}\n\n\t\tid := g.vsys + \":\" + ethernetInterface\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(ethernetInterface),\n\t\t\t\"panos_ethernet_interface\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\te, err := g.client.(*pango.Firewall).Network.EthernetInterface.Get(ethernetInterface)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif e.Mode == eth.ModeLayer2 || e.Mode == eth.ModeVirtualWire {\n\t\t\tg.Resources = append(g.Resources, g.createLayer2SubInterfaceResources(layer2.EthernetInterface, ethernetInterface, e.Mode)...)\n\t\t}\n\n\t\tif e.Mode == eth.ModeLayer3 {\n\t\t\tg.Resources = append(g.Resources, g.createLayer3SubInterfaceResources(layer3.EthernetInterface, ethernetInterface)...)\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createGRETunnelResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.GreTunnel, []string{}},\n\t\t\"\", false, \"panos_gre_tunnel\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createIKECryptoProfileResources() (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Firewall).Network.IkeCryptoProfile.GetList()\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, ikeCryptoProfile := range l {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tikeCryptoProfile,\n\t\t\tnormalizeResourceName(ikeCryptoProfile),\n\t\t\t\"panos_ike_crypto_profile\",\n\t\t\t\"panos\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\": ikeCryptoProfile,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createIKEGatewayResources() (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Firewall).Network.IkeGateway.GetList()\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, ikeGateway := range l {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tikeGateway,\n\t\t\tnormalizeResourceName(ikeGateway),\n\t\t\t\"panos_ike_gateway\",\n\t\t\t\"panos\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\": ikeGateway,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createIPSECCryptoProfileResources() (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Firewall).Network.IpsecCryptoProfile.GetList()\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, ipsecCryptoProfile := range l {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tipsecCryptoProfile,\n\t\t\tnormalizeResourceName(ipsecCryptoProfile),\n\t\t\t\"panos_ipsec_crypto_profile\",\n\t\t\t\"panos\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\": ipsecCryptoProfile,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createIPSECTunnelProxyIDIPv4Resources(ipsecTunnel string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.IpsecTunnelProxyId, []string{ipsecTunnel}},\n\t\tipsecTunnel+\":\", false, \"panos_ipsec_tunnel_proxy_id_ipv4\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createIPSECTunnelResources() (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Firewall).Network.IpsecTunnel.GetList()\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, ipsecTunnel := range l {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tipsecTunnel,\n\t\t\tnormalizeResourceName(ipsecTunnel),\n\t\t\t\"panos_ipsec_tunnel\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\tresources = append(resources, g.createIPSECTunnelProxyIDIPv4Resources(ipsecTunnel)...)\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createLayer2SubInterfaceResources(interfaceType, parentInterface, parentMode string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.Layer2Subinterface, []string{interfaceType, parentInterface, parentMode}},\n\t\tinterfaceType+\":\"+parentInterface+\":\"+parentMode+\":\"+g.vsys+\":\", false, \"panos_layer2_subinterface\", true, util.InterfaceImport,\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createLayer3SubInterfaceResources(interfaceType, parentInterface string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.Layer3Subinterface, []string{interfaceType, parentInterface}},\n\t\tinterfaceType+\":\"+parentInterface+\":\"+g.vsys+\":\", false, \"panos_layer3_subinterface\", true, util.InterfaceImport,\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createLoopbackInterfaceResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.LoopbackInterface, []string{}},\n\t\tg.vsys+\":\", false, \"panos_loopback_interface\", true, util.InterfaceImport,\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createManagementProfileResources() (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Firewall).Network.ManagementProfile.GetList()\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, managementProfile := range l {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tmanagementProfile,\n\t\t\tnormalizeResourceName(managementProfile),\n\t\t\t\"panos_management_profile\",\n\t\t\t\"panos\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\": managementProfile,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createMonitorProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.MonitorProfile, []string{}},\n\t\t\"\", false, \"panos_monitor_profile\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createRedistributionProfileResources(virtualRouter string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.RedistributionProfile, []string{virtualRouter}},\n\t\tvirtualRouter+\":\", true, \"panos_redistribution_profile_ipv4\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createStaticRouteIpv4Resources(virtualRouter string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.StaticRoute, []string{virtualRouter}},\n\t\tvirtualRouter+\":\", true, \"panos_static_route_ipv4\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createTunnelInterfaceResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.TunnelInterface, []string{}},\n\t\tg.vsys+\":\", false, \"panos_tunnel_interface\", true, util.InterfaceImport,\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createVirtualRouterResources() (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Firewall).Network.VirtualRouter.GetList()\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, virtualRouter := range l {\n\t\t// TODO: doesn't work!!?\n\t\t// rv, err := g.client.(*pango.Firewall).IsImported(util.VirtualRouterImport, \"\", \"\", g.vsys, virtualRouter)\n\t\t// if err != nil || !rv {\n\t\t// \tcontinue\n\t\t// }\n\n\t\tid := g.vsys + \":\" + virtualRouter\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(virtualRouter),\n\t\t\t\"panos_virtual_router\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\tresources = append(resources, g.createBGPResource(virtualRouter))\n\t\tresources = append(resources, g.createBGPAggregateResources(virtualRouter)...)\n\t\tresources = append(resources, g.createBGPAuthProfileResources(virtualRouter)...)\n\t\tresources = append(resources, g.createBGPConditionalAdvertisementResources(virtualRouter)...)\n\t\tresources = append(resources, g.createBGPDampeningProfileResources(virtualRouter)...)\n\t\tresources = append(resources, g.createBGPExportRuleGroupResources(virtualRouter)...)\n\t\tresources = append(resources, g.createBGPImportRuleGroupResources(virtualRouter)...)\n\t\tresources = append(resources, g.createBGPPeerGroupResources(virtualRouter)...)\n\t\tresources = append(resources, g.createBGPRedistResources(virtualRouter)...)\n\t\tresources = append(resources, g.createRedistributionProfileResources(virtualRouter)...)\n\t\tresources = append(resources, g.createStaticRouteIpv4Resources(virtualRouter)...)\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallNetworkingGenerator) createVlanResources() []terraformutils.Resource {\n\t// TODO: should activate check with util.VlanImport, but doesn't work?\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.Vlan, []string{}},\n\t\tg.vsys+\":\", false, \"panos_vlan\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createVlanInterfaceResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.VlanInterface, []string{}},\n\t\tg.vsys+\":\", false, \"panos_vlan_interface\", true, util.InterfaceImport,\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) createZoneResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Network.Zone, []string{g.vsys}},\n\t\tg.vsys+\":\", false, \"panos_zone\", false, \"\",\n\t)\n}\n\nfunc (g *FirewallNetworkingGenerator) InitResources() error {\n\tif err := g.Initialize(); err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = append(g.Resources, g.createAggregateInterfaceResources()...)\n\tg.Resources = append(g.Resources, g.createBFDProfileResources()...)\n\tg.Resources = append(g.Resources, g.createEthernetInterfaceResources()...)\n\tg.Resources = append(g.Resources, g.createGRETunnelResources()...)\n\tg.Resources = append(g.Resources, g.createIKECryptoProfileResources()...)\n\tg.Resources = append(g.Resources, g.createIKEGatewayResources()...)\n\tg.Resources = append(g.Resources, g.createIPSECCryptoProfileResources()...)\n\tg.Resources = append(g.Resources, g.createIPSECTunnelResources()...)\n\tg.Resources = append(g.Resources, g.createLoopbackInterfaceResources()...)\n\tg.Resources = append(g.Resources, g.createManagementProfileResources()...)\n\tg.Resources = append(g.Resources, g.createMonitorProfileResources()...)\n\tg.Resources = append(g.Resources, g.createTunnelInterfaceResources()...)\n\tg.Resources = append(g.Resources, g.createVirtualRouterResources()...)\n\tg.Resources = append(g.Resources, g.createVlanResources()...)\n\tg.Resources = append(g.Resources, g.createVlanInterfaceResources()...)\n\tg.Resources = append(g.Resources, g.createZoneResources()...)\n\n\treturn nil\n}\n\nfunc (g *FirewallNetworkingGenerator) PostConvertHook() error {\n\tmapInterfaceNames := map[string]string{}\n\tmapInterfaceModes := map[string]string{}\n\tmapIKECryptoProfileNames := map[string]string{}\n\tmapIKEGatewayNames := map[string]string{}\n\tmapIPSECCryptoProfileNames := map[string]string{}\n\n\tfor _, r := range g.Resources {\n\t\tif _, ok := r.Item[\"name\"]; ok {\n\t\t\tif r.InstanceInfo.Type == \"panos_aggregate_interface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t\tmapInterfaceModes[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".mode}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_ethernet_interface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t\tmapInterfaceModes[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".mode}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_layer2_subinterface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_layer3_subinterface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_loopback_interface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_tunnel_interface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_vlan_interface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_ike_crypto_profile\" {\n\t\t\t\tmapIKECryptoProfileNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_ike_gateway\" {\n\t\t\t\tmapIKEGatewayNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_ipsec_crypto_profile\" {\n\t\t\t\tmapIPSECCryptoProfileNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"panos_bgp\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_redistribution_profile_ipv4\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_static_route_ipv4\" {\n\t\t\tif _, ok := r.Item[\"virtual_router\"]; ok {\n\t\t\t\tr.Item[\"virtual_router\"] = \"${panos_virtual_router.\" + normalizeResourceName(r.Item[\"virtual_router\"].(string)) + \".name}\"\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_bgp_aggregate\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_bgp_auth_profile\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_bgp_conditional_adv\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_bgp_dampening_profile\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_bgp_export_rule_group\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_bgp_import_rule_group\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_bgp_peer_group\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_bgp_redist_rule\" {\n\t\t\tif _, ok := r.Item[\"virtual_router\"]; ok {\n\t\t\t\tr.Item[\"virtual_router\"] = \"${panos_bgp.\" + normalizeResourceName(r.Item[\"virtual_router\"].(string)) + \".virtual_router}\"\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_bgp_aggregate_advertise_filter\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_bgp_aggregate_suppress_filter\" {\n\t\t\tif _, ok := r.Item[\"virtual_router\"]; ok {\n\t\t\t\tr.Item[\"virtual_router\"] = \"${panos_bgp_aggregate.\" + normalizeResourceName(r.Item[\"virtual_router\"].(string)) + \".virtual_router}\"\n\t\t\t}\n\t\t\tif _, ok := r.Item[\"bgp_aggregate\"]; ok {\n\t\t\t\tr.Item[\"bgp_aggregate\"] = \"${panos_bgp_aggregate.\" + normalizeResourceName(r.Item[\"bgp_aggregate\"].(string)) + \".name}\"\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_bgp_peer\" {\n\t\t\tif _, ok := r.Item[\"virtual_router\"]; ok {\n\t\t\t\tr.Item[\"virtual_router\"] = \"${panos_bgp.\" + normalizeResourceName(r.Item[\"virtual_router\"].(string)) + \".virtual_router}\"\n\t\t\t\tr.Item[\"peer_as\"] = \"${panos_bgp.\" + normalizeResourceName(r.Item[\"virtual_router\"].(string)) + \".as_number}\"\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_bgp_conditional_adv_advertise_filter\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_bgp_conditional_adv_non_exist_filter\" {\n\t\t\tif _, ok := r.Item[\"virtual_router\"]; ok {\n\t\t\t\tr.Item[\"virtual_router\"] = \"${panos_bgp.\" + normalizeResourceName(r.Item[\"virtual_router\"].(string)) + \".virtual_router}\"\n\t\t\t}\n\t\t\tif _, ok := r.Item[\"panos_bgp_conditional_adv\"]; ok {\n\t\t\t\tr.Item[\"bgp_conditional_adv\"] = \"${panos_bgp_conditional_adv.\" + normalizeResourceName(r.Item[\"panos_bgp_conditional_adv\"].(string)) + \".name}\"\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_gre_tunnel\" {\n\t\t\tif mapExists(mapInterfaceNames, r.Item, \"interface\") {\n\t\t\t\tr.Item[\"interface\"] = mapInterfaceNames[r.Item[\"interface\"].(string)]\n\t\t\t}\n\t\t\tif mapExists(mapInterfaceNames, r.Item, \"tunnel_interface\") {\n\t\t\t\tr.Item[\"tunnel_interface\"] = mapInterfaceNames[r.Item[\"tunnel_interface\"].(string)]\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_ike_gateway\" {\n\t\t\tif mapExists(mapIKECryptoProfileNames, r.Item, \"ikev1_crypto_profile\") {\n\t\t\t\tr.Item[\"ikev1_crypto_profile\"] = mapIKECryptoProfileNames[r.Item[\"ikev1_crypto_profile\"].(string)]\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_ipsec_tunnel\" {\n\t\t\tif mapExists(mapInterfaceNames, r.Item, \"tunnel_interface\") {\n\t\t\t\tr.Item[\"tunnel_interface\"] = mapInterfaceNames[r.Item[\"tunnel_interface\"].(string)]\n\t\t\t}\n\t\t\tif mapExists(mapIKEGatewayNames, r.Item, \"ak_ike_gateway\") {\n\t\t\t\tr.Item[\"ak_ike_gateway\"] = mapIKEGatewayNames[r.Item[\"ak_ike_gateway\"].(string)]\n\t\t\t}\n\t\t\tif mapExists(mapIPSECCryptoProfileNames, r.Item, \"ak_ipsec_crypto_profile\") {\n\t\t\t\tr.Item[\"ak_ipsec_crypto_profile\"] = mapIPSECCryptoProfileNames[r.Item[\"ak_ipsec_crypto_profile\"].(string)]\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_ipsec_tunnel_proxy_id_ipv4\" {\n\t\t\tif mapExists(mapInterfaceNames, r.Item, \"ipsec_tunnel\") {\n\t\t\t\tr.Item[\"ipsec_tunnel\"] = mapInterfaceNames[r.Item[\"ipsec_tunnel\"].(string)]\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_layer2_subinterface\" {\n\t\t\tif mapExists(mapInterfaceModes, r.Item, \"parent_interface\") {\n\t\t\t\tr.Item[\"parent_mode\"] = mapInterfaceModes[r.Item[\"parent_interface\"].(string)]\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_layer2_subinterface\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_layer3_subinterface\" {\n\t\t\tif mapExists(mapInterfaceNames, r.Item, \"parent_interface\") {\n\t\t\t\tr.Item[\"parent_interface\"] = mapInterfaceNames[r.Item[\"parent_interface\"].(string)]\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_virtual_router\" {\n\t\t\tif r.Item[\"ospfv3_ext_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"ospfv3_ext_dist\"] = \"110\"\n\t\t\t}\n\n\t\t\tif r.Item[\"ebgp_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"ebgp_dist\"] = \"20\"\n\t\t\t}\n\n\t\t\tif r.Item[\"rip_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"rip_dist\"] = \"120\"\n\t\t\t}\n\n\t\t\tif r.Item[\"ibgp_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"ibgp_dist\"] = \"200\"\n\t\t\t}\n\n\t\t\tif r.Item[\"static_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"static_dist\"] = \"10\"\n\t\t\t}\n\n\t\t\tif r.Item[\"ospf_int_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"ospf_int_dist\"] = \"30\"\n\t\t\t}\n\n\t\t\tif r.Item[\"static_ipv6_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"static_ipv6_dist\"] = \"10\"\n\t\t\t}\n\n\t\t\tif r.Item[\"ospf_ext_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"ospf_ext_dist\"] = \"110\"\n\t\t\t}\n\n\t\t\tif r.Item[\"ospfv3_int_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"ospfv3_int_dist\"] = \"30\"\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_virtual_router\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_zone\" {\n\t\t\tif _, ok := r.Item[\"interfaces\"]; ok {\n\t\t\t\tinterfaces := make([]string, len(r.Item[\"interfaces\"].([]interface{})))\n\t\t\t\tfor k, eth := range r.Item[\"interfaces\"].([]interface{}) {\n\t\t\t\t\tif name, ok2 := mapInterfaceNames[eth.(string)]; ok2 {\n\t\t\t\t\t\tinterfaces[k] = name\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tinterfaces[k] = eth.(string)\n\t\t\t\t}\n\n\t\t\t\tr.Item[\"interfaces\"] = interfaces\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_vlan\" {\n\t\t\tif mapExists(mapInterfaceNames, r.Item, \"vlan_interface\") {\n\t\t\t\tr.Item[\"vlan_interface\"] = mapInterfaceNames[r.Item[\"vlan_interface\"].(string)]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/panos/firewall_objects.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage panos\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/PaloAltoNetworks/pango\"\n)\n\ntype FirewallObjectsGenerator struct {\n\tPanosService\n}\n\nfunc (g *FirewallObjectsGenerator) createResourcesFromList(o getGeneric, idPrefix string, terraformResourceName string) (resources []terraformutils.Resource) {\n\tl, err := o.i.(getListWithOneArg).GetList(o.params[0])\n\tif err != nil || len(l) == 0 {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, r := range l {\n\t\tid := idPrefix + r\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(r),\n\t\t\tterraformResourceName,\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallObjectsGenerator) createResourcesFromListWithVsys(o getGeneric, idPrefix string, terraformResourceName string) (resources []terraformutils.Resource) {\n\tl, err := o.i.(getListWithOneArg).GetList(o.params[0])\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, r := range l {\n\t\tid := idPrefix + r\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(r),\n\t\t\tterraformResourceName,\n\t\t\t\"panos\",\n\t\t\tmap[string]string{\n\t\t\t\t\"vsys\":         g.vsys,\n\t\t\t\t\"device_group\": \"shared\",\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallObjectsGenerator) createAddressGroupResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.AddressGroup, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_address_group\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createAdministrativeTagResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.Tags, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_administrative_tag\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createApplicationGroupResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.AppGroup, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_application_group\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createApplicationObjectResources() (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Firewall).Objects.Application.GetList(g.vsys)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, r := range l {\n\t\tid := g.vsys + \":\" + r\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(r),\n\t\t\t\"panos_application_object\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\t// TODO: fix\n\t\t// resources = append(resources, g.createApplicationSignatureResources(r)...)\n\t}\n\n\treturn resources\n}\n\n// func (g *FirewallObjectsGenerator) createApplicationSignatureResources(applicationObject string) []terraformutils.Resource {\n// \treturn g.createResourcesFromList(\n// \t\tgetGeneric{g.client.(*pango.Firewall).Objects.AppSignature, []string{g.vsys, applicationObject}},\n// \t\tg.vsys+\":\"+applicationObject+\":\", \"panos_application_signature\",\n// \t)\n// }\n\nfunc (g *FirewallObjectsGenerator) createEDLResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.Edl, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_edl\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createLogForwardingResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.LogForwardingProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_log_forwarding_profile\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createServiceGroupResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.ServiceGroup, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_service_group\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createServiceObjectResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.Services, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_service_object\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createAddressObjectResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.Address, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_address_object\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createAntiSpywareSecurityProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromListWithVsys(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.AntiSpywareProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_anti_spyware_security_profile\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createAntivirusSecurityProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromListWithVsys(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.AntivirusProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_antivirus_security_profile\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createCustomDataPatternObjectResources() []terraformutils.Resource {\n\treturn g.createResourcesFromListWithVsys(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.DataPattern, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_custom_data_pattern_object\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createDataFilteringSecurityProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromListWithVsys(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.DataFilteringProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_data_filtering_security_profile\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createDOSProtectionProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromListWithVsys(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.DosProtectionProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_dos_protection_profile\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createDynamicUserGroupResources() []terraformutils.Resource {\n\treturn g.createResourcesFromListWithVsys(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.DynamicUserGroup, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_dynamic_user_group\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createFileBlockingSecurityProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromListWithVsys(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.FileBlockingProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_file_blocking_security_profile\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createURLFilteringSecurityProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromListWithVsys(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.UrlFilteringProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_url_filtering_security_profile\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createVulnerabilitySecurityProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromListWithVsys(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.VulnerabilityProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_vulnerability_security_profile\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) createWildfireAnalysisSecurityProfileResources() []terraformutils.Resource {\n\treturn g.createResourcesFromListWithVsys(\n\t\tgetGeneric{g.client.(*pango.Firewall).Objects.WildfireAnalysisProfile, []string{g.vsys}},\n\t\tg.vsys+\":\", \"panos_wildfire_analysis_security_profile\",\n\t)\n}\n\nfunc (g *FirewallObjectsGenerator) InitResources() error {\n\tif err := g.Initialize(); err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = append(g.Resources, g.createAddressGroupResources()...)\n\tg.Resources = append(g.Resources, g.createAdministrativeTagResources()...)\n\tg.Resources = append(g.Resources, g.createApplicationGroupResources()...)\n\tg.Resources = append(g.Resources, g.createApplicationObjectResources()...)\n\tg.Resources = append(g.Resources, g.createEDLResources()...)\n\tg.Resources = append(g.Resources, g.createLogForwardingResources()...)\n\tg.Resources = append(g.Resources, g.createServiceGroupResources()...)\n\tg.Resources = append(g.Resources, g.createServiceObjectResources()...)\n\n\tg.Resources = append(g.Resources, g.createAddressObjectResources()...)\n\tg.Resources = append(g.Resources, g.createAntiSpywareSecurityProfileResources()...)\n\tg.Resources = append(g.Resources, g.createAntivirusSecurityProfileResources()...)\n\tg.Resources = append(g.Resources, g.createCustomDataPatternObjectResources()...)\n\tg.Resources = append(g.Resources, g.createDataFilteringSecurityProfileResources()...)\n\tg.Resources = append(g.Resources, g.createDOSProtectionProfileResources()...)\n\tg.Resources = append(g.Resources, g.createDynamicUserGroupResources()...)\n\tg.Resources = append(g.Resources, g.createFileBlockingSecurityProfileResources()...)\n\tg.Resources = append(g.Resources, g.createURLFilteringSecurityProfileResources()...)\n\tg.Resources = append(g.Resources, g.createVulnerabilitySecurityProfileResources()...)\n\tg.Resources = append(g.Resources, g.createWildfireAnalysisSecurityProfileResources()...)\n\n\treturn nil\n}\n\nfunc (g *FirewallObjectsGenerator) PostConvertHook() error {\n\tmapAddressObjectIDs := map[string]string{}\n\tmapApplicationObjectIDs := map[string]string{}\n\tmapServiceObjectIDs := map[string]string{}\n\n\tfor _, r := range g.Resources {\n\t\tif _, ok := r.Item[\"name\"]; ok {\n\t\t\tif r.InstanceInfo.Type == \"panos_address_object\" {\n\t\t\t\tmapAddressObjectIDs[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_application_object\" {\n\t\t\t\tmapApplicationObjectIDs[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_service_object\" {\n\t\t\t\tmapServiceObjectIDs[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"panos_address_group\" {\n\t\t\tif _, ok := r.Item[\"static_addresses\"]; ok {\n\t\t\t\tstaticAddresses := make([]string, len(r.Item[\"static_addresses\"].([]interface{})))\n\t\t\t\tfor k, staticAddress := range r.Item[\"static_addresses\"].([]interface{}) {\n\t\t\t\t\tif _, ok2 := mapAddressObjectIDs[staticAddress.(string)]; ok2 {\n\t\t\t\t\t\tstaticAddresses[k] = mapAddressObjectIDs[staticAddress.(string)]\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tstaticAddresses[k] = staticAddress.(string)\n\t\t\t\t}\n\n\t\t\t\tr.Item[\"static_addresses\"] = staticAddresses\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_application_group\" {\n\t\t\tif _, ok := r.Item[\"applications\"]; ok {\n\t\t\t\tapplications := make([]string, len(r.Item[\"applications\"].([]interface{})))\n\t\t\t\tfor k, application := range r.Item[\"applications\"].([]interface{}) {\n\t\t\t\t\tif _, ok2 := mapApplicationObjectIDs[application.(string)]; ok2 {\n\t\t\t\t\t\tapplications[k] = mapApplicationObjectIDs[application.(string)]\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tapplications[k] = application.(string)\n\t\t\t\t}\n\n\t\t\t\tr.Item[\"applications\"] = applications\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_service_group\" {\n\t\t\tif _, ok := r.Item[\"services\"]; ok {\n\t\t\t\tservices := make([]string, len(r.Item[\"services\"].([]interface{})))\n\t\t\t\tfor k, service := range r.Item[\"services\"].([]interface{}) {\n\t\t\t\t\tif _, ok2 := mapServiceObjectIDs[service.(string)]; ok2 {\n\t\t\t\t\t\tservices[k] = mapServiceObjectIDs[service.(string)]\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tservices[k] = service.(string)\n\t\t\t\t}\n\n\t\t\t\tr.Item[\"services\"] = services\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/panos/firewall_policy.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage panos\n\nimport (\n\t\"encoding/base64\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/PaloAltoNetworks/pango\"\n\t\"github.com/PaloAltoNetworks/pango/util\"\n)\n\ntype FirewallPolicyGenerator struct {\n\tPanosService\n}\n\nfunc (g *FirewallPolicyGenerator) createResourcesFromList(o getGeneric, terraformResourceName string) (resources []terraformutils.Resource) {\n\tl, err := o.i.(getListWithOneArg).GetList(o.params[0])\n\tif err != nil || len(l) == 0 {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tvar positionReference string\n\tid := g.vsys + \":\" + strconv.Itoa(util.MoveTop) + \"::\"\n\n\tfor k, r := range l {\n\t\tif k > 0 {\n\t\t\tid = g.vsys + \":\" + strconv.Itoa(util.MoveAfter) + \":\" + positionReference + \":\"\n\t\t}\n\n\t\tid += base64.StdEncoding.EncodeToString([]byte(r))\n\t\tpositionReference = r\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(r),\n\t\t\tterraformResourceName,\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *FirewallPolicyGenerator) createNATRuleGroupResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(getGeneric{g.client.(*pango.Firewall).Policies.Nat, []string{g.vsys}}, \"panos_nat_rule_group\")\n}\n\nfunc (g *FirewallPolicyGenerator) createPBFRuleGroupResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(getGeneric{g.client.(*pango.Firewall).Policies.PolicyBasedForwarding, []string{g.vsys}}, \"panos_pbf_rule_group\")\n}\n\nfunc (g *FirewallPolicyGenerator) createSecurityRuleGroupResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(getGeneric{g.client.(*pango.Firewall).Policies.Security, []string{g.vsys}}, \"panos_security_rule_group\")\n}\n\nfunc (g *FirewallPolicyGenerator) InitResources() error {\n\tif err := g.Initialize(); err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = append(g.Resources, g.createNATRuleGroupResources()...)\n\tg.Resources = append(g.Resources, g.createPBFRuleGroupResources()...)\n\tg.Resources = append(g.Resources, g.createSecurityRuleGroupResources()...)\n\n\treturn nil\n}\n\nfunc (g *FirewallPolicyGenerator) PostConvertHook() error {\n\tfor _, res := range g.Resources {\n\t\tif res.InstanceInfo.Type == \"panos_nat_rule_group\" {\n\t\t\tfor _, rule := range res.Item[\"rule\"].([]interface{}) {\n\t\t\t\tif _, ok := rule.(map[string]interface{})[\"translated_packet\"]; ok {\n\t\t\t\t\ta := rule.(map[string]interface{})[\"translated_packet\"].([]interface{})\n\t\t\t\t\tfor _, b := range a {\n\t\t\t\t\t\tif _, okb := b.(map[string]interface{})[\"source\"]; !okb {\n\t\t\t\t\t\t\tb.(map[string]interface{})[\"source\"] = make(map[string]interface{})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tfor _, b := range a {\n\t\t\t\t\t\tif _, okb := b.(map[string]interface{})[\"destination\"]; !okb {\n\t\t\t\t\t\t\tb.(map[string]interface{})[\"destination\"] = make(map[string]interface{})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif res.InstanceInfo.Type == \"panos_security_rule_group\" {\n\t\t\tfor _, rule := range res.Item[\"rule\"].([]interface{}) {\n\t\t\t\tif _, ok := rule.(map[string]interface{})[\"hip_profiles\"]; !ok {\n\t\t\t\t\trule.(map[string]interface{})[\"hip_profiles\"] = []string{\"any\"}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/panos/helpers.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage panos\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"unicode\"\n\n\t\"github.com/PaloAltoNetworks/pango\"\n\t\"golang.org/x/text/secure/precis\"\n\t\"golang.org/x/text/transform\"\n\t\"golang.org/x/text/unicode/norm\"\n)\n\nfunc Initialize() (interface{}, error) {\n\treturn pango.Connect(pango.Client{\n\t\tCheckEnvironment: true,\n\t})\n}\n\nfunc GetVsysList() ([]string, interface{}, error) {\n\tclient, err := Initialize()\n\tif err != nil {\n\t\treturn []string{}, nil, err\n\t}\n\n\tswitch c := client.(type) {\n\tcase *pango.Panorama:\n\t\treturn []string{\"shared\"}, pango.Panorama{}, nil\n\tcase *pango.Firewall:\n\t\tvar vsysList []string\n\t\tvsysList, err = c.Vsys.GetList()\n\t\treturn vsysList, pango.Firewall{}, err\n\t}\n\n\treturn []string{}, nil, fmt.Errorf(\"client type not supported\")\n}\n\nfunc FilterCallableResources(t interface{}, resources []string) []string {\n\tvar filteredResources []string\n\n\tswitch t.(type) {\n\tcase pango.Panorama:\n\t\tfor _, r := range resources {\n\t\t\tif strings.HasPrefix(r, \"panorama_\") {\n\t\t\t\tfilteredResources = append(filteredResources, r)\n\t\t\t}\n\t\t}\n\tcase pango.Firewall:\n\t\tfor _, r := range resources {\n\t\t\tif strings.HasPrefix(r, \"firewall_\") {\n\t\t\t\tfilteredResources = append(filteredResources, r)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn filteredResources\n}\n\nfunc normalizeResourceName(s string) string {\n\tnormalize := precis.NewIdentifier(\n\t\tprecis.AdditionalMapping(func() transform.Transformer {\n\t\t\treturn transform.Chain(norm.NFD, transform.RemoveFunc(func(r rune) bool { //nolint\n\t\t\t\treturn unicode.Is(unicode.Mn, r)\n\t\t\t}))\n\t\t}),\n\t\tprecis.Norm(norm.NFC),\n\t)\n\n\tr := strings.NewReplacer(\" \", \"_\",\n\t\t\"!\", \"_\",\n\t\t\"\\\"\", \"_\",\n\t\t\"#\", \"_\",\n\t\t\"%\", \"_\",\n\t\t\"&\", \"_\",\n\t\t\"'\", \"_\",\n\t\t\"(\", \"_\",\n\t\t\")\", \"_\",\n\t\t\"{\", \"_\",\n\t\t\"}\", \"_\",\n\t\t\"*\", \"_\",\n\t\t\"+\", \"_\",\n\t\t\",\", \"_\",\n\t\t\"-\", \"_\",\n\t\t\".\", \"_\",\n\t\t\"/\", \"_\",\n\t\t\"|\", \"_\",\n\t\t\"\\\\\", \"_\",\n\t\t\":\", \"_\",\n\t\t\";\", \"_\",\n\t\t\">\", \"_\",\n\t\t\"=\", \"_\",\n\t\t\"<\", \"_\",\n\t\t\"?\", \"_\",\n\t\t\"[\", \"_\",\n\t\t\"]\", \"_\",\n\t\t\"^\", \"_\",\n\t\t\"`\", \"_\",\n\t\t\"~\", \"_\",\n\t\t\"$\", \"_\",\n\t\t\"@\", \"_at_\")\n\treplaced := r.Replace(strings.ToLower(s))\n\n\tresult, err := normalize.String(replaced)\n\tif err != nil {\n\t\treturn replaced\n\t}\n\n\treturn result\n}\n\ntype getListWithoutArg interface {\n\tGetList() ([]string, error)\n}\n\ntype getListWithOneArg interface {\n\tGetList(string) ([]string, error)\n}\n\ntype getListWithTwoArgs interface {\n\tGetList(string, string) ([]string, error)\n}\n\ntype getListWithThreeArgs interface {\n\tGetList(string, string, string) ([]string, error)\n}\n\ntype getListWithFourArgs interface {\n\tGetList(string, string, string, string) ([]string, error)\n}\n\ntype getListWithFiveArgs interface {\n\tGetList(string, string, string, string, string) ([]string, error)\n}\n\ntype getGeneric struct {\n\ti      interface{}\n\tparams []string\n}\n\nfunc contains(s []string, e string) bool {\n\tfor _, v := range s {\n\t\tif v == e {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc mapExists(mapString map[string]string, item map[string]interface{}, element string) bool {\n\tif _, ok := item[element]; ok {\n\t\tif _, ok2 := mapString[item[element].(string)]; ok2 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n"
  },
  {
    "path": "providers/panos/panorama_device_config.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage panos\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/PaloAltoNetworks/pango\"\n\t\"github.com/PaloAltoNetworks/pango/util\"\n)\n\ntype PanoramaDeviceConfigGenerator struct {\n\tPanosService\n}\n\nfunc (g *PanoramaDeviceConfigGenerator) createResourcesFromList(o getGeneric, idPrefix string, useIDForResourceName bool, terraformResourceName string) (resources []terraformutils.Resource) {\n\tvar l []string\n\tvar err error\n\n\tswitch f := o.i.(type) {\n\tcase getListWithoutArg:\n\t\tl, err = f.GetList()\n\tcase getListWithTwoArgs:\n\t\tl, err = f.GetList(o.params[0], o.params[1])\n\tdefault:\n\t\terr = fmt.Errorf(\"not supported\")\n\t}\n\tif err != nil || len(l) == 0 {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, r := range l {\n\t\tid := idPrefix + r\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(func() string {\n\t\t\t\tif useIDForResourceName {\n\t\t\t\t\treturn id\n\t\t\t\t}\n\n\t\t\t\treturn r\n\t\t\t}()),\n\t\t\tterraformResourceName,\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaDeviceConfigGenerator) createDeviceGroupResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(getGeneric{g.client.(*pango.Panorama).Panorama.DeviceGroup, []string{}},\n\t\t\"\", false, \"panos_panorama_device_group\",\n\t)\n}\n\nfunc (g *PanoramaDeviceConfigGenerator) createDeviceGroupParentResources() (resources []terraformutils.Resource) {\n\tp, err := g.client.(*pango.Panorama).Panorama.DeviceGroup.GetParents()\n\tif err != nil {\n\t\treturn resources\n\t}\n\n\tfor dg, parent := range p {\n\t\tif parent != \"\" {\n\t\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\t\tdg,\n\t\t\t\tnormalizeResourceName(dg),\n\t\t\t\t\"panos_device_group_parent\",\n\t\t\t\t\"panos\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"device_group\": dg,\n\t\t\t\t\t\"parent\":       parent,\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc createAttributes(tmpl, ts, dg string) map[string]string {\n\tattributes := make(map[string]string)\n\n\tif tmpl != \"\" {\n\t\tattributes[\"template\"] = tmpl\n\t}\n\tif ts != \"\" {\n\t\tattributes[\"template_stack\"] = ts\n\t}\n\tif dg != \"\" {\n\t\tattributes[\"device_group\"] = dg\n\t}\n\n\treturn attributes\n}\n\nfunc createServerProfileResources(tmpl, ts, vsys, dg, terraformResourceName string, l []string) (resources []terraformutils.Resource) {\n\tattributes := createAttributes(tmpl, ts, dg)\n\n\tfor _, r := range l {\n\t\tid := tmpl + \":\" + ts + \":\" + vsys + \":\" + dg + \":\" + r\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\tterraformResourceName,\n\t\t\t\"panos\",\n\t\t\tattributes,\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaDeviceConfigGenerator) createEmailServerProfileResources(tmpl, ts, vsys, dg string) (resources []terraformutils.Resource) {\n\tl := make([]string, 0)\n\tvar err error\n\n\tif tmpl != \"\" || ts != \"\" {\n\t\tl, err = g.client.(*pango.Panorama).Device.EmailServerProfile.GetList(tmpl, ts, vsys)\n\t}\n\tif dg != \"\" {\n\t\tans := make([]string, 0, 7)\n\t\tans = append(ans, util.DeviceGroupXpathPrefix(dg)...)\n\t\tans = append(ans, []string{\"log-settings\", \"email\"}...)\n\t\tl, err = g.client.(util.XapiClient).EntryListUsing(g.client.(util.XapiClient).Get, ans)\n\t}\n\n\tif err != nil || len(l) == 0 {\n\t\treturn resources\n\t}\n\n\treturn createServerProfileResources(tmpl, ts, vsys, dg, \"panos_panorama_email_server_profile\", l)\n}\n\nfunc (g *PanoramaDeviceConfigGenerator) createHTTPServerProfileResources(tmpl, ts, vsys, dg string) (resources []terraformutils.Resource) {\n\tl := make([]string, 0)\n\tvar err error\n\n\tif tmpl != \"\" || ts != \"\" {\n\t\tl, err = g.client.(*pango.Panorama).Device.HttpServerProfile.GetList(tmpl, ts, vsys)\n\t}\n\tif dg != \"\" {\n\t\tans := make([]string, 0, 7)\n\t\tans = append(ans, util.DeviceGroupXpathPrefix(dg)...)\n\t\tans = append(ans, []string{\"log-settings\", \"http\"}...)\n\t\tl, err = g.client.(util.XapiClient).EntryListUsing(g.client.(util.XapiClient).Get, ans)\n\t}\n\n\tif err != nil || len(l) == 0 {\n\t\treturn resources\n\t}\n\n\treturn createServerProfileResources(tmpl, ts, vsys, dg, \"panos_panorama_http_server_profile\", l)\n}\n\nfunc (g *PanoramaDeviceConfigGenerator) createSNMPTrapServerProfileResources(tmpl, ts, vsys, dg string) (resources []terraformutils.Resource) {\n\tl := make([]string, 0)\n\tvar err error\n\n\tif tmpl != \"\" || ts != \"\" {\n\t\tl, err = g.client.(*pango.Panorama).Device.SnmpServerProfile.GetList(tmpl, ts, vsys)\n\t}\n\tif dg != \"\" {\n\t\tans := make([]string, 0, 7)\n\t\tans = append(ans, util.DeviceGroupXpathPrefix(dg)...)\n\t\tans = append(ans, []string{\"log-settings\", \"snmptrap\"}...)\n\t\tl, err = g.client.(util.XapiClient).EntryListUsing(g.client.(util.XapiClient).Get, ans)\n\t}\n\n\tif err != nil || len(l) == 0 {\n\t\treturn resources\n\t}\n\n\treturn createServerProfileResources(tmpl, ts, vsys, dg, \"panos_panorama_snmptrap_server_profile\", l)\n}\n\nfunc (g *PanoramaDeviceConfigGenerator) createSyslogServerProfileResources(tmpl, ts, vsys, dg string) (resources []terraformutils.Resource) {\n\tl := make([]string, 0)\n\tvar err error\n\n\tif tmpl != \"\" || ts != \"\" {\n\t\tl, err = g.client.(*pango.Panorama).Device.SyslogServerProfile.GetList(tmpl, ts, vsys)\n\t}\n\tif dg != \"\" {\n\t\tans := make([]string, 0, 7)\n\t\tans = append(ans, util.DeviceGroupXpathPrefix(dg)...)\n\t\tans = append(ans, []string{\"log-settings\", \"syslog\"}...)\n\t\tl, err = g.client.(util.XapiClient).EntryListUsing(g.client.(util.XapiClient).Get, ans)\n\t}\n\n\tif err != nil || len(l) == 0 {\n\t\treturn resources\n\t}\n\n\treturn createServerProfileResources(tmpl, ts, vsys, dg, \"panos_panorama_syslog_server_profile\", l)\n}\n\nfunc (g *PanoramaDeviceConfigGenerator) createTemplateResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(getGeneric{g.client.(*pango.Panorama).Panorama.Template, []string{}},\n\t\t\"\", false, \"panos_panorama_template\",\n\t)\n}\n\nfunc (g *PanoramaDeviceConfigGenerator) createTemplateStackResources() []terraformutils.Resource {\n\treturn g.createResourcesFromList(getGeneric{g.client.(*pango.Panorama).Panorama.TemplateStack, []string{}},\n\t\t\"\", false, \"panos_panorama_template_stack\",\n\t)\n}\n\nfunc (g *PanoramaDeviceConfigGenerator) createTemplateVariableResources(tmpl, ts string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(getGeneric{g.client.(*pango.Panorama).Panorama.TemplateVariable, []string{tmpl, ts}},\n\t\ttmpl+\":\"+ts+\":\", true, \"panos_panorama_template_variable\",\n\t)\n}\n\nfunc (g *PanoramaDeviceConfigGenerator) InitResources() error {\n\tif err := g.Initialize(); err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = append(g.Resources, g.createTemplateStackResources()...)\n\tg.Resources = append(g.Resources, g.createTemplateResources()...)\n\tg.Resources = append(g.Resources, g.createDeviceGroupResources()...)\n\tg.Resources = append(g.Resources, g.createDeviceGroupParentResources()...)\n\n\tts, err := g.client.(*pango.Panorama).Panorama.TemplateStack.GetList()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range ts {\n\t\tg.Resources = append(g.Resources, g.createTemplateVariableResources(\"\", v)...)\n\n\t\tvsysList, err := g.client.(*pango.Panorama).Vsys.GetList(\"\", v)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tvsysList = append(vsysList, \"shared\")\n\n\t\tfor _, vsys := range vsysList {\n\t\t\tg.Resources = append(g.Resources, g.createEmailServerProfileResources(\"\", v, vsys, \"\")...)\n\t\t\tg.Resources = append(g.Resources, g.createHTTPServerProfileResources(\"\", v, vsys, \"\")...)\n\t\t\tg.Resources = append(g.Resources, g.createSNMPTrapServerProfileResources(\"\", v, vsys, \"\")...)\n\t\t\tg.Resources = append(g.Resources, g.createSyslogServerProfileResources(\"\", v, vsys, \"\")...)\n\t\t}\n\t}\n\n\ttmpl, err := g.client.(*pango.Panorama).Panorama.Template.GetList()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range tmpl {\n\t\tg.Resources = append(g.Resources, g.createTemplateVariableResources(v, \"\")...)\n\n\t\tvsysList, err := g.client.(*pango.Panorama).Vsys.GetList(v, \"\")\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tvsysList = append(vsysList, \"shared\")\n\n\t\tfor _, vsys := range vsysList {\n\t\t\tg.Resources = append(g.Resources, g.createEmailServerProfileResources(v, \"\", vsys, \"\")...)\n\t\t\tg.Resources = append(g.Resources, g.createHTTPServerProfileResources(v, \"\", vsys, \"\")...)\n\t\t\tg.Resources = append(g.Resources, g.createSNMPTrapServerProfileResources(v, \"\", vsys, \"\")...)\n\t\t\tg.Resources = append(g.Resources, g.createSyslogServerProfileResources(v, \"\", vsys, \"\")...)\n\t\t}\n\t}\n\n\tdg, err := g.client.(*pango.Panorama).Panorama.DeviceGroup.GetList()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range dg {\n\t\tg.Resources = append(g.Resources, g.createEmailServerProfileResources(\"\", \"\", \"\", v)...)\n\t\tg.Resources = append(g.Resources, g.createHTTPServerProfileResources(\"\", \"\", \"\", v)...)\n\t\tg.Resources = append(g.Resources, g.createSNMPTrapServerProfileResources(\"\", \"\", \"\", v)...)\n\t\tg.Resources = append(g.Resources, g.createSyslogServerProfileResources(\"\", \"\", \"\", v)...)\n\t}\n\n\t// TODO: Panorama's own profiles are not yet supported by the Terraform provider\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/panos/panorama_networking.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage panos\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/PaloAltoNetworks/pango\"\n\t\"github.com/PaloAltoNetworks/pango/netw/interface/eth\"\n\t\"github.com/PaloAltoNetworks/pango/netw/interface/subinterface/layer2\"\n\t\"github.com/PaloAltoNetworks/pango/netw/interface/subinterface/layer3\"\n\t\"github.com/PaloAltoNetworks/pango/util\"\n\t\"github.com/PaloAltoNetworks/pango/vsys\"\n)\n\ntype PanoramaNetworkingGenerator struct {\n\tPanosService\n}\n\nfunc (g *PanoramaNetworkingGenerator) createResourcesFromList(\n\to getGeneric,\n\tidPrefix string,\n\tuseIDForResourceName bool,\n\tterraformResourceName string,\n) (resources []terraformutils.Resource) {\n\tvar l []string\n\tvar err error\n\n\tswitch f := o.i.(type) {\n\tcase getListWithoutArg:\n\t\tl, err = f.GetList()\n\tcase getListWithOneArg:\n\t\tl, err = f.GetList(o.params[0])\n\tcase getListWithTwoArgs:\n\t\tl, err = f.GetList(o.params[0], o.params[1])\n\tcase getListWithThreeArgs:\n\t\tl, err = f.GetList(o.params[0], o.params[1], o.params[2])\n\tcase getListWithFourArgs:\n\t\tl, err = f.GetList(o.params[0], o.params[1], o.params[2], o.params[3])\n\tcase getListWithFiveArgs:\n\t\tl, err = f.GetList(o.params[0], o.params[1], o.params[2], o.params[3], o.params[4])\n\tdefault:\n\t\terr = fmt.Errorf(\"not supported\")\n\t}\n\tif err != nil || len(l) == 0 {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, r := range l {\n\t\tid := idPrefix + r\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(func() string {\n\t\t\t\tif useIDForResourceName {\n\t\t\t\t\treturn id\n\t\t\t\t}\n\n\t\t\t\treturn r\n\t\t\t}()),\n\t\t\tterraformResourceName,\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createAggregateInterfaceResources(tmpl, ts string, v []vsys.Entry) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.AggregateInterface.GetList(tmpl, ts)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, vsys := range v {\n\t\tfor _, aggregateInterface := range l {\n\t\t\tif !contains(vsys.NetworkImports.Interfaces, aggregateInterface) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trv, err := g.client.(*pango.Panorama).IsImported(util.InterfaceImport, tmpl, ts, vsys.Name, aggregateInterface)\n\t\t\tif err != nil || !rv {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tid := tmpl + \":\" + ts + \":\" + vsys.Name + \":\" + aggregateInterface\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tnormalizeResourceName(id),\n\t\t\t\t\"panos_panorama_aggregate_interface\",\n\t\t\t\t\"panos\",\n\t\t\t\t[]string{},\n\t\t\t))\n\n\t\t\te, err := g.client.(*pango.Panorama).Network.AggregateInterface.Get(tmpl, ts, aggregateInterface)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif e.Mode == eth.ModeLayer2 || e.Mode == eth.ModeVirtualWire {\n\t\t\t\tg.Resources = append(g.Resources, g.createLayer2SubInterfaceResources(tmpl, ts, vsys.Name, layer2.EthernetInterface, aggregateInterface, e.Mode)...)\n\t\t\t}\n\n\t\t\tif e.Mode == eth.ModeLayer3 {\n\t\t\t\tg.Resources = append(g.Resources, g.createLayer3SubInterfaceResources(tmpl, ts, vsys.Name, layer3.EthernetInterface, aggregateInterface)...)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBFDProfileResources(tmpl, ts string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.BfdProfile, []string{tmpl, ts}},\n\t\ttmpl+\":\"+ts+\":\", false, \"panos_panorama_bfd_profile\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPResource(tmpl, ts, virtualRouter string) terraformutils.Resource {\n\treturn terraformutils.NewSimpleResource(\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter,\n\t\tnormalizeResourceName(tmpl+\":\"+ts+\":\"+virtualRouter),\n\t\t\"panos_panorama_bgp\",\n\t\t\"panos\",\n\t\t[]string{},\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPAggregateResources(tmpl, ts, virtualRouter string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.BgpAggregate.GetList(tmpl, ts, virtualRouter)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, bgpAggregate := range l {\n\t\tid := tmpl + \":\" + ts + \":\" + virtualRouter + \":\" + bgpAggregate\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_panorama_bgp_aggregate\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\tresources = append(resources, g.createBGPAggregateAdvertiseFilterResources(tmpl, ts, virtualRouter, bgpAggregate)...)\n\t\tresources = append(resources, g.createBGPAggregateSuppressFilterResources(tmpl, ts, virtualRouter, bgpAggregate)...)\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPAggregateAdvertiseFilterResources(tmpl, ts, virtualRouter, bgpAggregate string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.BgpAggAdvertiseFilter, []string{tmpl, ts, virtualRouter, bgpAggregate}},\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter+\":\"+bgpAggregate+\":\", true, \"panos_panorama_bgp_aggregate_advertise_filter\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPAggregateSuppressFilterResources(tmpl, ts, virtualRouter, bgpAggregate string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.BgpAggSuppressFilter, []string{tmpl, ts, virtualRouter, bgpAggregate}},\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter+\":\"+bgpAggregate+\":\", true, \"panos_panorama_bgp_aggregate_suppress_filter\",\n\t)\n}\n\n// The secret argument will contain \"(incorrect)\", not the real value\nfunc (g *PanoramaNetworkingGenerator) createBGPAuthProfileResources(tmpl, ts, virtualRouter string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.BgpAuthProfile, []string{tmpl, ts, virtualRouter}},\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter+\":\", true, \"panos_panorama_bgp_auth_profile\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPConditionalAdvertisementResources(tmpl, ts, virtualRouter string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.BgpConditionalAdv.GetList(tmpl, ts, virtualRouter)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, bgpConditionalAdv := range l {\n\t\tid := tmpl + \":\" + ts + \":\" + virtualRouter + \":\" + bgpConditionalAdv\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_panorama_bgp_conditional_adv\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\tresources = append(resources, g.createBGPConditionalAdvertisementAdvertiseFilterResources(tmpl, ts, virtualRouter, bgpConditionalAdv)...)\n\t\tresources = append(resources, g.createBGPConditionalAdvertisementNonExistFilterResources(tmpl, ts, virtualRouter, bgpConditionalAdv)...)\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPConditionalAdvertisementAdvertiseFilterResources(tmpl, ts, virtualRouter, bgpConditionalAdv string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.BgpConAdvAdvertiseFilter, []string{tmpl, ts, virtualRouter, bgpConditionalAdv}},\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter+\":\"+bgpConditionalAdv+\":\", true, \"panos_panorama_bgp_conditional_adv_advertise_filter\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPConditionalAdvertisementNonExistFilterResources(tmpl, ts, virtualRouter, bgpConditionalAdv string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.BgpConAdvNonExistFilter, []string{tmpl, ts, virtualRouter, bgpConditionalAdv}},\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter+\":\"+bgpConditionalAdv+\":\", true, \"panos_panorama_bgp_conditional_adv_non_exist_filter\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPDampeningProfileResources(tmpl, ts, virtualRouter string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.BgpDampeningProfile, []string{tmpl, ts, virtualRouter}},\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter+\":\", true, \"panos_panorama_bgp_dampening_profile\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPExportRuleGroupResources(tmpl, ts, virtualRouter string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.BgpExport, []string{tmpl, ts, virtualRouter}},\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter+\":\", true, \"panos_panorama_bgp_export_rule_group\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPImportRuleGroupResources(tmpl, ts, virtualRouter string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.BgpImport, []string{tmpl, ts, virtualRouter}},\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter+\":\", true, \"panos_panorama_bgp_import_rule_group\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPPeerGroupResources(tmpl, ts, virtualRouter string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.BgpPeerGroup.GetList(tmpl, ts, virtualRouter)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, bgpPeerGroup := range l {\n\t\tid := tmpl + \":\" + ts + \":\" + virtualRouter + \":\" + bgpPeerGroup\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_panorama_bgp_peer_group\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\tresources = append(resources, g.createBGPPeerResources(tmpl, ts, virtualRouter, bgpPeerGroup)...)\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPPeerResources(tmpl, ts, virtualRouter, bgpPeerGroup string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.BgpPeer, []string{tmpl, ts, virtualRouter, bgpPeerGroup}},\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter+\":\"+bgpPeerGroup+\":\", true, \"panos_panorama_bgp_peer\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createBGPRedistResources(tmpl, ts, virtualRouter string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.BgpRedistRule, []string{tmpl, ts, virtualRouter}},\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter+\":\", true, \"panos_panorama_bgp_redist_rule\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createEthernetInterfaceResources(tmpl, ts string, v []vsys.Entry) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.EthernetInterface.GetList(tmpl, ts)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, vsys := range v {\n\t\tfor _, ethernetInterface := range l {\n\t\t\tif !contains(vsys.NetworkImports.Interfaces, ethernetInterface) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trv, err := g.client.(*pango.Panorama).IsImported(util.InterfaceImport, tmpl, ts, vsys.Name, ethernetInterface)\n\t\t\tif err != nil || !rv {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tid := tmpl + \":\" + ts + \":\" + vsys.Name + \":\" + ethernetInterface\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tnormalizeResourceName(id),\n\t\t\t\t\"panos_panorama_ethernet_interface\",\n\t\t\t\t\"panos\",\n\t\t\t\t[]string{},\n\t\t\t))\n\n\t\t\te, err := g.client.(*pango.Panorama).Network.EthernetInterface.Get(tmpl, ts, ethernetInterface)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif e.Mode == eth.ModeLayer2 || e.Mode == eth.ModeVirtualWire {\n\t\t\t\tg.Resources = append(g.Resources, g.createLayer2SubInterfaceResources(tmpl, ts, vsys.Name, layer2.EthernetInterface, ethernetInterface, e.Mode)...)\n\t\t\t}\n\n\t\t\tif e.Mode == eth.ModeLayer3 {\n\t\t\t\tg.Resources = append(g.Resources, g.createLayer3SubInterfaceResources(tmpl, ts, vsys.Name, layer3.EthernetInterface, ethernetInterface)...)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createGRETunnelResources(tmpl, ts string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.GreTunnel, []string{tmpl, ts}},\n\t\ttmpl+\":\"+ts+\":\", false, \"panos_panorama_gre_tunnel\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createIKECryptoProfileResources(tmpl, ts string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.IkeCryptoProfile.GetList(tmpl, ts)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tidPrefix := tmpl + \":\" + ts + \":\"\n\tfor _, ikeCryptoProfile := range l {\n\t\tid := idPrefix + ikeCryptoProfile\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_panorama_ike_crypto_profile\",\n\t\t\t\"panos\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\": ikeCryptoProfile,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createIKEGatewayResources(tmpl, ts string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.IkeGateway.GetList(tmpl, ts)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tidPrefix := tmpl + \":\" + ts + \":\"\n\tfor _, ikeGateway := range l {\n\t\tid := idPrefix + ikeGateway\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_panorama_ike_gateway\",\n\t\t\t\"panos\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\": ikeGateway,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createIPSECCryptoProfileResources(tmpl, ts string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.IpsecCryptoProfile.GetList(tmpl, ts)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tidPrefix := tmpl + \":\" + ts + \":\"\n\tfor _, ipsecCryptoProfile := range l {\n\t\tid := idPrefix + ipsecCryptoProfile\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_panorama_ipsec_crypto_profile\",\n\t\t\t\"panos\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\": ipsecCryptoProfile,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createIPSECTunnelProxyIDIPv4Resources(tmpl, ts, ipsecTunnel string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.IpsecTunnelProxyId, []string{tmpl, ts, ipsecTunnel}},\n\t\ttmpl+\":\"+ts+\":\"+ipsecTunnel+\":\", true, \"panos_panorama_ipsec_tunnel_proxy_id_ipv4\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createIPSECTunnelResources(tmpl, ts string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.IpsecTunnel.GetList(tmpl, ts)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tidPrefix := tmpl + \"::\"\n\tfor _, ipsecTunnel := range l {\n\t\tid := idPrefix + ipsecTunnel\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_panorama_ipsec_tunnel\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\tresources = append(resources, g.createIPSECTunnelProxyIDIPv4Resources(tmpl, ts, ipsecTunnel)...)\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createLayer2SubInterfaceResources(tmpl, ts, vsys, interfaceType, parentInterface, parentMode string) []terraformutils.Resource {\n\t// TO FIX: check disabled!\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.Layer2Subinterface, []string{tmpl, ts, interfaceType, parentInterface, parentMode}},\n\t\ttmpl+\":\"+ts+\":\"+interfaceType+\":\"+parentInterface+\":\"+parentMode+\":\"+vsys+\":\", true, \"panos_panorama_layer2_subinterface\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createLayer3SubInterfaceResources(tmpl, ts, vsys, interfaceType, parentInterface string) []terraformutils.Resource {\n\t// TO FIX: check disabled!\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.Layer3Subinterface, []string{tmpl, ts, interfaceType, parentInterface}},\n\t\ttmpl+\":\"+ts+\":\"+interfaceType+\":\"+parentInterface+\":\"+vsys+\":\", true, \"panos_panorama_layer3_subinterface\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createLoopbackInterfaceResources(tmpl, ts string, v []vsys.Entry) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.LoopbackInterface.GetList(tmpl, ts)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, vsys := range v {\n\t\tfor _, loopbackInterface := range l {\n\t\t\tif !contains(vsys.NetworkImports.Interfaces, loopbackInterface) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trv, err := g.client.(*pango.Panorama).IsImported(util.InterfaceImport, tmpl, ts, vsys.Name, loopbackInterface)\n\t\t\tif err != nil || !rv {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tid := tmpl + \":\" + ts + \":\" + vsys.Name + \":\" + loopbackInterface\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tnormalizeResourceName(id),\n\t\t\t\t\"panos_panorama_loopback_interface\",\n\t\t\t\t\"panos\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createManagementProfileResources(tmpl, ts string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.ManagementProfile.GetList(tmpl, ts)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tidPrefix := tmpl + \":\" + ts + \":\"\n\tfor _, managementProfile := range l {\n\t\tid := idPrefix + managementProfile\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_panorama_management_profile\",\n\t\t\t\"panos\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\": managementProfile,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createMonitorProfileResources(tmpl, ts string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.MonitorProfile, []string{tmpl, ts}},\n\t\ttmpl+\":\"+ts+\":\", true, \"panos_panorama_monitor_profile\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createRedistributionProfileResources(tmpl, ts, virtualRouter string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.RedistributionProfile, []string{tmpl, ts, virtualRouter}},\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter+\":\", true, \"panos_panorama_redistribution_profile_ipv4\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createStaticRouteIpv4Resources(tmpl, ts, virtualRouter string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Network.StaticRoute, []string{tmpl, ts, virtualRouter}},\n\t\ttmpl+\":\"+ts+\":\"+virtualRouter+\":\", true, \"panos_panorama_static_route_ipv4\",\n\t)\n}\n\nfunc (g *PanoramaNetworkingGenerator) createTunnelInterfaceResources(tmpl, ts string, v []vsys.Entry) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.TunnelInterface.GetList(tmpl, ts)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, vsys := range v {\n\t\tfor _, tunnelInterface := range l {\n\t\t\tif !contains(vsys.NetworkImports.Interfaces, tunnelInterface) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trv, err := g.client.(*pango.Panorama).IsImported(util.InterfaceImport, tmpl, ts, vsys.Name, tunnelInterface)\n\t\t\tif err != nil || !rv {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tid := tmpl + \":\" + ts + \":\" + vsys.Name + \":\" + tunnelInterface\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tnormalizeResourceName(id),\n\t\t\t\t\"panos_panorama_tunnel_interface\",\n\t\t\t\t\"panos\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createVirtualRouterResources(tmpl, ts string, v []vsys.Entry) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.VirtualRouter.GetList(tmpl, ts)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, vsys := range v {\n\t\tfor _, virtualRouter := range l {\n\t\t\tif !contains(vsys.NetworkImports.VirtualRouters, virtualRouter) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// TODO: doesn't work!!?\n\t\t\t// rv, err := g.client.(*pango.Panorama).IsImported(util.InterfaceImport, tmpl, ts, vsys.Name, virtualRouter)\n\t\t\t// if err != nil || !rv {\n\t\t\t// \tcontinue\n\t\t\t// }\n\n\t\t\tid := tmpl + \":\" + ts + \":\" + vsys.Name + \":\" + virtualRouter\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tnormalizeResourceName(id),\n\t\t\t\t\"panos_panorama_virtual_router\",\n\t\t\t\t\"panos\",\n\t\t\t\t[]string{},\n\t\t\t))\n\n\t\t\tresources = append(resources, g.createBGPResource(tmpl, ts, virtualRouter))\n\t\t\tresources = append(resources, g.createBGPAggregateResources(tmpl, ts, virtualRouter)...)\n\t\t\tresources = append(resources, g.createBGPAuthProfileResources(tmpl, ts, virtualRouter)...)\n\t\t\tresources = append(resources, g.createBGPConditionalAdvertisementResources(tmpl, ts, virtualRouter)...)\n\t\t\tresources = append(resources, g.createBGPDampeningProfileResources(tmpl, ts, virtualRouter)...)\n\t\t\tresources = append(resources, g.createBGPExportRuleGroupResources(tmpl, ts, virtualRouter)...)\n\t\t\tresources = append(resources, g.createBGPImportRuleGroupResources(tmpl, ts, virtualRouter)...)\n\t\t\tresources = append(resources, g.createBGPPeerGroupResources(tmpl, ts, virtualRouter)...)\n\t\t\tresources = append(resources, g.createBGPRedistResources(tmpl, ts, virtualRouter)...)\n\t\t\tresources = append(resources, g.createRedistributionProfileResources(tmpl, ts, virtualRouter)...)\n\t\t\tresources = append(resources, g.createStaticRouteIpv4Resources(tmpl, ts, virtualRouter)...)\n\t\t}\n\t}\n\n\treturn resources\n}\n\n// FIX: get VLANs in Vsys = None\nfunc (g *PanoramaNetworkingGenerator) createVlanResources(tmpl, ts string, v []vsys.Entry) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.Vlan.GetList(tmpl, ts)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, vsys := range v {\n\t\tfor _, vlan := range l {\n\t\t\tif !contains(vsys.NetworkImports.Vlans, vlan) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trv, err := g.client.(*pango.Panorama).IsImported(util.VlanImport, tmpl, ts, vsys.Name, vlan)\n\t\t\tif err != nil || !rv {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tid := tmpl + \":\" + ts + \":\" + vsys.Name + \":\" + vlan\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tnormalizeResourceName(id),\n\t\t\t\t\"panos_panorama_vlan\",\n\t\t\t\t\"panos\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createVlanInterfaceResources(tmpl, ts string, v []vsys.Entry) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Network.VlanInterface.GetList(tmpl, ts)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, vsys := range v {\n\t\tfor _, vlanInterface := range l {\n\t\t\tif !contains(vsys.NetworkImports.Interfaces, vlanInterface) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trv, err := g.client.(*pango.Panorama).IsImported(util.InterfaceImport, tmpl, ts, vsys.Name, vlanInterface)\n\t\t\tif err != nil || !rv {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tid := tmpl + \":\" + ts + \":\" + vsys.Name + \":\" + vlanInterface\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tnormalizeResourceName(id),\n\t\t\t\t\"panos_panorama_vlan_interface\",\n\t\t\t\t\"panos\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) createZoneResources(tmpl, ts string, v []vsys.Entry) (resources []terraformutils.Resource) {\n\tfor _, vsys := range v {\n\t\tl, err := g.client.(*pango.Panorama).Network.Zone.GetList(tmpl, ts, vsys.Name)\n\t\tif err != nil {\n\t\t\treturn []terraformutils.Resource{}\n\t\t}\n\n\t\tfor _, zone := range l {\n\t\t\tid := tmpl + \":\" + ts + \":\" + vsys.Name + \":\" + zone\n\t\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\t\tid,\n\t\t\t\tnormalizeResourceName(id),\n\t\t\t\t\"panos_panorama_zone\",\n\t\t\t\t\"panos\",\n\t\t\t\t[]string{},\n\t\t\t))\n\t\t}\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaNetworkingGenerator) InitResources() error {\n\tif err := g.Initialize(); err != nil {\n\t\treturn err\n\t}\n\n\tts, err := g.client.(*pango.Panorama).Panorama.TemplateStack.GetList()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range ts {\n\t\tg.Resources = append(g.Resources, g.createBFDProfileResources(\"\", v)...)\n\t\tg.Resources = append(g.Resources, g.createIKECryptoProfileResources(\"\", v)...)\n\t\tg.Resources = append(g.Resources, g.createIKEGatewayResources(\"\", v)...)\n\t\tg.Resources = append(g.Resources, g.createIPSECCryptoProfileResources(\"\", v)...)\n\t\tg.Resources = append(g.Resources, g.createManagementProfileResources(\"\", v)...)\n\t\tg.Resources = append(g.Resources, g.createMonitorProfileResources(\"\", v)...)\n\t}\n\n\ttmpl, err := g.client.(*pango.Panorama).Panorama.Template.GetList()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range tmpl {\n\t\tvsysAll, err := g.client.(*pango.Panorama).Vsys.GetAll(v, \"\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tg.Resources = append(g.Resources, g.createAggregateInterfaceResources(v, \"\", vsysAll)...)\n\t\tg.Resources = append(g.Resources, g.createBFDProfileResources(v, \"\")...)\n\t\tg.Resources = append(g.Resources, g.createEthernetInterfaceResources(v, \"\", vsysAll)...)\n\t\tg.Resources = append(g.Resources, g.createGRETunnelResources(v, \"\")...)\n\t\tg.Resources = append(g.Resources, g.createIKECryptoProfileResources(v, \"\")...)\n\t\tg.Resources = append(g.Resources, g.createIKEGatewayResources(v, \"\")...)\n\t\tg.Resources = append(g.Resources, g.createIPSECCryptoProfileResources(v, \"\")...)\n\t\tg.Resources = append(g.Resources, g.createIPSECTunnelResources(v, \"\")...)\n\t\tg.Resources = append(g.Resources, g.createLoopbackInterfaceResources(v, \"\", vsysAll)...)\n\t\tg.Resources = append(g.Resources, g.createManagementProfileResources(v, \"\")...)\n\t\tg.Resources = append(g.Resources, g.createMonitorProfileResources(v, \"\")...)\n\t\tg.Resources = append(g.Resources, g.createTunnelInterfaceResources(v, \"\", vsysAll)...)\n\t\tg.Resources = append(g.Resources, g.createVirtualRouterResources(v, \"\", vsysAll)...)\n\t\tg.Resources = append(g.Resources, g.createVlanResources(v, \"\", vsysAll)...)\n\t\tg.Resources = append(g.Resources, g.createVlanInterfaceResources(v, \"\", vsysAll)...)\n\t\tg.Resources = append(g.Resources, g.createZoneResources(v, \"\", vsysAll)...)\n\t}\n\n\treturn nil\n}\n\nfunc (g *PanoramaNetworkingGenerator) PostConvertHook() error {\n\tmapInterfaceNames := map[string]string{}\n\tmapInterfaceModes := map[string]string{}\n\tmapIKECryptoProfileNames := map[string]string{}\n\tmapIKEGatewayNames := map[string]string{}\n\tmapIPSECCryptoProfileNames := map[string]string{}\n\n\tfor _, r := range g.Resources {\n\t\tif _, ok := r.Item[\"name\"]; ok {\n\t\t\tif r.InstanceInfo.Type == \"panos_panorama_aggregate_interface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t\tmapInterfaceModes[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".mode}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_panorama_ethernet_interface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t\tmapInterfaceModes[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".mode}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_panorama_layer2_subinterface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_panorama_layer3_subinterface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_panorama_loopback_interface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_panorama_tunnel_interface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_panorama_vlan_interface\" {\n\t\t\t\tmapInterfaceNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_panorama_ike_crypto_profile\" {\n\t\t\t\tmapIKECryptoProfileNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_panorama_ike_gateway\" {\n\t\t\t\tmapIKEGatewayNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_panorama_ipsec_crypto_profile\" {\n\t\t\t\tmapIPSECCryptoProfileNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"panos_panorama_bgp\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_redistribution_profile_ipv4\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_static_route_ipv4\" {\n\t\t\tif _, ok := r.Item[\"virtual_router\"]; ok {\n\t\t\t\tif r.Item[\"virtual_router\"].(string) != \"default\" {\n\t\t\t\t\tr.Item[\"virtual_router\"] = \"${panos_panorama_virtual_router.\" + normalizeResourceName(r.Item[\"virtual_router\"].(string)) + \".name}\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_bgp_aggregate\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_bgp_auth_profile\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_bgp_conditional_adv\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_bgp_dampening_profile\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_bgp_export_rule_group\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_bgp_import_rule_group\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_bgp_peer_group\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_bgp_redist_rule\" {\n\t\t\tif _, ok := r.Item[\"virtual_router\"]; ok {\n\t\t\t\tif r.Item[\"virtual_router\"].(string) != \"default\" {\n\t\t\t\t\tr.Item[\"virtual_router\"] = \"${panos_panorama_bgp.\" + normalizeResourceName(r.Item[\"virtual_router\"].(string)) + \".virtual_router}\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_bgp_aggregate_advertise_filter\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_bgp_aggregate_suppress_filter\" {\n\t\t\tif _, ok := r.Item[\"virtual_router\"]; ok {\n\t\t\t\tif r.Item[\"virtual_router\"].(string) != \"default\" {\n\t\t\t\t\tr.Item[\"virtual_router\"] = \"${panos_panorama_bgp_aggregate.\" + normalizeResourceName(r.Item[\"virtual_router\"].(string)) + \".virtual_router}\"\n\t\t\t\t}\n\t\t\t}\n\t\t\tif _, ok := r.Item[\"bgp_aggregate\"]; ok {\n\t\t\t\tr.Item[\"bgp_aggregate\"] = \"${panos_panorama_bgp_aggregate.\" + normalizeResourceName(r.Item[\"bgp_aggregate\"].(string)) + \".name}\"\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_bgp_peer\" {\n\t\t\tif _, ok := r.Item[\"virtual_router\"]; ok {\n\t\t\t\tif r.Item[\"virtual_router\"].(string) != \"default\" {\n\t\t\t\t\tr.Item[\"virtual_router\"] = \"${panos_panorama_bgp.\" + normalizeResourceName(r.Item[\"virtual_router\"].(string)) + \".virtual_router}\"\n\t\t\t\t\tr.Item[\"peer_as\"] = \"${panos_panorama_bgp.\" + normalizeResourceName(r.Item[\"virtual_router\"].(string)) + \".as_number}\"\n\t\t\t\t}\n\t\t\t}\n\t\t\tif _, ok := r.Item[\"panos_bgp_peer_group\"]; ok {\n\t\t\t\tr.Item[\"bgp_peer_group\"] = \"${panos_panorama_bgp_peer_group.\" + normalizeResourceName(r.Item[\"panos_bgp_peer_group\"].(string)) + \".name}\"\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_bgp_conditional_adv_advertise_filter\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_bgp_conditional_adv_non_exist_filter\" {\n\t\t\tif _, ok := r.Item[\"virtual_router\"]; ok {\n\t\t\t\tif r.Item[\"virtual_router\"].(string) != \"default\" {\n\t\t\t\t\tr.Item[\"virtual_router\"] = \"${panos_panorama_bgp.\" + normalizeResourceName(r.Item[\"virtual_router\"].(string)) + \".virtual_router}\"\n\t\t\t\t}\n\t\t\t}\n\t\t\tif _, ok := r.Item[\"panos_bgp_conditional_adv\"]; ok {\n\t\t\t\tr.Item[\"bgp_conditional_adv\"] = \"${panos_panorama_bgp_conditional_adv.\" + normalizeResourceName(r.Item[\"panos_bgp_conditional_adv\"].(string)) + \".name}\"\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_gre_tunnel\" {\n\t\t\tif mapExists(mapInterfaceNames, r.Item, \"interface\") {\n\t\t\t\tr.Item[\"interface\"] = mapInterfaceNames[r.Item[\"interface\"].(string)]\n\t\t\t}\n\t\t\tif mapExists(mapInterfaceNames, r.Item, \"tunnel_interface\") {\n\t\t\t\tr.Item[\"tunnel_interface\"] = mapInterfaceNames[r.Item[\"tunnel_interface\"].(string)]\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_ike_gateway\" {\n\t\t\tif mapExists(mapIKECryptoProfileNames, r.Item, \"ikev1_crypto_profile\") {\n\t\t\t\tr.Item[\"ikev1_crypto_profile\"] = mapIKECryptoProfileNames[r.Item[\"ikev1_crypto_profile\"].(string)]\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_ipsec_tunnel\" {\n\t\t\tif mapExists(mapInterfaceNames, r.Item, \"tunnel_interface\") {\n\t\t\t\tr.Item[\"tunnel_interface\"] = mapInterfaceNames[r.Item[\"tunnel_interface\"].(string)]\n\t\t\t}\n\t\t\tif mapExists(mapIKEGatewayNames, r.Item, \"ak_ike_gateway\") {\n\t\t\t\tr.Item[\"ak_ike_gateway\"] = mapIKEGatewayNames[r.Item[\"ak_ike_gateway\"].(string)]\n\t\t\t}\n\t\t\tif mapExists(mapIPSECCryptoProfileNames, r.Item, \"ak_ipsec_crypto_profile\") {\n\t\t\t\tr.Item[\"ak_ipsec_crypto_profile\"] = mapIPSECCryptoProfileNames[r.Item[\"ak_ipsec_crypto_profile\"].(string)]\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_ipsec_tunnel_proxy_id_ipv4\" {\n\t\t\tif mapExists(mapInterfaceNames, r.Item, \"tunnel_interface\") {\n\t\t\t\tr.Item[\"tunnel_interface\"] = mapInterfaceNames[r.Item[\"tunnel_interface\"].(string)]\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_layer2_subinterface\" {\n\t\t\tif mapExists(mapInterfaceModes, r.Item, \"parent_interface\") {\n\t\t\t\tr.Item[\"parent_mode\"] = mapInterfaceModes[r.Item[\"parent_interface\"].(string)]\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_layer2_subinterface\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_layer3_subinterface\" {\n\t\t\tif mapExists(mapInterfaceNames, r.Item, \"parent_interface\") {\n\t\t\t\tr.Item[\"parent_interface\"] = mapInterfaceNames[r.Item[\"parent_interface\"].(string)]\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_virtual_router\" {\n\t\t\tif r.Item[\"ospfv3_ext_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"ospfv3_ext_dist\"] = \"110\"\n\t\t\t}\n\n\t\t\tif r.Item[\"ebgp_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"ebgp_dist\"] = \"20\"\n\t\t\t}\n\n\t\t\tif r.Item[\"rip_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"rip_dist\"] = \"120\"\n\t\t\t}\n\n\t\t\tif r.Item[\"ibgp_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"ibgp_dist\"] = \"200\"\n\t\t\t}\n\n\t\t\tif r.Item[\"static_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"static_dist\"] = \"10\"\n\t\t\t}\n\n\t\t\tif r.Item[\"ospf_int_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"ospf_int_dist\"] = \"30\"\n\t\t\t}\n\n\t\t\tif r.Item[\"static_ipv6_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"static_ipv6_dist\"] = \"10\"\n\t\t\t}\n\n\t\t\tif r.Item[\"ospf_ext_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"ospf_ext_dist\"] = \"110\"\n\t\t\t}\n\n\t\t\tif r.Item[\"ospfv3_int_dist\"].(string) == \"0\" {\n\t\t\t\tr.Item[\"ospfv3_int_dist\"] = \"30\"\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_virtual_router\" ||\n\t\t\tr.InstanceInfo.Type == \"panos_panorama_zone\" {\n\t\t\tif _, ok := r.Item[\"interfaces\"]; ok {\n\t\t\t\tinterfaces := make([]string, len(r.Item[\"interfaces\"].([]interface{})))\n\t\t\t\tfor k, eth := range r.Item[\"interfaces\"].([]interface{}) {\n\t\t\t\t\tif name, ok2 := mapInterfaceNames[eth.(string)]; ok2 {\n\t\t\t\t\t\tinterfaces[k] = name\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tinterfaces[k] = eth.(string)\n\t\t\t\t}\n\n\t\t\t\tr.Item[\"interfaces\"] = interfaces\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_vlan\" {\n\t\t\tif mapExists(mapInterfaceNames, r.Item, \"vlan_interface\") {\n\t\t\t\tr.Item[\"vlan_interface\"] = mapInterfaceNames[r.Item[\"vlan_interface\"].(string)]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/panos/panorama_objects.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage panos\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/PaloAltoNetworks/pango\"\n)\n\ntype PanoramaObjectsGenerator struct {\n\tPanosService\n}\n\nfunc (g *PanoramaObjectsGenerator) createResourcesFromList(o getGeneric, dg string, terraformResourceName string) (resources []terraformutils.Resource) {\n\tl, err := o.i.(getListWithOneArg).GetList(o.params[0])\n\tif err != nil || len(l) == 0 {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, r := range l {\n\t\tid := dg + \":\" + r\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\tterraformResourceName,\n\t\t\t\"panos\",\n\t\t\tmap[string]string{\n\t\t\t\t\"device_group\": dg,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaObjectsGenerator) createAddressGroupResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.AddressGroup, []string{dg}},\n\t\tdg, \"panos_panorama_address_group\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createAdministrativeTagResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.Tags, []string{dg}},\n\t\tdg, \"panos_panorama_administrative_tag\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createApplicationGroupResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.AppGroup, []string{dg}},\n\t\tdg, \"panos_panorama_application_group\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createApplicationObjectResources(dg string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Objects.Application.GetList(dg)\n\tif err != nil {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tfor _, r := range l {\n\t\tid := dg + \":\" + r\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_panorama_application_object\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\t// TODO\n\t\t// resources = append(resources, g.createApplicationSignatureResources(dg, r)...)\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaObjectsGenerator) createEDLResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.Edl, []string{dg}},\n\t\tdg, \"panos_panorama_edl\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createLogForwardingResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.LogForwardingProfile, []string{dg}},\n\t\tdg, \"panos_panorama_log_forwarding_profile\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createServiceGroupResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.ServiceGroup, []string{dg}},\n\t\tdg, \"panos_panorama_service_group\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createServiceObjectResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.Services, []string{dg}},\n\t\tdg, \"panos_panorama_service_object\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createAddressObjectResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.Address, []string{dg}},\n\t\tdg, \"panos_address_object\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createAntiSpywareSecurityProfileResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.AntiSpywareProfile, []string{dg}},\n\t\tdg, \"panos_anti_spyware_security_profile\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createAntivirusSecurityProfileResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.AntivirusProfile, []string{dg}},\n\t\tdg, \"panos_antivirus_security_profile\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createCustomDataPatternObjectResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.DataPattern, []string{dg}},\n\t\tdg, \"panos_custom_data_pattern_object\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createDataFilteringSecurityProfileResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.DataFilteringProfile, []string{dg}},\n\t\tdg, \"panos_data_filtering_security_profile\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createDOSProtectionProfileResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.DosProtectionProfile, []string{dg}},\n\t\tdg, \"panos_dos_protection_profile\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createDynamicUserGroupResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.DynamicUserGroup, []string{dg}},\n\t\tdg, \"panos_dynamic_user_group\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createFileBlockingSecurityProfileResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.FileBlockingProfile, []string{dg}},\n\t\tdg, \"panos_file_blocking_security_profile\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createURLFilteringSecurityProfileResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.UrlFilteringProfile, []string{dg}},\n\t\tdg, \"panos_url_filtering_security_profile\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createVulnerabilitySecurityProfileResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.VulnerabilityProfile, []string{dg}},\n\t\tdg, \"panos_vulnerability_security_profile\",\n\t)\n}\n\nfunc (g *PanoramaObjectsGenerator) createWildfireAnalysisSecurityProfileResources(dg string) []terraformutils.Resource {\n\treturn g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Objects.WildfireAnalysisProfile, []string{dg}},\n\t\tdg, \"panos_wildfire_analysis_security_profile\",\n\t)\n}\nfunc (g *PanoramaObjectsGenerator) InitResources() error {\n\tif err := g.Initialize(); err != nil {\n\t\treturn err\n\t}\n\n\tdg, err := g.client.(*pango.Panorama).Panorama.DeviceGroup.GetList()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range dg {\n\t\tg.Resources = append(g.Resources, g.createAddressGroupResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createAdministrativeTagResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createApplicationGroupResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createApplicationObjectResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createEDLResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createLogForwardingResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createServiceGroupResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createServiceObjectResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createAddressObjectResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createAntiSpywareSecurityProfileResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createAntivirusSecurityProfileResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createCustomDataPatternObjectResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createDataFilteringSecurityProfileResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createDOSProtectionProfileResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createDynamicUserGroupResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createFileBlockingSecurityProfileResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createURLFilteringSecurityProfileResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createVulnerabilitySecurityProfileResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createWildfireAnalysisSecurityProfileResources(v)...)\n\t}\n\n\treturn nil\n}\n\nfunc (g *PanoramaObjectsGenerator) PostConvertHook() error {\n\tmapAddressObjectIDs := map[string]string{}\n\tmapApplicationObjectIDs := map[string]string{}\n\tmapServiceObjectIDs := map[string]string{}\n\n\tfor _, r := range g.Resources {\n\t\tif _, ok := r.Item[\"name\"]; ok {\n\t\t\tif r.InstanceInfo.Type == \"panos_address_object\" {\n\t\t\t\tmapAddressObjectIDs[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_panorama_application_object\" {\n\t\t\t\tmapApplicationObjectIDs[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\n\t\t\tif r.InstanceInfo.Type == \"panos_panorama_service_object\" {\n\t\t\t\tmapServiceObjectIDs[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"panos_panorama_address_group\" {\n\t\t\tif _, ok := r.Item[\"static_addresses\"]; ok {\n\t\t\t\tstaticAddresses := make([]string, len(r.Item[\"static_addresses\"].([]interface{})))\n\t\t\t\tfor k, staticAddress := range r.Item[\"static_addresses\"].([]interface{}) {\n\t\t\t\t\tif _, ok2 := mapAddressObjectIDs[staticAddress.(string)]; ok2 {\n\t\t\t\t\t\tstaticAddresses[k] = mapAddressObjectIDs[staticAddress.(string)]\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tstaticAddresses[k] = staticAddress.(string)\n\t\t\t\t}\n\n\t\t\t\tr.Item[\"static_addresses\"] = staticAddresses\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_application_group\" {\n\t\t\tif _, ok := r.Item[\"applications\"]; ok {\n\t\t\t\tapplications := make([]string, len(r.Item[\"applications\"].([]interface{})))\n\t\t\t\tfor k, application := range r.Item[\"applications\"].([]interface{}) {\n\t\t\t\t\tif _, ok2 := mapApplicationObjectIDs[application.(string)]; ok2 {\n\t\t\t\t\t\tapplications[k] = mapApplicationObjectIDs[application.(string)]\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tapplications[k] = application.(string)\n\t\t\t\t}\n\n\t\t\t\tr.Item[\"applications\"] = applications\n\t\t\t}\n\t\t}\n\n\t\tif r.InstanceInfo.Type == \"panos_panorama_service_group\" {\n\t\t\tif _, ok := r.Item[\"services\"]; ok {\n\t\t\t\tservices := make([]string, len(r.Item[\"services\"].([]interface{})))\n\t\t\t\tfor k, service := range r.Item[\"services\"].([]interface{}) {\n\t\t\t\t\tif _, ok2 := mapServiceObjectIDs[service.(string)]; ok2 {\n\t\t\t\t\t\tservices[k] = mapServiceObjectIDs[service.(string)]\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tservices[k] = service.(string)\n\t\t\t\t}\n\n\t\t\t\tr.Item[\"services\"] = services\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/panos/panorama_plugins.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage panos\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/PaloAltoNetworks/pango\"\n)\n\ntype PanoramaPluginsGenerator struct {\n\tPanosService\n}\n\nfunc (g *PanoramaPluginsGenerator) createGCPAccountResources() (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Panorama.GcpAccount.GetList()\n\tif err != nil || len(l) == 0 {\n\t\treturn resources\n\t}\n\n\tfor _, r := range l {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tr,\n\t\t\tnormalizeResourceName(r),\n\t\t\t\"panos_panorama_gcp_account\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaPluginsGenerator) createGKEClusterResources(group string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Panorama.GkeCluster.GetList(group)\n\tif err != nil || len(l) == 0 {\n\t\treturn resources\n\t}\n\n\tfor _, r := range l {\n\t\tid := group + \":\" + r\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(id),\n\t\t\t\"panos_panorama_gke_cluster\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaPluginsGenerator) createGKEClusterGroupResources() (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Panorama.GkeClusterGroup.GetList()\n\tif err != nil || len(l) == 0 {\n\t\treturn resources\n\t}\n\n\tfor _, r := range l {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tr,\n\t\t\tnormalizeResourceName(r),\n\t\t\t\"panos_panorama_gke_cluster_group\",\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\n\t\tresources = append(resources, g.createGKEClusterResources(r)...)\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaPluginsGenerator) InitResources() error {\n\tif err := g.Initialize(); err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = append(g.Resources, g.createGCPAccountResources()...)\n\tg.Resources = append(g.Resources, g.createGKEClusterGroupResources()...)\n\n\treturn nil\n}\n\nfunc (g *PanoramaPluginsGenerator) PostConvertHook() error {\n\tmapGKEClusterGroupNames := map[string]string{}\n\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"panos_panorama_gke_cluster_group\" {\n\t\t\tmapGKEClusterGroupNames[r.Item[\"name\"].(string)] = \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".name}\"\n\t\t}\n\t}\n\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"panos_panorama_gke_cluster\" {\n\t\t\tif mapExists(mapGKEClusterGroupNames, r.Item, \"gke_cluster_group\") {\n\t\t\t\tr.Item[\"gke_cluster_group\"] = mapGKEClusterGroupNames[r.Item[\"gke_cluster_group\"].(string)]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/panos/panorama_policy.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage panos\n\nimport (\n\t\"encoding/base64\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/PaloAltoNetworks/pango\"\n\t\"github.com/PaloAltoNetworks/pango/util\"\n)\n\ntype PanoramaPolicyGenerator struct {\n\tPanosService\n}\n\nfunc (g *PanoramaPolicyGenerator) createResourcesFromList(o getGeneric, terraformResourceName string) (resources []terraformutils.Resource) {\n\tl, err := o.i.(getListWithTwoArgs).GetList(o.params[0], o.params[1])\n\tif err != nil || len(l) == 0 {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tvar positionReference string\n\tid := o.params[0] + \":\" + o.params[1] + \":\" + strconv.Itoa(util.MoveTop) + \"::\"\n\n\tfor k, r := range l {\n\t\tif k > 0 {\n\t\t\tid = o.params[0] + \":\" + o.params[1] + \":\" + strconv.Itoa(util.MoveAfter) + \":\" + positionReference + \":\"\n\t\t}\n\n\t\tid += base64.StdEncoding.EncodeToString([]byte(r))\n\t\tpositionReference = r\n\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(o.params[0]+\":\"+o.params[1]+\":\"+r),\n\t\t\tterraformResourceName,\n\t\t\t\"panos\",\n\t\t\t[]string{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaPolicyGenerator) createNATRuleGroupResources(dg string) (resources []terraformutils.Resource) {\n\tresources = append(resources, g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Policies.Nat, []string{dg, util.PreRulebase}},\n\t\t\"panos_panorama_nat_rule_group\")...,\n\t)\n\n\tresources = append(resources, g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Policies.Nat, []string{dg, util.Rulebase}},\n\t\t\"panos_panorama_nat_rule_group\")...,\n\t)\n\n\tresources = append(resources, g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Policies.Nat, []string{dg, util.PostRulebase}},\n\t\t\"panos_panorama_nat_rule_group\")...,\n\t)\n\n\treturn resources\n}\n\nfunc (g *PanoramaPolicyGenerator) createPBFRuleGroupResources(dg string) (resources []terraformutils.Resource) {\n\tresources = append(resources, g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Policies.PolicyBasedForwarding, []string{dg, util.PreRulebase}},\n\t\t\"panos_panorama_pbf_rule_group\")...,\n\t)\n\n\tresources = append(resources, g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Policies.PolicyBasedForwarding, []string{dg, util.Rulebase}},\n\t\t\"panos_panorama_pbf_rule_group\")...,\n\t)\n\n\tresources = append(resources, g.createResourcesFromList(\n\t\tgetGeneric{g.client.(*pango.Panorama).Policies.PolicyBasedForwarding, []string{dg, util.PostRulebase}},\n\t\t\"panos_panorama_pbf_rule_group\")...,\n\t)\n\n\treturn resources\n}\n\nfunc (g *PanoramaPolicyGenerator) createSecurityRuleGroupRulebaseResources(dg, rulebase string) (resources []terraformutils.Resource) {\n\tl, err := g.client.(*pango.Panorama).Policies.Security.GetList(dg, rulebase)\n\tif err != nil || len(l) == 0 {\n\t\treturn []terraformutils.Resource{}\n\t}\n\n\tvar positionReference string\n\tid := dg + \":\" + rulebase + \":\" + strconv.Itoa(util.MoveTop) + \"::\"\n\n\tfor k, r := range l {\n\t\tif k > 0 {\n\t\t\tid = dg + \":\" + rulebase + \":\" + strconv.Itoa(util.MoveAfter) + \":\" + positionReference + \":\"\n\t\t}\n\n\t\tid += base64.StdEncoding.EncodeToString([]byte(r))\n\t\tpositionReference = r\n\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tid,\n\t\t\tnormalizeResourceName(dg+\":\"+rulebase+\":\"+r),\n\t\t\t\"panos_panorama_security_rule_group\",\n\t\t\t\"panos\",\n\t\t\tmap[string]string{\n\t\t\t\t\"device_group\":    dg,\n\t\t\t\t\"rulebase\":        rulebase,\n\t\t\t\t\"rule.#\":          \"1\", // Add just enough attributes to make the refresh work...\n\t\t\t\t\"rule.0.name\":     r,   // Add just enough attributes to make the refresh work...\n\t\t\t\t\"rule.0.target.#\": \"0\", // Add just enough attributes to make the refresh work...\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t))\n\t}\n\n\treturn resources\n}\n\nfunc (g *PanoramaPolicyGenerator) createSecurityRuleGroupResources(dg string) (resources []terraformutils.Resource) {\n\tresources = append(resources, g.createSecurityRuleGroupRulebaseResources(dg, util.PreRulebase)...)\n\tresources = append(resources, g.createSecurityRuleGroupRulebaseResources(dg, util.Rulebase)...)\n\tresources = append(resources, g.createSecurityRuleGroupRulebaseResources(dg, util.PostRulebase)...)\n\n\treturn resources\n}\n\nfunc (g *PanoramaPolicyGenerator) InitResources() error {\n\tif err := g.Initialize(); err != nil {\n\t\treturn err\n\t}\n\n\tdg, err := g.client.(*pango.Panorama).Panorama.DeviceGroup.GetList()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range dg {\n\t\tg.Resources = append(g.Resources, g.createNATRuleGroupResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createPBFRuleGroupResources(v)...)\n\t\tg.Resources = append(g.Resources, g.createSecurityRuleGroupResources(v)...)\n\t}\n\n\treturn nil\n}\n\nfunc (g *PanoramaPolicyGenerator) PostConvertHook() error {\n\tfor _, res := range g.Resources {\n\t\tif res.InstanceInfo.Type == \"panos_panorama_nat_rule_group\" {\n\t\t\tfor _, rule := range res.Item[\"rule\"].([]interface{}) {\n\t\t\t\tif _, ok := rule.(map[string]interface{})[\"translated_packet\"]; ok {\n\t\t\t\t\ta := rule.(map[string]interface{})[\"translated_packet\"].([]interface{})\n\t\t\t\t\tfor _, b := range a {\n\t\t\t\t\t\tif _, okb := b.(map[string]interface{})[\"source\"]; !okb {\n\t\t\t\t\t\t\tb.(map[string]interface{})[\"source\"] = make(map[string]interface{})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tfor _, b := range a {\n\t\t\t\t\t\tif _, okb := b.(map[string]interface{})[\"destination\"]; !okb {\n\t\t\t\t\t\t\tb.(map[string]interface{})[\"destination\"] = make(map[string]interface{})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif res.InstanceInfo.Type == \"panos_panorama_security_rule_group\" {\n\t\t\tfor _, rule := range res.Item[\"rule\"].([]interface{}) {\n\t\t\t\tif _, ok := rule.(map[string]interface{})[\"hip_profiles\"]; !ok {\n\t\t\t\t\trule.(map[string]interface{})[\"hip_profiles\"] = []string{\"any\"}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/panos/panos_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage panos\n\nimport (\n\t\"errors\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype PanosProvider struct { //nolint\n\tterraformutils.Provider\n\tvsys string\n}\n\nfunc (p *PanosProvider) Init(args []string) error {\n\tp.vsys = args[0]\n\n\treturn nil\n}\n\nfunc (p *PanosProvider) GetName() string {\n\treturn \"panos\"\n}\n\nfunc (p *PanosProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (p *PanosProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{})\n}\n\nfunc (p *PanosProvider) GetBasicConfig() cty.Value {\n\treturn p.GetConfig()\n}\n\nfunc (p *PanosProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"vsys\": p.vsys,\n\t})\n\n\treturn nil\n}\n\nfunc (p *PanosProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"firewall_device_config\": &FirewallDeviceConfigGenerator{},\n\t\t\"firewall_networking\":    &FirewallNetworkingGenerator{},\n\t\t\"firewall_objects\":       &FirewallObjectsGenerator{},\n\t\t\"firewall_policy\":        &FirewallPolicyGenerator{},\n\t\t\"panorama_device_config\": &PanoramaDeviceConfigGenerator{},\n\t\t\"panorama_networking\":    &PanoramaNetworkingGenerator{},\n\t\t\"panorama_objects\":       &PanoramaObjectsGenerator{},\n\t\t\"panorama_plugins\":       &PanoramaPluginsGenerator{},\n\t\t\"panorama_policy\":        &PanoramaPolicyGenerator{},\n\t}\n}\n\nfunc (PanosProvider) GetResourceConnections() map[string]map[string][]string {\n\n\treturn map[string]map[string][]string{}\n}\n"
  },
  {
    "path": "providers/panos/panos_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage panos\n\nimport (\n\t\"errors\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype PanosService struct { //nolint\n\tterraformutils.Service\n\tclient interface{}\n\tvsys   string\n}\n\nfunc (p *PanosService) Initialize() error {\n\tif _, ok := p.Args[\"vsys\"].(string); ok {\n\t\tp.vsys = p.Args[\"vsys\"].(string)\n\t} else {\n\t\treturn errors.New(p.GetName() + \": \" + \"vsys name not parsable\")\n\t}\n\n\tc, err := Initialize()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp.client = c\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/rabbitmq/binding.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage rabbitmq\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype BindingGenerator struct {\n\tRBTService\n}\n\ntype Binding struct {\n\tSource          string                 `json:\"source\"`\n\tVhost           string                 `json:\"vhost\"`\n\tDestination     string                 `json:\"destination\"`\n\tDestinationType string                 `json:\"destination_type\"`\n\tPropertiesKey   string                 `json:\"properties_key\"`\n\tArguments       map[string]interface{} `json:\"arguments\"`\n}\n\ntype Bindings []Binding\n\nvar BindingAllowEmptyValues = []string{\"source\"}\nvar BindingAdditionalFields = map[string]interface{}{}\n\nfunc (g BindingGenerator) createResources(bindings Bindings) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, binding := range bindings {\n\t\targumentsJSON, errArgumentsJSON := json.Marshal(binding.Arguments)\n\t\tif errArgumentsJSON != nil {\n\t\t\targumentsJSON = []byte(\"{}\")\n\t\t}\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s/%s/%s/%s/%s\", percentEncodeSlashes(binding.Vhost), binding.Source, binding.Destination, binding.DestinationType, binding.PropertiesKey),\n\t\t\tfmt.Sprintf(\"binding_%s_%s_%s_%s_%s\", normalizeResourceName(binding.Source), normalizeResourceName(binding.Vhost), normalizeResourceName(binding.Destination), normalizeResourceName(binding.DestinationType), normalizeResourceName(binding.PropertiesKey)),\n\t\t\t\"rabbitmq_binding\",\n\t\t\t\"rabbitmq\",\n\t\t\tmap[string]string{\n\t\t\t\t\"source\":           binding.Source,\n\t\t\t\t\"vhost\":            binding.Vhost,\n\t\t\t\t\"destination\":      binding.Destination,\n\t\t\t\t\"destination_type\": binding.DestinationType,\n\t\t\t\t\"properties_key\":   binding.PropertiesKey,\n\t\t\t\t\"arguments_json\":   string(argumentsJSON),\n\t\t\t},\n\t\t\tBindingAllowEmptyValues,\n\t\t\tBindingAdditionalFields,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *BindingGenerator) InitResources() error {\n\tbody, err := g.generateRequest(\"/api/bindings?columns=source,vhost,destination,destination_type,properties_key,arguments\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar bindings Bindings\n\terr = json.Unmarshal(body, &bindings)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(bindings)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/rabbitmq/exchange.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage rabbitmq\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype ExchangeGenerator struct {\n\tRBTService\n}\n\ntype Exchange struct {\n\tName  string `json:\"name\"`\n\tVhost string `json:\"vhost\"`\n}\n\ntype Exchanges []Exchange\n\nvar ExchangeAllowEmptyValues = []string{}\nvar ExchangeAdditionalFields = map[string]interface{}{}\n\nfunc (g ExchangeGenerator) createResources(exchanges Exchanges) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, exchange := range exchanges {\n\t\tif len(exchange.Name) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s@%s\", exchange.Name, exchange.Vhost),\n\t\t\tfmt.Sprintf(\"exchange_%s_%s\", normalizeResourceName(exchange.Vhost), normalizeResourceName(exchange.Name)),\n\t\t\t\"rabbitmq_exchange\",\n\t\t\t\"rabbitmq\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":  exchange.Name,\n\t\t\t\t\"vhost\": exchange.Vhost,\n\t\t\t},\n\t\t\tExchangeAllowEmptyValues,\n\t\t\tExchangeAdditionalFields,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *ExchangeGenerator) InitResources() error {\n\tbody, err := g.generateRequest(\"/api/exchanges?columns=name,vhost\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar exchanges Exchanges\n\terr = json.Unmarshal(body, &exchanges)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(exchanges)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/rabbitmq/helpers.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage rabbitmq\n\nimport (\n\t\"strings\"\n\t\"unicode\"\n\n\t\"golang.org/x/text/secure/precis\"\n\t\"golang.org/x/text/transform\"\n\t\"golang.org/x/text/unicode/norm\"\n)\n\nfunc normalizeResourceName(s string) string {\n\tnormalize := precis.NewIdentifier(\n\t\tprecis.AdditionalMapping(func() transform.Transformer {\n\t\t\treturn transform.Chain(norm.NFD, transform.RemoveFunc(func(r rune) bool { //nolint\n\t\t\t\treturn unicode.Is(unicode.Mn, r)\n\t\t\t}))\n\t\t}),\n\t\tprecis.Norm(norm.NFC),\n\t)\n\tnoWhiteSpacesString := strings.ReplaceAll(s, \" \", \"_\")\n\tnormalizedLower, _ := normalize.String(strings.ToLower(noWhiteSpacesString))\n\tr := strings.NewReplacer(\" \", \"_\",\n\t\t\"!\", \"_\",\n\t\t\"\\\"\", \"_\",\n\t\t\"#\", \"_\",\n\t\t\"%\", \"_\",\n\t\t\"&\", \"_\",\n\t\t\"'\", \"_\",\n\t\t\"(\", \"_\",\n\t\t\")\", \"_\",\n\t\t\"{\", \"_\",\n\t\t\"}\", \"_\",\n\t\t\"*\", \"_\",\n\t\t\"+\", \"_\",\n\t\t\",\", \"_\",\n\t\t\"-\", \"_\",\n\t\t\".\", \"_\",\n\t\t\"/\", \"slash\",\n\t\t\"|\", \"_\",\n\t\t\"\\\\\", \"_\",\n\t\t\":\", \"_\",\n\t\t\";\", \"_\",\n\t\t\">\", \"_\",\n\t\t\"=\", \"_\",\n\t\t\"<\", \"_\",\n\t\t\"?\", \"_\",\n\t\t\"[\", \"_\",\n\t\t\"]\", \"_\",\n\t\t\"^\", \"_\",\n\t\t\"`\", \"_\",\n\t\t\"~\", \"_\",\n\t\t\"$\", \"_\",\n\t\t\"@\", \"_at_\")\n\treturn r.Replace(normalizedLower)\n}\n\nfunc percentEncodeSlashes(s string) string {\n\t// Encode any percent signs, then encode any forward slashes.\n\treturn strings.ReplaceAll(strings.ReplaceAll(s, \"%\", \"%25\"), \"/\", \"%2F\")\n}\n"
  },
  {
    "path": "providers/rabbitmq/permissions.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage rabbitmq\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype PermissionsGenerator struct {\n\tRBTService\n}\n\ntype Permissions struct {\n\tUser  string `json:\"user\"`\n\tVhost string `json:\"vhost\"`\n}\n\ntype AllPermissions []Permissions\n\nvar PermissionsAllowEmptyValues = []string{\"configure\", \"write\", \"read\"}\nvar PermissionsAdditionalFields = map[string]interface{}{}\n\nfunc (g PermissionsGenerator) createResources(allPermissions AllPermissions) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, permissions := range allPermissions {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s@%s\", permissions.User, permissions.Vhost),\n\t\t\tfmt.Sprintf(\"permissions_%s_%s\", normalizeResourceName(permissions.User), normalizeResourceName(permissions.Vhost)),\n\t\t\t\"rabbitmq_permissions\",\n\t\t\t\"rabbitmq\",\n\t\t\tmap[string]string{\n\t\t\t\t\"user\":  permissions.User,\n\t\t\t\t\"vhost\": permissions.Vhost,\n\t\t\t},\n\t\t\tPermissionsAllowEmptyValues,\n\t\t\tPermissionsAdditionalFields,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *PermissionsGenerator) InitResources() error {\n\tbody, err := g.generateRequest(\"/api/permissions?columns=user,vhost\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar permissions AllPermissions\n\terr = json.Unmarshal(body, &permissions)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(permissions)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/rabbitmq/policy.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage rabbitmq\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype PolicyGenerator struct {\n\tRBTService\n}\n\ntype Policy struct {\n\tName  string `json:\"name\"`\n\tVhost string `json:\"vhost\"`\n}\n\ntype Policies []Policy\n\nvar PolicyAllowEmptyValues = []string{}\nvar PolicyAdditionalFields = map[string]interface{}{}\n\nfunc (g PolicyGenerator) createResources(policies Policies) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, policy := range policies {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s@%s\", policy.Name, policy.Vhost),\n\t\t\tfmt.Sprintf(\"policy_%s_%s\", normalizeResourceName(policy.Vhost), normalizeResourceName(policy.Name)),\n\t\t\t\"rabbitmq_policy\",\n\t\t\t\"rabbitmq\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":  policy.Name,\n\t\t\t\t\"vhost\": policy.Vhost,\n\t\t\t},\n\t\t\tPolicyAllowEmptyValues,\n\t\t\tPolicyAdditionalFields,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *PolicyGenerator) InitResources() error {\n\tbody, err := g.generateRequest(\"/api/policies?columns=name,vhost\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar policies Policies\n\terr = json.Unmarshal(body, &policies)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(policies)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/rabbitmq/queue.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage rabbitmq\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype QueueGenerator struct {\n\tRBTService\n}\n\ntype Queue struct {\n\tName  string `json:\"name\"`\n\tVhost string `json:\"vhost\"`\n}\n\ntype Queues []Queue\n\nvar QueueAllowEmptyValues = []string{}\nvar QueueAdditionalFields = map[string]interface{}{}\n\nfunc (g QueueGenerator) createResources(queues Queues) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, queue := range queues {\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s@%s\", queue.Name, queue.Vhost),\n\t\t\tfmt.Sprintf(\"queue_%s_%s\", normalizeResourceName(queue.Vhost), normalizeResourceName(queue.Name)),\n\t\t\t\"rabbitmq_queue\",\n\t\t\t\"rabbitmq\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":  queue.Name,\n\t\t\t\t\"vhost\": queue.Vhost,\n\t\t\t},\n\t\t\tQueueAllowEmptyValues,\n\t\t\tQueueAdditionalFields,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *QueueGenerator) InitResources() error {\n\tbody, err := g.generateRequest(\"/api/queues?columns=name,vhost\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar queues Queues\n\terr = json.Unmarshal(body, &queues)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(queues)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/rabbitmq/rabbitmq_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage rabbitmq\n\nimport (\n\t\"errors\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype RBTProvider struct { //nolint\n\tterraformutils.Provider\n\tendpoint string\n\tusername string\n\tpassword string\n}\n\nfunc (p *RBTProvider) Init(args []string) error {\n\tp.endpoint = args[0]\n\tp.username = args[1]\n\tp.password = args[2]\n\treturn nil\n}\n\nfunc (p *RBTProvider) GetName() string {\n\treturn \"rabbitmq\"\n}\n\nfunc (p *RBTProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (p *RBTProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"endpoint\": cty.StringVal(p.endpoint),\n\t\t\"username\": cty.StringVal(p.username),\n\t\t\"password\": cty.StringVal(p.password),\n\t})\n}\n\nfunc (p *RBTProvider) GetBasicConfig() cty.Value {\n\treturn p.GetConfig()\n}\n\nfunc (p *RBTProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"endpoint\": p.endpoint,\n\t\t\"username\": p.username,\n\t\t\"password\": p.password,\n\t})\n\treturn nil\n}\n\nfunc (p *RBTProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"bindings\":    &BindingGenerator{},\n\t\t\"exchanges\":   &ExchangeGenerator{},\n\t\t\"permissions\": &PermissionsGenerator{},\n\t\t\"policies\":    &PolicyGenerator{},\n\t\t\"queues\":      &QueueGenerator{},\n\t\t\"users\":       &UserGenerator{},\n\t\t\"vhosts\":      &VhostGenerator{},\n\t\t\"shovels\":     &ShovelGenerator{},\n\t}\n}\n\nfunc (RBTProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"bindings\": {\n\t\t\t\"exchanges\": []string{\"source\", \"name\", \"destination\", \"name\"},\n\t\t\t\"queues\":    []string{\"destination\", \"name\"},\n\t\t\t\"vhosts\":    []string{\"vhost\", \"self_link\"},\n\t\t},\n\t\t\"exchanges\": {\n\t\t\t\"vhosts\": []string{\"vhost\", \"self_link\"},\n\t\t},\n\t\t\"shovels\": {\n\t\t\t\"vhosts\": []string{\"vhost\", \"self_link\"},\n\t\t},\n\t\t\"permissions\": {\n\t\t\t\"users\":  []string{\"user\", \"self_link\"},\n\t\t\t\"vhosts\": []string{\"vhost\", \"self_link\"},\n\t\t},\n\t\t\"policies\": {\n\t\t\t\"vhosts\": []string{\"vhost\", \"self_link\"},\n\t\t},\n\t\t\"queues\": {\n\t\t\t\"vhosts\": []string{\"vhost\", \"self_link\"},\n\t\t},\n\t}\n}\n"
  },
  {
    "path": "providers/rabbitmq/rabbitmq_service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage rabbitmq\n\nimport (\n\t\"io\"\n\t\"net/http\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype RBTService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *RBTService) generateRequest(uri string) ([]byte, error) {\n\ttr := &http.Transport{}\n\tclient := &http.Client{Transport: tr}\n\treq, err := http.NewRequest(\"GET\", s.Args[\"endpoint\"].(string)+uri, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.SetBasicAuth(s.Args[\"username\"].(string), s.Args[\"password\"].(string))\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn body, nil\n}\n"
  },
  {
    "path": "providers/rabbitmq/shovel.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage rabbitmq\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype ShovelGenerator struct {\n\tRBTService\n}\n\ntype Shovel struct {\n\tName  string `json:\"name\"`\n\tVhost string `json:\"vhost\"`\n}\n\ntype Shovels []Shovel\n\nvar ShovelAllowEmptyValues = []string{}\nvar ShovelAdditionalFields = map[string]interface{}{}\n\nfunc (g ShovelGenerator) createResources(shovels Shovels) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, shovel := range shovels {\n\t\tif len(shovel.Name) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tresources = append(resources, terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s@%s\", shovel.Name, shovel.Vhost),\n\t\t\tfmt.Sprintf(\"shovel_%s_%s\", normalizeResourceName(shovel.Vhost), normalizeResourceName(shovel.Name)),\n\t\t\t\"rabbitmq_shovel\",\n\t\t\t\"rabbitmq\",\n\t\t\tmap[string]string{\n\t\t\t\t\"name\":  shovel.Name,\n\t\t\t\t\"vhost\": shovel.Vhost,\n\t\t\t},\n\t\t\tShovelAllowEmptyValues,\n\t\t\tShovelAdditionalFields,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *ShovelGenerator) InitResources() error {\n\tbody, err := g.generateRequest(\"/api/shovels?columns=name,vhost\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar shovels Shovels\n\terr = json.Unmarshal(body, &shovels)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(shovels)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/rabbitmq/user.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage rabbitmq\n\nimport (\n\t\"encoding/json\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype UserGenerator struct {\n\tRBTService\n}\n\ntype User struct {\n\tName string `json:\"name\"`\n}\n\ntype Users []User\n\nvar UserAllowEmptyValues = []string{}\n\nfunc (g UserGenerator) createResources(users Users) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, user := range users {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tuser.Name,\n\t\t\t\"user_\"+normalizeResourceName(user.Name),\n\t\t\t\"rabbitmq_user\",\n\t\t\t\"rabbitmq\",\n\t\t\tUserAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *UserGenerator) InitResources() error {\n\tbody, err := g.generateRequest(\"/api/users?columns=name\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar users Users\n\terr = json.Unmarshal(body, &users)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(users)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/rabbitmq/vhost.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage rabbitmq\n\nimport (\n\t\"encoding/json\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype VhostGenerator struct {\n\tRBTService\n}\n\ntype Vhost struct {\n\tName string `json:\"name\"`\n}\n\ntype Vhosts []Vhost\n\nvar VhostAllowEmptyValues = []string{}\n\nfunc (g VhostGenerator) createResources(vhosts Vhosts) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, vhost := range vhosts {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tvhost.Name,\n\t\t\t\"vhost_\"+normalizeResourceName(vhost.Name),\n\t\t\t\"rabbitmq_vhost\",\n\t\t\t\"rabbitmq\",\n\t\t\tVhostAllowEmptyValues,\n\t\t))\n\t}\n\treturn resources\n}\n\nfunc (g *VhostGenerator) InitResources() error {\n\tbody, err := g.generateRequest(\"/api/vhosts?columns=name\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar vhosts Vhosts\n\terr = json.Unmarshal(body, &vhosts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(vhosts)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/acl.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tvpc \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312\"\n)\n\ntype ACLGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *ACLGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := vpc.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := vpc.NewDescribeNetworkAclsRequest()\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"tencentcloud_vpc_acl\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\tfor i := range filters {\n\t\trequest.NetworkAclIds = append(request.NetworkAclIds, &filters[i])\n\t}\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*vpc.NetworkAcl, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeNetworkAcls(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.NetworkAclSet...)\n\t\tif len(response.Response.NetworkAclSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.NetworkAclId,\n\t\t\t*instance.NetworkAclName+\"_\"+*instance.NetworkAclId,\n\t\t\t\"tencentcloud_vpc_acl\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\n\t\tfor _, subnet := range instance.SubnetSet {\n\t\t\tattachment := terraformutils.NewResource(\n\t\t\t\t*instance.NetworkAclId+\"#\"+*subnet.SubnetId,\n\t\t\t\t*instance.NetworkAclId+\"_\"+*subnet.SubnetId,\n\t\t\t\t\"tencentcloud_vpc_acl_attachment\",\n\t\t\t\t\"tencentcloud\",\n\t\t\t\tmap[string]string{},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tattachment.AdditionalFields[\"acl_id\"] = \"${tencentcloud_vpc_acl.\" + resource.ResourceName + \".id}\"\n\t\t\tg.Resources = append(g.Resources, attachment)\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/as.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tas \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/as/v20180419\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n)\n\ntype AsGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *AsGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := as.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadScalingGroups(client); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadScalingConfigs(client); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *AsGenerator) loadScalingGroups(client *as.Client) error {\n\trequest := as.NewDescribeAutoScalingGroupsRequest()\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*as.AutoScalingGroup, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeAutoScalingGroups(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.AutoScalingGroupSet...)\n\t\tif len(response.Response.AutoScalingGroupSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.AutoScalingGroupId,\n\t\t\t*instance.AutoScalingGroupName+\"_\"+*instance.AutoScalingGroupId,\n\t\t\t\"tencentcloud_as_scaling_group\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\nfunc (g *AsGenerator) loadScalingConfigs(client *as.Client) error {\n\trequest := as.NewDescribeLaunchConfigurationsRequest()\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*as.LaunchConfiguration, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeLaunchConfigurations(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.LaunchConfigurationSet...)\n\t\tif len(response.Response.LaunchConfigurationSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.LaunchConfigurationId,\n\t\t\t*instance.LaunchConfigurationName+\"_\"+*instance.LaunchConfigurationId,\n\t\t\t\"tencentcloud_as_scaling_config\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\nfunc (g *AsGenerator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type != \"tencentcloud_as_scaling_group\" {\n\t\t\tcontinue\n\t\t}\n\t\tif configID, exist := resource.InstanceState.Attributes[\"configuration_id\"]; exist {\n\t\t\tfor _, r := range g.Resources {\n\t\t\t\tif r.InstanceInfo.Type != \"tencentcloud_as_scaling_config\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif configID == r.InstanceState.Attributes[\"id\"] {\n\t\t\t\t\tg.Resources[i].Item[\"configuration_id\"] = \"${tencentcloud_as_scaling_config.\" + r.ResourceName + \".id}\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/cbs.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tcbs \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cbs/v20170312\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n)\n\ntype CbsGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *CbsGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := cbs.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := cbs.NewDescribeDisksRequest()\n\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"tencentcloud_cbs_storage\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\tfor i := range filters {\n\t\trequest.DiskIds = append(request.DiskIds, &filters[i])\n\t}\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*cbs.Disk, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeDisks(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.DiskSet...)\n\t\tif len(response.Response.DiskSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.DiskId,\n\t\t\t*instance.DiskId,\n\t\t\t\"tencentcloud_cbs_storage\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\n\t\tif *instance.Attached {\n\t\t\tattachment := terraformutils.NewResource(\n\t\t\t\t*instance.DiskId,\n\t\t\t\t*instance.DiskId,\n\t\t\t\t\"tencentcloud_cbs_storage_attachment\",\n\t\t\t\t\"tencentcloud\",\n\t\t\t\tmap[string]string{},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tattachment.AdditionalFields[\"storage_id\"] = \"${tencentcloud_cbs_storage.\" + resource.ResourceName + \".id}\"\n\t\t\tg.Resources = append(g.Resources, attachment)\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/cdn.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tcdn \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn/v20180606\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n)\n\ntype CdnGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *CdnGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := cdn.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := cdn.NewDescribeDomainsConfigRequest()\n\n\tvar offset int64\n\tvar pageSize int64 = 50\n\tallInstances := make([]*cdn.DetailDomain, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeDomainsConfig(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.Domains...)\n\t\tif len(response.Response.Domains) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.Domain,\n\t\t\t*instance.Domain,\n\t\t\t\"tencentcloud_cdn_domain\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\nfunc (g *CdnGenerator) PostConvertHook() error {\n\tfor _, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"tencentcloud_cdn_domain\" {\n\t\t\thttpsConfigs := resource.Item[\"https_config\"].([]interface{})\n\t\t\tif len(httpsConfigs) > 0 {\n\t\t\t\tconfig := httpsConfigs[0].(map[string]interface{})\n\t\t\t\tif config[\"https_switch\"] == \"on\" &&\n\t\t\t\t\tresource.InstanceState.Attributes[\"https_config.0.server_certificate_config.#\"] == \"1\" {\n\t\t\t\t\tserverCert := map[string]interface{}{\n\t\t\t\t\t\t\"certificate_content\": \"\",\n\t\t\t\t\t\t\"private_key\":         \"\",\n\t\t\t\t\t}\n\t\t\t\t\tserverCerts := make([]interface{}, 0, 1)\n\t\t\t\t\tserverCerts = append(serverCerts, serverCert)\n\t\t\t\t\tconfig[\"server_certificate_config\"] = serverCerts\n\t\t\t\t}\n\t\t\t\tif config[\"verify_client\"] == \"on\" {\n\t\t\t\t\tclientCert := map[string]interface{}{\n\t\t\t\t\t\t\"certificate_content\": \"\",\n\t\t\t\t\t}\n\t\t\t\t\tclientCerts := make([]interface{}, 0, 1)\n\t\t\t\t\tclientCerts = append(clientCerts, clientCert)\n\t\t\t\t\tconfig[\"client_certificate_config\"] = clientCerts\n\t\t\t\t}\n\t\t\t\thttpsConfigs[0] = config\n\t\t\t}\n\t\t\tresource.Item[\"https_config\"] = httpsConfigs\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/cfs.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tcfs \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cfs/v20190719\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n)\n\ntype CfsGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *CfsGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := cfs.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := cfs.NewDescribeCfsFileSystemsRequest()\n\tresponse, err := client.DescribeCfsFileSystems(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, instance := range response.Response.FileSystems {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.FileSystemId,\n\t\t\t*instance.FsName+\"_\"+*instance.FileSystemId,\n\t\t\t\"tencentcloud_cfs_file_system\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/clb.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tclb \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb/v20180317\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n)\n\ntype ClbGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *ClbGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := clb.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := clb.NewDescribeLoadBalancersRequest()\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"tencentcloud_clb_instance\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\tfor i := range filters {\n\t\trequest.LoadBalancerIds = append(request.LoadBalancerIds, &filters[i])\n\t}\n\n\tvar offset int64\n\tvar pageSize int64 = 50\n\tallInstances := make([]*clb.LoadBalancer, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeLoadBalancers(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.LoadBalancerSet...)\n\t\tif len(response.Response.LoadBalancerSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.LoadBalancerId,\n\t\t\t*instance.LoadBalancerName+\"_\"+*instance.LoadBalancerId,\n\t\t\t\"tencentcloud_clb_instance\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\n\t\tif err := g.loadListener(client, *instance.LoadBalancerId, resource.ResourceName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *ClbGenerator) loadListener(client *clb.Client, loadBalancerID, resourceName string) error {\n\trequest := clb.NewDescribeTargetsRequest()\n\trequest.LoadBalancerId = &loadBalancerID\n\tresponse, err := client.DescribeTargets(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, listener := range response.Response.Listeners {\n\t\tresource := terraformutils.NewResource(\n\t\t\tloadBalancerID+\"#\"+*listener.ListenerId,\n\t\t\t*listener.ListenerId,\n\t\t\t\"tencentcloud_clb_listener\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{\n\t\t\t\t\"scheduler\": \"WRR\",\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tresource.AdditionalFields[\"clb_id\"] = \"${tencentcloud_clb_instance.\" + resourceName + \".id}\"\n\t\tg.Resources = append(g.Resources, resource)\n\t\tif len(listener.Targets) > 0 {\n\t\t\tattachmentResource := terraformutils.NewResource(\n\t\t\t\t\"#\"+*listener.ListenerId+\"#\"+loadBalancerID,\n\t\t\t\t*listener.ListenerId,\n\t\t\t\t\"tencentcloud_clb_attachment\",\n\t\t\t\t\"tencentcloud\",\n\t\t\t\tmap[string]string{},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tattachmentResource.AdditionalFields[\"clb_id\"] = \"${tencentcloud_clb_instance.\" + resourceName + \".id}\"\n\t\t\tattachmentResource.AdditionalFields[\"listener_id\"] = \"${tencentcloud_clb_listener.\" + resource.ResourceName + \".listener_id}\"\n\t\t\tg.Resources = append(g.Resources, attachmentResource)\n\t\t}\n\n\t\tfor _, rule := range listener.Rules {\n\t\t\truleResource := terraformutils.NewResource(\n\t\t\t\tloadBalancerID+\"#\"+*listener.ListenerId+\"#\"+*rule.LocationId,\n\t\t\t\t*rule.LocationId,\n\t\t\t\t\"tencentcloud_clb_listener_rule\",\n\t\t\t\t\"tencentcloud\",\n\t\t\t\tmap[string]string{},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\truleResource.AdditionalFields[\"clb_id\"] = \"${tencentcloud_clb_instance.\" + resourceName + \".id}\"\n\t\t\truleResource.AdditionalFields[\"listener_id\"] = \"${tencentcloud_clb_listener.\" + resource.ResourceName + \".listener_id}\"\n\t\t\tg.Resources = append(g.Resources, ruleResource)\n\n\t\t\tif len(rule.Targets) > 0 {\n\t\t\t\tattachmentResource := terraformutils.NewResource(\n\t\t\t\t\t*rule.LocationId+\"#\"+*listener.ListenerId+\"#\"+loadBalancerID,\n\t\t\t\t\t*rule.LocationId,\n\t\t\t\t\t\"tencentcloud_clb_attachment\",\n\t\t\t\t\t\"tencentcloud\",\n\t\t\t\t\tmap[string]string{},\n\t\t\t\t\t[]string{},\n\t\t\t\t\tmap[string]interface{}{},\n\t\t\t\t)\n\t\t\t\tattachmentResource.AdditionalFields[\"clb_id\"] = \"${tencentcloud_clb_instance.\" + resourceName + \".id}\"\n\t\t\t\tattachmentResource.AdditionalFields[\"listener_id\"] = \"${tencentcloud_clb_listener.\" + resource.ResourceName + \".listener_id}\"\n\t\t\t\tattachmentResource.AdditionalFields[\"rule_id\"] = \"${tencentcloud_clb_listener_rule.\" + ruleResource.ResourceName + \".rule_id}\"\n\t\t\t\tg.Resources = append(g.Resources, attachmentResource)\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn nil\n}\n\nfunc (g *ClbGenerator) PostConvertHook() error {\n\tfor _, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"tencentcloud_clb_listener\" ||\n\t\t\tresource.InstanceInfo.Type == \"tencentcloud_clb_listener_rule\" {\n\t\t\tif v, ok := resource.Item[\"session_expire_time\"]; ok {\n\t\t\t\tsessionExpireTime := v.(string)\n\t\t\t\tif sessionExpireTime == \"0\" {\n\t\t\t\t\tdelete(resource.Item, \"session_expire_time\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tif _, ok := resource.Item[\"sni_switch\"]; ok {\n\t\t\t\tif v, ok := resource.Item[\"protocol\"]; ok && v.(string) != \"HTTPS\" {\n\t\t\t\t\tdelete(resource.Item, \"sni_switch\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/cos.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"net/url\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\t\"github.com/tencentyun/cos-go-sdk-v5\"\n)\n\ntype CosGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *CosGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\trequestURL := fmt.Sprintf(\"https://cos.%s.myqcloud.com\", region)\n\tu, _ := url.Parse(requestURL)\n\turi := &cos.BaseURL{ServiceURL: u}\n\tclient := cos.NewClient(uri, &http.Client{\n\t\tTransport: &cos.AuthorizationTransport{\n\t\t\tSecretID:     credential.SecretId,\n\t\t\tSecretKey:    credential.SecretKey,\n\t\t\tSessionToken: credential.Token,\n\t\t},\n\t})\n\n\tresult, _, err := client.Service.Get(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, bucket := range result.Buckets {\n\t\tresource := terraformutils.NewResource(\n\t\t\tbucket.Name,\n\t\t\tbucket.Name,\n\t\t\t\"tencentcloud_cos_bucket\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{\n\t\t\t\t\"acl\": \"private\",\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\nfunc (g *CosGenerator) PostConvertHook() error {\n\tfor _, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"tencentcloud_cos_bucket\" {\n\t\t\tif _, ok := resource.Item[\"lifecycle_rules\"]; ok {\n\t\t\t\tlifecycleRules := resource.Item[\"lifecycle_rules\"].([]interface{})\n\t\t\t\tfor i := range lifecycleRules {\n\t\t\t\t\trule := lifecycleRules[i].(map[string]interface{})\n\t\t\t\t\tif _, ok := rule[\"filter_prefix\"]; !ok {\n\t\t\t\t\t\trule[\"filter_prefix\"] = \"\"\n\t\t\t\t\t\tlifecycleRules[i] = rule\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/cvm.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tcvm \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312\"\n)\n\ntype CvmGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *CvmGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := cvm.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := cvm.NewDescribeInstancesRequest()\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"tencentcloud_instance\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\tfor i := range filters {\n\t\trequest.InstanceIds = append(request.InstanceIds, &filters[i])\n\t}\n\n\tvar offset int64\n\tvar pageSize int64 = 50\n\tallInstances := make([]*cvm.Instance, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeInstances(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.InstanceSet...)\n\t\tif len(response.Response.InstanceSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.InstanceId,\n\t\t\t*instance.InstanceName+\"_\"+*instance.InstanceId,\n\t\t\t\"tencentcloud_instance\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{\n\t\t\t\t\"disable_monitor_service\":  \"false\",\n\t\t\t\t\"disable_security_service\": \"false\",\n\t\t\t\t\"force_delete\":             \"false\",\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\t// Do not collect keys with CVM cause there can be keys not belong to any of them\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\nfunc (g *CvmGenerator) loadKeyPairs(client *cvm.Client, keyIds []*string) (resourceName string, errRet error) {\n\trequest := cvm.NewDescribeKeyPairsRequest()\n\trequest.KeyIds = keyIds\n\tresponse, err := client.DescribeKeyPairs(request)\n\tif err != nil {\n\t\terrRet = err\n\t\treturn\n\t}\n\tif len(response.Response.KeyPairSet) < 1 {\n\t\terrRet = fmt.Errorf(\"no key pair\")\n\t\treturn\n\t}\n\n\tinstance := response.Response.KeyPairSet[0]\n\tresourceName = *instance.KeyName + \"_\" + *instance.KeyId\n\tfor _, r := range g.Resources {\n\t\tif r.InstanceInfo.Type == \"tencentcloud_key_pair\" && r.ResourceName == resourceName {\n\t\t\treturn\n\t\t}\n\t}\n\tresource := terraformutils.NewResource(\n\t\t*instance.KeyId,\n\t\tresourceName,\n\t\t\"tencentcloud_key_pair\",\n\t\t\"tencentcloud\",\n\t\tmap[string]string{},\n\t\t[]string{},\n\t\tmap[string]interface{}{},\n\t)\n\tg.Resources = append(g.Resources, resource)\n\treturn\n}\n\n/*\nfunc (g *CvmGenerator) PostConvertHook() error {\n\tfor _, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"tencentcloud_instance\" {\n\t\t\tresource.InstanceState.Attributes[\"disable_monitor_service\"] = \"false\"\n\t\t\tresource.InstanceState.Attributes[\"disable_security_service\"] = \"false\"\n\t\t\tresource.InstanceState.Attributes[\"force_delete\"] = \"false\"\n\t\t}\n\t}\n\treturn nil\n}\n*/\n"
  },
  {
    "path": "providers/tencentcloud/dnspod.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tdnspod \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod/v20210323\"\n)\n\ntype DnspodGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *DnspodGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := dnspod.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn g.DescribeDomainList(client)\n}\nfunc (g *DnspodGenerator) DescribeDomainList(client *dnspod.Client) error {\n\trequest := dnspod.NewDescribeDomainListRequest()\n\n\tvar offset int64\n\tvar limit int64 = 50\n\tallInstances := make([]*dnspod.DomainListItem, 0)\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &limit\n\t\tresponse, err := client.DescribeDomainList(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tallInstances = append(allInstances, response.Response.DomainList...)\n\t\tif len(response.Response.DomainList) < int(limit) {\n\t\t\tbreak\n\t\t}\n\n\t\toffset += limit\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.Name,\n\t\t\t*instance.Name,\n\t\t\t\"tencentcloud_dnspod_domain_instance\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t\tif err := g.DescribeRecordList(client, *instance.Name, resource.ResourceName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\nfunc (g *DnspodGenerator) DescribeRecordList(client *dnspod.Client, name, resourceName string) error {\n\trequest := dnspod.NewDescribeRecordListRequest()\n\n\trequest.Domain = &name\n\tvar offset uint64\n\tvar limit uint64 = 50\n\tallInstances := make([]*dnspod.RecordListItem, 0)\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &limit\n\t\tresponse, err := client.DescribeRecordList(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tallInstances = append(allInstances, response.Response.RecordList...)\n\t\tif len(response.Response.RecordList) < int(limit) {\n\t\t\tbreak\n\t\t}\n\n\t\toffset += limit\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\tname+\"#\"+strconv.FormatUint(*instance.RecordId, 10),\n\t\t\tname+\"_\"+strconv.FormatUint(*instance.RecordId, 10),\n\t\t\t\"tencentcloud_dnspod_record\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tresource.AdditionalFields[\"domain\"] = \"${tencentcloud_dnspod_domain_instance.\" + resourceName + \".id}\"\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/eip.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tvpc \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312\"\n)\n\ntype EipGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *EipGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := vpc.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar offset int64\n\tvar pageSize int64 = 50\n\tallInstances := make([]*vpc.Address, 0)\n\trequest := vpc.NewDescribeAddressesRequest()\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"tencentcloud_eip\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\tfor i := range filters {\n\t\trequest.AddressIds = append(request.AddressIds, &filters[i])\n\t}\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeAddresses(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.AddressSet...)\n\t\tif len(response.Response.AddressSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.AddressId,\n\t\t\t*instance.AddressId,\n\t\t\t\"tencentcloud_eip\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\n\t\tif instance.InstanceId != nil && *instance.InstanceId != \"\" {\n\t\t\tassociation := terraformutils.NewResource(\n\t\t\t\t*instance.AddressId+\"::\"+*instance.InstanceId,\n\t\t\t\t*instance.AddressId,\n\t\t\t\t\"tencentcloud_eip_association\",\n\t\t\t\t\"tencentcloud\",\n\t\t\t\tmap[string]string{},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tassociation.AdditionalFields[\"eip_id\"] = \"${tencentcloud_eip.\" + resource.ResourceName + \".id}\"\n\t\t\tg.Resources = append(g.Resources, association)\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/elasticsearch.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tes \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/es/v20180416\"\n)\n\ntype EsGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *EsGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := es.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := es.NewDescribeInstancesRequest()\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*es.InstanceInfo, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeInstances(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.InstanceList...)\n\t\tif len(response.Response.InstanceList) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.InstanceId,\n\t\t\t*instance.InstanceName+\"_\"+*instance.InstanceId,\n\t\t\t\"tencentcloud_elasticsearch_instance\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\nfunc (g *EsGenerator) PostConvertHook() error {\n\tfor i := range g.Resources {\n\t\tg.Resources[i].Item[\"password\"] = \"test1234;\"\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/gaap.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tgaap \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/gaap/v20180529\"\n)\n\ntype GaapGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *GaapGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := gaap.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.loadProxy(client); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadRealServer(client); err != nil {\n\t\treturn err\n\t}\n\tif err := g.loadCertificate(client); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc (g *GaapGenerator) loadProxy(client *gaap.Client) error {\n\trequest := gaap.NewDescribeProxiesRequest()\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"tencentcloud_gaap_proxy\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\tfor i := range filters {\n\t\trequest.InstanceIds = append(request.InstanceIds, &filters[i])\n\t}\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*gaap.ProxyInfo, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeProxies(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.ProxySet...)\n\t\tif len(response.Response.ProxySet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.ProxyId,\n\t\t\t*instance.ProxyName+\"_\"+*instance.ProxyId,\n\t\t\t\"tencentcloud_gaap_proxy\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\n\t\tif len(g.Filter) > 0 {\n\t\t\tmatch := false\n\t\t\tfor _, filter := range g.Filter {\n\t\t\t\tif filter.Filter(resource) {\n\t\t\t\t\tmatch = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !match {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif err := g.loadHTTPListener(client, *instance.ProxyId, resource.ResourceName); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := g.loadHTTPSListener(client, *instance.ProxyId, resource.ResourceName); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := g.loadTCPListener(client, *instance.ProxyId, resource.ResourceName); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := g.loadUDPListener(client, *instance.ProxyId, resource.ResourceName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *GaapGenerator) matchFilter(resource *terraformutils.Resource) bool {\n\n\treturn false\n}\n\nfunc (g *GaapGenerator) loadRealServer(client *gaap.Client) error {\n\trequest := gaap.NewDescribeRealServersRequest()\n\tvar projectID int64 = -1\n\trequest.ProjectId = &projectID\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*gaap.BindRealServerInfo, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeRealServers(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.RealServerSet...)\n\t\tif len(response.Response.RealServerSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.RealServerId,\n\t\t\t*instance.RealServerName+\"_\"+*instance.RealServerId,\n\t\t\t\"tencentcloud_gaap_realserver\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\nfunc (g *GaapGenerator) loadHTTPListener(client *gaap.Client, proxyID, resourceName string) error {\n\trequest := gaap.NewDescribeHTTPListenersRequest()\n\trequest.ProxyId = &proxyID\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*gaap.HTTPListener, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeHTTPListeners(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.ListenerSet...)\n\t\tif len(response.Response.ListenerSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.ListenerId,\n\t\t\t*instance.ListenerName+\"_\"+*instance.ListenerId,\n\t\t\t\"tencentcloud_gaap_layer7_listener\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{\"proxy_id\": proxyID},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tresource.AdditionalFields[\"proxy_id\"] = \"${tencentcloud_gaap_proxy.\" + resourceName + \".id}\"\n\t\tg.Resources = append(g.Resources, resource)\n\n\t\tif err := g.loadDomain(client, *instance.ListenerId, \"HTTP\", resource.ResourceName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *GaapGenerator) loadHTTPSListener(client *gaap.Client, proxyID, resourceName string) error {\n\trequest := gaap.NewDescribeHTTPSListenersRequest()\n\trequest.ProxyId = &proxyID\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*gaap.HTTPSListener, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeHTTPSListeners(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.ListenerSet...)\n\t\tif len(response.Response.ListenerSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.ListenerId,\n\t\t\t*instance.ListenerName+\"_\"+*instance.ListenerId,\n\t\t\t\"tencentcloud_gaap_layer7_listener\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{\"proxy_id\": proxyID},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tresource.AdditionalFields[\"proxy_id\"] = \"${tencentcloud_gaap_proxy.\" + resourceName + \".id}\"\n\t\tg.Resources = append(g.Resources, resource)\n\n\t\tif err := g.loadDomain(client, *instance.ListenerId, \"HTTPS\", resource.ResourceName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *GaapGenerator) loadTCPListener(client *gaap.Client, proxyID, resourceName string) error {\n\trequest := gaap.NewDescribeTCPListenersRequest()\n\trequest.ProxyId = &proxyID\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*gaap.TCPListener, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeTCPListeners(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.ListenerSet...)\n\t\tif len(response.Response.ListenerSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.ListenerId,\n\t\t\t*instance.ListenerName+\"_\"+*instance.ListenerId,\n\t\t\t\"tencentcloud_gaap_layer4_listener\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{\"proxy_id\": proxyID},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tresource.AdditionalFields[\"proxy_id\"] = \"${tencentcloud_gaap_proxy.\" + resourceName + \".id}\"\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\treturn nil\n}\n\nfunc (g *GaapGenerator) loadUDPListener(client *gaap.Client, proxyID, resourceName string) error {\n\trequest := gaap.NewDescribeUDPListenersRequest()\n\trequest.ProxyId = &proxyID\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*gaap.UDPListener, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeUDPListeners(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.ListenerSet...)\n\t\tif len(response.Response.ListenerSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.ListenerId,\n\t\t\t*instance.ListenerName+\"_\"+*instance.ListenerId,\n\t\t\t\"tencentcloud_gaap_layer4_listener\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{\"proxy_id\": proxyID},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tresource.AdditionalFields[\"proxy_id\"] = \"${tencentcloud_gaap_proxy.\" + resourceName + \".id}\"\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\treturn nil\n}\n\nfunc (g *GaapGenerator) loadDomain(client *gaap.Client, listenerID, protocol, resourceName string) error {\n\trequest := gaap.NewDescribeRulesRequest()\n\trequest.ListenerId = &listenerID\n\tresponse, err := client.DescribeRules(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, domain := range response.Response.DomainRuleSet {\n\t\tresource := terraformutils.NewResource(\n\t\t\tfmt.Sprintf(\"%s+%s+%s\", listenerID, protocol, *domain.Domain),\n\t\t\tfmt.Sprintf(\"%s+%s+%s\", listenerID, protocol, *domain.Domain),\n\t\t\t\"tencentcloud_gaap_http_domain\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tresource.AdditionalFields[\"listener_id\"] = \"${tencentcloud_gaap_layer7_listener.\" + resourceName + \".id}\"\n\t\tg.Resources = append(g.Resources, resource)\n\n\t\tfor _, rule := range domain.RuleSet {\n\t\t\truleResource := terraformutils.NewResource(\n\t\t\t\t*rule.RuleId,\n\t\t\t\t*rule.RuleId,\n\t\t\t\t\"tencentcloud_gaap_http_rule\",\n\t\t\t\t\"tencentcloud\",\n\t\t\t\tmap[string]string{},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\truleResource.AdditionalFields[\"listener_id\"] = \"${tencentcloud_gaap_layer7_listener.\" + resourceName + \".id}\"\n\t\t\truleResource.AdditionalFields[\"domain\"] = \"${tencentcloud_gaap_http_domain.\" + resource.ResourceName + \".domain}\"\n\t\t\tg.Resources = append(g.Resources, ruleResource)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *GaapGenerator) loadCertificate(client *gaap.Client) error {\n\trequest := gaap.NewDescribeCertificatesRequest()\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*gaap.Certificate, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeCertificates(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.CertificateSet...)\n\t\tif len(response.Response.CertificateSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.CertificateId,\n\t\t\t*instance.CertificateAlias+\"_\"+*instance.CertificateId,\n\t\t\t\"tencentcloud_gaap_certificate\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\nfunc (g *GaapGenerator) PostConvertHook() error {\n\tfor _, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"tencentcloud_gaap_http_domain\" {\n\t\t\tdelete(resource.Item, \"client_certificate_id\")\n\t\t\tdelete(resource.Item, \"realserver_certificate_id\")\n\t\t} else if resource.InstanceInfo.Type == \"tencentcloud_gaap_layer7_listener\" {\n\t\t\tdelete(resource.Item, \"client_certificate_id\")\n\t\t} else if resource.InstanceInfo.Type == \"tencentcloud_gaap_certificate\" {\n\t\t\tresource.Item[\"content\"] = \"\"\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/key_pair.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tcvm \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312\"\n)\n\ntype KeyPairGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *KeyPairGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := cvm.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := cvm.NewDescribeKeyPairsRequest()\n\n\tvar offset int64\n\tvar pageSize int64 = 50\n\tallInstances := make([]*cvm.KeyPair, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeKeyPairs(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.KeyPairSet...)\n\t\tif len(response.Response.KeyPairSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.KeyId,\n\t\t\t*instance.KeyName+\"_\"+*instance.KeyId,\n\t\t\t\"tencentcloud_key_pair\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/mongodb.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tmongodb \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/mongodb/v20180408\"\n)\n\ntype MongodbGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *MongodbGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := mongodb.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := mongodb.NewDescribeDBInstancesRequest()\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*mongodb.MongoDBInstanceDetail, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeDBInstances(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.InstanceDetails...)\n\t\tif len(response.Response.InstanceDetails) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.InstanceId,\n\t\t\t*instance.InstanceName+\"_\"+*instance.InstanceId,\n\t\t\t\"tencentcloud_mongodb_instance\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\nfunc (g *MongodbGenerator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"tencentcloud_mongodb_instance\" {\n\t\t\tg.Resources[i].Item[\"password\"] = \"test1234;\"\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/mysql.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"math/rand\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tcdb \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdb/v20170320\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n)\n\ntype MysqlGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *MysqlGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := cdb.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := cdb.NewDescribeDBInstancesRequest()\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"tencentcloud_mysql_instance\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\tfor i := range filters {\n\t\trequest.InstanceIds = append(request.InstanceIds, &filters[i])\n\t}\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*cdb.InstanceInfo, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeDBInstances(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.Items...)\n\t\tif len(response.Response.Items) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tif *instance.InstanceType == 1 {\n\t\t\tresource := terraformutils.NewResource(\n\t\t\t\t*instance.InstanceId,\n\t\t\t\t*instance.InstanceName+\"_\"+*instance.InstanceId,\n\t\t\t\t\"tencentcloud_mysql_instance\",\n\t\t\t\t\"tencentcloud\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"force_delete\":   \"false\",\n\t\t\t\t\t\"prepaid_period\": \"1\",\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t} else if *instance.InstanceType == 3 {\n\t\t\tresource := terraformutils.NewResource(\n\t\t\t\t*instance.InstanceId,\n\t\t\t\t*instance.InstanceName+\"_\"+*instance.InstanceId,\n\t\t\t\t\"tencentcloud_mysql_readonly_instance\",\n\t\t\t\t\"tencentcloud\",\n\t\t\t\tmap[string]string{\n\t\t\t\t\t\"force_delete\":   \"false\",\n\t\t\t\t\t\"prepaid_period\": \"1\",\n\t\t\t\t},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\tg.Resources = append(g.Resources, resource)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (g *MysqlGenerator) PostConvertHook() error {\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type == \"tencentcloud_mysql_instance\" {\n\t\t\tpassword := g.generatePassword(16)\n\t\t\tg.Resources[i].Item[\"root_password\"] = password\n\t\t\tg.Resources[i].InstanceState.Attributes[\"root_password\"] = password\n\t\t}\n\t\tdelete(resource.Item, \"pay_type\")\n\t\tdelete(resource.Item, \"period\")\n\t}\n\n\tfor i, resource := range g.Resources {\n\t\tif resource.InstanceInfo.Type != \"tencentcloud_mysql_readonly_instance\" {\n\t\t\tcontinue\n\t\t}\n\t\tdelete(resource.Item, \"pay_type\")\n\t\tdelete(resource.Item, \"period\")\n\t\tif masterID, exist := resource.InstanceState.Attributes[\"master_instance_id\"]; exist {\n\t\t\tfor _, r := range g.Resources {\n\t\t\t\tif r.InstanceInfo.Type != \"tencentcloud_mysql_instance\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif masterID == r.InstanceState.Attributes[\"id\"] {\n\t\t\t\t\tg.Resources[i].Item[\"master_instance_id\"] = \"${tencentcloud_mysql_instance.\" + r.ResourceName + \".id}\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *MysqlGenerator) generatePassword(length int) string {\n\tdigits := \"0123456789\"\n\talphabets := \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\"\n\tspecials := \"_+-!@#$\"\n\tall := digits + alphabets + specials\n\n\tpassword := make([]byte, length)\n\tpassword[0] = alphabets[rand.Intn(len(alphabets))]\n\tpassword[1] = digits[rand.Intn(len(digits))]\n\tfor i := 2; i < length; i++ {\n\t\tpassword[i] = all[rand.Intn(len(all))]\n\t}\n\trand.Shuffle(len(password), func(i, j int) {\n\t\tpassword[i], password[j] = password[j], password[i]\n\t})\n\treturn string(password)\n}\n"
  },
  {
    "path": "providers/tencentcloud/nat_gateway.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tvpc \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312\"\n)\n\ntype NatGatewayGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *NatGatewayGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := vpc.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := vpc.NewDescribeNatGatewaysRequest()\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*vpc.NatGateway, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeNatGateways(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.NatGatewaySet...)\n\t\tif len(response.Response.NatGatewaySet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.NatGatewayId,\n\t\t\t*instance.NatGatewayName+\"_\"+*instance.NatGatewayId,\n\t\t\t\"tencentcloud_nat_gateway\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/pts.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tpts \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/pts/v20210728\"\n)\n\ntype PtsGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *PtsGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := pts.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn g.DescribeProjects(client)\n}\nfunc (g *PtsGenerator) DescribeProjects(client *pts.Client) error {\n\trequest := pts.NewDescribeProjectsRequest()\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"tencentcloud_pts_project\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\n\tfor i := range filters {\n\t\trequest.ProjectIds = append(request.ProjectIds, &filters[i])\n\t}\n\n\tvar offset int64\n\tvar limit int64 = 50\n\tallInstances := make([]*pts.Project, 0)\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &limit\n\t\tresponse, err := client.DescribeProjects(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tallInstances = append(allInstances, response.Response.ProjectSet...)\n\t\tif len(response.Response.ProjectSet) < int(limit) {\n\t\t\tbreak\n\t\t}\n\n\t\toffset += limit\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.ProjectId,\n\t\t\t*instance.ProjectId+\"_\"+*instance.ProjectId,\n\t\t\t\"tencentcloud_pts_project\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/redis.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tredis \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/redis/v20180412\"\n)\n\ntype RedisGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *RedisGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := redis.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := redis.NewDescribeInstancesRequest()\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*redis.InstanceSet, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeInstances(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.InstanceSet...)\n\t\tif len(response.Response.InstanceSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.InstanceId,\n\t\t\t*instance.InstanceName+\"_\"+*instance.InstanceId,\n\t\t\t\"tencentcloud_redis_instance\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/route_table.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tvpc \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312\"\n)\n\ntype RouteTableGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *RouteTableGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := vpc.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := vpc.NewDescribeRouteTablesRequest()\n\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"tencentcloud_route_table\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\tfor i := range filters {\n\t\trequest.RouteTableIds = append(request.RouteTableIds, &filters[i])\n\t}\n\n\toffset := 0\n\tpageSize := 50\n\tallInstances := make([]*vpc.RouteTable, 0)\n\n\tfor {\n\t\toffsetString := strconv.Itoa(offset)\n\t\tlimitString := strconv.Itoa(pageSize)\n\t\trequest.Offset = &offsetString\n\t\trequest.Limit = &limitString\n\t\tresponse, err := client.DescribeRouteTables(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.RouteTableSet...)\n\t\tif len(response.Response.RouteTableSet) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.RouteTableId,\n\t\t\t*instance.RouteTableName+\"_\"+*instance.RouteTableId,\n\t\t\t\"tencentcloud_route_table\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\n\t\tfor _, entry := range instance.RouteSet {\n\t\t\tentryID := fmt.Sprintf(\"%d.%s\", *entry.RouteId, *instance.RouteTableId)\n\t\t\tentryName := fmt.Sprintf(\"%s_%d\", *instance.RouteTableId, *entry.RouteId)\n\t\t\tentryResource := terraformutils.NewResource(\n\t\t\t\tentryID,\n\t\t\t\tentryName,\n\t\t\t\t\"tencentcloud_route_table_entry\",\n\t\t\t\t\"tencentcloud\",\n\t\t\t\tmap[string]string{},\n\t\t\t\t[]string{},\n\t\t\t\tmap[string]interface{}{},\n\t\t\t)\n\t\t\t// Route table id could be connected\n\t\t\tg.Resources = append(g.Resources, entryResource)\n\t\t}\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/scf.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tscf \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/scf/v20180416\"\n)\n\ntype ScfGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *ScfGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := scf.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := scf.NewListFunctionsRequest()\n\n\tvar offset int64\n\tvar pageSize int64 = 50\n\tallInstances := make([]*scf.Function, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.ListFunctions(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.Functions...)\n\t\tif len(response.Response.Functions) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.Namespace+\"+\"+*instance.FunctionName,\n\t\t\t*instance.Namespace+\"_\"+*instance.FunctionName,\n\t\t\t\"tencentcloud_scf_function\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/security_group.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tvpc \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312\"\n)\n\ntype SecurityGroupGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *SecurityGroupGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := vpc.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := vpc.NewDescribeSecurityGroupsRequest()\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"tencentcloud_security_group\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\tfor i := range filters {\n\t\trequest.SecurityGroupIds = append(request.SecurityGroupIds, &filters[i])\n\t}\n\n\tvar offset int64\n\tvar pageSize int64 = 50\n\tallInstances := make([]*vpc.SecurityGroup, 0)\n\n\tfor {\n\t\toffsetString := fmt.Sprintf(\"%d\", offset)\n\t\tlimitString := fmt.Sprintf(\"%d\", pageSize)\n\t\trequest.Offset = &offsetString\n\t\trequest.Limit = &limitString\n\t\tresponse, err := client.DescribeSecurityGroups(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.SecurityGroupSet...)\n\t\tif len(response.Response.SecurityGroupSet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.SecurityGroupId,\n\t\t\t*instance.SecurityGroupName+\"_\"+*instance.SecurityGroupId,\n\t\t\t\"tencentcloud_security_group\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\n\t\truleResource := terraformutils.NewResource(\n\t\t\t*instance.SecurityGroupId,\n\t\t\t*instance.SecurityGroupName+\"_\"+*instance.SecurityGroupId,\n\t\t\t\"tencentcloud_security_group_lite_rule\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\truleResource.AdditionalFields[\"security_group_id\"] = \"${tencentcloud_security_group.\" + resource.ResourceName + \".id}\"\n\t\tg.Resources = append(g.Resources, ruleResource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/ses.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tses \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ses/v20201002\"\n)\n\ntype SesGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *SesGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := ses.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = g.ListEmailIdentities(client); err != nil {\n\t\treturn err\n\t}\n\n\treturn g.ListEmailTemplates(client)\n}\nfunc (g *SesGenerator) ListEmailIdentities(client *ses.Client) error {\n\trequest := ses.NewListEmailIdentitiesRequest()\n\n\tvar allInstances []*ses.EmailIdentity\n\tresponse, err := client.ListEmailIdentities(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tallInstances = response.Response.EmailIdentities\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.IdentityName,\n\t\t\t*instance.IdentityName,\n\t\t\t\"tencentcloud_ses_domain\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t\tif err := g.ListEmailAddress(client); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\nfunc (g *SesGenerator) ListEmailAddress(client *ses.Client) error {\n\trequest := ses.NewListEmailAddressRequest()\n\n\tvar allInstances []*ses.EmailSender\n\tresponse, err := client.ListEmailAddress(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tallInstances = response.Response.EmailSenders\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.EmailAddress,\n\t\t\t*instance.EmailAddress,\n\t\t\t\"tencentcloud_ses_email_address\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\nfunc (g *SesGenerator) ListEmailTemplates(client *ses.Client) error {\n\trequest := ses.NewListEmailTemplatesRequest()\n\n\tvar offset uint64\n\tvar limit uint64 = 50\n\tallInstances := make([]*ses.TemplatesMetadata, 0)\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &limit\n\t\tresponse, err := client.ListEmailTemplates(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tallInstances = append(allInstances, response.Response.TemplatesMetadata...)\n\t\tif len(response.Response.TemplatesMetadata) < int(limit) {\n\t\t\tbreak\n\t\t}\n\n\t\toffset += limit\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\tstrconv.FormatUint(*instance.TemplateID, 10),\n\t\t\tstrconv.FormatUint(*instance.TemplateID, 10),\n\t\t\t\"tencentcloud_ses_template\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/ssl.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tssl \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ssl/v20191205\"\n)\n\ntype SslGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *SslGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := ssl.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := ssl.NewDescribeCertificatesRequest()\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*ssl.Certificates, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeCertificates(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.Certificates...)\n\t\tif len(response.Response.Certificates) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.CertificateId,\n\t\t\t*instance.CertificateId,\n\t\t\t\"tencentcloud_ssl_certificate\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/subnet.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tvpc \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312\"\n)\n\ntype SubnetGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *SubnetGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := vpc.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := vpc.NewDescribeSubnetsRequest()\n\toffset := 0\n\tpageSize := 50\n\tallSubnets := make([]*vpc.Subnet, 0)\n\n\tfor {\n\t\toffsetString := strconv.Itoa(offset)\n\t\tlimitString := strconv.Itoa(pageSize)\n\t\trequest.Offset = &offsetString\n\t\trequest.Limit = &limitString\n\t\tresponse, err := client.DescribeSubnets(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallSubnets = append(allSubnets, response.Response.SubnetSet...)\n\t\tif len(response.Response.SubnetSet) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, subnet := range allSubnets {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*subnet.SubnetId,\n\t\t\t*subnet.SubnetName+\"_\"+*subnet.SubnetId,\n\t\t\t\"tencentcloud_subnet\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/tat.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\ttat \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat/v20201028\"\n)\n\ntype TatGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *TatGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := tat.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn g.DescribeCommands(client)\n}\nfunc (g *TatGenerator) DescribeCommands(client *tat.Client) error {\n\trequest := tat.NewDescribeCommandsRequest()\n\tfilters := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"tencentcloud_tat_command\") {\n\t\t\tfilters = append(filters, filter.AcceptableValues...)\n\t\t}\n\t}\n\n\tfor i := range filters {\n\t\trequest.CommandIds = append(request.CommandIds, &filters[i])\n\t}\n\n\tvar offset uint64\n\tvar limit uint64 = 50\n\tallInstances := make([]*tat.Command, 0)\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &limit\n\t\tresponse, err := client.DescribeCommands(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tallInstances = append(allInstances, response.Response.CommandSet...)\n\t\tif len(response.Response.CommandSet) < int(limit) {\n\t\t\tbreak\n\t\t}\n\n\t\toffset += limit\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.CommandId,\n\t\t\t*instance.CommandId+\"_\"+*instance.CommandId,\n\t\t\t\"tencentcloud_tat_command\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t\tif err := g.DescribeInvokers(client, *instance.CommandId, resource.ResourceName); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\nfunc (g *TatGenerator) DescribeInvokers(client *tat.Client, commandID, resourceName string) error {\n\trequest := tat.NewDescribeInvokersRequest()\n\trequest.Filters = []*tat.Filter{\n\t\t{\n\t\t\tName:   String(\"command-id\"),\n\t\t\tValues: []*string{&commandID},\n\t\t},\n\t}\n\tvar offset uint64\n\tvar limit uint64 = 50\n\tallInstances := make([]*tat.Invoker, 0)\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &limit\n\t\tresponse, err := client.DescribeInvokers(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tallInstances = append(allInstances, response.Response.InvokerSet...)\n\t\tif len(response.Response.InvokerSet) < int(limit) {\n\t\t\tbreak\n\t\t}\n\n\t\toffset += limit\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.InvokerId,\n\t\t\t*instance.InvokerId+\"_\"+*instance.InvokerId,\n\t\t\t\"tencentcloud_tat_invoker\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tresource.AdditionalFields[\"command_id\"] = \"${tencentcloud_tat_command.\" + resourceName + \".id}\"\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/tcaplus.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors\"\n\ttcaplus \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb/v20190823\"\n)\n\ntype TcaplusGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *TcaplusGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := tcaplus.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := tcaplus.NewDescribeClustersRequest()\n\n\tvar offset int64\n\tvar pageSize int64 = 50\n\tallInstances := make([]*tcaplus.ClusterInfo, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeClusters(request)\n\t\tif err != nil {\n\t\t\tsdkErr, ok := err.(*errors.TencentCloudSDKError)\n\t\t\tif ok && sdkErr.Code == \"UnsupportedRegion\" {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.Clusters...)\n\t\tif len(response.Response.Clusters) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.ClusterId,\n\t\t\t*instance.ClusterName+\"_\"+*instance.ClusterId,\n\t\t\t\"tencentcloud_tcaplus_cluster\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/tencentcloud_helpers.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nfunc Bool(i bool) *bool { return &i }\n\nfunc String(i string) *string { return &i }\n\nfunc Int(i int) *int { return &i }\n\nfunc Uint(i uint) *uint { return &i }\n\nfunc Int64(i int64) *int64 { return &i }\n\nfunc Float64(i float64) *float64 { return &i }\n\nfunc Uint64(i uint64) *uint64 { return &i }\n\nfunc IntInt64(i int) *int64 {\n\ti64 := int64(i)\n\treturn &i64\n}\n\nfunc IntUint64(i int) *uint64 {\n\tu := uint64(i)\n\treturn &u\n}\n\nfunc Int64Uint64(i int64) *uint64 {\n\tu := uint64(i)\n\treturn &u\n}\n\nfunc UInt64Int64(i uint64) *int64 {\n\tu := int64(i)\n\treturn &u\n}\n"
  },
  {
    "path": "providers/tencentcloud/tencentcloud_provider.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype TencentCloudProvider struct { //nolint\n\tterraformutils.Provider\n\tregion     string\n\tcredential common.Credential\n}\n\nfunc (p *TencentCloudProvider) getCredential() error {\n\tsecretID := os.Getenv(\"TENCENTCLOUD_SECRET_ID\")\n\tif secretID == \"\" {\n\t\treturn errors.New(\"TENCENTCLOUD_SECRET_ID must be set\")\n\t}\n\tsecretKey := os.Getenv(\"TENCENTCLOUD_SECRET_KEY\")\n\tif secretKey == \"\" {\n\t\treturn errors.New(\"TENCENTCLOUD_SECRET_KEY must be set\")\n\t}\n\ttoken := os.Getenv(\"TENCENTCLOUD_SECURITY_TOKEN\")\n\n\tp.credential = common.Credential{\n\t\tSecretId:  secretID,\n\t\tSecretKey: secretKey,\n\t\tToken:     token,\n\t}\n\treturn nil\n}\n\nfunc (p *TencentCloudProvider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"region\": cty.StringVal(p.region),\n\t})\n}\n\nfunc (p *TencentCloudProvider) GetName() string {\n\treturn \"tencentcloud\"\n}\n\nfunc (p *TencentCloudProvider) GetSource() string {\n\treturn \"tencentcloudstack/\" + p.GetName()\n}\n\nfunc (p *TencentCloudProvider) Init(args []string) error {\n\terr := p.getCredential()\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.region = args[0]\n\treturn nil\n}\n\nfunc (p *TencentCloudProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"tencentcloud: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"region\":     p.region,\n\t\t\"credential\": p.credential,\n\t})\n\treturn nil\n}\n\nfunc (p *TencentCloudProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"cvm\":            &CvmGenerator{},\n\t\t\"vpc\":            &VpcGenerator{},\n\t\t\"cdn\":            &CdnGenerator{},\n\t\t\"as\":             &AsGenerator{},\n\t\t\"clb\":            &ClbGenerator{},\n\t\t\"cos\":            &CosGenerator{},\n\t\t\"key_pair\":       &KeyPairGenerator{},\n\t\t\"security_group\": &SecurityGroupGenerator{},\n\t\t\"cbs\":            &CbsGenerator{},\n\t\t\"cfs\":            &CfsGenerator{},\n\t\t\"elasticsearch\":  &EsGenerator{},\n\t\t\"gaap\":           &GaapGenerator{},\n\t\t\"mongodb\":        &MongodbGenerator{},\n\t\t\"mysql\":          &MysqlGenerator{},\n\t\t\"redis\":          &RedisGenerator{},\n\t\t\"ssl\":            &SslGenerator{},\n\t\t\"scf\":            &ScfGenerator{},\n\t\t\"tcaplus\":        &TcaplusGenerator{},\n\t\t\"vpn\":            &VpnGenerator{},\n\t\t\"eip\":            &EipGenerator{},\n\t\t\"subnet\":         &SubnetGenerator{},\n\t\t\"route_table\":    &RouteTableGenerator{},\n\t\t\"nat_gateway\":    &NatGatewayGenerator{},\n\t\t\"acl\":            &ACLGenerator{},\n\t\t\"pts\":            &PtsGenerator{},\n\t\t\"tat\":            &TatGenerator{},\n\t\t\"dnspod\":         &DnspodGenerator{},\n\t\t\"ses\":            &SesGenerator{},\n\t}\n}\n\nfunc (p *TencentCloudProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{\n\t\t\"cvm\": {\n\t\t\t\"vpc\":            []string{\"vpc_id\", \"id\"},\n\t\t\t\"subnet\":         []string{\"subnet_id\", \"id\"},\n\t\t\t\"security_group\": []string{\"security_groups\", \"id\"},\n\t\t\t\"key_pair\":       []string{\"key_name\", \"id\"},\n\t\t},\n\t\t\"as\": {\n\t\t\t\"vpc\":    []string{\"vpc_id\", \"id\"},\n\t\t\t\"subnet\": []string{\"subnet_ids\", \"id\"},\n\t\t\t\"clb\":    []string{\"forward_balancer_ids\", \"id\"},\n\t\t},\n\t\t\"clb\": {\n\t\t\t\"vpc\":            []string{\"vpc_id\", \"id\", \"target_region_info_vpc_id\", \"id\"},\n\t\t\t\"subnet\":         []string{\"subnet_id\", \"id\"},\n\t\t\t\"security_group\": []string{\"security_groups\", \"id\"},\n\t\t\t\"cvm\":            []string{\"targets.instance_id\", \"id\"},\n\t\t},\n\t\t\"cfs\": {\n\t\t\t\"vpc\":    []string{\"vpc_id\", \"id\"},\n\t\t\t\"subnet\": []string{\"subnet_id\", \"id\"},\n\t\t},\n\t\t\"elasticsearch\": {\n\t\t\t\"vpc\":    []string{\"vpc_id\", \"id\"},\n\t\t\t\"subnet\": []string{\"subnet_id\", \"id\"},\n\t\t},\n\t\t\"mongodb\": {\n\t\t\t\"vpc\":    []string{\"vpc_id\", \"id\"},\n\t\t\t\"subnet\": []string{\"subnet_id\", \"id\"},\n\t\t},\n\t\t\"mysql\": {\n\t\t\t\"vpc\":            []string{\"vpc_id\", \"id\"},\n\t\t\t\"subnet\":         []string{\"subnet_id\", \"id\"},\n\t\t\t\"security_group\": []string{\"security_groups\", \"id\"},\n\t\t},\n\t\t\"redis\": {\n\t\t\t\"vpc\":    []string{\"vpc_id\", \"id\"},\n\t\t\t\"subnet\": []string{\"subnet_id\", \"id\"},\n\t\t},\n\t\t\"scf\": {\n\t\t\t\"vpc\":    []string{\"vpc_id\", \"id\"},\n\t\t\t\"subnet\": []string{\"subnet_id\", \"id\"},\n\t\t\t\"cos\":    []string{\"cos_bucket_name\", \"id\"},\n\t\t},\n\t\t\"tcaplus\": {\n\t\t\t\"vpc\":    []string{\"vpc_id\", \"id\"},\n\t\t\t\"subnet\": []string{\"subnet_id\", \"id\"},\n\t\t},\n\t\t\"vpn\": {\n\t\t\t\"vpc\": []string{\"vpc_id\", \"id\"},\n\t\t},\n\t\t\"subnet\": {\n\t\t\t\"vpc\":         []string{\"vpc_id\", \"id\"},\n\t\t\t\"route_table\": []string{\"route_table_id\", \"id\"},\n\t\t},\n\t\t\"route_table\": {\n\t\t\t\"vpc\":         []string{\"vpc_id\", \"id\"},\n\t\t\t\"route_table\": []string{\"route_table_id\", \"id\"},\n\t\t\t\"nat_gateway\": []string{\"next_hub\", \"id\"},\n\t\t\t\"vpn\":         []string{\"next_hub\", \"id\"},\n\t\t},\n\t\t\"nat_gateway\": {\n\t\t\t\"vpc\": []string{\"vpc_id\", \"id\"},\n\t\t},\n\t\t\"acl\": {\n\t\t\t\"vpc\":    []string{\"vpc_id\", \"id\"},\n\t\t\t\"subnet\": []string{\"subnet_id\", \"id\"},\n\t\t},\n\t\t\"eip\": {\n\t\t\t\"cvm\": []string{\"instance_id\", \"id\"},\n\t\t},\n\t\t\"cbs\": {\n\t\t\t\"cvm\": []string{\"instance_id\", \"id\"},\n\t\t},\n\t}\n}\n\nfunc (p *TencentCloudProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\tp.GetName(): map[string]interface{}{\n\t\t\t\t\"region\": p.region,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc NewTencentCloudClientProfile() *profile.ClientProfile {\n\tcpf := profile.NewClientProfile()\n\n\t// all request use method POST\n\tcpf.HttpProfile.ReqMethod = \"POST\"\n\t// request timeout\n\tcpf.HttpProfile.ReqTimeout = 300\n\t// default language\n\tcpf.Language = \"en-US\"\n\n\treturn cpf\n}\n"
  },
  {
    "path": "providers/tencentcloud/tencentcloud_service.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport \"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\ntype TencentCloudService struct { //nolint\n\tterraformutils.Service\n}\n"
  },
  {
    "path": "providers/tencentcloud/vpc.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tvpc \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312\"\n)\n\ntype VpcGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *VpcGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := vpc.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := vpc.NewDescribeVpcsRequest()\n\trequest.Filters = make([]*vpc.Filter, 0)\n\tvpcIds := make([]string, 0)\n\tfor _, filter := range g.Filter {\n\t\tif filter.FieldPath == \"id\" && filter.IsApplicable(\"tencentcloud_vpc\") {\n\t\t\tvpcIds = append(vpcIds, filter.AcceptableValues...)\n\t\t}\n\t}\n\tif len(vpcIds) > 0 {\n\t\trequest.VpcIds = make([]*string, 0, len(vpcIds))\n\t\tfor i := range vpcIds {\n\t\t\trequest.VpcIds = append(request.VpcIds, &vpcIds[i])\n\t\t}\n\t}\n\n\toffset := 0\n\tpageSize := 50\n\tallVpcs := make([]*vpc.Vpc, 0)\n\n\tfor {\n\t\toffsetString := strconv.Itoa(offset)\n\t\tlimitString := strconv.Itoa(pageSize)\n\t\trequest.Offset = &offsetString\n\t\trequest.Limit = &limitString\n\t\tresponse, err := client.DescribeVpcs(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallVpcs = append(allVpcs, response.Response.VpcSet...)\n\t\tif len(response.Response.VpcSet) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, vpcInstance := range allVpcs {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*vpcInstance.VpcId,\n\t\t\t*vpcInstance.VpcName+\"_\"+*vpcInstance.VpcId,\n\t\t\t\"tencentcloud_vpc\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\t// g.loadSubnets(client, *vpcInstance.VpcId, resource.ResourceName)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n\nfunc (g *VpcGenerator) loadSubnets(client *vpc.Client, vpcID, resourceName string) error {\n\trequest := vpc.NewDescribeSubnetsRequest()\n\trequest.Filters = make([]*vpc.Filter, 0, 1)\n\tidKey := \"vpc-id\"\n\tidFilter := vpc.Filter{\n\t\tName:   &idKey,\n\t\tValues: []*string{&vpcID},\n\t}\n\trequest.Filters = append(request.Filters, &idFilter)\n\n\toffset := 0\n\tpageSize := 50\n\tallSubnets := make([]*vpc.Subnet, 0)\n\n\tfor {\n\t\toffsetString := strconv.Itoa(offset)\n\t\tlimitString := strconv.Itoa(pageSize)\n\t\trequest.Offset = &offsetString\n\t\trequest.Limit = &limitString\n\t\tresponse, err := client.DescribeSubnets(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallSubnets = append(allSubnets, response.Response.SubnetSet...)\n\t\tif len(response.Response.SubnetSet) < pageSize {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, subnet := range allSubnets {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*subnet.SubnetId,\n\t\t\t*subnet.SubnetName+\"_\"+*subnet.SubnetId,\n\t\t\t\"tencentcloud_subnet\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tresource.AdditionalFields[\"vpc_id\"] = \"${tencentcloud_vpc.\" + resourceName + \".id}\"\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/tencentcloud/vpn.go",
    "content": "// Copyright 2022 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage tencentcloud\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common\"\n\tvpc \"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312\"\n)\n\ntype VpnGenerator struct {\n\tTencentCloudService\n}\n\nfunc (g *VpnGenerator) InitResources() error {\n\targs := g.GetArgs()\n\tregion := args[\"region\"].(string)\n\tcredential := args[\"credential\"].(common.Credential)\n\tprofile := NewTencentCloudClientProfile()\n\tclient, err := vpc.NewClient(&credential, region, profile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trequest := vpc.NewDescribeVpnGatewaysRequest()\n\n\tvar offset uint64\n\tvar pageSize uint64 = 50\n\tallInstances := make([]*vpc.VpnGateway, 0)\n\n\tfor {\n\t\trequest.Offset = &offset\n\t\trequest.Limit = &pageSize\n\t\tresponse, err := client.DescribeVpnGateways(request)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tallInstances = append(allInstances, response.Response.VpnGatewaySet...)\n\t\tif len(response.Response.VpnGatewaySet) < int(pageSize) {\n\t\t\tbreak\n\t\t}\n\t\toffset += pageSize\n\t}\n\n\tfor _, instance := range allInstances {\n\t\tresource := terraformutils.NewResource(\n\t\t\t*instance.VpnGatewayId,\n\t\t\t*instance.VpnGatewayName+\"_\"+*instance.VpnGatewayId,\n\t\t\t\"tencentcloud_vpn_gateway\",\n\t\t\t\"tencentcloud\",\n\t\t\tmap[string]string{},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{},\n\t\t)\n\t\tg.Resources = append(g.Resources, resource)\n\t}\n\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vault/vault_provider.go",
    "content": "package vault\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype Provider struct {\n\tterraformutils.Provider\n\ttoken   string\n\taddress string\n}\n\nfunc (p *Provider) Init(args []string) error {\n\n\tif address := os.Getenv(\"VAULT_ADDR\"); address != \"\" {\n\t\tp.address = os.Getenv(\"VAULT_ADDR\")\n\t}\n\n\tif token := os.Getenv(\"VAULT_TOKEN\"); token != \"\" {\n\t\tp.token = os.Getenv(\"VAULT_TOKEN\")\n\t}\n\n\tif len(args) > 0 && args[0] != \"\" {\n\t\tp.address = args[0]\n\t}\n\n\tif len(args) > 1 && args[1] != \"\" {\n\t\tp.token = args[1]\n\t}\n\n\treturn nil\n}\n\nfunc (p *Provider) GetConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{\n\t\t\"token\":   cty.StringVal(p.token),\n\t\t\"address\": cty.StringVal(p.address),\n\t})\n}\n\nfunc (p *Provider) GetName() string {\n\treturn \"vault\"\n}\n\nfunc (p *Provider) InitService(serviceName string, verbose bool) error {\n\tif service, ok := p.GetSupportedService()[serviceName]; ok {\n\t\tp.Service = service\n\t\tp.Service.SetName(serviceName)\n\t\tp.Service.SetVerbose(verbose)\n\t\tp.Service.SetProviderName(p.GetName())\n\t\tp.Service.SetArgs(map[string]interface{}{\n\t\t\t\"token\":   p.token,\n\t\t\t\"address\": p.address,\n\t\t})\n\t\tif err := service.(*ServiceGenerator).setVaultClient(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\treturn errors.New(p.GetName() + \": \" + serviceName + \" not supported service\")\n}\n\nfunc getSupportedMountServices() map[string]terraformutils.ServiceGenerator {\n\tservices := make(map[string]terraformutils.ServiceGenerator)\n\tmapping := map[string][]string{\n\t\t\"secret_backend\":      {\"ad\", \"aws\", \"azure\", \"consul\", \"gcp\", \"nomad\", \"pki\", \"rabbitmq\", \"terraform_cloud\"},\n\t\t\"secret_backend_role\": {\"ad\", \"aws\", \"azure\", \"consul\", \"database\", \"pki\", \"rabbitmq\", \"ssh\"},\n\t\t\"auth_backend\":        {\"gcp\", \"github\", \"jwt\", \"ldap\", \"okta\"},\n\t\t\"auth_backend_role\":   {\"alicloud\", \"approle\", \"aws\", \"azure\", \"cert\", \"gcp\", \"jwt\", \"kubernetes\", \"token\"},\n\t\t\"auth_backend_user\":   {\"ldap\", \"okta\"},\n\t\t\"auth_backend_group\":  {\"ldap\", \"okta\"},\n\t}\n\tfor resource, mountTypes := range mapping {\n\t\tfor _, mountType := range mountTypes {\n\t\t\tservices[fmt.Sprintf(\"%s_%s\", mountType, resource)] =\n\t\t\t\t&ServiceGenerator{mountType: mountType, resource: resource}\n\t\t}\n\t}\n\treturn services\n}\n\nfunc (p *Provider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\tgenerators := getSupportedMountServices()\n\tgenerators[\"policy\"] = &ServiceGenerator{resource: \"policy\"}\n\tgenerators[\"mount\"] = &ServiceGenerator{resource: \"mount\"}\n\tgenerators[\"generic_secret\"] = &ServiceGenerator{resource: \"generic_secret\", mountType: \"kv\"}\n\treturn generators\n}\n\nfunc (Provider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (Provider) GetProviderData(_ ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n"
  },
  {
    "path": "providers/vault/vault_service_generator.go",
    "content": "package vault\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"regexp\"\n\t\"sort\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\tvault \"github.com/hashicorp/vault/api\"\n)\n\ntype ServiceGenerator struct { //nolint\n\tterraformutils.Service\n\tclient    *vault.Client\n\tmountType string\n\tresource  string\n}\n\nfunc (g *ServiceGenerator) setVaultClient() error {\n\tclient, err := vault.NewClient(&vault.Config{Address: g.Args[\"address\"].(string)})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif g.Args[\"token\"] != \"\" {\n\t\tclient.SetToken(g.Args[\"token\"].(string))\n\t}\n\tg.client = client\n\treturn nil\n}\n\nfunc (g *ServiceGenerator) InitResources() error {\n\tswitch g.resource {\n\tcase \"secret_backend\":\n\t\treturn g.createSecretBackendResources()\n\tcase \"secret_backend_role\":\n\t\treturn g.createSecretBackendRoleResources()\n\tcase \"auth_backend\":\n\t\treturn g.createAuthBackendResources()\n\tcase \"auth_backend_role\":\n\t\treturn g.createAuthBackendEntityResources(\"role\", \"role\")\n\tcase \"auth_backend_user\":\n\t\treturn g.createAuthBackendEntityResources(\"users\", \"user\")\n\tcase \"auth_backend_group\":\n\t\treturn g.createAuthBackendEntityResources(\"groups\", \"group\")\n\tcase \"policy\":\n\t\treturn g.createPolicyResources()\n\tcase \"generic_secret\":\n\t\treturn g.createGenericSecretResources()\n\tcase \"mount\":\n\t\treturn g.createMountResources()\n\tdefault:\n\t\treturn errors.New(\"unsupported service type. shouldn't ever reach here\")\n\t}\n}\n\nfunc (g *ServiceGenerator) createSecretBackendResources() error {\n\tmounts, err := g.mountsByType()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, mount := range mounts {\n\t\tg.Resources = append(g.Resources,\n\t\t\tterraformutils.NewSimpleResource(\n\t\t\t\tmount,\n\t\t\t\tmount,\n\t\t\t\tfmt.Sprintf(\"vault_%s_secret_backend\", g.mountType),\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t}\n\treturn nil\n}\n\nfunc (g *ServiceGenerator) createSecretBackendRoleResources() error {\n\tmounts, err := g.mountsByType()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, mount := range mounts {\n\t\tpath := fmt.Sprintf(\"%s/roles\", mount)\n\t\ts, err := g.client.Logical().List(path)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error calling path %s: %s\", path, err)\n\t\t\tcontinue\n\t\t}\n\t\tif s == nil {\n\t\t\tlog.Printf(\"call to %s returned nil result\", path)\n\t\t\tcontinue\n\t\t}\n\t\troles, ok := s.Data[\"keys\"]\n\t\tif !ok {\n\t\t\tlog.Printf(\"no keys in call to %s\", path)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, role := range roles.([]interface{}) {\n\t\t\tg.Resources = append(g.Resources,\n\t\t\t\tterraformutils.NewSimpleResource(\n\t\t\t\t\tfmt.Sprintf(\"%s/roles/%s\", mount, role),\n\t\t\t\t\tfmt.Sprintf(\"%s_%s\", mount, role),\n\t\t\t\t\tfmt.Sprintf(\"vault_%s_secret_backend_role\", g.mountType),\n\t\t\t\t\tg.ProviderName,\n\t\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *ServiceGenerator) mountsByType() ([]string, error) {\n\tmounts, err := g.client.Sys().ListMounts()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar typeMounts []string\n\tfor name, mount := range mounts {\n\t\tif g.mountType == \"\" || mount.Type == g.mountType {\n\t\t\tid := strings.ReplaceAll(name, \"/\", \"\")\n\t\t\ttypeMounts = append(typeMounts, id)\n\t\t}\n\t}\n\treturn typeMounts, nil\n}\n\nfunc (g *ServiceGenerator) createAuthBackendResources() error {\n\tbackends, err := g.backendsByType()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, backend := range backends {\n\t\tg.Resources = append(g.Resources,\n\t\t\tterraformutils.NewSimpleResource(\n\t\t\t\tbackend,\n\t\t\t\tbackend,\n\t\t\t\tfmt.Sprintf(\"vault_%s_auth_backend\", g.mountType),\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t}\n\treturn nil\n}\n\nfunc (g *ServiceGenerator) createAuthBackendEntityResources(apiEntity, tfEntity string) error {\n\tbackends, err := g.backendsByType()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, backend := range backends {\n\t\tpath := fmt.Sprintf(\"/auth/%s/%s\", backend, apiEntity)\n\t\ts, err := g.client.Logical().List(path)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error calling path %s: %s\", path, err)\n\t\t\tcontinue\n\t\t}\n\t\tif s == nil {\n\t\t\tlog.Printf(\"call to %s returned nil result\", path)\n\t\t\tcontinue\n\t\t}\n\t\tnames, ok := s.Data[\"keys\"]\n\t\tif !ok {\n\t\t\tlog.Printf(\"no keys in call to %s\", path)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, name := range names.([]interface{}) {\n\t\t\tg.Resources = append(g.Resources,\n\t\t\t\tterraformutils.NewSimpleResource(\n\t\t\t\t\tfmt.Sprintf(\"auth/%s/%s/%s\", backend, apiEntity, name),\n\t\t\t\t\tfmt.Sprintf(\"%s_%s\", backend, name),\n\t\t\t\t\tfmt.Sprintf(\"vault_%s_auth_backend_%s\", g.mountType, tfEntity),\n\t\t\t\t\tg.ProviderName,\n\t\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *ServiceGenerator) backendsByType() ([]string, error) {\n\tauthBackends, err := g.client.Sys().ListAuth()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar typeBackends []string\n\tfor name, authBackend := range authBackends {\n\t\tif authBackend.Type != g.mountType {\n\t\t\tcontinue\n\t\t}\n\t\tid := strings.ReplaceAll(name, \"/\", \"\")\n\t\ttypeBackends = append(typeBackends, id)\n\t}\n\treturn typeBackends, nil\n}\n\nfunc (g *ServiceGenerator) createPolicyResources() error {\n\tpolicies, err := g.client.Sys().ListPolicies()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, policy := range policies {\n\t\tif policy == \"root\" {\n\t\t\tcontinue\n\t\t}\n\t\tg.Resources = append(g.Resources,\n\t\t\tterraformutils.NewSimpleResource(\n\t\t\t\tpolicy,\n\t\t\t\tpolicy,\n\t\t\t\t\"vault_policy\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t}\n\treturn nil\n}\n\nfunc (g *ServiceGenerator) createGenericSecretResources() error {\n\tmounts, err := g.mountsByType()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, mount := range mounts {\n\t\tpath := fmt.Sprintf(\"%s/\", mount)\n\t\ts, err := g.client.Logical().List(path)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error calling path %s: %s\", path, err)\n\t\t\tcontinue\n\t\t}\n\t\tif s == nil {\n\t\t\tlog.Printf(\"call to %s returned nil result\", path)\n\t\t\tcontinue\n\t\t}\n\t\tsecrets, ok := s.Data[\"keys\"]\n\t\tif !ok {\n\t\t\tlog.Printf(\"no keys in call to %s\", path)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, secret := range secrets.([]interface{}) {\n\t\t\tg.Resources = append(g.Resources,\n\t\t\t\tterraformutils.NewSimpleResource(\n\t\t\t\t\tfmt.Sprintf(\"%s/%s\", mount, secret),\n\t\t\t\t\tfmt.Sprintf(\"%s_%s\", mount, secret),\n\t\t\t\t\t\"vault_generic_secret\",\n\t\t\t\t\tg.ProviderName,\n\t\t\t\t\t[]string{}))\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (g *ServiceGenerator) createMountResources() error {\n\tmounts, err := g.mountsByType()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, mount := range mounts {\n\t\tg.Resources = append(g.Resources,\n\t\t\tterraformutils.NewSimpleResource(\n\t\t\t\tmount,\n\t\t\t\tmount,\n\t\t\t\t\"vault_mount\",\n\t\t\t\tg.ProviderName,\n\t\t\t\t[]string{}))\n\t}\n\treturn nil\n}\n\nfunc (g *ServiceGenerator) PostConvertHook() error {\n\tfor _, resource := range g.Resources {\n\t\tswitch resource.InstanceInfo.Type {\n\t\tcase \"vault_aws_secret_backend_role\":\n\t\t\tif policyDocument, ok := resource.Item[\"policy_document\"]; ok {\n\t\t\t\t// borrowed from providers/aws/aws_service.go\n\t\t\t\tsanitizedPolicy := regexp.MustCompile(`(\\${[0-9A-Za-z:]+})`).\n\t\t\t\t\tReplaceAllString(policyDocument.(string), \"$$$1\")\n\t\t\t\tresource.Item[\"policy_document\"] = fmt.Sprintf(`<<POLICY\n%s\nPOLICY`, sanitizedPolicy)\n\t\t\t}\n\t\tcase \"vault_ldap_auth_backend_group\":\n\t\t\tif policies, ok := resource.Item[\"policies\"]; ok {\n\t\t\t\tvar strPolicies []string\n\t\t\t\tfor _, policy := range policies.([]interface{}) {\n\t\t\t\t\tstrPolicies = append(strPolicies, policy.(string))\n\t\t\t\t}\n\t\t\t\tsort.Strings(strPolicies)\n\t\t\t\tresource.Item[\"policies\"] = strPolicies\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/bare_metal_server.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/vultr/govultr\"\n)\n\ntype BareMetalServerGenerator struct {\n\tVultrService\n}\n\nfunc (g BareMetalServerGenerator) createResources(serverList []govultr.BareMetalServer) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, server := range serverList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tserver.BareMetalServerID,\n\t\t\tserver.BareMetalServerID,\n\t\t\t\"vultr_bare_metal_server\",\n\t\t\t\"vultr\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *BareMetalServerGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.BareMetalServer.List(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/block_storage.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/vultr/govultr\"\n)\n\ntype BlockStorageGenerator struct {\n\tVultrService\n}\n\nfunc (g BlockStorageGenerator) createResources(blockStorageList []govultr.BlockStorage) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, blockStorage := range blockStorageList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tblockStorage.BlockStorageID,\n\t\t\tblockStorage.BlockStorageID,\n\t\t\t\"vultr_block_storage\",\n\t\t\t\"vultr\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *BlockStorageGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.BlockStorage.List(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/dns_domain.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/vultr/govultr\"\n)\n\ntype DNSDomainGenerator struct {\n\tVultrService\n}\n\nfunc (g *DNSDomainGenerator) loadDNSDomains(client *govultr.Client) ([]govultr.DNSDomain, error) {\n\tdomainList, err := client.DNSDomain.List(context.Background())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, domain := range domainList {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tdomain.Domain,\n\t\t\tdomain.Domain,\n\t\t\t\"vultr_dns_domain\",\n\t\t\t\"vultr\",\n\t\t\t[]string{}))\n\t}\n\treturn domainList, nil\n}\n\nfunc (g *DNSDomainGenerator) loadDNSRecords(client *govultr.Client, domain string) error {\n\trecordList, err := client.DNSRecord.List(context.Background(), domain)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, record := range recordList {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tstrconv.Itoa(record.RecordID),\n\t\t\tstrconv.Itoa(record.RecordID),\n\t\t\t\"vultr_dns_record\",\n\t\t\t\"vultr\",\n\t\t\tmap[string]string{\"domain\": domain},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n\nfunc (g *DNSDomainGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tdomainList, err := g.loadDNSDomains(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, domain := range domainList {\n\t\terr := g.loadDNSRecords(client, domain.Domain)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/firewall_group.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/vultr/govultr\"\n)\n\ntype FirewallGroupGenerator struct {\n\tVultrService\n}\n\nfunc (g *FirewallGroupGenerator) loadFirewallGroups(client *govultr.Client) ([]govultr.FirewallGroup, error) {\n\tfirewallGroups, err := client.FirewallGroup.List(context.Background())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, firewallGroup := range firewallGroups {\n\t\tg.Resources = append(g.Resources, terraformutils.NewSimpleResource(\n\t\t\tfirewallGroup.FirewallGroupID,\n\t\t\tfirewallGroup.FirewallGroupID,\n\t\t\t\"vultr_firewall_group\",\n\t\t\t\"vultr\",\n\t\t\t[]string{}))\n\t}\n\treturn firewallGroups, nil\n}\n\nfunc (g *FirewallGroupGenerator) loadFirewallRulesByIPType(client *govultr.Client, firewallGroupID string, ipType string) error {\n\tfirewallRules, err := client.FirewallRule.ListByIPType(context.Background(), firewallGroupID, ipType)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, firewallRule := range firewallRules {\n\t\tg.Resources = append(g.Resources, terraformutils.NewResource(\n\t\t\tstrconv.Itoa(firewallRule.RuleNumber),\n\t\t\tstrconv.Itoa(firewallRule.RuleNumber),\n\t\t\t\"vultr_firewall_rule\",\n\t\t\t\"vultr\",\n\t\t\tmap[string]string{\n\t\t\t\t\"firewall_group_id\": firewallGroupID,\n\t\t\t\t\"ip_type\":           ipType,\n\t\t\t},\n\t\t\t[]string{},\n\t\t\tmap[string]interface{}{}))\n\t}\n\treturn nil\n}\n\nfunc (g *FirewallGroupGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tfirewallGroups, err := g.loadFirewallGroups(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, firewallGroup := range firewallGroups {\n\t\terr := g.loadFirewallRulesByIPType(client, firewallGroup.FirewallGroupID, \"v4\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = g.loadFirewallRulesByIPType(client, firewallGroup.FirewallGroupID, \"v6\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/network.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/vultr/govultr\"\n)\n\ntype NetworkGenerator struct {\n\tVultrService\n}\n\nfunc (g NetworkGenerator) createResources(networkList []govultr.Network) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, network := range networkList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tnetwork.NetworkID,\n\t\t\tnetwork.NetworkID,\n\t\t\t\"vultr_network\",\n\t\t\t\"vultr\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *NetworkGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.Network.List(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/reserved_ip.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/vultr/govultr\"\n)\n\ntype ReservedIPGenerator struct {\n\tVultrService\n}\n\nfunc (g ReservedIPGenerator) createResources(ipList []govultr.ReservedIP) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, ip := range ipList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tip.ReservedIPID,\n\t\t\tip.ReservedIPID,\n\t\t\t\"vultr_reserved_ip\",\n\t\t\t\"vultr\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *ReservedIPGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.ReservedIP.List(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/server.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/vultr/govultr\"\n)\n\ntype ServerGenerator struct {\n\tVultrService\n}\n\nfunc (g ServerGenerator) createResources(serverList []govultr.Server) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, server := range serverList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tserver.InstanceID,\n\t\t\tserver.InstanceID,\n\t\t\t\"vultr_server\",\n\t\t\t\"vultr\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *ServerGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.Server.List(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/snapshot.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/vultr/govultr\"\n)\n\ntype SnapshotGenerator struct {\n\tVultrService\n}\n\nfunc (g SnapshotGenerator) createResources(snapshotList []govultr.Snapshot) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, snapshot := range snapshotList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tsnapshot.SnapshotID,\n\t\t\tsnapshot.SnapshotID,\n\t\t\t\"vultr_snapshot\",\n\t\t\t\"vultr\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *SnapshotGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.Snapshot.List(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/ssh_key.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/vultr/govultr\"\n)\n\ntype SSHKeyGenerator struct {\n\tVultrService\n}\n\nfunc (g SSHKeyGenerator) createResources(keyList []govultr.SSHKey) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, key := range keyList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tkey.SSHKeyID,\n\t\t\tkey.SSHKeyID,\n\t\t\t\"vultr_ssh_key\",\n\t\t\t\"vultr\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *SSHKeyGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.SSHKey.List(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/startup_script.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/vultr/govultr\"\n)\n\ntype StartupScriptGenerator struct {\n\tVultrService\n}\n\nfunc (g StartupScriptGenerator) createResources(scriptList []govultr.StartupScript) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, script := range scriptList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tscript.ScriptID,\n\t\t\tscript.ScriptID,\n\t\t\t\"vultr_startup_script\",\n\t\t\t\"vultr\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *StartupScriptGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.StartupScript.List(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/user.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/vultr/govultr\"\n)\n\ntype UserGenerator struct {\n\tVultrService\n}\n\nfunc (g UserGenerator) createResources(userList []govultr.User) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, user := range userList {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tuser.UserID,\n\t\t\tuser.UserID,\n\t\t\t\"vultr_user\",\n\t\t\t\"vultr\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *UserGenerator) InitResources() error {\n\tclient := g.generateClient()\n\toutput, err := client.User.List(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(output)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/vultr_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype VultrProvider struct { //nolint\n\tterraformutils.Provider\n\tapiKey string\n}\n\nfunc (p *VultrProvider) Init(args []string) error {\n\tif os.Getenv(\"VULTR_API_KEY\") == \"\" {\n\t\treturn errors.New(\"set VULTR_API_KEY env var\")\n\t}\n\tp.apiKey = os.Getenv(\"VULTR_API_KEY\")\n\n\treturn nil\n}\n\nfunc (p *VultrProvider) GetName() string {\n\treturn \"vultr\"\n}\n\nfunc (p *VultrProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (VultrProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *VultrProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"bare_metal_server\": &BareMetalServerGenerator{},\n\t\t\"block_storage\":     &BlockStorageGenerator{},\n\t\t\"dns_domain\":        &DNSDomainGenerator{},\n\t\t\"firewall_group\":    &FirewallGroupGenerator{},\n\t\t\"network\":           &NetworkGenerator{},\n\t\t\"reserved_ip\":       &ReservedIPGenerator{},\n\t\t\"server\":            &ServerGenerator{},\n\t\t\"snapshot\":          &SnapshotGenerator{},\n\t\t\"ssh_key\":           &SSHKeyGenerator{},\n\t\t\"startup_script\":    &StartupScriptGenerator{},\n\t\t\"user\":              &UserGenerator{},\n\t}\n}\n\nfunc (p *VultrProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"vultr: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"api_key\": p.apiKey,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/vultr/vultr_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage vultr\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/vultr/govultr\"\n)\n\ntype VultrService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (s *VultrService) generateClient() *govultr.Client {\n\treturn govultr.NewClient(nil, s.Args[\"api_key\"].(string))\n}\n"
  },
  {
    "path": "providers/xenorchestra/acls.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage xenorchestra\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/ddelnano/terraform-provider-xenorchestra/client\"\n)\n\ntype AclGenerator struct { //nolint\n\tXenorchestraService\n}\n\nfunc (g AclGenerator) createResources(acls []client.Acl) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, acl := range acls {\n\t\tresourceName := acl.Id\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tacl.Id,\n\t\t\tresourceName,\n\t\t\t\"xenorchestra_acl\",\n\t\t\t\"xenorchestra\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *AclGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tacls, err := client.GetAcls()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(acls)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/xenorchestra/resource_sets.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage xenorchestra\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/ddelnano/terraform-provider-xenorchestra/client\"\n)\n\ntype ResourceSetGenerator struct {\n\tXenorchestraService\n}\n\nfunc (g ResourceSetGenerator) createResources(acls []client.ResourceSet) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, acl := range acls {\n\t\tresourceName := acl.Id\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tacl.Id,\n\t\t\tresourceName,\n\t\t\t\"xenorchestra_resource_set\",\n\t\t\t\"xenorchestra\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n\nfunc (g *ResourceSetGenerator) InitResources() error {\n\tclient := g.generateClient()\n\tacls, err := client.GetResourceSets()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.Resources = g.createResources(acls)\n\treturn nil\n}\n"
  },
  {
    "path": "providers/xenorchestra/xenorchestra_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage xenorchestra\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\ntype XenorchestraProvider struct { //nolint\n\tterraformutils.Provider\n\turl      string\n\tuser     string\n\tpassword string\n}\n\nfunc (p *XenorchestraProvider) Init(args []string) error {\n\tif os.Getenv(\"XOA_URL\") == \"\" {\n\t\treturn errors.New(\"set XOA_URL env var\")\n\t}\n\tp.url = os.Getenv(\"XOA_URL\")\n\n\tif os.Getenv(\"XOA_USER\") == \"\" {\n\t\treturn errors.New(\"set XOA_USER env var\")\n\t}\n\tp.user = os.Getenv(\"XOA_USER\")\n\n\tif os.Getenv(\"XOA_PASSWORD\") == \"\" {\n\t\treturn errors.New(\"set XOA_PASSWORD env var\")\n\t}\n\tp.password = os.Getenv(\"XOA_PASSWORD\")\n\n\treturn nil\n}\n\nfunc (p *XenorchestraProvider) GetName() string {\n\treturn \"xenorchestra\"\n}\n\nfunc (p *XenorchestraProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"provider\": map[string]interface{}{\n\t\t\t\"xenorchestra\": map[string]interface{}{\n\t\t\t\t\"url\":      p.url,\n\t\t\t\t\"username\": p.user,\n\t\t\t\t\"password\": p.password,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc (XenorchestraProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *XenorchestraProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"acl\":          &AclGenerator{},\n\t\t\"resource_set\": &ResourceSetGenerator{},\n\t}\n}\n\nfunc (p *XenorchestraProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"xenorchestra: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\t\"url\":      p.url,\n\t\t\"username\": p.user,\n\t\t\"password\": p.password,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/xenorchestra/xenorchestra_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage xenorchestra\n\nimport (\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/ddelnano/terraform-provider-xenorchestra/client\"\n)\n\ntype XenorchestraService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (m *XenorchestraService) generateClient() *client.Client {\n\tconfig := client.Config{\n\t\tUrl:      m.Args[\"url\"].(string),\n\t\tUsername: m.Args[\"username\"].(string),\n\t\tPassword: m.Args[\"password\"].(string),\n\t}\n\tclient, _ := client.NewClient(config)\n\treturn client\n}\n"
  },
  {
    "path": "providers/yandex/compute_disk.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage yandex\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1\"\n\tycsdk \"github.com/yandex-cloud/go-sdk\"\n)\n\ntype DiskGenerator struct {\n\tYandexService\n}\n\nfunc (g *DiskGenerator) loadDisks(sdk *ycsdk.SDK, folderID string) ([]*compute.Disk, error) {\n\tdisks := []*compute.Disk{}\n\tpageToken := \"\"\n\tfor {\n\t\tresp, err := sdk.Compute().Disk().List(context.Background(), &compute.ListDisksRequest{\n\t\t\tFolderId:  folderID,\n\t\t\tPageSize:  defaultPageSize,\n\t\t\tPageToken: pageToken,\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdisks = append(disks, resp.GetDisks()...)\n\n\t\tif resp.GetNextPageToken() == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t}\n\treturn disks, nil\n\n}\n\nfunc (g *DiskGenerator) InitResources() error {\n\tsdk, err := g.InitSDK()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult, err := g.loadDisks(sdk, g.Args[\"folder_id\"].(string))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(result)\n\n\treturn nil\n}\n\nfunc (g *DiskGenerator) createResources(disks []*compute.Disk) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, disk := range disks {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tdisk.GetId(),\n\t\t\tdisk.GetId(),\n\t\t\t\"yandex_compute_disk\",\n\t\t\t\"yandex\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n"
  },
  {
    "path": "providers/yandex/compute_instance.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage yandex\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1\"\n\tycsdk \"github.com/yandex-cloud/go-sdk\"\n)\n\ntype InstanceGenerator struct {\n\tYandexService\n}\n\nfunc (g *InstanceGenerator) loadInstances(sdk *ycsdk.SDK, folderID string) ([]*compute.Instance, error) {\n\tinstances := []*compute.Instance{}\n\tpageToken := \"\"\n\tfor {\n\t\tresp, err := sdk.Compute().Instance().List(context.Background(), &compute.ListInstancesRequest{\n\t\t\tFolderId:  folderID,\n\t\t\tPageSize:  defaultPageSize,\n\t\t\tPageToken: pageToken,\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tinstances = append(instances, resp.GetInstances()...)\n\n\t\tif resp.GetNextPageToken() == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t}\n\treturn instances, nil\n\n}\n\nfunc (g *InstanceGenerator) InitResources() error {\n\tsdk, err := g.InitSDK()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult, err := g.loadInstances(sdk, g.Args[\"folder_id\"].(string))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(result)\n\n\treturn nil\n}\n\nfunc (g *InstanceGenerator) createResources(instances []*compute.Instance) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, instance := range instances {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tinstance.GetId(),\n\t\t\tinstance.GetId(),\n\t\t\t\"yandex_compute_instance\",\n\t\t\t\"yandex\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n"
  },
  {
    "path": "providers/yandex/util.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage yandex\n\nconst defaultPageSize = 1000\n"
  },
  {
    "path": "providers/yandex/vpc_network.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage yandex\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/yandex-cloud/go-genproto/yandex/cloud/vpc/v1\"\n\tycsdk \"github.com/yandex-cloud/go-sdk\"\n)\n\ntype NetworkGenerator struct {\n\tYandexService\n}\n\nfunc (g *NetworkGenerator) loadNetworks(sdk *ycsdk.SDK, folderID string) ([]*vpc.Network, error) {\n\tnetworks := []*vpc.Network{}\n\tpageToken := \"\"\n\tfor {\n\t\tresp, err := sdk.VPC().Network().List(context.Background(), &vpc.ListNetworksRequest{\n\t\t\tFolderId:  folderID,\n\t\t\tPageSize:  defaultPageSize,\n\t\t\tPageToken: pageToken,\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tnetworks = append(networks, resp.GetNetworks()...)\n\n\t\tif resp.GetNextPageToken() == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t}\n\treturn networks, nil\n\n}\n\nfunc (g *NetworkGenerator) InitResources() error {\n\tsdk, err := ycsdk.Build(context.Background(), ycsdk.Config{\n\t\tCredentials: ycsdk.OAuthToken(g.Args[\"token\"].(string)),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult, err := g.loadNetworks(sdk, g.Args[\"folder_id\"].(string))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(result)\n\n\treturn nil\n}\n\nfunc (g *NetworkGenerator) createResources(networks []*vpc.Network) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, network := range networks {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tnetwork.GetId(),\n\t\t\tnetwork.GetId(),\n\t\t\t\"yandex_vpc_network\",\n\t\t\t\"yandex\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n"
  },
  {
    "path": "providers/yandex/vpc_subnet.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage yandex\n\nimport (\n\t\"context\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/yandex-cloud/go-genproto/yandex/cloud/vpc/v1\"\n\tycsdk \"github.com/yandex-cloud/go-sdk\"\n)\n\ntype SubnetGenerator struct {\n\tYandexService\n}\n\nfunc (g *SubnetGenerator) loadSubnets(sdk *ycsdk.SDK, folderID string) ([]*vpc.Subnet, error) {\n\tsubnets := []*vpc.Subnet{}\n\tpageToken := \"\"\n\tfor {\n\t\tresp, err := sdk.VPC().Subnet().List(context.Background(), &vpc.ListSubnetsRequest{\n\t\t\tFolderId:  folderID,\n\t\t\tPageSize:  defaultPageSize,\n\t\t\tPageToken: pageToken,\n\t\t})\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tsubnets = append(subnets, resp.GetSubnets()...)\n\n\t\tif resp.GetNextPageToken() == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t}\n\treturn subnets, nil\n\n}\n\nfunc (g *SubnetGenerator) InitResources() error {\n\tsdk, err := ycsdk.Build(context.Background(), ycsdk.Config{\n\t\tCredentials: ycsdk.OAuthToken(g.Args[\"token\"].(string)),\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresult, err := g.loadSubnets(sdk, g.Args[\"folder_id\"].(string))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tg.Resources = g.createResources(result)\n\n\treturn nil\n}\n\nfunc (g *SubnetGenerator) createResources(subnets []*vpc.Subnet) []terraformutils.Resource {\n\tvar resources []terraformutils.Resource\n\tfor _, subnet := range subnets {\n\t\tresources = append(resources, terraformutils.NewSimpleResource(\n\t\t\tsubnet.GetId(),\n\t\t\tsubnet.GetId(),\n\t\t\t\"yandex_vpc_subnet\",\n\t\t\t\"yandex\",\n\t\t\t[]string{}))\n\t}\n\treturn resources\n}\n"
  },
  {
    "path": "providers/yandex/yandex_provider.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage yandex\n\nimport (\n\t\"errors\"\n\t\"os\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nconst KeyToken = \"token\"\nconst KeyFolderID = \"folder_id\"\nconst KeySaKeyFileOrContent = \"sa_key_or_content\"\n\ntype YandexProvider struct { //nolint\n\tterraformutils.Provider\n\ttoken              string\n\tsaKeyFileOrContent string\n\tfolderID           string\n}\n\nfunc (p *YandexProvider) Init(args []string) error {\n\tif ycToken, ok := os.LookupEnv(\"YC_TOKEN\"); ok {\n\t\tp.token = ycToken\n\t}\n\n\tif saKeyFileOrContent, ok := os.LookupEnv(\"YC_SERVICE_ACCOUNT_KEY_FILE\"); ok {\n\t\tp.saKeyFileOrContent = saKeyFileOrContent\n\t}\n\n\tif len(args) > 0 {\n\t\t//  first args is target folder ID\n\t\tp.folderID = args[0]\n\t} else {\n\t\tif os.Getenv(\"YC_FOLDER_ID\") == \"\" {\n\t\t\treturn errors.New(\"set YC_FOLDER_ID env var\")\n\t\t}\n\t\tp.folderID = os.Getenv(\"YC_FOLDER_ID\")\n\t}\n\n\treturn nil\n}\n\nfunc (p *YandexProvider) GetName() string {\n\treturn \"yandex\"\n}\n\nfunc (p *YandexProvider) GetProviderData(arg ...string) map[string]interface{} {\n\treturn map[string]interface{}{}\n}\n\nfunc (YandexProvider) GetResourceConnections() map[string]map[string][]string {\n\treturn map[string]map[string][]string{}\n}\n\nfunc (p *YandexProvider) GetSupportedService() map[string]terraformutils.ServiceGenerator {\n\treturn map[string]terraformutils.ServiceGenerator{\n\t\t\"disk\":     &DiskGenerator{},\n\t\t\"instance\": &InstanceGenerator{},\n\t\t\"network\":  &NetworkGenerator{},\n\t\t\"subnet\":   &SubnetGenerator{},\n\t}\n}\n\nfunc (p *YandexProvider) InitService(serviceName string, verbose bool) error {\n\tvar isSupported bool\n\tif _, isSupported = p.GetSupportedService()[serviceName]; !isSupported {\n\t\treturn errors.New(\"yandex: \" + serviceName + \" not supported service\")\n\t}\n\tp.Service = p.GetSupportedService()[serviceName]\n\tp.Service.SetName(serviceName)\n\tp.Service.SetVerbose(verbose)\n\tp.Service.SetProviderName(p.GetName())\n\tp.Service.SetArgs(map[string]interface{}{\n\t\tKeyFolderID:           p.folderID,\n\t\tKeyToken:              p.token,\n\t\tKeySaKeyFileOrContent: p.saKeyFileOrContent,\n\t})\n\treturn nil\n}\n"
  },
  {
    "path": "providers/yandex/yandex_service.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage yandex\n\nimport (\n\t\"context\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"net\"\n\t\"os\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/mitchellh/go-homedir\"\n\tycsdk \"github.com/yandex-cloud/go-sdk\"\n\t\"github.com/yandex-cloud/go-sdk/iamkey\"\n)\n\ntype YandexService struct { //nolint\n\tterraformutils.Service\n}\n\nfunc (y *YandexService) InitSDK() (*ycsdk.SDK, error) {\n\tif saKeyOrContent := y.Args[KeySaKeyFileOrContent].(string); saKeyOrContent != \"\" {\n\t\tcontents, _, err := pathOrContents(saKeyOrContent)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error loading credentials: %s\", err)\n\t\t}\n\n\t\tkey, err := iamKeyFromJSONContent(contents)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tserviceAccountKey, err := ycsdk.ServiceAccountKey(key)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn ycsdk.Build(context.Background(), ycsdk.Config{\n\t\t\tCredentials: serviceAccountKey},\n\t\t)\n\t}\n\n\tif cToken := y.Args[KeyToken].(string); cToken != \"\" {\n\t\tif strings.HasPrefix(cToken, \"t1.\") && strings.Count(cToken, \".\") == 2 {\n\t\t\treturn ycsdk.Build(context.Background(), ycsdk.Config{\n\t\t\t\tCredentials: ycsdk.NewIAMTokenCredentials(cToken)},\n\t\t\t)\n\t\t}\n\t\treturn ycsdk.Build(context.Background(), ycsdk.Config{\n\t\t\tCredentials: ycsdk.OAuthToken(cToken),\n\t\t})\n\t}\n\n\tif sa := ycsdk.InstanceServiceAccount(); checkServiceAccountAvailable(context.Background(), sa) {\n\t\treturn ycsdk.Build(context.Background(), ycsdk.Config{\n\t\t\tCredentials: sa,\n\t\t})\n\t}\n\n\treturn nil, fmt.Errorf(\"one of 'YC_TOKEN' or 'YC_SERVICE_ACCOUNT_KEY_FILE' env variable should be specified; if you are inside compute instance, you can attach service account to it in order to authenticate via instance service account\")\n}\n\nfunc pathOrContents(poc string) (string, bool, error) {\n\tif len(poc) == 0 {\n\t\treturn poc, false, nil\n\t}\n\n\tpath := poc\n\tif path[0] == '~' {\n\t\tvar err error\n\t\tpath, err = homedir.Expand(path)\n\t\tif err != nil {\n\t\t\treturn path, true, err\n\t\t}\n\t}\n\n\tif _, err := os.Stat(path); err == nil {\n\t\tcontents, err := os.ReadFile(path)\n\t\treturn string(contents), true, err\n\t}\n\n\treturn poc, false, nil\n}\n\nfunc iamKeyFromJSONContent(content string) (*iamkey.Key, error) {\n\tkey := &iamkey.Key{}\n\terr := json.Unmarshal([]byte(content), key)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"service account JSON key unmarshal fail: %s\", err)\n\t}\n\treturn key, nil\n}\n\nfunc checkServiceAccountAvailable(ctx context.Context, sa ycsdk.NonExchangeableCredentials) bool {\n\tdialer := net.Dialer{Timeout: 50 * time.Millisecond}\n\tconn, err := dialer.Dial(\"tcp\", net.JoinHostPort(ycsdk.InstanceMetadataAddr, \"80\"))\n\tif err != nil {\n\t\treturn false\n\t}\n\t_ = conn.Close()\n\t_, err = sa.IAMToken(ctx)\n\treturn err == nil\n}\n"
  },
  {
    "path": "snap/snapcraft.yaml",
    "content": "name: terraformer\nsummary: CLI tool.\ndescription:|  CLI tool to generate terraform files from existing infrastructure (reverse Terraform).\n  \nadopt-info:terraformer\n\ngrade: stable\nconfinement: strict\n\narchitectures:\n  - build-on: amd64\n  - build-on: armhf\n  - build-on: arm64\n\napps:\n  terraformer:\n    command: bin/terraformer\n    plugs:\n      - home\n      - network\n      - removable-media\n\nparts:\n  terraformer:\nplugin: nil \n    source: https://github.com/GoogleCloudPlatform/terraformer.git\n    source-type: git\n    override-pull: |\n      git clone https://github.com/GoogleCloudPlatform/terraformer.git src/github.com/GoogleCloudPlatform/terraformer\n       cd src/github.com/GoogleCloudPlatform/terraformer\n      last_committed_tag=\"$(git describe --tags --abbrev=0)\"\n      last_committed_tag_ver=\"$(echo ${last_committed_tag} | sed 's/v//')\"\n      last_released_tag=\"$(snap info $SNAPCRAFT_PROJECT_NAME | awk '$1 == \"beta:\" { print $2 }')\"\n      # If the latest tag from the upstream project has not been released to\n      # beta, build that tag instead of master.\n      if [ \"${last_committed_tag_ver}\" != \"${last_released_tag}\" ]; then\n        git fetch\n        git checkout \"${last_committed_tag}\"\n      fi\n      snapcraftctl set-version \"$(git describe --tags | sed 's/v//')\"\n      override-build: |\n      export GOPATH=$PWD\n      cd src/github.com/GoogleCloudPlatform/terraformer\n      env CGO_ENABLED=0 GOOS=linux \\\n      go build --ldflags \"-s -w \\\n        -X 'github.com/GoogleCloudPlatform/terraformer/version.GitCommit=$(git rev-list -1 HEAD)' \\\n        -X 'github.com/GoogleCloudPlatform/terraformer/version.Version=$(git describe --tags --abbrev=0)'\" \\\n        -a -installsuffix cgo -o $SNAPCRAFT_PART_INSTALL/bin/terraformer\n    build-snaps:\n      - go\n    build-packages:\n      - git\n      - sed\n\n"
  },
  {
    "path": "terraformutils/base_provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage terraformutils\n\nimport (\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype ProviderGenerator interface {\n\tInit(args []string) error\n\tInitService(serviceName string, verbose bool) error\n\tGetName() string\n\tGetService() ServiceGenerator\n\tGetConfig() cty.Value\n\tGetBasicConfig() cty.Value\n\tGetSupportedService() map[string]ServiceGenerator\n\tGenerateFiles()\n\tGetProviderData(arg ...string) map[string]interface{}\n\tGenerateOutputPath() error\n\tGetResourceConnections() map[string]map[string][]string\n}\n\ntype ProviderWithSource interface {\n\tGetSource() string\n}\n\ntype Provider struct {\n\tService ServiceGenerator\n\tConfig  cty.Value\n}\n\nfunc (p *Provider) Init(args []string) error {\n\tpanic(\"implement me\")\n}\n\nfunc (p *Provider) GetConfig() cty.Value {\n\treturn p.Config\n}\n\nfunc (p *Provider) GetName() string {\n\tpanic(\"implement me\")\n}\n\nfunc (p *Provider) InitService(serviceName string) error {\n\tpanic(\"implement me\")\n}\n\nfunc (p *Provider) GenerateOutputPath() error {\n\tpanic(\"implement me\")\n}\n\nfunc (p *Provider) GenerateFiles() {\n\tpanic(\"implement me\")\n}\n\nfunc (p *Provider) GetService() ServiceGenerator {\n\treturn p.Service\n}\n\nfunc (p *Provider) GetSupportedService() map[string]ServiceGenerator {\n\tpanic(\"implement me\")\n}\n\nfunc (p *Provider) GetBasicConfig() cty.Value {\n\treturn cty.ObjectVal(map[string]cty.Value{})\n}\n"
  },
  {
    "path": "terraformutils/connect.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage terraformutils\n\nfunc ConnectServices(importResources map[string][]Resource, isServicePath bool, resourceConnections map[string]map[string][]string) map[string][]Resource {\n\tfor resource, connection := range resourceConnections {\n\t\tif _, exist := importResources[resource]; exist {\n\t\t\tfor k, connectionPairs := range connection {\n\t\t\t\tif len(connectionPairs)%2 == 1 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif cc, ok := importResources[k]; ok {\n\t\t\t\t\tfor i := 0; i < len(connectionPairs)/2; i++ {\n\t\t\t\t\t\tconnectionPair := []string{connectionPairs[i*2], connectionPairs[i*2+1]}\n\t\t\t\t\t\tfor _, ccc := range cc {\n\t\t\t\t\t\t\tif !isServicePath {\n\t\t\t\t\t\t\t\tmapResource(importResources, resource, connectionPair, ccc, \"local\")\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmapResource(importResources, resource, connectionPair, ccc, k)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn importResources\n}\n\nfunc mapResource(importResources map[string][]Resource, resource string, connectionPair []string, resourceToMap Resource, k string) {\n\tfor i := range importResources[resource] {\n\t\tkey := connectionPair[1]\n\t\tif connectionPair[1] == \"self_link\" || connectionPair[1] == \"id\" {\n\t\t\tkey = resourceToMap.GetIDKey()\n\t\t}\n\t\tmappingResourceAttr := WalkAndGet(key, resourceToMap.InstanceState.Attributes)\n\t\tkeyValue := resourceToMap.InstanceInfo.Type + \"_\" + resourceToMap.ResourceName + \"_\" + key\n\t\tlinkValue := \"${data.terraform_remote_state.\" + k + \".outputs.\" + keyValue + \"}\"\n\n\t\tif len(mappingResourceAttr) == 1 {\n\t\t\tresourceIdentifier := mappingResourceAttr[0].(string)\n\t\t\tWalkAndOverride(connectionPair[0], resourceIdentifier, linkValue, importResources[resource][i].Item)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "terraformutils/connect_test.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage terraformutils\n\nimport (\n\t\"log\"\n\t\"reflect\"\n\t\"testing\"\n\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\nfunc TestSimpleReference(t *testing.T) {\n\timportResources := map[string][]Resource{\n\t\t\"type1\": {prepare(\"ID1\", \"type1\", map[string]string{\n\t\t\t\"type2_ref\": \"ID2\",\n\t\t}, map[string]interface{}{\n\t\t\t\"type2_ref\": \"ID2\",\n\t\t})},\n\t\t\"type2\": {prepareNoAttrs(\"ID2\", \"type2\")},\n\t}\n\n\tresourceConnections := map[string]map[string][]string{\n\t\t\"type1\": {\n\t\t\t\"type2\": {\"type2_ref\", \"id\"},\n\t\t},\n\t}\n\tresources := ConnectServices(importResources, true, resourceConnections)\n\n\tif !reflect.DeepEqual(resources[\"type1\"][0].Item, map[string]interface{}{\n\t\t\"type2_ref\": \"${data.terraform_remote_state.type2.outputs.type2_tfer--name-type2_id}\",\n\t}) {\n\t\tt.Errorf(\"failed to connect %v\", resources[\"type1\"][0].Item)\n\t}\n}\n\nfunc TestManyReferences(t *testing.T) {\n\timportResources := map[string][]Resource{\n\t\t\"type1\": {prepare(\"ID1\", \"type1\", map[string]string{\n\t\t\t\"type2_ref1\": \"ID2\",\n\t\t\t\"type2_ref2\": \"ID2\",\n\t\t}, map[string]interface{}{\n\t\t\t\"type2_ref1\": \"ID2\",\n\t\t\t\"type2_ref2\": \"ID2\",\n\t\t})},\n\t\t\"type2\": {prepareNoAttrs(\"ID2\", \"type2\")},\n\t}\n\n\tresourceConnections := map[string]map[string][]string{\n\t\t\"type1\": {\n\t\t\t\"type2\": {\n\t\t\t\t\"type2_ref1\", \"id\",\n\t\t\t\t\"type2_ref2\", \"id\",\n\t\t\t},\n\t\t},\n\t}\n\tresources := ConnectServices(importResources, true, resourceConnections)\n\n\tif !reflect.DeepEqual(resources[\"type1\"][0].Item, map[string]interface{}{\n\t\t\"type2_ref1\": \"${data.terraform_remote_state.type2.outputs.type2_tfer--name-type2_id}\",\n\t\t\"type2_ref2\": \"${data.terraform_remote_state.type2.outputs.type2_tfer--name-type2_id}\",\n\t}) {\n\t\tt.Errorf(\"failed to connect %v\", resources[\"type1\"][0].Item)\n\t}\n}\n\nfunc TestResourceGroups(t *testing.T) {\n\timportResources := map[string][]Resource{\n\t\t\"group1\": {prepare(\"ID1\", \"type1\", map[string]string{\n\t\t\t\"type2_ref1\": \"ID2\",\n\t\t\t\"type2_ref2\": \"ID2\",\n\t\t}, map[string]interface{}{\n\t\t\t\"type2_ref1\": \"ID2\",\n\t\t\t\"type2_ref2\": \"ID2\",\n\t\t}),\n\t\t\tprepareNoAttrs(\"ID3\", \"type3\")},\n\t\t\"group2\": {\n\t\t\tprepare(\"ID2\", \"type2\", map[string]string{\n\t\t\t\t\"uid\": \"ID2\",\n\t\t\t}, map[string]interface{}{\n\t\t\t\t\"uid\": \"ID2\",\n\t\t\t}),\n\t\t\tprepareNoAttrs(\"ID4\", \"type4\")},\n\t}\n\n\tresourceConnections := map[string]map[string][]string{\n\t\t\"group1\": {\n\t\t\t\"group2\": {\n\t\t\t\t\"type2_ref1\", \"uid\",\n\t\t\t\t\"type2_ref2\", \"uid\",\n\t\t\t},\n\t\t},\n\t}\n\tresources := ConnectServices(importResources, true, resourceConnections)\n\n\tif !reflect.DeepEqual(resources[\"group1\"][0].Item, map[string]interface{}{\n\t\t\"type2_ref1\": \"${data.terraform_remote_state.group2.outputs.type2_tfer--name-type2_uid}\",\n\t\t\"type2_ref2\": \"${data.terraform_remote_state.group2.outputs.type2_tfer--name-type2_uid}\",\n\t}) {\n\t\tt.Errorf(\"failed to connect %v\", resources[\"group1\"][0].Item)\n\t}\n}\n\nfunc TestNestedReference(t *testing.T) {\n\timportResources := map[string][]Resource{\n\t\t\"type1\": {prepare(\"ID1\", \"type1\", map[string]string{\n\t\t\t\"nested.type2_ref\": \"ID2\",\n\t\t}, mapI(\"nested\", mapI(\"type2_ref\", \"ID2\")))},\n\t\t\"type2\": {prepareNoAttrs(\"ID2\", \"type2\")},\n\t}\n\n\tresourceConnections := map[string]map[string][]string{\n\t\t\"type1\": {\n\t\t\t\"type2\": {\"nested.type2_ref\", \"id\"},\n\t\t},\n\t}\n\tresources := ConnectServices(importResources, true, resourceConnections)\n\n\tif !reflect.DeepEqual(resources[\"type1\"][0].Item, mapI(\"nested\", mapI(\"type2_ref\", \"${data.terraform_remote_state.type2.outputs.type2_tfer--name-type2_id}\"))) {\n\t\tt.Errorf(\"failed to connect %v\", resources)\n\t}\n}\n\nfunc prepareNoAttrs(id, resourceType string) Resource {\n\treturn prepare(id, resourceType, map[string]string{}, map[string]interface{}{})\n}\n\nfunc prepare(id, resourceType string, attributes map[string]string, attributesParsed map[string]interface{}) Resource {\n\tr := NewResource(id, \"name-\"+resourceType, resourceType, \"provider\", attributes, []string{}, map[string]interface{}{})\n\tr.InstanceState.Attributes[\"id\"] = r.InstanceState.ID\n\terr := r.ParseTFstate(&MockedFlatmapParser{\n\t\tattributesParsed: attributesParsed,\n\t}, cty.NilType)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn r\n}\n\nfunc mapI(key string, value interface{}) map[string]interface{} {\n\treturn map[string]interface{}{key: value}\n}\n\ntype MockedFlatmapParser struct {\n\tFlatmapParser\n\tattributesParsed map[string]interface{}\n}\n\nfunc (p *MockedFlatmapParser) Parse(ty cty.Type) (map[string]interface{}, error) {\n\treturn p.attributesParsed, nil\n}\n"
  },
  {
    "path": "terraformutils/flatmap.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage terraformutils\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"strings\"\n\n\t\"github.com/hashicorp/terraform/configs/hcl2shim\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype Flatmapper interface {\n\tParse(ty cty.Type) (map[string]interface{}, error)\n}\n\ntype FlatmapParser struct {\n\tFlatmapper\n\tattributes       map[string]string\n\tignoreKeys       []*regexp.Regexp\n\tallowEmptyValues []*regexp.Regexp\n}\n\nfunc NewFlatmapParser(attributes map[string]string, ignoreKeys []*regexp.Regexp, allowEmptyValues []*regexp.Regexp) *FlatmapParser {\n\treturn &FlatmapParser{\n\t\tattributes:       attributes,\n\t\tignoreKeys:       ignoreKeys,\n\t\tallowEmptyValues: allowEmptyValues,\n\t}\n}\n\n// FromFlatmap converts a map compatible with what would be produced\n// by the \"flatmap\" package to a map[string]interface{} object type.\n//\n// The intended result type must be provided in order to guide how the\n// map contents are decoded. This must be an object type or this function\n// will panic.\n//\n// Flatmap values can only represent maps when they are of primitive types,\n// so the given type must not have any maps of complex types or the result\n// is undefined.\n//\n// The result may contain null values if the given map does not contain keys\n// for all of the different key paths implied by the given type.\nfunc (p *FlatmapParser) Parse(ty cty.Type) (map[string]interface{}, error) {\n\tif p.attributes == nil {\n\t\treturn nil, nil\n\t}\n\tif !ty.IsObjectType() {\n\t\treturn nil, fmt.Errorf(\"FlatmapParser#Parse called on %#v\", ty)\n\t}\n\treturn p.fromFlatmapObject(\"\", ty.AttributeTypes())\n}\n\nfunc (p *FlatmapParser) fromFlatmapValue(key string, ty cty.Type) (interface{}, error) {\n\tswitch {\n\tcase ty.IsPrimitiveType():\n\t\treturn p.fromFlatmapPrimitive(key)\n\tcase ty.IsObjectType():\n\t\treturn p.fromFlatmapObject(key+\".\", ty.AttributeTypes())\n\tcase ty.IsTupleType():\n\t\treturn p.fromFlatmapTuple(key+\".\", ty.TupleElementTypes())\n\tcase ty.IsMapType():\n\t\treturn p.fromFlatmapMap(key+\".\", ty.ElementType())\n\tcase ty.IsListType():\n\t\treturn p.fromFlatmapList(key+\".\", ty.ElementType())\n\tcase ty.IsSetType():\n\t\treturn p.fromFlatmapSet(key+\".\", ty.ElementType())\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"cannot decode %s from flatmap\", ty.FriendlyName())\n\t}\n}\n\nfunc (p *FlatmapParser) fromFlatmapPrimitive(key string) (interface{}, error) {\n\tvalue, ok := p.attributes[key]\n\tif !ok {\n\t\treturn nil, nil\n\t}\n\treturn value, nil\n}\n\nfunc (p *FlatmapParser) fromFlatmapObject(prefix string, tys map[string]cty.Type) (map[string]interface{}, error) {\n\tvalues := make(map[string]interface{})\n\tfor name, ty := range tys {\n\t\tinAttributes := false\n\t\tattributeName := \"\"\n\t\tfor k := range p.attributes {\n\t\t\tif k == prefix+name {\n\t\t\t\tattributeName = k\n\t\t\t\tinAttributes = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif k == name {\n\t\t\t\tattributeName = k\n\t\t\t\tinAttributes = true\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif strings.HasPrefix(k, prefix+name+\".\") {\n\t\t\t\tattributeName = k\n\t\t\t\tinAttributes = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlastAttribute := (prefix + name)[len(prefix):]\n\t\t\tif lastAttribute == k {\n\t\t\t\tattributeName = k\n\t\t\t\tinAttributes = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif _, exist := p.attributes[prefix+name+\".#\"]; exist {\n\t\t\tattributeName = prefix + name + \".#\"\n\t\t\tinAttributes = true\n\t\t}\n\n\t\tif _, exist := p.attributes[prefix+name+\".%\"]; exist {\n\t\t\tattributeName = prefix + name + \".%\"\n\t\t\tinAttributes = true\n\t\t}\n\n\t\tif !inAttributes {\n\t\t\tcontinue\n\t\t}\n\t\tif p.isAttributeIgnored(prefix + name) {\n\t\t\tcontinue\n\t\t}\n\t\tvalue, err := p.fromFlatmapValue(prefix+name, ty)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif p.isValueAllowed(value, attributeName) {\n\t\t\tvalues[name] = value\n\t\t}\n\t}\n\tif len(values) == 0 {\n\t\treturn nil, nil\n\t}\n\treturn values, nil\n}\n\nfunc (p *FlatmapParser) fromFlatmapTuple(prefix string, tys []cty.Type) ([]interface{}, error) {\n\t// if the container is unknown, there is no count string\n\tlistName := strings.TrimRight(prefix, \".\")\n\tif p.attributes[listName] == hcl2shim.UnknownVariableValue {\n\t\treturn nil, nil\n\t}\n\n\tcountStr, exists := p.attributes[prefix+\"#\"]\n\tif !exists {\n\t\treturn nil, nil\n\t}\n\tif countStr == hcl2shim.UnknownVariableValue {\n\t\treturn nil, nil\n\t}\n\n\tcount, err := strconv.Atoi(countStr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid count value for %q in state: %s\", prefix, err)\n\t}\n\tif count != len(tys) {\n\t\treturn nil, fmt.Errorf(\"wrong number of values for %q in state: got %d, but need %d\", prefix, count, len(tys))\n\t}\n\n\tvar values []interface{}\n\tfor i, ty := range tys {\n\t\tkey := prefix + strconv.Itoa(i)\n\t\tvalue, err := p.fromFlatmapValue(key, ty)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif p.isValueAllowed(value, prefix) {\n\t\t\tvalues = append(values, value)\n\t\t}\n\t}\n\tif len(values) == 0 {\n\t\treturn nil, nil\n\t}\n\treturn values, nil\n}\n\nfunc (p *FlatmapParser) fromFlatmapMap(prefix string, ty cty.Type) (map[string]interface{}, error) {\n\t// if the container is unknown, there is no count string\n\tlistName := strings.TrimRight(prefix, \".\")\n\tif p.attributes[listName] == hcl2shim.UnknownVariableValue {\n\t\treturn nil, nil\n\t}\n\n\t// We actually don't really care about the \"count\" of a map for our\n\t// purposes here, but we do need to check if it _exists_ in order to\n\t// recognize the difference between null (not set at all) and empty.\n\tstrCount, exists := p.attributes[prefix+\"%\"]\n\tif !exists {\n\t\treturn nil, nil\n\t}\n\tif strCount == hcl2shim.UnknownVariableValue {\n\t\treturn nil, nil\n\t}\n\n\tvalues := make(map[string]interface{})\n\tfor fullKey := range p.attributes {\n\t\tif !strings.HasPrefix(fullKey, prefix) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// The flatmap format doesn't allow us to distinguish between keys\n\t\t// that contain periods and nested objects, so by convention a\n\t\t// map is only ever of primitive type in flatmap, and we just assume\n\t\t// that the remainder of the raw key (dots and all) is the key we\n\t\t// want in the result value.\n\t\tkey := fullKey[len(prefix):]\n\t\tif key == \"%\" {\n\t\t\t// Ignore the \"count\" key\n\t\t\tcontinue\n\t\t}\n\t\tif p.isAttributeIgnored(fullKey) {\n\t\t\tcontinue\n\t\t}\n\t\tvalue, err := p.fromFlatmapValue(fullKey, ty)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif p.isValueAllowed(value, prefix) {\n\t\t\tvalues[key] = value\n\t\t}\n\t}\n\tif len(values) == 0 {\n\t\treturn nil, nil\n\t}\n\treturn values, nil\n}\n\nfunc (p *FlatmapParser) fromFlatmapList(prefix string, ty cty.Type) ([]interface{}, error) {\n\t// if the container is unknown, there is no count string\n\tlistName := strings.TrimRight(prefix, \".\")\n\tif p.attributes[listName] == hcl2shim.UnknownVariableValue {\n\t\treturn nil, nil\n\t}\n\n\tcountStr, exists := p.attributes[prefix+\"#\"]\n\tif !exists {\n\t\treturn nil, nil\n\t}\n\tif countStr == hcl2shim.UnknownVariableValue {\n\t\treturn nil, nil\n\t}\n\n\tcount, err := strconv.Atoi(countStr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid count value for %q in state: %s\", prefix, err)\n\t}\n\n\tif count == 0 {\n\t\treturn nil, nil\n\t}\n\n\tvar values []interface{}\n\tfor i := 0; i < count; i++ {\n\t\tkey := prefix + strconv.Itoa(i)\n\n\t\tif p.isAttributeIgnored(key) {\n\t\t\tcontinue\n\t\t}\n\n\t\tvalue, err := p.fromFlatmapValue(key, ty)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif p.isValueAllowed(value, prefix) {\n\t\t\tvalues = append(values, value)\n\t\t}\n\t}\n\treturn values, nil\n}\n\nfunc (p *FlatmapParser) fromFlatmapSet(prefix string, ty cty.Type) ([]interface{}, error) {\n\t// if the container is unknown, there is no count string\n\tlistName := strings.TrimRight(prefix, \".\")\n\tif p.attributes[listName] == hcl2shim.UnknownVariableValue {\n\t\treturn nil, nil\n\t}\n\n\tstrCount, exists := p.attributes[prefix+\"#\"]\n\tif !exists {\n\t\treturn nil, nil\n\t}\n\tif strCount == hcl2shim.UnknownVariableValue {\n\t\treturn nil, nil\n\t}\n\n\t// Keep track of keys we've seen, se we don't add the same set value\n\t// multiple times. The cty.Set will normally de-duplicate values, but we may\n\t// have unknown values that would not show as equivalent.\n\tseen := map[string]bool{}\n\n\tvar values []interface{}\n\tfor fullKey := range p.attributes {\n\t\tif !strings.HasPrefix(fullKey, prefix) {\n\t\t\tcontinue\n\t\t}\n\n\t\tsubKey := fullKey[len(prefix):]\n\t\tif subKey == \"#\" {\n\t\t\t// Ignore the \"count\" key\n\t\t\tcontinue\n\t\t}\n\n\t\tkey := fullKey\n\n\t\tif p.isAttributeIgnored(fullKey) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif dot := strings.IndexByte(subKey, '.'); dot != -1 {\n\t\t\tkey = fullKey[:dot+len(prefix)]\n\t\t}\n\n\t\tif seen[key] {\n\t\t\tcontinue\n\t\t}\n\t\tseen[key] = true\n\n\t\t// The flatmap format doesn't allow us to distinguish between keys\n\t\t// that contain periods and nested objects, so by convention a\n\t\t// map is only ever of primitive type in flatmap, and we just assume\n\t\t// that the remainder of the raw key (dots and all) is the key we\n\t\t// want in the result value.\n\n\t\tvalue, err := p.fromFlatmapValue(key, ty)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif p.isValueAllowed(value, prefix) {\n\t\t\tvalues = append(values, value)\n\t\t}\n\t}\n\tif len(values) == 0 {\n\t\treturn nil, nil\n\t}\n\treturn values, nil\n}\n\nfunc (p *FlatmapParser) isAttributeIgnored(name string) bool {\n\tignored := false\n\tfor _, pattern := range p.ignoreKeys {\n\t\tif pattern.MatchString(name) {\n\t\t\tignored = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn ignored\n}\n\nfunc (p *FlatmapParser) isValueAllowed(value interface{}, prefix string) bool {\n\tif !reflect.ValueOf(value).IsValid() {\n\t\treturn false\n\t}\n\tswitch reflect.ValueOf(value).Kind() {\n\tcase reflect.Slice:\n\t\tif reflect.ValueOf(value).Len() == 0 {\n\t\t\treturn false\n\t\t}\n\n\t\tfor i := 0; i < reflect.ValueOf(value).Len(); i++ {\n\t\t\tif !reflect.ValueOf(value).Index(i).IsZero() {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\tcase reflect.Map:\n\t\tif reflect.ValueOf(value).Len() == 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\tif !reflect.ValueOf(value).IsZero() {\n\t\treturn true\n\t}\n\n\tallowed := false\n\tfor _, pattern := range p.allowEmptyValues {\n\t\tif pattern.MatchString(prefix) {\n\t\t\tallowed = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn allowed\n}\n"
  },
  {
    "path": "terraformutils/flatmap_test.go",
    "content": "package terraformutils\n\nimport (\n\t\"regexp\"\n\t\"testing\"\n\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\nfunc TestNestedAttributeFiltering(t *testing.T) {\n\tattributes := map[string]string{\n\t\t\"attribute\":        \"value1\",\n\t\t\"nested.attribute\": \"value2\",\n\t}\n\n\tignoreKeys := []*regexp.Regexp{\n\t\tregexp.MustCompile(`^attribute$`),\n\t}\n\tparser := NewFlatmapParser(attributes, ignoreKeys, []*regexp.Regexp{})\n\n\tattributesType := cty.Object(map[string]cty.Type{\n\t\t\"attribute\": cty.String,\n\t\t\"nested\": cty.Object(map[string]cty.Type{\n\t\t\t\"attribute\": cty.String,\n\t\t}),\n\t})\n\n\tresult, _ := parser.Parse(attributesType)\n\n\tif _, ok := result[\"attribute\"]; ok {\n\t\tt.Errorf(\"failed to resolve %v\", result)\n\t}\n\tif val, ok := result[\"nested\"].(map[string]interface{})[\"attribute\"]; !ok && val != \"value2\" {\n\t\tt.Errorf(\"failed to resolve %v\", result)\n\t}\n}\n"
  },
  {
    "path": "terraformutils/hcl.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage terraformutils\n\nimport (\n\t\"bytes\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"regexp\"\n\t\"sort\"\n\t\"strings\"\n\n\t\"github.com/hashicorp/hcl/hcl/ast\"\n\thclPrinter \"github.com/hashicorp/hcl/hcl/printer\"\n\thclParser \"github.com/hashicorp/hcl/json/parser\"\n)\n\n// Copy code from https://github.com/kubernetes/kops project with few changes for support many provider and heredoc\n\nconst safeChars = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_\"\n\nvar unsafeChars = regexp.MustCompile(`[^0-9A-Za-z_\\-]`)\n\n// make HCL output reproducible by sorting the AST nodes\nfunc sortHclTree(tree interface{}) {\n\tswitch t := tree.(type) {\n\tcase []*ast.ObjectItem:\n\t\tsort.Slice(t, func(i, j int) bool {\n\t\t\tvar bI, bJ bytes.Buffer\n\t\t\t_, _ = hclPrinter.Fprint(&bI, t[i]), hclPrinter.Fprint(&bJ, t[j])\n\t\t\treturn bI.String() < bJ.String()\n\t\t})\n\tcase []ast.Node:\n\t\tsort.Slice(t, func(i, j int) bool {\n\t\t\tvar bI, bJ bytes.Buffer\n\t\t\t_, _ = hclPrinter.Fprint(&bI, t[i]), hclPrinter.Fprint(&bJ, t[j])\n\t\t\treturn bI.String() < bJ.String()\n\t\t})\n\tdefault:\n\t}\n}\n\n// sanitizer fixes up an invalid HCL AST, as produced by the HCL parser for JSON\ntype astSanitizer struct {\n\tsort bool\n}\n\n// output prints creates b printable HCL output and returns it.\nfunc (v *astSanitizer) visit(n interface{}) {\n\tswitch t := n.(type) {\n\tcase *ast.File:\n\t\tv.visit(t.Node)\n\tcase *ast.ObjectList:\n\t\tvar index int\n\t\tif v.sort {\n\t\t\tsortHclTree(t.Items)\n\t\t}\n\t\tfor {\n\t\t\tif index == len(t.Items) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tv.visit(t.Items[index])\n\t\t\tindex++\n\t\t}\n\tcase *ast.ObjectKey:\n\tcase *ast.ObjectItem:\n\t\tv.visitObjectItem(t)\n\tcase *ast.LiteralType:\n\tcase *ast.ListType:\n\t\tif v.sort {\n\t\t\tsortHclTree(t.List)\n\t\t}\n\tcase *ast.ObjectType:\n\t\tif v.sort {\n\t\t\tsortHclTree(t.List)\n\t\t}\n\t\tv.visit(t.List)\n\tdefault:\n\t\tfmt.Printf(\" unknown type: %T\\n\", n)\n\t}\n}\n\nfunc (v *astSanitizer) visitObjectItem(o *ast.ObjectItem) {\n\tfor i, k := range o.Keys {\n\t\tif i == 0 {\n\t\t\ttext := k.Token.Text\n\t\t\tif text != \"\" && text[0] == '\"' && text[len(text)-1] == '\"' {\n\t\t\t\tv := text[1 : len(text)-1]\n\t\t\t\tsafe := true\n\t\t\t\tfor _, c := range v {\n\t\t\t\t\tif !strings.ContainsRune(safeChars, c) {\n\t\t\t\t\t\tsafe = false\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif strings.HasPrefix(v, \"--\") { // if the key starts with \"--\", we must quote it. Seen in aws_glue_job.default_arguments parameter\n\t\t\t\t\tv = fmt.Sprintf(`\"%s\"`, v)\n\t\t\t\t}\n\t\t\t\tif safe {\n\t\t\t\t\tk.Token.Text = v\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tswitch t := o.Val.(type) {\n\tcase *ast.LiteralType: // heredoc support\n\t\tif strings.HasPrefix(t.Token.Text, `\"<<`) {\n\t\t\tt.Token.Text = t.Token.Text[1:]\n\t\t\tt.Token.Text = t.Token.Text[:len(t.Token.Text)-1]\n\t\t\tt.Token.Text = strings.ReplaceAll(t.Token.Text, `\\n`, \"\\n\")\n\t\t\tt.Token.Text = strings.ReplaceAll(t.Token.Text, `\\t`, \"\")\n\t\t\tt.Token.Type = 10\n\t\t\t// check if text json for Unquote and Indent\n\t\t\tjsonTest := t.Token.Text\n\t\t\tlines := strings.Split(jsonTest, \"\\n\")\n\t\t\tjsonTest = strings.Join(lines[1:len(lines)-1], \"\\n\")\n\t\t\tjsonTest = strings.ReplaceAll(jsonTest, \"\\\\\\\"\", \"\\\"\")\n\t\t\t// it's json we convert to heredoc back\n\t\t\tvar tmp interface{} = map[string]interface{}{}\n\t\t\terr := json.Unmarshal([]byte(jsonTest), &tmp)\n\t\t\tif err != nil {\n\t\t\t\ttmp = make([]interface{}, 0)\n\t\t\t\terr = json.Unmarshal([]byte(jsonTest), &tmp)\n\t\t\t}\n\t\t\tif err == nil {\n\t\t\t\tdataJSONBytes, err := json.MarshalIndent(tmp, \"\", \"  \")\n\t\t\t\tif err == nil {\n\t\t\t\t\tjsonData := strings.Split(string(dataJSONBytes), \"\\n\")\n\t\t\t\t\t// first line for heredoc\n\t\t\t\t\tjsonData = append([]string{lines[0]}, jsonData...)\n\t\t\t\t\t// last line for heredoc\n\t\t\t\t\tjsonData = append(jsonData, lines[len(lines)-1])\n\t\t\t\t\thereDoc := strings.Join(jsonData, \"\\n\")\n\t\t\t\t\tt.Token.Text = hereDoc\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase *ast.ListType:\n\t\tif v.sort {\n\t\t\tsortHclTree(t.List)\n\t\t}\n\tdefault:\n\t}\n\n\t// A hack so that Assign.IsValid is true, so that the printer will output =\n\to.Assign.Line = 1\n\n\tv.visit(o.Val)\n}\n\nfunc Print(data interface{}, mapsObjects map[string]struct{}, format string, sort bool) ([]byte, error) {\n\tswitch format {\n\tcase \"hcl\":\n\t\treturn hclPrint(data, mapsObjects, sort)\n\tcase \"json\":\n\t\treturn jsonPrint(data)\n\t}\n\treturn []byte{}, errors.New(\"error: unknown output format\")\n}\n\nfunc hclPrint(data interface{}, mapsObjects map[string]struct{}, sort bool) ([]byte, error) {\n\tdataBytesJSON, err := jsonPrint(data)\n\tif err != nil {\n\t\treturn dataBytesJSON, err\n\t}\n\tdataJSON := string(dataBytesJSON)\n\tnodes, err := hclParser.Parse([]byte(dataJSON))\n\tif err != nil {\n\t\tlog.Println(dataJSON)\n\t\treturn []byte{}, fmt.Errorf(\"error parsing terraform json: %v\", err)\n\t}\n\tvar sanitizer astSanitizer\n\tsanitizer.sort = sort\n\tsanitizer.visit(nodes)\n\n\tvar b bytes.Buffer\n\terr = hclPrinter.Fprint(&b, nodes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error writing HCL: %v\", err)\n\t}\n\ts := b.String()\n\n\t// Remove extra whitespace...\n\ts = strings.ReplaceAll(s, \"\\n\\n\", \"\\n\")\n\n\t// ...but leave whitespace between resources\n\ts = strings.ReplaceAll(s, \"}\\nresource\", \"}\\n\\nresource\")\n\n\t// Apply Terraform style (alignment etc.)\n\tformatted, err := hclPrinter.Format([]byte(s))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// hack for support terraform 0.12\n\tformatted = terraform12Adjustments(formatted, mapsObjects)\n\t// hack for support terraform 0.13\n\tformatted = terraform13Adjustments(formatted)\n\tif err != nil {\n\t\tlog.Println(\"Invalid HCL follows:\")\n\t\tfor i, line := range strings.Split(s, \"\\n\") {\n\t\t\tfmt.Printf(\"%4d|\\t%s\\n\", i+1, line)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"error formatting HCL: %v\", err)\n\t}\n\n\treturn formatted, nil\n}\n\nfunc terraform12Adjustments(formatted []byte, mapsObjects map[string]struct{}) []byte {\n\tsingletonListFix := regexp.MustCompile(`^\\s*\\w+ = {`)\n\tsingletonListFixEnd := regexp.MustCompile(`^\\s*}`)\n\n\ts := string(formatted)\n\told := \" = {\"\n\tnewEquals := \" {\"\n\tlines := strings.Split(s, \"\\n\")\n\tprefix := make([]string, 0)\n\tfor i, line := range lines {\n\t\tif singletonListFixEnd.MatchString(line) && len(prefix) > 0 {\n\t\t\tprefix = prefix[:len(prefix)-1]\n\t\t\tcontinue\n\t\t}\n\t\tif !singletonListFix.MatchString(line) {\n\t\t\tcontinue\n\t\t}\n\t\tkey := strings.Trim(strings.Split(line, old)[0], \" \")\n\t\tprefix = append(prefix, key)\n\t\tif _, exist := mapsObjects[strings.Join(prefix, \".\")]; exist {\n\t\t\tcontinue\n\t\t}\n\t\tlines[i] = strings.ReplaceAll(line, old, newEquals)\n\t}\n\ts = strings.Join(lines, \"\\n\")\n\treturn []byte(s)\n}\n\nfunc terraform13Adjustments(formatted []byte) []byte {\n\ts := string(formatted)\n\trequiredProvidersRe := regexp.MustCompile(\"required_providers \\\".*\\\" {\")\n\tendBraceRe := regexp.MustCompile(`^\\s*}`)\n\tlines := strings.Split(s, \"\\n\")\n\tfor i, line := range lines {\n\t\tif requiredProvidersRe.MatchString(line) {\n\t\t\tparts := strings.Split(strings.TrimSpace(line), \" \")\n\t\t\tprovider := strings.ReplaceAll(parts[1], \"\\\"\", \"\")\n\t\t\tlines[i] = \"\\trequired_providers {\"\n\t\t\tvar innerBlock []string\n\t\t\tinner := i + 1\n\t\t\tfor ; !endBraceRe.MatchString(lines[inner]); inner++ {\n\t\t\t\tinnerBlock = append(innerBlock, \"\\t\"+lines[inner])\n\t\t\t}\n\t\t\tlines[i+1] = \"\\t\\t\" + provider + \" = {\\n\" + strings.Join(innerBlock, \"\\n\") + \"\\n\\t\\t}\"\n\t\t\tlines = append(lines[:i+2], lines[inner:]...)\n\t\t\tbreak\n\t\t}\n\t}\n\ts = strings.Join(lines, \"\\n\")\n\treturn []byte(s)\n}\n\nfunc escapeRune(s string) string {\n\treturn fmt.Sprintf(\"-%04X-\", s)\n}\n\n// Sanitize name for terraform style\nfunc TfSanitize(name string) string {\n\tname = unsafeChars.ReplaceAllStringFunc(name, escapeRune)\n\tname = \"tfer--\" + name\n\treturn name\n}\n\n// Print hcl file from TerraformResource + provider\nfunc HclPrintResource(resources []Resource, providerData map[string]interface{}, output string, sort bool) ([]byte, error) {\n\tresourcesByType := map[string]map[string]interface{}{}\n\tmapsObjects := map[string]struct{}{}\n\tindexRe := regexp.MustCompile(`\\.[0-9]+`)\n\tfor _, res := range resources {\n\t\tr := resourcesByType[res.InstanceInfo.Type]\n\t\tif r == nil {\n\t\t\tr = make(map[string]interface{})\n\t\t\tresourcesByType[res.InstanceInfo.Type] = r\n\t\t}\n\n\t\tif r[res.ResourceName] != nil {\n\t\t\tlog.Println(resources)\n\t\t\tlog.Printf(\"[ERR]: duplicate resource found: %s.%s\", res.InstanceInfo.Type, res.ResourceName)\n\t\t\tcontinue\n\t\t}\n\n\t\tr[res.ResourceName] = res.Item\n\n\t\tfor k := range res.InstanceState.Attributes {\n\t\t\tif strings.HasSuffix(k, \".%\") {\n\t\t\t\tkey := strings.TrimSuffix(k, \".%\")\n\t\t\t\tmapsObjects[indexRe.ReplaceAllString(key, \"\")] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\n\tdata := map[string]interface{}{}\n\tif len(resourcesByType) > 0 {\n\t\tdata[\"resource\"] = resourcesByType\n\t}\n\tif len(providerData) > 0 {\n\t\tdata[\"provider\"] = providerData\n\t}\n\tvar err error\n\n\thclBytes, err := Print(data, mapsObjects, output, sort)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\treturn hclBytes, nil\n}\n"
  },
  {
    "path": "terraformutils/hcl_test.go",
    "content": "// Copyright 2020 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage terraformutils\n\nimport (\n\t\"strings\"\n\t\"testing\"\n)\n\nfunc TestPrintResource(t *testing.T) {\n\tvar resources []Resource\n\tvar nested []map[string]interface{}\n\tnested = append(nested, mapI(\"field1\", \"egg\"))\n\timportResource := prepare(\"ID1\", \"type1\", map[string]string{\n\t\t\"type1\":                  \"ID2\",\n\t\t\"map1.%\":                 \"1\",\n\t\t\"map1.foo\":               \"bar\",\n\t\t\"nested.#\":               \"1\",\n\t\t\"nested.0.map1.#\":        \"1\",\n\t\t\"nested.0.map1.0.field1\": \"egg\",\n\t\t\"nested2.#\":              \"1\",\n\t\t\"nested2.0.field1\":       \"spam\",\n\t\t\"nested2.0.map2.%\":       \"1\",\n\t\t\"nested2.0.map2.foo\":     \"bar\",\n\t}, map[string]interface{}{\n\t\t\"type1\":   \"ID2\",\n\t\t\"map1\":    mapI(\"foo\", \"bar\"),\n\t\t\"nested\":  mapI(\"map1\", nested),\n\t\t\"nested2\": map[string]interface{}{\"map2\": mapI(\"bar\", \"foo\"), \"field1\": \"egg\"},\n\t})\n\tresources = append(resources, importResource)\n\tproviderData := map[string]interface{}{}\n\toutput := \"hcl\"\n\tdata, _ := HclPrintResource(resources, providerData, output, true)\n\n\tif strings.Count(string(data), \"map1 = \") != 1 {\n\t\tt.Errorf(\"failed to parse data %s\", string(data))\n\t}\n\tif strings.Count(string(data), \"map2 = \") != 1 {\n\t\tt.Errorf(\"failed to parse data %s\", string(data))\n\t}\n}\n"
  },
  {
    "path": "terraformutils/json.go",
    "content": "package terraformutils\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"log\"\n\t\"regexp\"\n\t\"strings\"\n)\n\nvar OpeningBracketRegexp = regexp.MustCompile(`.?\\\\<`)\nvar ClosingBracketRegexp = regexp.MustCompile(`.?\\\\>`)\n\nfunc jsonPrint(data interface{}) ([]byte, error) {\n\tdataJSONBytes, err := json.MarshalIndent(data, \"\", \"  \")\n\tif err != nil {\n\t\tlog.Println(string(dataJSONBytes))\n\t\treturn []byte{}, fmt.Errorf(\"error marshalling terraform data to json: %v\", err)\n\t}\n\t// We don't need to escape > or <\n\ts := strings.ReplaceAll(string(dataJSONBytes), \"\\\\u003c\", \"<\")\n\ts = OpeningBracketRegexp.ReplaceAllStringFunc(s, escapingBackslashReplacer(\"<\"))\n\ts = strings.ReplaceAll(s, \"\\\\u003e\", \">\")\n\ts = ClosingBracketRegexp.ReplaceAllStringFunc(s, escapingBackslashReplacer(\">\"))\n\treturn []byte(s), nil\n}\n\nfunc escapingBackslashReplacer(backslashedCharacter string) func(string) string {\n\treturn func(match string) string {\n\t\tif strings.HasPrefix(match, \"\\\\\\\\\") {\n\t\t\treturn match // Don't replace regular backslashes\n\t\t}\n\t\treturn strings.Replace(match, \"\\\\\"+backslashedCharacter, backslashedCharacter, 1)\n\t}\n}\n"
  },
  {
    "path": "terraformutils/providers_mapping.go",
    "content": "package terraformutils\n\nimport (\n\t\"log\"\n\t\"math/rand\"\n\t\"reflect\"\n\t\"time\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/providerwrapper\"\n)\n\ntype ProvidersMapping struct {\n\tbaseProvider       ProviderGenerator\n\tResources          map[*Resource]bool\n\tServices           map[string]bool\n\tProviders          map[ProviderGenerator]bool\n\tproviderToService  map[ProviderGenerator]string\n\tserviceToProvider  map[string]ProviderGenerator\n\tresourceToProvider map[*Resource]ProviderGenerator\n}\n\nfunc NewProvidersMapping(baseProvider ProviderGenerator) *ProvidersMapping {\n\tprovidersMapping := &ProvidersMapping{\n\t\tbaseProvider:       baseProvider,\n\t\tResources:          map[*Resource]bool{},\n\t\tServices:           map[string]bool{},\n\t\tProviders:          map[ProviderGenerator]bool{},\n\t\tproviderToService:  map[ProviderGenerator]string{},\n\t\tserviceToProvider:  map[string]ProviderGenerator{},\n\t\tresourceToProvider: map[*Resource]ProviderGenerator{},\n\t}\n\n\treturn providersMapping\n}\n\nfunc deepCopyProvider(provider ProviderGenerator) ProviderGenerator {\n\treturn reflect.New(reflect.ValueOf(provider).Elem().Type()).Interface().(ProviderGenerator)\n}\n\nfunc (p *ProvidersMapping) GetBaseProvider() ProviderGenerator {\n\treturn p.baseProvider\n}\n\nfunc (p *ProvidersMapping) AddServiceToProvider(service string) ProviderGenerator {\n\tnewProvider := deepCopyProvider(p.baseProvider)\n\tp.Providers[newProvider] = true\n\tp.Services[service] = true\n\tp.providerToService[newProvider] = service\n\tp.serviceToProvider[service] = newProvider\n\n\treturn newProvider\n}\n\nfunc (p *ProvidersMapping) GetServices() []string {\n\tservices := make([]string, len(p.Services))\n\tfor service := range p.Services {\n\t\tservices = append(services, service)\n\t}\n\n\treturn services\n}\n\nfunc (p *ProvidersMapping) RemoveServices(services []string) {\n\tfor _, service := range services {\n\t\tdelete(p.Services, service)\n\n\t\tmatchingProvider := p.serviceToProvider[service]\n\t\tdelete(p.Providers, matchingProvider)\n\t\tdelete(p.providerToService, matchingProvider)\n\t\tdelete(p.serviceToProvider, service)\n\t}\n}\n\nfunc (p *ProvidersMapping) ShuffleResources() []*Resource {\n\tresources := []*Resource{}\n\tfor resource := range p.Resources {\n\t\tresources = append(resources, resource)\n\t}\n\trand.Seed(time.Now().UnixNano())\n\trand.Shuffle(len(resources), func(i, j int) { resources[i], resources[j] = resources[j], resources[i] })\n\n\treturn resources\n}\n\nfunc (p *ProvidersMapping) ProcessResources(isCleanup bool) {\n\tinitialResources := p.resourceToProvider\n\tif isCleanup && len(initialResources) > 0 {\n\t\tp.Resources = map[*Resource]bool{}\n\t\tp.resourceToProvider = map[*Resource]ProviderGenerator{}\n\t\tfor provider := range p.Providers {\n\t\t\tresources := provider.GetService().GetResources()\n\t\t\tlog.Printf(\"Filtered number of resources for service %s: %d\", p.providerToService[provider], len(provider.GetService().GetResources()))\n\t\t\tfor i := range resources {\n\t\t\t\tresource := resources[i]\n\t\t\t\tp.Resources[&resource] = true\n\t\t\t\tp.resourceToProvider[&resource] = provider\n\t\t\t}\n\t\t}\n\t} else if !isCleanup {\n\t\tfor provider := range p.Providers {\n\t\t\tresources := provider.GetService().GetResources()\n\t\t\tlog.Printf(\"Number of resources for service %s: %d\", p.providerToService[provider], len(provider.GetService().GetResources()))\n\t\t\tfor i := range resources {\n\t\t\t\tresource := resources[i]\n\t\t\t\tp.Resources[&resource] = true\n\t\t\t\tp.resourceToProvider[&resource] = provider\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (p *ProvidersMapping) MatchProvider(resource *Resource) ProviderGenerator {\n\treturn p.resourceToProvider[resource]\n}\n\nfunc (p *ProvidersMapping) SetResources(resourceToKeep []*Resource) {\n\tp.Resources = map[*Resource]bool{}\n\tresourcesGroupsByProviders := map[ProviderGenerator][]Resource{}\n\tfor i := range resourceToKeep {\n\t\tresource := resourceToKeep[i]\n\t\tprovider := p.resourceToProvider[resource]\n\t\tif resourcesGroupsByProviders[provider] == nil {\n\t\t\tresourcesGroupsByProviders[provider] = []Resource{}\n\t\t}\n\t\tresourcesGroupsByProviders[provider] = append(resourcesGroupsByProviders[provider], *resource)\n\t\tp.Resources[resource] = true\n\t}\n\n\tfor provider := range p.Providers {\n\t\tprovider.GetService().SetResources(resourcesGroupsByProviders[provider])\n\t}\n}\n\nfunc (p *ProvidersMapping) GetResourcesByService() map[string][]Resource {\n\tmapping := map[string][]Resource{}\n\tfor service := range p.Services {\n\t\tmapping[service] = []Resource{}\n\t}\n\n\tfor resource := range p.Resources {\n\t\tprovider := p.resourceToProvider[resource]\n\t\tservice := p.providerToService[provider]\n\t\tmapping[service] = append(mapping[service], *resource)\n\t}\n\n\treturn mapping\n}\n\nfunc (p *ProvidersMapping) ConvertTFStates(providerWrapper *providerwrapper.ProviderWrapper) {\n\tfor resource := range p.Resources {\n\t\terr := resource.ConvertTFstate(providerWrapper)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"failed to convert resources %s because of error %s\", resource.InstanceInfo.Id, err)\n\t\t}\n\t}\n\n\tresourcesGroupsByProviders := map[ProviderGenerator][]Resource{}\n\tfor resource := range p.Resources {\n\t\tprovider := p.resourceToProvider[resource]\n\t\tif resourcesGroupsByProviders[provider] == nil {\n\t\t\tresourcesGroupsByProviders[provider] = []Resource{}\n\t\t}\n\t\tresourcesGroupsByProviders[provider] = append(resourcesGroupsByProviders[provider], *resource)\n\t}\n\n\tfor provider := range p.Providers {\n\t\tprovider.GetService().SetResources(resourcesGroupsByProviders[provider])\n\t}\n\n}\n\nfunc (p *ProvidersMapping) CleanupProviders() {\n\tfor provider := range p.Providers {\n\t\tprovider.GetService().PostRefreshCleanup()\n\t\terr := provider.GetService().PostConvertHook()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"failed run PostConvertHook because of error %s\", err)\n\t\t}\n\t}\n\tp.ProcessResources(true)\n}\n"
  },
  {
    "path": "terraformutils/providerwrapper/provider.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage providerwrapper //nolint\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"os/exec\"\n\t\"runtime\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/terraformerstring\"\n\n\t\"github.com/zclconf/go-cty/cty\"\n\n\t\"github.com/hashicorp/go-hclog\"\n\t\"github.com/hashicorp/go-plugin\"\n\t\"github.com/hashicorp/terraform/configs/configschema\"\n\ttfplugin \"github.com/hashicorp/terraform/plugin\"\n\t\"github.com/hashicorp/terraform/providers\"\n\t\"github.com/hashicorp/terraform/terraform\"\n\t\"github.com/hashicorp/terraform/version\"\n)\n\n// DefaultDataDir is the default directory for storing local data.\nconst DefaultDataDir = \".terraform\"\n\n// DefaultPluginVendorDir is the location in the config directory to look for\n// user-added plugin binaries. Terraform only reads from this path if it\n// exists, it is never created by terraform.\nconst DefaultPluginVendorDirV12 = \"terraform.d/plugins/\" + pluginMachineName\n\n// pluginMachineName is the directory name used in new plugin paths.\nconst pluginMachineName = runtime.GOOS + \"_\" + runtime.GOARCH\n\ntype ProviderWrapper struct {\n\tProvider     *tfplugin.GRPCProvider\n\tclient       *plugin.Client\n\trpcClient    plugin.ClientProtocol\n\tproviderName string\n\tconfig       cty.Value\n\tschema       *providers.GetSchemaResponse\n\tretryCount   int\n\tretrySleepMs int\n}\n\nfunc NewProviderWrapper(providerName string, providerConfig cty.Value, verbose bool, options ...map[string]int) (*ProviderWrapper, error) {\n\tp := &ProviderWrapper{retryCount: 5, retrySleepMs: 300}\n\tp.providerName = providerName\n\tp.config = providerConfig\n\n\tif len(options) > 0 {\n\t\tretryCount, hasOption := options[0][\"retryCount\"]\n\t\tif hasOption {\n\t\t\tp.retryCount = retryCount\n\t\t}\n\t\tretrySleepMs, hasOption := options[0][\"retrySleepMs\"]\n\t\tif hasOption {\n\t\t\tp.retrySleepMs = retrySleepMs\n\t\t}\n\t}\n\n\terr := p.initProvider(verbose)\n\n\treturn p, err\n}\n\nfunc (p *ProviderWrapper) Kill() {\n\tp.client.Kill()\n}\n\nfunc (p *ProviderWrapper) GetSchema() *providers.GetSchemaResponse {\n\tif p.schema == nil {\n\t\tr := p.Provider.GetSchema()\n\t\tp.schema = &r\n\t}\n\treturn p.schema\n}\n\nfunc (p *ProviderWrapper) GetReadOnlyAttributes(resourceTypes []string) (map[string][]string, error) {\n\tr := p.GetSchema()\n\n\tif r.Diagnostics.HasErrors() {\n\t\treturn nil, r.Diagnostics.Err()\n\t}\n\treadOnlyAttributes := map[string][]string{}\n\tfor resourceName, obj := range r.ResourceTypes {\n\t\tif terraformerstring.ContainsString(resourceTypes, resourceName) {\n\t\t\treadOnlyAttributes[resourceName] = append(readOnlyAttributes[resourceName], \"^id$\")\n\t\t\tfor k, v := range obj.Block.Attributes {\n\t\t\t\tif !v.Optional && !v.Required {\n\t\t\t\t\tif v.Type.IsListType() || v.Type.IsSetType() {\n\t\t\t\t\t\treadOnlyAttributes[resourceName] = append(readOnlyAttributes[resourceName], \"^\"+k+\"\\\\.(.*)\")\n\t\t\t\t\t} else {\n\t\t\t\t\t\treadOnlyAttributes[resourceName] = append(readOnlyAttributes[resourceName], \"^\"+k+\"$\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treadOnlyAttributes[resourceName] = p.readObjBlocks(obj.Block.BlockTypes, readOnlyAttributes[resourceName], \"-1\")\n\t\t}\n\t}\n\treturn readOnlyAttributes, nil\n}\n\nfunc (p *ProviderWrapper) readObjBlocks(block map[string]*configschema.NestedBlock, readOnlyAttributes []string, parent string) []string {\n\tfor k, v := range block {\n\t\tif len(v.BlockTypes) > 0 {\n\t\t\tif parent == \"-1\" {\n\t\t\t\treadOnlyAttributes = p.readObjBlocks(v.BlockTypes, readOnlyAttributes, k)\n\t\t\t} else {\n\t\t\t\treadOnlyAttributes = p.readObjBlocks(v.BlockTypes, readOnlyAttributes, parent+\"\\\\.[0-9]+\\\\.\"+k)\n\t\t\t}\n\t\t}\n\t\tfieldCount := 0\n\t\tfor key, l := range v.Attributes {\n\t\t\tif !l.Optional && !l.Required {\n\t\t\t\tfieldCount++\n\t\t\t\tswitch v.Nesting {\n\t\t\t\tcase configschema.NestingList:\n\t\t\t\t\tif parent == \"-1\" {\n\t\t\t\t\t\treadOnlyAttributes = append(readOnlyAttributes, \"^\"+k+\"\\\\.[0-9]+\\\\.\"+key+\"($|\\\\.[0-9]+|\\\\.#)\")\n\t\t\t\t\t} else {\n\t\t\t\t\t\treadOnlyAttributes = append(readOnlyAttributes, \"^\"+parent+\"\\\\.(.*)\\\\.\"+key+\"$\")\n\t\t\t\t\t}\n\t\t\t\tcase configschema.NestingSet:\n\t\t\t\t\tif parent == \"-1\" {\n\t\t\t\t\t\treadOnlyAttributes = append(readOnlyAttributes, \"^\"+k+\"\\\\.[0-9]+\\\\.\"+key+\"$\")\n\t\t\t\t\t} else {\n\t\t\t\t\t\treadOnlyAttributes = append(readOnlyAttributes, \"^\"+parent+\"\\\\.(.*)\\\\.\"+key+\"($|\\\\.(.*))\")\n\t\t\t\t\t}\n\t\t\t\tcase configschema.NestingMap:\n\t\t\t\t\treadOnlyAttributes = append(readOnlyAttributes, parent+\"\\\\.\"+key)\n\t\t\t\tdefault:\n\t\t\t\t\treadOnlyAttributes = append(readOnlyAttributes, parent+\"\\\\.\"+key+\"$\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif fieldCount == len(v.Block.Attributes) && fieldCount > 0 && len(v.BlockTypes) == 0 {\n\t\t\treadOnlyAttributes = append(readOnlyAttributes, \"^\"+k)\n\t\t}\n\t}\n\treturn readOnlyAttributes\n}\n\nfunc (p *ProviderWrapper) Refresh(info *terraform.InstanceInfo, state *terraform.InstanceState) (*terraform.InstanceState, error) {\n\tschema := p.GetSchema()\n\timpliedType := schema.ResourceTypes[info.Type].Block.ImpliedType()\n\tpriorState, err := state.AttrsAsObjectValue(impliedType)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccessReadResource := false\n\tresp := providers.ReadResourceResponse{}\n\tfor i := 0; i < p.retryCount; i++ {\n\t\tresp = p.Provider.ReadResource(providers.ReadResourceRequest{\n\t\t\tTypeName:   info.Type,\n\t\t\tPriorState: priorState,\n\t\t\tPrivate:    []byte{},\n\t\t})\n\t\tif resp.Diagnostics.HasErrors() {\n\t\t\tlog.Println(resp.Diagnostics.Err())\n\t\t\tlog.Printf(\"WARN: Fail read resource from provider, wait %dms before retry\\n\", p.retrySleepMs)\n\t\t\ttime.Sleep(time.Duration(p.retrySleepMs) * time.Millisecond)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tsuccessReadResource = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !successReadResource {\n\t\tlog.Println(\"Fail read resource from provider, trying import command\")\n\t\t// retry with regular import command - without resource attributes\n\t\timportResponse := p.Provider.ImportResourceState(providers.ImportResourceStateRequest{\n\t\t\tTypeName: info.Type,\n\t\t\tID:       state.ID,\n\t\t})\n\t\tif importResponse.Diagnostics.HasErrors() {\n\t\t\treturn nil, resp.Diagnostics.Err()\n\t\t}\n\t\tif len(importResponse.ImportedResources) == 0 {\n\t\t\treturn nil, errors.New(\"not able to import resource for a given ID\")\n\t\t}\n\t\treturn terraform.NewInstanceStateShimmedFromValue(importResponse.ImportedResources[0].State, int(schema.ResourceTypes[info.Type].Version)), nil\n\t}\n\n\tif resp.NewState.IsNull() {\n\t\tmsg := fmt.Sprintf(\"ERROR: Read resource response is null for resource %s\", info.Id)\n\t\treturn nil, errors.New(msg)\n\t}\n\n\treturn terraform.NewInstanceStateShimmedFromValue(resp.NewState, int(schema.ResourceTypes[info.Type].Version)), nil\n}\n\nfunc (p *ProviderWrapper) initProvider(verbose bool) error {\n\tproviderFilePath, err := getProviderFileName(p.providerName)\n\tif err != nil {\n\t\treturn err\n\t}\n\toptions := hclog.LoggerOptions{\n\t\tName:   \"plugin\",\n\t\tLevel:  hclog.Error,\n\t\tOutput: os.Stdout,\n\t}\n\tif verbose {\n\t\toptions.Level = hclog.Trace\n\t}\n\tlogger := hclog.New(&options)\n\tp.client = plugin.NewClient(\n\t\t&plugin.ClientConfig{\n\t\t\tCmd:              exec.Command(providerFilePath),\n\t\t\tHandshakeConfig:  tfplugin.Handshake,\n\t\t\tVersionedPlugins: tfplugin.VersionedPlugins,\n\t\t\tManaged:          true,\n\t\t\tLogger:           logger,\n\t\t\tAllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC},\n\t\t\tAutoMTLS:         true,\n\t\t})\n\tp.rpcClient, err = p.client.Client()\n\tif err != nil {\n\t\treturn err\n\t}\n\traw, err := p.rpcClient.Dispense(tfplugin.ProviderPluginName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp.Provider = raw.(*tfplugin.GRPCProvider)\n\n\tconfig, err := p.GetSchema().Provider.Block.CoerceValue(p.config)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.Provider.Configure(providers.ConfigureRequest{\n\t\tTerraformVersion: version.Version,\n\t\tConfig:           config,\n\t})\n\n\treturn nil\n}\n\nfunc getProviderFileName(providerName string) (string, error) {\n\tdefaultDataDir := os.Getenv(\"TF_DATA_DIR\")\n\tif defaultDataDir == \"\" {\n\t\tdefaultDataDir = DefaultDataDir\n\t}\n\tproviderFilePath, err := getProviderFileNameV13andV14(defaultDataDir, providerName)\n\tif err != nil || providerFilePath == \"\" {\n\t\tproviderFilePath, err = getProviderFileNameV13andV14(os.Getenv(\"HOME\")+string(os.PathSeparator)+\n\t\t\t\".terraform.d\", providerName)\n\t}\n\tif err != nil || providerFilePath == \"\" {\n\t\treturn getProviderFileNameV12(providerName)\n\t}\n\treturn providerFilePath, nil\n}\n\nfunc getProviderFileNameV13andV14(prefix, providerName string) (string, error) {\n\t// Read terraform v14 file path\n\tregistryDir := prefix + string(os.PathSeparator) + \"providers\" + string(os.PathSeparator) +\n\t\t\"registry.terraform.io\"\n\tproviderDirs, err := os.ReadDir(registryDir)\n\tif err != nil {\n\t\t// Read terraform v13 file path\n\t\tregistryDir = prefix + string(os.PathSeparator) + \"plugins\" + string(os.PathSeparator) +\n\t\t\t\"registry.terraform.io\"\n\t\tproviderDirs, err = os.ReadDir(registryDir)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\tproviderFilePath := \"\"\n\tfor _, providerDir := range providerDirs {\n\t\tpluginPath := registryDir + string(os.PathSeparator) + providerDir.Name() +\n\t\t\tstring(os.PathSeparator) + providerName\n\t\tdirs, err := os.ReadDir(pluginPath)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, dir := range dirs {\n\t\t\tif !dir.IsDir() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, dir := range dirs {\n\t\t\t\tfullPluginPath := pluginPath + string(os.PathSeparator) + dir.Name() +\n\t\t\t\t\tstring(os.PathSeparator) + runtime.GOOS + \"_\" + runtime.GOARCH\n\t\t\t\tfiles, err := os.ReadDir(fullPluginPath)\n\t\t\t\tif err == nil {\n\t\t\t\t\tfor _, file := range files {\n\t\t\t\t\t\tif strings.HasPrefix(file.Name(), \"terraform-provider-\"+providerName) {\n\t\t\t\t\t\t\tproviderFilePath = fullPluginPath + string(os.PathSeparator) + file.Name()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn providerFilePath, nil\n}\n\nfunc getProviderFileNameV12(providerName string) (string, error) {\n\tdefaultDataDir := os.Getenv(\"TF_DATA_DIR\")\n\tif defaultDataDir == \"\" {\n\t\tdefaultDataDir = DefaultDataDir\n\t}\n\tpluginPath := defaultDataDir + string(os.PathSeparator) + \"plugins\" + string(os.PathSeparator) + runtime.GOOS + \"_\" + runtime.GOARCH\n\tfiles, err := os.ReadDir(pluginPath)\n\tif err != nil {\n\t\tpluginPath = os.Getenv(\"HOME\") + string(os.PathSeparator) + \".\" + DefaultPluginVendorDirV12\n\t\tfiles, err = os.ReadDir(pluginPath)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\tproviderFilePath := \"\"\n\tfor _, file := range files {\n\t\tif file.IsDir() {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(file.Name(), \"terraform-provider-\"+providerName) {\n\t\t\tproviderFilePath = pluginPath + string(os.PathSeparator) + file.Name()\n\t\t}\n\t}\n\treturn providerFilePath, nil\n}\n\nfunc GetProviderVersion(providerName string) string {\n\tproviderFilePath, err := getProviderFileName(providerName)\n\tif err != nil {\n\t\tlog.Println(\"Can't find provider file path. Ensure that you are following https://www.terraform.io/docs/configuration/providers.html#third-party-plugins.\")\n\t\treturn \"\"\n\t}\n\tt := strings.Split(providerFilePath, string(os.PathSeparator))\n\tproviderFileName := t[len(t)-1]\n\tproviderFileNameParts := strings.Split(providerFileName, \"_\")\n\tif len(providerFileNameParts) < 2 {\n\t\tlog.Println(\"Can't find provider version. Ensure that you are following https://www.terraform.io/docs/configuration/providers.html#plugin-names-and-versions.\")\n\t\treturn \"\"\n\t}\n\tproviderVersion := providerFileNameParts[1]\n\treturn \"~> \" + strings.TrimPrefix(providerVersion, \"v\")\n}\n"
  },
  {
    "path": "terraformutils/providerwrapper/provider_test.go",
    "content": "package providerwrapper //nolint\n\nimport (\n\t\"regexp\"\n\t\"testing\"\n\n\t\"github.com/hashicorp/terraform/configs/configschema\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\nfunc TestIgnoredAttributes(t *testing.T) {\n\tattributes := map[string]*configschema.Attribute{\n\t\t\"computed_attribute\": {\n\t\t\tType:     cty.Number,\n\t\t\tComputed: true,\n\t\t},\n\t\t\"required_attribute\": {\n\t\t\tType:     cty.String,\n\t\t\tRequired: true,\n\t\t},\n\t}\n\n\ttestCases := map[string]struct {\n\t\tblock                map[string]*configschema.NestedBlock\n\t\tignoredAttributes    []string\n\t\tnotIgnoredAttributes []string\n\t}{\n\t\t\"nesting_set\": {map[string]*configschema.NestedBlock{\n\t\t\t\"attribute_one\": {\n\t\t\t\tBlock: configschema.Block{\n\t\t\t\t\tAttributes: attributes,\n\t\t\t\t},\n\t\t\t\tNesting: configschema.NestingSet,\n\t\t\t},\n\t\t}, []string{\"nesting_set.attribute_one.computed_attribute\"},\n\t\t\t[]string{\"nesting_set.attribute_one.required_attribute\"}},\n\t\t\"nesting_list\": {map[string]*configschema.NestedBlock{\n\t\t\t\"attribute_one\": {\n\t\t\t\tBlock: configschema.Block{\n\t\t\t\t\tAttributes: map[string]*configschema.Attribute{},\n\t\t\t\t\tBlockTypes: map[string]*configschema.NestedBlock{\n\t\t\t\t\t\t\"attribute_two_nested\": {\n\t\t\t\t\t\t\tNesting: configschema.NestingList,\n\t\t\t\t\t\t\tBlock: configschema.Block{\n\t\t\t\t\t\t\t\tAttributes: attributes,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tNesting: configschema.NestingList,\n\t\t\t},\n\t\t}, []string{\"nesting_list.0.attribute_one.0.attribute_two_nested.computed_attribute\"},\n\t\t\t[]string{\"nesting_list.0.attribute_one.0.attribute_two_nested.required_attribute\"}},\n\t}\n\n\tfor key, tc := range testCases {\n\t\tt.Run(key, func(t *testing.T) {\n\t\t\tprovider := ProviderWrapper{}\n\t\t\treadOnlyAttributes := provider.readObjBlocks(tc.block, []string{}, key)\n\t\t\tfor _, attr := range tc.ignoredAttributes {\n\t\t\t\tif ignored := isAttributeIgnored(attr, readOnlyAttributes); !ignored {\n\t\t\t\t\tt.Errorf(\"attribute \\\"%s\\\" was not ignored. Pattern list: %s\", attr, readOnlyAttributes)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor _, attr := range tc.notIgnoredAttributes {\n\t\t\t\tif ignored := isAttributeIgnored(attr, readOnlyAttributes); ignored {\n\t\t\t\t\tt.Errorf(\"attribute \\\"%s\\\" was ignored. Pattern list: %s\", attr, readOnlyAttributes)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc isAttributeIgnored(name string, patterns []string) bool {\n\tignored := false\n\tfor _, pattern := range patterns {\n\t\tif match, _ := regexp.MatchString(pattern, name); match {\n\t\t\tignored = true\n\t\t\tbreak\n\t\t}\n\t}\n\treturn ignored\n}\n"
  },
  {
    "path": "terraformutils/resource.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage terraformutils\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"regexp\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/providerwrapper\"\n\t\"github.com/hashicorp/terraform/terraform\"\n\t\"github.com/zclconf/go-cty/cty\"\n)\n\ntype Resource struct {\n\tInstanceInfo      *terraform.InstanceInfo\n\tInstanceState     *terraform.InstanceState\n\tOutputs           map[string]*terraform.OutputState `json:\",omitempty\"`\n\tResourceName      string\n\tProvider          string\n\tItem              map[string]interface{} `json:\",omitempty\"`\n\tIgnoreKeys        []string               `json:\",omitempty\"`\n\tAllowEmptyValues  []string               `json:\",omitempty\"`\n\tAdditionalFields  map[string]interface{} `json:\",omitempty\"`\n\tSlowQueryRequired bool\n\tDataFiles         map[string][]byte\n}\n\ntype ApplicableFilter interface {\n\tIsApplicable(resourceName string) bool\n}\n\ntype ResourceFilter struct {\n\tApplicableFilter\n\tServiceName      string\n\tFieldPath        string\n\tAcceptableValues []string\n}\n\nfunc (rf *ResourceFilter) Filter(resource Resource) bool {\n\tif !rf.IsApplicable(strings.TrimPrefix(resource.InstanceInfo.Type, resource.Provider+\"_\")) {\n\t\treturn true\n\t}\n\tvar vals []interface{}\n\tswitch {\n\tcase rf.FieldPath == \"id\":\n\t\tvals = []interface{}{resource.InstanceState.ID}\n\tcase rf.AcceptableValues == nil:\n\t\tvar hasField = WalkAndCheckField(rf.FieldPath, resource.InstanceState.Attributes)\n\t\tif hasField {\n\t\t\treturn true\n\t\t}\n\t\treturn WalkAndCheckField(rf.FieldPath, resource.Item)\n\tdefault:\n\t\tvals = WalkAndGet(rf.FieldPath, resource.InstanceState.Attributes)\n\t\tif len(vals) == 0 {\n\t\t\tvals = WalkAndGet(rf.FieldPath, resource.Item)\n\t\t}\n\t}\n\tfor _, val := range vals {\n\t\tfor _, acceptableValue := range rf.AcceptableValues {\n\t\t\tif val == acceptableValue {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}\n\nfunc (rf *ResourceFilter) IsApplicable(serviceName string) bool {\n\treturn rf.ServiceName == \"\" || rf.ServiceName == serviceName\n}\n\nfunc (rf *ResourceFilter) isInitial() bool {\n\treturn rf.FieldPath == \"id\"\n}\n\nfunc NewResource(id, resourceName, resourceType, provider string,\n\tattributes map[string]string,\n\tallowEmptyValues []string,\n\tadditionalFields map[string]interface{}) Resource {\n\treturn Resource{\n\t\tResourceName: TfSanitize(resourceName),\n\t\tItem:         nil,\n\t\tProvider:     provider,\n\t\tInstanceState: &terraform.InstanceState{\n\t\t\tID:         id,\n\t\t\tAttributes: attributes,\n\t\t},\n\t\tInstanceInfo: &terraform.InstanceInfo{\n\t\t\tType: resourceType,\n\t\t\tId:   fmt.Sprintf(\"%s.%s\", resourceType, TfSanitize(resourceName)),\n\t\t},\n\t\tAdditionalFields: additionalFields,\n\t\tAllowEmptyValues: allowEmptyValues,\n\t}\n}\n\nfunc NewSimpleResource(id, resourceName, resourceType, provider string, allowEmptyValues []string) Resource {\n\treturn NewResource(\n\t\tid,\n\t\tresourceName,\n\t\tresourceType,\n\t\tprovider,\n\t\tmap[string]string{},\n\t\tallowEmptyValues,\n\t\tmap[string]interface{}{},\n\t)\n}\n\nfunc (r *Resource) Refresh(provider *providerwrapper.ProviderWrapper) {\n\tvar err error\n\tif r.SlowQueryRequired {\n\t\ttime.Sleep(200 * time.Millisecond)\n\t}\n\tr.InstanceState, err = provider.Refresh(r.InstanceInfo, r.InstanceState)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}\n\nfunc (r Resource) GetIDKey() string {\n\tif _, exist := r.InstanceState.Attributes[\"self_link\"]; exist {\n\t\treturn \"self_link\"\n\t}\n\treturn \"id\"\n}\n\nfunc (r *Resource) ParseTFstate(parser Flatmapper, impliedType cty.Type) error {\n\tattributes, err := parser.Parse(impliedType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// add Additional Fields to resource\n\tfor key, value := range r.AdditionalFields {\n\t\tattributes[key] = value\n\t}\n\n\tif attributes == nil {\n\t\tattributes = map[string]interface{}{} // ensure HCL can represent empty resource correctly\n\t}\n\n\tr.Item = attributes\n\treturn nil\n}\n\nfunc (r *Resource) ConvertTFstate(provider *providerwrapper.ProviderWrapper) error {\n\tignoreKeys := []*regexp.Regexp{}\n\tfor _, pattern := range r.IgnoreKeys {\n\t\tignoreKeys = append(ignoreKeys, regexp.MustCompile(pattern))\n\t}\n\tallowEmptyValues := []*regexp.Regexp{}\n\tfor _, pattern := range r.AllowEmptyValues {\n\t\tif pattern != \"\" {\n\t\t\tallowEmptyValues = append(allowEmptyValues, regexp.MustCompile(pattern))\n\t\t}\n\t}\n\tparser := NewFlatmapParser(r.InstanceState.Attributes, ignoreKeys, allowEmptyValues)\n\tschema := provider.GetSchema()\n\timpliedType := schema.ResourceTypes[r.InstanceInfo.Type].Block.ImpliedType()\n\treturn r.ParseTFstate(parser, impliedType)\n}\n\nfunc (r *Resource) ServiceName() string {\n\treturn strings.TrimPrefix(r.InstanceInfo.Type, r.Provider+\"_\")\n}\n"
  },
  {
    "path": "terraformutils/service.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage terraformutils\n\nimport (\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/providerwrapper\"\n)\n\ntype ServiceGenerator interface {\n\tInitResources() error\n\tGetResources() []Resource\n\tSetResources(resources []Resource)\n\tParseFilter(rawFilter string) []ResourceFilter\n\tParseFilters(rawFilters []string)\n\tPostConvertHook() error\n\tGetArgs() map[string]interface{}\n\tSetArgs(args map[string]interface{})\n\tSetName(name string)\n\tSetVerbose(bool)\n\tSetProviderName(name string)\n\tGetProviderName() string\n\tGetName() string\n\tInitialCleanup()\n\tPopulateIgnoreKeys(*providerwrapper.ProviderWrapper)\n\tPostRefreshCleanup()\n}\n\ntype Service struct {\n\tName         string\n\tResources    []Resource\n\tProviderName string\n\tArgs         map[string]interface{}\n\tFilter       []ResourceFilter\n\tVerbose      bool\n}\n\nfunc (s *Service) SetProviderName(providerName string) {\n\ts.ProviderName = providerName\n}\n\nfunc (s *Service) GetProviderName() string {\n\treturn s.ProviderName\n}\n\nfunc (s *Service) SetVerbose(verbose bool) {\n\ts.Verbose = verbose\n}\n\nfunc (s *Service) ParseFilters(rawFilters []string) {\n\ts.Filter = []ResourceFilter{}\n\tfor _, rawFilter := range rawFilters {\n\t\tfilters := s.ParseFilter(rawFilter)\n\t\ts.Filter = append(s.Filter, filters...)\n\t}\n}\n\nfunc (s *Service) ParseFilter(rawFilter string) []ResourceFilter {\n\tvar filters []ResourceFilter\n\tif !strings.HasPrefix(rawFilter, \"Name=\") && len(strings.Split(rawFilter, \"=\")) == 2 {\n\t\tparts := strings.Split(rawFilter, \"=\")\n\t\tserviceName, resourcesID := parts[0], parts[1]\n\t\tfilters = append(filters, ResourceFilter{\n\t\t\tServiceName:      serviceName,\n\t\t\tFieldPath:        \"id\",\n\t\t\tAcceptableValues: ParseFilterValues(resourcesID),\n\t\t})\n\t} else {\n\t\tparts := strings.Split(rawFilter, \";\")\n\t\tif !((len(parts) == 1 && strings.HasPrefix(rawFilter, \"Name=\")) || len(parts) == 2 || len(parts) == 3) {\n\t\t\tlog.Print(\"Invalid filter: \" + rawFilter)\n\t\t\treturn filters\n\t\t}\n\t\tvar ServiceNamePart string\n\t\tvar FieldPathPart string\n\t\tvar AcceptableValuesPart string\n\t\tswitch len(parts) {\n\t\tcase 1:\n\t\t\tServiceNamePart = \"\"\n\t\t\tFieldPathPart = parts[0]\n\t\t\tAcceptableValuesPart = \"\"\n\t\tcase 2:\n\t\t\tServiceNamePart = \"\"\n\t\t\tFieldPathPart = parts[0]\n\t\t\tAcceptableValuesPart = parts[1]\n\t\tdefault:\n\t\t\tServiceNamePart = strings.TrimPrefix(parts[0], \"Type=\")\n\t\t\tFieldPathPart = parts[1]\n\t\t\tAcceptableValuesPart = parts[2]\n\t\t}\n\n\t\tfilters = append(filters, ResourceFilter{\n\t\t\tServiceName:      ServiceNamePart,\n\t\t\tFieldPath:        strings.TrimPrefix(FieldPathPart, \"Name=\"),\n\t\t\tAcceptableValues: ParseFilterValues(strings.TrimPrefix(AcceptableValuesPart, \"Value=\")),\n\t\t})\n\t}\n\treturn filters\n}\n\nfunc (s *Service) SetName(name string) {\n\ts.Name = name\n}\nfunc (s *Service) GetName() string {\n\treturn s.Name\n}\n\nfunc (s *Service) InitialCleanup() {\n\tFilterCleanup(s, true)\n}\n\nfunc (s *Service) PostRefreshCleanup() {\n\tif len(s.Filter) != 0 {\n\t\tFilterCleanup(s, false)\n\t}\n}\n\nfunc (s *Service) GetArgs() map[string]interface{} {\n\treturn s.Args\n}\nfunc (s *Service) SetArgs(args map[string]interface{}) {\n\ts.Args = args\n}\n\nfunc (s *Service) GetResources() []Resource {\n\treturn s.Resources\n}\nfunc (s *Service) SetResources(resources []Resource) {\n\ts.Resources = resources\n}\n\nfunc (s *Service) InitResources() error {\n\tpanic(\"implement me\")\n}\n\nfunc (s *Service) PostConvertHook() error {\n\treturn nil\n}\n\nfunc (s *Service) PopulateIgnoreKeys(providerWrapper *providerwrapper.ProviderWrapper) {\n\tvar resourcesTypes []string\n\tfor _, r := range s.Resources {\n\t\tresourcesTypes = append(resourcesTypes, r.InstanceInfo.Type)\n\t}\n\tkeys := IgnoreKeys(resourcesTypes, providerWrapper)\n\tfor k, v := range keys {\n\t\tfor i := range s.Resources {\n\t\t\tif s.Resources[i].InstanceInfo.Type == k {\n\t\t\t\ts.Resources[i].IgnoreKeys = append(s.Resources[i].IgnoreKeys, v...)\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "terraformutils/service_test.go",
    "content": "package terraformutils\n\nimport (\n\t\"reflect\"\n\t\"testing\"\n\n\t\"github.com/hashicorp/terraform/terraform\"\n)\n\nfunc TestEmptyFiltersParsing(t *testing.T) {\n\tservice := Service{}\n\tservice.ParseFilters([]string{})\n\n\tif !reflect.DeepEqual(service.Filter, []ResourceFilter{}) {\n\t\tt.Errorf(\"failed to parse, got %v\", service.Filter)\n\t}\n}\n\nfunc TestIdFiltersParsing(t *testing.T) {\n\tservice := Service{}\n\tservice.ParseFilters([]string{\"aws_vpc=myid\"})\n\n\tif !reflect.DeepEqual(service.Filter, []ResourceFilter{\n\t\t{\n\t\t\tServiceName:      \"aws_vpc\",\n\t\t\tFieldPath:        \"id\",\n\t\t\tAcceptableValues: []string{\"myid\"},\n\t\t}}) {\n\t\tt.Errorf(\"failed to parse, got %v\", service.Filter)\n\t}\n}\n\nfunc TestComplexIdFiltersParsing(t *testing.T) {\n\tservice := Service{}\n\tservice.ParseFilters([]string{\"resource=id1:'project:dataset_id'\"})\n\n\tif !reflect.DeepEqual(service.Filter, []ResourceFilter{\n\t\t{\n\t\t\tServiceName:      \"resource\",\n\t\t\tFieldPath:        \"id\",\n\t\t\tAcceptableValues: []string{\"id1\", \"project:dataset_id\"},\n\t\t}}) {\n\t\tt.Errorf(\"failed to parse, got %v\", service.Filter)\n\t}\n}\n\nfunc TestEdgeIdFiltersParsing(t *testing.T) {\n\tservice := Service{}\n\tservice.ParseFilters([]string{\"aws_vpc=:myid\"})\n\n\tif !reflect.DeepEqual(service.Filter, []ResourceFilter{\n\t\t{\n\t\t\tServiceName:      \"aws_vpc\",\n\t\t\tFieldPath:        \"id\",\n\t\t\tAcceptableValues: []string{\"myid\"},\n\t\t}}) {\n\t\tt.Errorf(\"failed to parse, got %v\", service.Filter)\n\t}\n}\n\nfunc TestServiceIdCleanupWithFilter(t *testing.T) {\n\tservice := Service{\n\t\tResources: []Resource{{\n\t\t\tInstanceInfo: &terraform.InstanceInfo{\n\t\t\t\tType: \"type1\",\n\t\t\t},\n\t\t\tInstanceState: &terraform.InstanceState{\n\t\t\t\tID: \"myid\",\n\t\t\t}}, {\n\t\t\tInstanceInfo: &terraform.InstanceInfo{\n\t\t\t\tType: \"type2\",\n\t\t\t},\n\t\t\tInstanceState: &terraform.InstanceState{\n\t\t\t\tID: \"myid\",\n\t\t\t}}},\n\t}\n\tservice.ParseFilters([]string{\"type1=:otherId\"})\n\tservice.InitialCleanup()\n\n\tif !reflect.DeepEqual(len(service.Resources), 1) {\n\t\tt.Errorf(\"failed to cleanup\")\n\t}\n}\n\nfunc TestServiceAttributeCleanupWithFilter(t *testing.T) {\n\tservice := Service{\n\t\tResources: []Resource{\n\t\t\t{\n\t\t\t\tInstanceInfo: &terraform.InstanceInfo{\n\t\t\t\t\tType: \"aws_vpc\",\n\t\t\t\t},\n\t\t\t\tInstanceState: &terraform.InstanceState{\n\t\t\t\t\tID: \"vpc1\",\n\t\t\t\t},\n\t\t\t\tItem: mapI(\"tags\", mapI(\"Name\", \"some\"))},\n\t\t\t{\n\t\t\t\tInstanceInfo: &terraform.InstanceInfo{\n\t\t\t\t\tType: \"aws_vpc\",\n\t\t\t\t},\n\t\t\t\tInstanceState: &terraform.InstanceState{\n\t\t\t\t\tID: \"vpc2\",\n\t\t\t\t},\n\t\t\t\tItem: mapI(\"tags\", mapI(\"Name\", \"default\"))}},\n\t}\n\tservice.ParseFilters([]string{\"Name=tags.Name;Value=default\"})\n\tservice.PostRefreshCleanup()\n\n\tif !reflect.DeepEqual(len(service.Resources), 1) {\n\t\tt.Errorf(\"failed to cleanup\")\n\t}\n}\n\nfunc TestServiceAttributeNameOnlyCleanupWithFilter(t *testing.T) {\n\tservice := Service{\n\t\tResources: []Resource{\n\t\t\t{\n\t\t\t\tInstanceInfo: &terraform.InstanceInfo{\n\t\t\t\t\tType: \"aws_vpc\",\n\t\t\t\t},\n\t\t\t\tInstanceState: &terraform.InstanceState{\n\t\t\t\t\tID: \"vpc1\",\n\t\t\t\t},\n\t\t\t\tItem: mapI(\"tags\", mapI(\"Abc\", nil))},\n\t\t\t{\n\t\t\t\tInstanceInfo: &terraform.InstanceInfo{\n\t\t\t\t\tType: \"aws_vpc\",\n\t\t\t\t},\n\t\t\t\tInstanceState: &terraform.InstanceState{\n\t\t\t\t\tID: \"vpc2\",\n\t\t\t\t},\n\t\t\t\tItem: mapI(\"tags\", mapI(\"Name\", \"default\"))}},\n\t}\n\tservice.ParseFilters([]string{\"Name=tags.Abc\"})\n\tservice.PostRefreshCleanup()\n\n\tif !reflect.DeepEqual(len(service.Resources), 1) {\n\t\tt.Errorf(\"failed to cleanup\")\n\t}\n}\n"
  },
  {
    "path": "terraformutils/terraformoutput/bucket.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage terraformoutput\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"strings\"\n\n\t\"cloud.google.com/go/storage\"\n)\n\ntype BucketState struct {\n\tName string\n}\n\nfunc (b BucketState) BucketGetTfData(path string) interface{} {\n\tname := strings.ReplaceAll(b.Name, \"gs://\", \"\")\n\tbucketStateData := map[string]interface{}{\n\t\t\"terraform\": map[string]interface{}{\n\t\t\t\"backend\": []map[string]interface{}{\n\t\t\t\t{\n\t\t\t\t\t\"gcs\": map[string]interface{}{\n\t\t\t\t\t\t\"bucket\": name,\n\t\t\t\t\t\t\"prefix\": b.BucketPrefix(path),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\treturn bucketStateData\n}\n\nfunc (b BucketState) BucketPrefix(path string) string {\n\treturn strings.TrimSuffix(path, \"/\")\n}\n\nfunc (b BucketState) BucketUpload(path string, file []byte) error {\n\tctx := context.Background()\n\tclient, err := storage.NewClient(ctx)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create client: %v\", err)\n\t}\n\tname := strings.ReplaceAll(b.Name, \"gs://\", \"\")\n\twc := client.Bucket(name).Object(b.BucketPrefix(path) + \"/default.tfstate\").NewWriter(ctx)\n\tif _, err = wc.Write(file); err != nil {\n\t\treturn err\n\t}\n\tif err := wc.Close(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "terraformutils/terraformoutput/hcl.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//\thttp://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\npackage terraformoutput\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/providerwrapper\"\n\n\t\"github.com/hashicorp/terraform/terraform\"\n)\n\nfunc OutputHclFiles(resources []terraformutils.Resource, provider terraformutils.ProviderGenerator, path string, serviceName string, isCompact bool, output string, sort bool) error {\n\tif err := os.MkdirAll(path, os.ModePerm); err != nil {\n\t\treturn err\n\t}\n\n\tproviderConfig := map[string]interface{}{\n\t\t\"version\": providerwrapper.GetProviderVersion(provider.GetName()),\n\t}\n\n\tif providerWithSource, ok := provider.(terraformutils.ProviderWithSource); ok {\n\t\tproviderConfig[\"source\"] = providerWithSource.GetSource()\n\t}\n\n\t// create provider file\n\tproviderData := provider.GetProviderData()\n\tproviderData[\"terraform\"] = map[string]interface{}{\n\t\t\"required_providers\": []map[string]interface{}{{\n\t\t\tprovider.GetName(): providerConfig,\n\t\t}},\n\t}\n\n\tproviderDataFile, err := terraformutils.Print(providerData, map[string]struct{}{}, output, sort)\n\tif err != nil {\n\t\treturn err\n\t}\n\tPrintFile(path+\"/provider.\"+GetFileExtension(output), providerDataFile)\n\n\t// create outputs files\n\toutputs := map[string]interface{}{}\n\toutputsByResource := map[string]map[string]interface{}{}\n\n\tfor i, r := range resources {\n\t\toutputState := map[string]*terraform.OutputState{}\n\t\toutputsByResource[r.InstanceInfo.Type+\"_\"+r.ResourceName+\"_\"+r.GetIDKey()] = map[string]interface{}{\n\t\t\t\"value\": \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".\" + r.GetIDKey() + \"}\",\n\t\t}\n\t\toutputState[r.InstanceInfo.Type+\"_\"+r.ResourceName+\"_\"+r.GetIDKey()] = &terraform.OutputState{\n\t\t\tType:  \"string\",\n\t\t\tValue: r.InstanceState.Attributes[r.GetIDKey()],\n\t\t}\n\t\tfor _, v := range provider.GetResourceConnections() {\n\t\t\tfor k, ids := range v {\n\t\t\t\tif (serviceName != \"\" && k == serviceName) || (serviceName == \"\" && k == r.ServiceName()) {\n\t\t\t\t\tif _, exist := r.InstanceState.Attributes[ids[1]]; exist {\n\t\t\t\t\t\tkey := ids[1]\n\t\t\t\t\t\tif ids[1] == \"self_link\" || ids[1] == \"id\" {\n\t\t\t\t\t\t\tkey = r.GetIDKey()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlinkKey := r.InstanceInfo.Type + \"_\" + r.ResourceName + \"_\" + key\n\t\t\t\t\t\toutputsByResource[linkKey] = map[string]interface{}{\n\t\t\t\t\t\t\t\"value\": \"${\" + r.InstanceInfo.Type + \".\" + r.ResourceName + \".\" + key + \"}\",\n\t\t\t\t\t\t}\n\t\t\t\t\t\toutputState[linkKey] = &terraform.OutputState{\n\t\t\t\t\t\t\tType:  \"string\",\n\t\t\t\t\t\t\tValue: r.InstanceState.Attributes[ids[1]],\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tresources[i].Outputs = outputState\n\t}\n\tif len(outputsByResource) > 0 {\n\t\toutputs[\"output\"] = outputsByResource\n\t\toutputsFile, err := terraformutils.Print(outputs, map[string]struct{}{}, output, sort)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tPrintFile(path+\"/outputs.\"+GetFileExtension(output), outputsFile)\n\t}\n\n\t// group by resource by type\n\ttypeOfServices := map[string][]terraformutils.Resource{}\n\tfor _, r := range resources {\n\t\ttypeOfServices[r.InstanceInfo.Type] = append(typeOfServices[r.InstanceInfo.Type], r)\n\t}\n\tif isCompact {\n\t\terr := printFile(resources, \"resources\", path, output, sort)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tfor k, v := range typeOfServices {\n\t\t\tfileName := strings.ReplaceAll(k, strings.Split(k, \"_\")[0]+\"_\", \"\")\n\t\t\terr := printFile(v, fileName, path, output, sort)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc printFile(v []terraformutils.Resource, fileName, path, output string, sort bool) error {\n\tfor _, res := range v {\n\t\tif res.DataFiles == nil {\n\t\t\tcontinue\n\t\t}\n\t\tfor fileName, content := range res.DataFiles {\n\t\t\tif err := os.MkdirAll(path+\"/data/\", os.ModePerm); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr := os.WriteFile(path+\"/data/\"+fileName, content, os.ModePerm)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\ttfFile, err := terraformutils.HclPrintResource(v, map[string]interface{}{}, output, sort)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = os.WriteFile(path+\"/\"+fileName+\".\"+GetFileExtension(output), tfFile, os.ModePerm)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc PrintFile(path string, data []byte) {\n\terr := os.WriteFile(path, data, os.ModePerm)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn\n\t}\n}\n\nfunc GetFileExtension(outputFormat string) string {\n\tif outputFormat == \"json\" {\n\t\treturn \"tf.json\"\n\t}\n\treturn \"tf\"\n}\n"
  },
  {
    "path": "terraformutils/test_data/test1.json",
    "content": "{\n  \"version\": 3,\n  \"terraform_version\": \"0.11.10\",\n  \"serial\": 3,\n  \"lineage\": \"11c0e8e7-bc2d-8f4c-b40b-25f62ece8666\",\n  \"modules\": [\n    {\n      \"path\": [\n        \"root\"\n      ],\n      \"outputs\": {},\n      \"resources\": {\n        \"google_compute_firewall.resource-id\": {\n          \"type\": \"google_compute_firewall\",\n          \"depends_on\": [],\n          \"primary\": {\n            \"id\": \"resource-id\",\n            \"attributes\": {\n              \"direction\": \"INGRESS\",\n              \"enable_logging\": \"false\",\n              \"id\": \"resource-id\",\n              \"name\": \"resource-name\"\n            },\n            \"meta\": {\n              \"schema_version\": \"1\"\n            },\n            \"tainted\": false\n          },\n          \"deposed\": [],\n          \"provider\": \"provider.google\"\n        }\n      }\n    }\n  ]\n}"
  },
  {
    "path": "terraformutils/test_data/test2.json",
    "content": "{\n  \"version\": 3,\n  \"terraform_version\": \"0.11.10\",\n  \"serial\": 3,\n  \"lineage\": \"11c0e8e7-bc2d-8f4c-b40b-25f62ece8666\",\n  \"modules\": [\n    {\n      \"path\": [\n        \"root\"\n      ],\n      \"outputs\": {},\n      \"resources\": {\n        \"google_compute_firewall.resource-idA\": {\n          \"type\": \"google_compute_firewall\",\n          \"depends_on\": [],\n          \"primary\": {\n            \"id\": \"resource-idA\",\n            \"attributes\": {\n              \"direction\": \"INGRESS\",\n              \"enable_logging\": \"false\",\n              \"id\": \"resource-idA\",\n              \"name\": \"resource-nameA\"\n            },\n            \"meta\": {\n              \"schema_version\": \"1\"\n            },\n            \"tainted\": false\n          },\n          \"deposed\": [],\n          \"provider\": \"provider.google\"\n        },\n        \"google_compute_firewall.resource-idB\": {\n          \"type\": \"google_compute_firewall\",\n          \"depends_on\": [],\n          \"primary\": {\n            \"id\": \"resource-idB\",\n            \"attributes\": {\n              \"direction\": \"INGRESS\",\n              \"enable_logging\": \"false\",\n              \"id\": \"resource-idB\",\n              \"name\": \"resource-nameB\"\n            },\n            \"meta\": {\n              \"schema_version\": \"1\"\n            },\n            \"tainted\": false\n          },\n          \"deposed\": [],\n          \"provider\": \"provider.google\"\n        }\n      }\n    }\n  ]\n}"
  },
  {
    "path": "terraformutils/test_data/test3.json",
    "content": "{\n  \"version\": 3,\n  \"terraform_version\": \"0.11.10\",\n  \"serial\": 3,\n  \"lineage\": \"11c0e8e7-bc2d-8f4c-b40b-25f62ece8666\",\n  \"modules\": [\n    {\n      \"path\": [\n        \"root\"\n      ],\n      \"outputs\": {},\n      \"resources\": {\n        \"google_compute_firewall.resource-id\": {\n          \"type\": \"google_compute_firewall\",\n          \"depends_on\": [],\n          \"primary\": {\n            \"id\": \"resource-id\",\n            \"attributes\": {\n              \"myarray.#\": \"1\",\n              \"myarray.0.value1\": \"value1\",\n              \"myarray.0.value2\": \"value2\",\n              \"myarray.1.value3\": \"value3\",\n              \"myarray.1.value4\": \"value4\",\n              \"direction\": \"INGRESS\",\n              \"enable_logging\": \"false\",\n              \"id\": \"resource-id\",\n              \"name\": \"resource-name\"\n            },\n            \"meta\": {\n              \"schema_version\": \"1\"\n            },\n            \"tainted\": false\n          },\n          \"deposed\": [],\n          \"provider\": \"provider.google\"\n        }\n      }\n    }\n  ]\n}"
  },
  {
    "path": "terraformutils/test_data/test4.json",
    "content": "{\n  \"version\": 3,\n  \"terraform_version\": \"0.11.10\",\n  \"serial\": 3,\n  \"lineage\": \"11c0e8e7-bc2d-8f4c-b40b-25f62ece8666\",\n  \"modules\": [\n    {\n      \"path\": [\n        \"root\"\n      ],\n      \"outputs\": {},\n      \"resources\": {\n        \"google_compute_firewall.resource-id\": {\n          \"type\": \"google_compute_firewall\",\n          \"depends_on\": [],\n          \"primary\": {\n            \"id\": \"resource-id\",\n            \"attributes\": {\n              \"myarray.#\": \"2\",\n              \"myarray.0.subarray1.1245\": \"value1\",\n              \"myarray.0.subarray1.12454\": \"value2\",\n              \"myarray.1.subarray3.123456\": \"value3\",\n              \"myarray.1.subarray4\": \"value4\",\n              \"direction\": \"INGRESS\",\n              \"enable_logging\": \"false\",\n              \"id\": \"resource-id\",\n              \"name\": \"resource-name\"\n            },\n            \"meta\": {\n              \"schema_version\": \"1\"\n            },\n            \"tainted\": false\n          },\n          \"deposed\": [],\n          \"provider\": \"provider.google\"\n        }\n      }\n    }\n  ]\n}"
  },
  {
    "path": "terraformutils/test_data/test5.json",
    "content": "{\n  \"version\": 3,\n  \"terraform_version\": \"0.11.10\",\n  \"serial\": 3,\n  \"lineage\": \"11c0e8e7-bc2d-8f4c-b40b-25f62ece8666\",\n  \"modules\": [\n    {\n      \"path\": [\n        \"root\"\n      ],\n      \"outputs\": {},\n      \"resources\": {\n        \"google_compute_firewall.resource-id\": {\n          \"type\": \"google_compute_firewall\",\n          \"depends_on\": [],\n          \"primary\": {\n            \"id\": \"resource-id\",\n            \"attributes\": {\n              \"myarray.#\": \"1\",\n              \"myarray.1245\": \"value1\",\n              \"myarray.12455\": \"value2\",\n              \"myarray.12455778\": \"value3\",\n              \"myarray2.#\": \"2\",\n              \"myarray2.0.subarray3.123456.subsubarray\": \"value3\",\n              \"myarray2.1.subarray4\": \"value4\",\n              \"direction\": \"INGRESS\",\n              \"enable_logging\": \"false\",\n              \"id\": \"resource-id\",\n              \"name\": \"resource-name\"\n            },\n            \"meta\": {\n              \"schema_version\": \"1\"\n            },\n            \"tainted\": false\n          },\n          \"deposed\": [],\n          \"provider\": \"provider.google\"\n        }\n      }\n    }\n  ]\n}"
  },
  {
    "path": "terraformutils/test_data/test6.json",
    "content": "{\n  \"version\": 3,\n  \"terraform_version\": \"0.11.10\",\n  \"serial\": 3,\n  \"lineage\": \"11c0e8e7-bc2d-8f4c-b40b-25f62ece8666\",\n  \"modules\": [\n    {\n      \"path\": [\n        \"root\"\n      ],\n      \"outputs\": {},\n      \"resources\": {\n        \"google_compute_firewall.resource-id\": {\n          \"type\": \"google_compute_firewall\",\n          \"depends_on\": [],\n          \"primary\": {\n            \"id\": \"resource-id\",\n            \"attributes\": {\n              \"lifecycle_rule.#\": \"1\",\n              \"lifecycle_rule.0.action.#\": \"1\",\n              \"lifecycle_rule.0.action.4029382586.storage_class\": \"\",\n              \"lifecycle_rule.0.action.4029382586.type\": \"Delete\",\n              \"lifecycle_rule.0.condition.#\": \"1\",\n              \"lifecycle_rule.0.condition.395037683.age\": \"1\",\n              \"lifecycle_rule.0.condition.395037683.created_before\": \"\",\n              \"lifecycle_rule.0.condition.395037683.is_live\": \"false\",\n              \"lifecycle_rule.0.condition.395037683.matches_storage_class.#\": \"0\",\n              \"lifecycle_rule.0.condition.395037683.num_newer_versions\": \"0\",\n              \"direction\": \"INGRESS\",\n              \"enable_logging\": \"false\",\n              \"id\": \"resource-id\",\n              \"name\": \"resource-name\"\n            },\n            \"meta\": {\n              \"schema_version\": \"1\"\n            },\n            \"tainted\": false\n          },\n          \"deposed\": [],\n          \"provider\": \"provider.google\"\n        }\n      }\n    }\n  ]\n}"
  },
  {
    "path": "terraformutils/test_data/test7.json",
    "content": "{\n  \"version\": 3,\n  \"terraform_version\": \"0.11.10\",\n  \"serial\": 3,\n  \"lineage\": \"11c0e8e7-bc2d-8f4c-b40b-25f62ece8666\",\n  \"modules\": [\n    {\n      \"path\": [\n        \"root\"\n      ],\n      \"outputs\": {},\n      \"resources\": {\n        \"google_compute_firewall.resource-id\": {\n          \"type\": \"google_compute_firewall\",\n          \"depends_on\": [],\n          \"primary\": {\n            \"id\": \"resource-id\",\n            \"attributes\": {\n              \"direction\": \"INGRESS\",\n              \"enable_logging\": \"false\",\n              \"ignored\": \"no value\",\n              \"more.3.regex\": \"no value\",\n              \"id\": \"resource-id\",\n              \"name\": \"resource-name\"\n            },\n            \"meta\": {\n              \"schema_version\": \"1\"\n            },\n            \"tainted\": false\n          },\n          \"deposed\": [],\n          \"provider\": \"provider.google\"\n        }\n      }\n    }\n  ]\n}"
  },
  {
    "path": "terraformutils/test_data/test8.json",
    "content": "{\n  \"version\": 3,\n  \"terraform_version\": \"0.11.10\",\n  \"serial\": 3,\n  \"lineage\": \"11c0e8e7-bc2d-8f4c-b40b-25f62ece8666\",\n  \"modules\": [\n    {\n      \"path\": [\n        \"root\"\n      ],\n      \"outputs\": {},\n      \"resources\": {\n        \"google_compute_firewall.resource-id\": {\n          \"type\": \"google_compute_firewall\",\n          \"depends_on\": [],\n          \"primary\": {\n            \"id\": \"resource-id\",\n            \"attributes\": {\n              \"direction\": \"INGRESS\",\n              \"enable_logging\": \"false\",\n              \"id\": \"resource-id\",\n              \"name\": \"resource-name\",\n              \"allow_empty\": \"\",\n              \"not_allow_empty\": \"\",\n              \"boolval\": \"false\",\n              \"intval\": \"124\"\n            },\n            \"meta\": {\n              \"schema_version\": \"1\"\n            },\n            \"tainted\": false\n          },\n          \"deposed\": [],\n          \"provider\": \"provider.google\"\n        }\n      }\n    }\n  ]\n}"
  },
  {
    "path": "terraformutils/test_data/test9.json",
    "content": "{\n  \"version\": 3,\n  \"terraform_version\": \"0.11.10\",\n  \"serial\": 3,\n  \"lineage\": \"11c0e8e7-bc2d-8f4c-b40b-25f62ece8666\",\n  \"modules\": [\n    {\n      \"path\": [\n        \"root\"\n      ],\n      \"outputs\": {},\n      \"resources\": {\n        \"google_compute_firewall.resource-id\": {\n          \"type\": \"google_compute_firewall\",\n          \"depends_on\": [],\n          \"primary\": {\n            \"id\": \"resource-id\",\n            \"attributes\": {\n              \"direction\": \"INGRESS\",\n              \"enable_logging\": \"false\",\n              \"id\": \"resource-id\",\n              \"name\": \"resource-name\",\n              \"allow_empty\": \"\",\n              \"not_allow_empty\": \"\",\n              \"boolval\": \"false\",\n              \"intval\": \"124\"\n            },\n            \"meta\": {\n              \"schema_version\": \"1\"\n            },\n            \"tainted\": false\n          },\n          \"deposed\": [],\n          \"provider\": \"provider.google\"\n        }\n      }\n    }\n  ]\n}"
  },
  {
    "path": "terraformutils/tfstate_converter_test.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage terraformutils\n\n/*\nimport (\n\t\"testing\"\n\n\t\"github.com/stretchr/testify/assert\"\n)\n\ntype convertTest struct {\n\tname         string\n\tdataFilePath string\n\texpect       []TerraformResource\n\tmetaData     map[string]ResourceMetaData\n}\n\nfunc TestBasicConvert(t *testing.T) {\n\trunConvert(convertTest{\n\t\tdataFilePath: \"test1.json\",\n\t\tname:         \"basic tfstate\",\n\t\texpect: []TerraformResource{\n\t\t\t{\n\t\t\t\tServiceName: \"resource-id\",\n\t\t\t\tResourceType: \"google_compute_firewall\",\n\t\t\t\tID:           \"resource-id\",\n\t\t\t\tItem: map[string]interface{}{\n\t\t\t\t\t\"direction\":      \"INGRESS\",\n\t\t\t\t\t\"enable_logging\": false,\n\t\t\t\t\t\"id\":             \"resource-id\",\n\t\t\t\t\t\"name\":           \"resource-name\",\n\t\t\t\t},\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t\tmetaData: map[string]ResourceMetaData{\n\t\t\t\"resource-id\": {\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t}, t)\n}\n\nfunc TestBasicIgnoreKeyConvert(t *testing.T) {\n\trunConvert(convertTest{\n\t\tdataFilePath: \"test7.json\",\n\t\tname:         \"basic tfstate\",\n\t\texpect: []TerraformResource{\n\t\t\t{\n\t\t\t\tServiceName: \"resource-id\",\n\t\t\t\tResourceType: \"google_compute_firewall\",\n\t\t\t\tID:           \"resource-id\",\n\t\t\t\tItem: map[string]interface{}{\n\t\t\t\t\t\"direction\":      \"INGRESS\",\n\t\t\t\t\t\"enable_logging\": false,\n\t\t\t\t\t\"id\":             \"resource-id\",\n\t\t\t\t\t\"name\":           \"resource-name\",\n\t\t\t\t},\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t\tmetaData: map[string]ResourceMetaData{\n\t\t\t\"resource-id\": {\n\t\t\t\tProvider: \"google\",\n\t\t\t\tIgnoreKeys: map[string]bool{\n\t\t\t\t\t\"ignored\":          true,\n\t\t\t\t\t\"more.[0-9].regex\": true,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}, t)\n}\n\nfunc TestBasicAllowEmptyConvert(t *testing.T) {\n\trunConvert(convertTest{\n\t\tdataFilePath: \"test8.json\",\n\t\tname:         \"basic tfstate\",\n\t\texpect: []TerraformResource{\n\t\t\t{\n\t\t\t\tServiceName: \"resource-id\",\n\t\t\t\tResourceType: \"google_compute_firewall\",\n\t\t\t\tID:           \"resource-id\",\n\t\t\t\tItem: map[string]interface{}{\n\t\t\t\t\t\"direction\":      \"INGRESS\",\n\t\t\t\t\t\"enable_logging\": false,\n\t\t\t\t\t\"id\":             \"resource-id\",\n\t\t\t\t\t\"name\":           \"resource-name\",\n\t\t\t\t\t\"allow_empty\":    \"\",\n\t\t\t\t\t\"boolval\":        false,\n\t\t\t\t\t\"intval\":         \"124\",\n\t\t\t\t},\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t\tmetaData: map[string]ResourceMetaData{\n\t\t\t\"resource-id\": {\n\t\t\t\tProvider:        \"google\",\n\t\t\t\tAllowEmptyValue: map[string]bool{\"^allow_empty$\": true},\n\t\t\t},\n\t\t},\n\t}, t)\n}\n\nfunc TestBasicAdditionalFieldsConvert(t *testing.T) {\n\trunConvert(convertTest{\n\t\tdataFilePath: \"test9.json\",\n\t\tname:         \"basic tfstate\",\n\t\texpect: []TerraformResource{\n\t\t\t{\n\t\t\t\tServiceName: \"resource-id\",\n\t\t\t\tResourceType: \"google_compute_firewall\",\n\t\t\t\tID:           \"resource-id\",\n\t\t\t\tItem: map[string]interface{}{\n\t\t\t\t\t\"direction\":      \"INGRESS\",\n\t\t\t\t\t\"enable_logging\": false,\n\t\t\t\t\t\"id\":             \"resource-id\",\n\t\t\t\t\t\"name\":           \"resource-name\",\n\t\t\t\t\t\"boolval\":        false,\n\t\t\t\t\t\"intval\":         \"124\",\n\t\t\t\t\t\"add_me\":         \"value\",\n\t\t\t\t},\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t\tmetaData: map[string]ResourceMetaData{\n\t\t\t\"resource-id\": {\n\t\t\t\tProvider:         \"google\",\n\t\t\t\tAdditionalFields: map[string]string{\"add_me\": \"value\"},\n\t\t\t},\n\t\t},\n\t}, t)\n}\n\nfunc TestBasicTfstate2(t *testing.T) {\n\trunConvert(convertTest{\n\t\tdataFilePath: \"test2.json\",\n\t\tname:         \"basic tfstate 2\",\n\t\texpect: []TerraformResource{\n\t\t\t{\n\t\t\t\tServiceName: \"resource-idA\",\n\t\t\t\tResourceType: \"google_compute_firewall\",\n\t\t\t\tID:           \"resource-idA\",\n\t\t\t\tItem: map[string]interface{}{\n\t\t\t\t\t\"direction\":      \"INGRESS\",\n\t\t\t\t\t\"enable_logging\": false,\n\t\t\t\t\t\"id\":             \"resource-idA\",\n\t\t\t\t\t\"name\":           \"resource-nameA\",\n\t\t\t\t},\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tServiceName: \"resource-idB\",\n\t\t\t\tResourceType: \"google_compute_firewall\",\n\t\t\t\tID:           \"resource-idB\",\n\t\t\t\tItem: map[string]interface{}{\n\t\t\t\t\t\"direction\":      \"INGRESS\",\n\t\t\t\t\t\"enable_logging\": false,\n\t\t\t\t\t\"id\":             \"resource-idB\",\n\t\t\t\t\t\"name\":           \"resource-nameB\",\n\t\t\t\t},\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t\tmetaData: map[string]ResourceMetaData{\n\t\t\t\"resource-idB\": {\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t\t\"resource-idA\": {\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t}, t)\n}\n\nfunc TestBasicArray(t *testing.T) {\n\trunConvert(convertTest{\n\t\tdataFilePath: \"test3.json\",\n\t\tname:         \"basic array\",\n\t\texpect: []TerraformResource{\n\t\t\t{\n\t\t\t\tServiceName: \"resource-id\",\n\t\t\t\tResourceType: \"google_compute_firewall\",\n\t\t\t\tID:           \"resource-id\",\n\t\t\t\tItem: map[string]interface{}{\n\t\t\t\t\t\"direction\":      \"INGRESS\",\n\t\t\t\t\t\"enable_logging\": false,\n\t\t\t\t\t\"id\":             \"resource-id\",\n\t\t\t\t\t\"name\":           \"resource-name\",\n\t\t\t\t\t\"myarray\": []interface{}{\n\t\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\t\"value1\": \"value1\",\n\t\t\t\t\t\t\t\"value2\": \"value2\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\t\"value3\": \"value3\",\n\t\t\t\t\t\t\t\"value4\": \"value4\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t\tmetaData: map[string]ResourceMetaData{\n\t\t\t\"resource-id\": {\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t}, t)\n}\n\nfunc TestBasicArray2(t *testing.T) {\n\trunConvert(convertTest{\n\t\tdataFilePath: \"test4.json\",\n\t\tname:         \"basic array 2\",\n\t\texpect: []TerraformResource{\n\t\t\t{\n\t\t\t\tServiceName: \"resource-id\",\n\t\t\t\tResourceType: \"google_compute_firewall\",\n\t\t\t\tID:           \"resource-id\",\n\t\t\t\tItem: map[string]interface{}{\n\t\t\t\t\t\"direction\":      \"INGRESS\",\n\t\t\t\t\t\"enable_logging\": false,\n\t\t\t\t\t\"id\":             \"resource-id\",\n\t\t\t\t\t\"name\":           \"resource-name\",\n\t\t\t\t\t\"myarray\": []interface{}{\n\t\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\t\"subarray1\": map[string]interface{}{\n\t\t\t\t\t\t\t\t\"1245\":  \"value1\",\n\t\t\t\t\t\t\t\t\"12454\": \"value2\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\t\"subarray3\": map[string]interface{}{\"123456\": \"value3\"},\n\t\t\t\t\t\t\t\"subarray4\": \"value4\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t\tmetaData: map[string]ResourceMetaData{\n\t\t\t\"resource-id\": {\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t}, t)\n}\n\nfunc TestBasicArray3(t *testing.T) {\n\trunConvert(convertTest{\n\t\tdataFilePath: \"test5.json\",\n\t\tname:         \"basic array 3\",\n\t\texpect: []TerraformResource{\n\t\t\t{\n\t\t\t\tServiceName: \"resource-id\",\n\t\t\t\tResourceType: \"google_compute_firewall\",\n\t\t\t\tID:           \"resource-id\",\n\t\t\t\tItem: map[string]interface{}{\n\t\t\t\t\t\"direction\":      \"INGRESS\",\n\t\t\t\t\t\"enable_logging\": false,\n\t\t\t\t\t\"id\":             \"resource-id\",\n\t\t\t\t\t\"name\":           \"resource-name\",\n\t\t\t\t\t\"myarray\":        []interface{}{\"value1\", \"value2\", \"value3\"},\n\t\t\t\t\t\"myarray2\": []interface{}{\n\t\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\t\"subarray3\": map[string]interface{}{\n\t\t\t\t\t\t\t\t\"123456\": map[string]interface{}{\n\t\t\t\t\t\t\t\t\t\"subsubarray\": \"value3\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\t\"subarray4\": \"value4\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t\tmetaData: map[string]ResourceMetaData{\n\t\t\t\"resource-id\": {\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t}, t)\n}\n\nfunc TestBasicArray4(t *testing.T) {\n\trunConvert(convertTest{\n\t\tdataFilePath: \"test6.json\",\n\t\tname:         \"basic array 4\",\n\t\texpect: []TerraformResource{\n\t\t\t{\n\t\t\t\tServiceName: \"resource-id\",\n\t\t\t\tResourceType: \"google_compute_firewall\",\n\t\t\t\tID:           \"resource-id\",\n\t\t\t\tItem: map[string]interface{}{\n\t\t\t\t\t\"direction\":      \"INGRESS\",\n\t\t\t\t\t\"enable_logging\": false,\n\t\t\t\t\t\"id\":             \"resource-id\",\n\t\t\t\t\t\"name\":           \"resource-name\",\n\t\t\t\t\t\"lifecycle_rule\": []interface{}{\n\t\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\t\"action\": []interface{}{\n\t\t\t\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\t\t\t\"storage_class\": \"\",\n\t\t\t\t\t\t\t\t\t\"type\":          \"Delete\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"condition\": []interface{}{\n\t\t\t\t\t\t\t\tmap[string]interface{}{\n\t\t\t\t\t\t\t\t\t\"age\":                \"1\",\n\t\t\t\t\t\t\t\t\t\"created_before\":     \"\",\n\t\t\t\t\t\t\t\t\t\"is_live\":            false,\n\t\t\t\t\t\t\t\t\t\"num_newer_versions\": \"0\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tProvider: \"google\",\n\t\t\t},\n\t\t},\n\t\tmetaData: map[string]ResourceMetaData{\n\t\t\t\"resource-id\": {\n\t\t\t\tProvider: \"google\",\n\t\t\t\tAllowEmptyValue: map[string]bool{\n\t\t\t\t\t\"storage_class\":  true,\n\t\t\t\t\t\"created_before\": true,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}, t)\n}\n\nfunc runConvert(testCase convertTest, t *testing.T) {\n\tc := TfstateConverter{}\n\tactual, err := c.Convert(\"test_data/\"+testCase.dataFilePath, testCase.metaData)\n\tif err != nil {\n\t\tt.Error(err)\n\t}\n\tif !assert.ObjectsAreEqual(testCase.expect, actual) {\n\t\tassert.Equal(t, testCase.expect, actual, \"Convert error \"+testCase.name)\n\t}\n}\n*/\n"
  },
  {
    "path": "terraformutils/utils.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage terraformutils\n\nimport (\n\t\"bytes\"\n\t\"log\"\n\t\"sync\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils/providerwrapper\"\n\n\t\"github.com/hashicorp/terraform/terraform\"\n)\n\ntype BaseResource struct {\n\tTags map[string]string `json:\"tags,omitempty\"`\n}\n\nfunc NewTfState(resources []Resource) *terraform.State {\n\ttfstate := &terraform.State{\n\t\tVersion:   terraform.StateVersion,\n\t\tTFVersion: terraform.VersionString(), //nolint\n\t\tSerial:    1,\n\t}\n\toutputs := map[string]*terraform.OutputState{}\n\tfor _, r := range resources {\n\t\tfor k, v := range r.Outputs {\n\t\t\toutputs[k] = v\n\t\t}\n\t}\n\ttfstate.Modules = []*terraform.ModuleState{\n\t\t{\n\t\t\tPath:      []string{\"root\"},\n\t\t\tResources: map[string]*terraform.ResourceState{},\n\t\t\tOutputs:   outputs,\n\t\t},\n\t}\n\tfor _, resource := range resources {\n\t\tresourceState := &terraform.ResourceState{\n\t\t\tType:     resource.InstanceInfo.Type,\n\t\t\tPrimary:  resource.InstanceState,\n\t\t\tProvider: \"provider.\" + resource.Provider,\n\t\t}\n\t\ttfstate.Modules[0].Resources[resource.InstanceInfo.Type+\".\"+resource.ResourceName] = resourceState\n\t}\n\treturn tfstate\n}\n\nfunc PrintTfState(resources []Resource) ([]byte, error) {\n\tstate := NewTfState(resources)\n\tvar buf bytes.Buffer\n\terr := terraform.WriteState(state, &buf)\n\treturn buf.Bytes(), err\n}\n\nfunc RefreshResources(resources []*Resource, provider *providerwrapper.ProviderWrapper, slowProcessingResources [][]*Resource) ([]*Resource, error) {\n\trefreshedResources := []*Resource{}\n\tinput := make(chan *Resource, len(resources))\n\tvar wg sync.WaitGroup\n\tpoolSize := 15\n\tfor i := range resources {\n\t\twg.Add(1)\n\t\tinput <- resources[i]\n\t}\n\tclose(input)\n\n\tfor i := 0; i < poolSize; i++ {\n\t\tgo RefreshResourceWorker(input, &wg, provider)\n\t}\n\n\tspInputs := []chan *Resource{}\n\tfor i, resourceGroup := range slowProcessingResources {\n\t\tspInputs = append(spInputs, make(chan *Resource, len(resourceGroup)))\n\t\tfor j := range resourceGroup {\n\t\t\tspInputs[i] <- resourceGroup[j]\n\t\t}\n\t\tclose(spInputs[i])\n\t}\n\n\tfor i := 0; i < len(spInputs); i++ {\n\t\twg.Add(len(slowProcessingResources[i]))\n\t\tgo RefreshResourceWorker(spInputs[i], &wg, provider)\n\t}\n\n\twg.Wait()\n\tfor _, r := range resources {\n\t\tif r.InstanceState != nil && r.InstanceState.ID != \"\" {\n\t\t\trefreshedResources = append(refreshedResources, r)\n\t\t} else {\n\t\t\tlog.Printf(\"ERROR: Unable to refresh resource %s\", r.ResourceName)\n\t\t}\n\t}\n\n\tfor _, resourceGroup := range slowProcessingResources {\n\t\tfor i := range resourceGroup {\n\t\t\tr := resourceGroup[i]\n\t\t\tif r.InstanceState != nil && r.InstanceState.ID != \"\" {\n\t\t\t\trefreshedResources = append(refreshedResources, r)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"ERROR: Unable to refresh resource %s\", r.ResourceName)\n\t\t\t}\n\t\t}\n\t}\n\treturn refreshedResources, nil\n}\n\nfunc RefreshResourcesByProvider(providersMapping *ProvidersMapping, providerWrapper *providerwrapper.ProviderWrapper) error {\n\tallResources := providersMapping.ShuffleResources()\n\tslowProcessingResources := make(map[ProviderGenerator][]*Resource)\n\tregularResources := []*Resource{}\n\tfor i := range allResources {\n\t\tresource := allResources[i]\n\t\tif resource.SlowQueryRequired {\n\t\t\tprovider := providersMapping.MatchProvider(resource)\n\t\t\tif slowProcessingResources[provider] == nil {\n\t\t\t\tslowProcessingResources[provider] = []*Resource{}\n\t\t\t}\n\t\t\tslowProcessingResources[provider] = append(slowProcessingResources[provider], resource)\n\t\t} else {\n\t\t\tregularResources = append(regularResources, resource)\n\t\t}\n\t}\n\n\tvar spResourcesList [][]*Resource\n\tfor p := range slowProcessingResources {\n\t\tspResourcesList = append(spResourcesList, slowProcessingResources[p])\n\t}\n\n\trefreshedResources, err := RefreshResources(regularResources, providerWrapper, spResourcesList)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprovidersMapping.SetResources(refreshedResources)\n\treturn nil\n}\n\nfunc RefreshResourceWorker(input chan *Resource, wg *sync.WaitGroup, provider *providerwrapper.ProviderWrapper) {\n\tfor r := range input {\n\t\tlog.Println(\"Refreshing state...\", r.InstanceInfo.Id)\n\t\tr.Refresh(provider)\n\t\twg.Done()\n\t}\n}\n\nfunc IgnoreKeys(resourcesTypes []string, p *providerwrapper.ProviderWrapper) map[string][]string {\n\treadOnlyAttributes, err := p.GetReadOnlyAttributes(resourcesTypes)\n\tif err != nil {\n\t\tlog.Println(\"plugin error 2:\", err)\n\t\treturn map[string][]string{}\n\t}\n\treturn readOnlyAttributes\n}\n\nfunc ParseFilterValues(value string) []string {\n\tvar values []string\n\n\tvalueBuffering := true\n\twrapped := false\n\tvar valueBuffer []byte\n\tfor i := 0; i < len(value); i++ {\n\t\tif value[i] == '\\'' {\n\t\t\twrapped = !wrapped\n\t\t\tcontinue\n\t\t} else if value[i] == ':' {\n\t\t\tif len(valueBuffer) == 0 {\n\t\t\t\tcontinue\n\t\t\t} else if valueBuffering && !wrapped {\n\t\t\t\tvalues = append(values, string(valueBuffer))\n\t\t\t\tvalueBuffering = false\n\t\t\t\tvalueBuffer = []byte{}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tvalueBuffering = true\n\t\tvalueBuffer = append(valueBuffer, value[i])\n\t}\n\tif len(valueBuffer) > 0 {\n\t\tvalues = append(values, string(valueBuffer))\n\t}\n\n\treturn values\n}\n\nfunc FilterCleanup(s *Service, isInitial bool) {\n\tif len(s.Filter) == 0 {\n\t\treturn\n\t}\n\tvar newListOfResources []Resource\n\tfor _, resource := range s.Resources {\n\t\tallPredicatesTrue := true\n\t\tfor _, filter := range s.Filter {\n\t\t\tif filter.isInitial() == isInitial {\n\t\t\t\tallPredicatesTrue = allPredicatesTrue && filter.Filter(resource)\n\t\t\t}\n\t\t}\n\t\tif allPredicatesTrue && !ContainsResource(newListOfResources, resource) {\n\t\t\tnewListOfResources = append(newListOfResources, resource)\n\t\t}\n\t}\n\ts.Resources = newListOfResources\n}\n\nfunc ContainsResource(s []Resource, e Resource) bool {\n\tfor _, a := range s {\n\t\tif a.InstanceInfo.Id == e.InstanceInfo.Id {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n"
  },
  {
    "path": "terraformutils/walk.go",
    "content": "// Copyright 2019 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage terraformutils\n\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"strings\"\n)\n\nfunc WalkAndGet(path string, data interface{}) []interface{} {\n\t_, values := walkAndGet(path, data)\n\treturn values\n}\nfunc WalkAndCheckField(path string, data interface{}) bool {\n\thasField, _ := walkAndGet(path, data)\n\treturn hasField\n}\n\nfunc WalkAndOverride(path, oldValue, newValue string, data interface{}) {\n\tpathSegments := strings.Split(path, \".\")\n\twalkAndOverride(pathSegments, oldValue, newValue, data)\n}\n\nfunc walkAndGet(path string, data interface{}) (bool, []interface{}) {\n\tval := reflect.ValueOf(data)\n\n\tif data == nil {\n\t\tif path == \"\" {\n\t\t\treturn true, []interface{}{}\n\t\t}\n\t\treturn false, []interface{}{}\n\t}\n\n\tif isArray(val.Interface()) {\n\t\tvar arrayValues []interface{}\n\t\tfor i := 0; i < val.Len(); i++ {\n\t\t\tfoundField, fieldValue := walkAndGet(path, val.Index(i).Interface())\n\t\t\tif foundField {\n\t\t\t\tarrayValues = append(arrayValues, fieldValue...)\n\t\t\t}\n\t\t}\n\t\treturn len(arrayValues) > 0, arrayValues\n\t}\n\n\tif val.Kind() == reflect.Map {\n\t\tfor _, e := range val.MapKeys() {\n\t\t\tv := val.MapIndex(e)\n\t\t\tpathFirstElement := strings.SplitN(path, \".\", 2)\n\t\t\tif e.String() == pathFirstElement[0] {\n\t\t\t\tvar pathReminder = \"\"\n\t\t\t\tif len(pathFirstElement) > 1 {\n\t\t\t\t\tpathReminder = pathFirstElement[1]\n\t\t\t\t}\n\t\t\t\thasField, value := walkAndGet(pathReminder, v.Interface())\n\t\t\t\tif !hasField {\n\t\t\t\t\thasField, value = walkAndGet(path, v.Interface())\n\t\t\t\t}\n\t\t\t\treturn hasField, value\n\t\t\t} else if e.String() == path {\n\t\t\t\treturn walkAndGet(\"\", v.Interface())\n\t\t\t}\n\t\t}\n\t}\n\n\tif val.Kind() == reflect.String && path == \"\" {\n\t\treturn true, []interface{}{val.Interface()}\n\t}\n\n\treturn false, []interface{}{}\n}\n\nfunc walkAndOverride(pathSegments []string, oldValue, newValue string, data interface{}) {\n\tval := reflect.ValueOf(data)\n\tswitch {\n\tcase isArray(val.Interface()):\n\t\tfor i := 0; i < val.Len(); i++ {\n\t\t\tarrayValue := val.Index(i).Interface()\n\t\t\twalkAndOverride(pathSegments, oldValue, newValue, arrayValue)\n\t\t}\n\tcase len(pathSegments) == 1:\n\t\tif val.Kind() == reflect.Map {\n\t\t\tfor _, e := range val.MapKeys() {\n\t\t\t\tv := val.MapIndex(e)\n\t\t\t\tif e.String() == pathSegments[0] {\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase isArray(v.Interface()):\n\t\t\t\t\t\tvalss := v.Interface().([]interface{})\n\t\t\t\t\t\tfor idx, currentValue := range valss {\n\t\t\t\t\t\t\tcurValString, ok := currentValue.(string)\n\t\t\t\t\t\t\tif ok && oldValue == curValString {\n\t\t\t\t\t\t\t\tvalss[idx] = newValue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif !ok {\n\t\t\t\t\t\t\t\tfmt.Printf(\"Warning: expected string at path: %s, but found: %+v\\n\", e.String(), currentValue)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tcase isStringArray(v.Interface()):\n\t\t\t\t\t\tvalss := v.Interface().([]string)\n\t\t\t\t\t\tfor idx, currentValue := range valss {\n\t\t\t\t\t\t\tif oldValue == currentValue {\n\t\t\t\t\t\t\t\tvalss[idx] = newValue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tcase oldValue == fmt.Sprint(v.Interface()):\n\t\t\t\t\t\tval.Interface().(map[string]interface{})[pathSegments[0]] = newValue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase val.Kind() == reflect.Map:\n\t\tfor _, e := range val.MapKeys() {\n\t\t\tv := val.MapIndex(e)\n\t\t\tif e.String() == pathSegments[0] {\n\t\t\t\twalkAndOverride(pathSegments[1:], oldValue, newValue, v.Interface())\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc isArray(val interface{}) bool { // Go reflect lib can't sometimes detect given value is array\n\tswitch val.(type) {\n\tcase []interface{}:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n\nfunc isStringArray(val interface{}) bool { // to support locally established arrays\n\tswitch val.(type) {\n\tcase []string:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}\n"
  },
  {
    "path": "terraformutils/walk_test.go",
    "content": "package terraformutils\n\nimport (\n\t\"reflect\"\n\t\"testing\"\n)\n\nfunc TestEmptyWalkAndGet(t *testing.T) {\n\tstructure := map[string]interface{}{}\n\tvalue := WalkAndGet(\"attr1\", structure)\n\n\tif !reflect.DeepEqual(value, []interface{}{}) {\n\t\tt.Errorf(\"failed to get value %v\", value)\n\t}\n}\n\nfunc TestEmptyNestedWalkAndGet(t *testing.T) {\n\tstructure := map[string]map[string]interface{}{}\n\tvalue := WalkAndGet(\"attr1.attr2\", structure)\n\n\tif !reflect.DeepEqual(value, []interface{}{}) {\n\t\tt.Errorf(\"failed to get value %v\", value)\n\t}\n}\n\nfunc TestSimpleWalkAndGet(t *testing.T) {\n\tstructure := map[string]interface{}{\n\t\t\"attr1\": \"value\",\n\t}\n\tvalue := WalkAndGet(\"attr1\", structure)\n\n\tif !reflect.DeepEqual(value, []interface{}{\"value\"}) {\n\t\tt.Errorf(\"failed to get value %v\", value)\n\t}\n}\n\nfunc TestSimpleArrayWalkAndGet(t *testing.T) {\n\tstructure := map[string][]interface{}{\n\t\t\"attr1\": {\"value\"},\n\t}\n\tvalue := WalkAndGet(\"attr1\", structure)\n\n\tif !reflect.DeepEqual(value, []interface{}{\"value\"}) {\n\t\tt.Errorf(\"failed to get value %v\", value)\n\t}\n}\n\nfunc TestNestedWalkAndGet(t *testing.T) {\n\tstructure := map[string]map[string]interface{}{\n\t\t\"attr1\": {\n\t\t\t\"attr2\": \"value\",\n\t\t},\n\t}\n\tvalue := WalkAndGet(\"attr1.attr2\", structure)\n\n\tif !reflect.DeepEqual(value, []interface{}{\"value\"}) {\n\t\tt.Errorf(\"failed to get value %v\", value)\n\t}\n}\n\nfunc TestNestedWalkWithDotInKeyAndGet(t *testing.T) {\n\tstructure := map[string]map[string]interface{}{\n\t\t\"attr1\": {\n\t\t\t\"attr2.attr3\": \"value\",\n\t\t},\n\t}\n\tvalue := WalkAndGet(\"attr1.attr2.attr3\", structure)\n\n\tif !reflect.DeepEqual(value, []interface{}{\"value\"}) {\n\t\tt.Errorf(\"failed to get value %v\", value)\n\t}\n}\n\nfunc TestNestedArrayWalkAndGet(t *testing.T) {\n\tstructure := mapI(\"attr1\", []interface{}{\n\t\tmapI(\"attr2\", \"value1\"),\n\t\tmapI(\"attr2\", \"value2\")})\n\tvalue := WalkAndGet(\"attr1.attr2\", structure)\n\n\tif !reflect.DeepEqual(value, []interface{}{\"value1\", \"value2\"}) {\n\t\tt.Errorf(\"failed to get value %v\", value)\n\t}\n}\n\nfunc TestNonExistingWalkAndGet(t *testing.T) {\n\tstructure := map[string]interface{}{\n\t\t\"attr1\": \"test\",\n\t}\n\tvalue := WalkAndGet(\"attr1.attr2\", structure)\n\n\tif !reflect.DeepEqual(value, []interface{}{}) {\n\t\tt.Errorf(\"failed to get value %v\", value)\n\t}\n}\n\nfunc TestSimpleWalkAndOverride(t *testing.T) {\n\tstructure := map[string]interface{}{\n\t\t\"attr1\": \"value\",\n\t}\n\tWalkAndOverride(\"attr1\", \"value\", \"newValue\", structure)\n\n\tif structure[\"attr1\"] != \"newValue\" {\n\t\tt.Errorf(\"failed to set value\")\n\t}\n}\n\nfunc TestSimpleArrayWalkAndOverride(t *testing.T) {\n\tstructure := map[string][]interface{}{\n\t\t\"attr1\": {\"value\"},\n\t}\n\tWalkAndOverride(\"attr1\", \"value\", \"newValue\", structure)\n\n\tif structure[\"attr1\"][0] != \"newValue\" {\n\t\tt.Errorf(\"failed to set value\")\n\t}\n}\n\nfunc TestSimpleWalkAndNotOverride(t *testing.T) {\n\tstructure := map[string]interface{}{\n\t\t\"attr1\": \"value\",\n\t}\n\tWalkAndOverride(\"attr1\", \"differentValue\", \"newValue\", structure)\n\n\tif structure[\"attr1\"] != \"value\" {\n\t\tt.Errorf(\"failed to set value\")\n\t}\n}\n\nfunc TestNonExistentWalkAndOverride(t *testing.T) {\n\tstructure := map[string]interface{}{\n\t\t\"attr1\": \"value\",\n\t}\n\tWalkAndOverride(\"attr1.nonExistentAttr\", \"value\", \"newValue\", structure)\n\n\t_, exists := structure[\"nonExistentAttr\"]\n\tif exists {\n\t\tt.Errorf(\"failed to set value\")\n\t}\n}\n\nfunc TestNestedWalkAndOverride(t *testing.T) {\n\tstructure := map[string]map[string]interface{}{\n\t\t\"attr1\": {\n\t\t\t\"attr2\": \"value\",\n\t\t},\n\t}\n\tWalkAndOverride(\"attr1.attr2\", \"value\", \"newValue\", structure)\n\n\tif structure[\"attr1\"][\"attr2\"] != \"newValue\" {\n\t\tt.Errorf(\"failed to set value\")\n\t}\n}\n\nfunc TestNestedArrayWalkAndOverride(t *testing.T) {\n\tstructure := mapI(\"attr1\", []interface{}{\n\t\tmapI(\"attr2\", \"value1\"),\n\t\tmapI(\"attr2\", \"value2\")})\n\tWalkAndOverride(\"attr1.attr2\", \"value2\", \"newValue\", structure)\n\n\tif structure[\"attr1\"].([]interface{})[0].(map[string]interface{})[\"attr2\"] != \"value1\" || structure[\"attr1\"].([]interface{})[1].(map[string]interface{})[\"attr2\"] != \"newValue\" {\n\t\tt.Errorf(\"failed to set value\")\n\t}\n}\n\nfunc TestNestedMapWalkAndOverride(t *testing.T) {\n\tstructure := mapI(\"x\", []interface{}{\n\t\tmapI(\"y\", mapI(\"z\", \"42\")),\n\t})\n\tWalkAndOverride(\"z.y\", \"z\", \"newValue\", structure)\n\n\texpected := mapI(\"x\", []interface{}{\n\t\tmapI(\"y\", mapI(\"z\", \"42\")),\n\t})\n\tif !reflect.DeepEqual(structure, expected) {\n\t\tt.Errorf(\"failed to set value\")\n\t}\n}\n\nfunc TestEmptyWalkAndCheckField(t *testing.T) {\n\tstructure := map[string]interface{}{}\n\tvalue := WalkAndCheckField(\"attr1\", structure)\n\n\tif !reflect.DeepEqual(value, false) {\n\t\tt.Errorf(\"failed to get value %v\", value)\n\t}\n}\n\nfunc TestSimpleWalkAndCheckField(t *testing.T) {\n\tstructure := map[string]interface{}{\n\t\t\"attr1\": \"value\",\n\t}\n\tvalue := WalkAndCheckField(\"attr1\", structure)\n\n\tif !reflect.DeepEqual(value, true) {\n\t\tt.Errorf(\"failed to get value %v\", value)\n\t}\n}\n"
  },
  {
    "path": "tests/aws/main.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"os/exec\"\n\t\"time\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/cmd\"\n\taws_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/aws\"\n)\n\nfunc main() {\n\ttCommand := cmd.NewCmdRoot()\n\tpathPattern := \"{output}/{provider}/\"\n\ttCommand.SetArgs([]string{\n\t\t\"import\",\n\t\t\"aws\",\n\t\t\"--regions=ap-southeast-1\",\n\t\t\"--resources=ssm\",\n\t\t\"--profile=personal\",\n\t\t\"--verbose\",\n\t\t\"--compact\",\n\t\t\"--path-pattern=\" + pathPattern,\n\t})\n\tstart := time.Now()\n\tif err := tCommand.Execute(); err != nil {\n\t\tlog.Println(err)\n\t\tos.Exit(1)\n\t}\n\tlog.Printf(\"Importing took %s\", time.Since(start))\n\tstart = time.Now()\n\trunTerraform(pathPattern)\n\tlog.Printf(\"Terraform init + plan took %s\", time.Since(start))\n}\n\nfunc runTerraform(pathPattern string) {\n\trootPath, _ := os.Getwd()\n\tprovider := &aws_terraforming.AWSProvider{}\n\n\tcurrentPath := cmd.Path(pathPattern, provider.GetName(), \"\", cmd.DefaultPathOutput)\n\tif err := os.Chdir(currentPath); err != nil {\n\t\tlog.Println(err)\n\t\tos.Exit(1)\n\t}\n\ttfCmd := exec.Command(\"sh\", \"-c\", \"terraform init && terraform plan\")\n\ttfCmd.Stdout = os.Stdout\n\ttfCmd.Stderr = os.Stderr\n\terr := tfCmd.Run()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tos.Exit(1)\n\t}\n\terr = os.Chdir(rootPath)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}\n"
  },
  {
    "path": "tests/commercetools/main.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"os/exec\"\n\t\"sort\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/cmd\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\tcommercetools_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/commercetools\"\n)\n\nconst command = \"terraform init && terraform plan\"\n\nfunc main() {\n\tclientID := os.Getenv(\"CTP_CLIENT_ID\")\n\tclientScope := os.Getenv(\"CTP_CLIENT_SCOPE\")\n\tclientSecret := os.Getenv(\"CTP_CLIENT_SECRET\")\n\tprojectKey := os.Getenv(\"CTP_PROJECT_KEY\")\n\tbaseURL := \"https://api.sphere.io\"\n\ttokenURL := \"https://auth.sphere.io\"\n\n\tservices := []string{}\n\tprovider := &commercetools_terraforming.CommercetoolsProvider{}\n\tfor service := range provider.GetSupportedService() {\n\t\tservices = append(services, service)\n\t}\n\tsort.Strings(services)\n\tprovider = &commercetools_terraforming.CommercetoolsProvider{\n\t\tProvider: terraformutils.Provider{},\n\t}\n\terr := cmd.Import(provider, cmd.ImportOptions{\n\t\tResources:   services,\n\t\tPathPattern: cmd.DefaultPathPattern,\n\t\tPathOutput:  cmd.DefaultPathOutput,\n\t\tState:       \"local\",\n\t\tConnect:     true,\n\t}, []string{clientID, clientScope, clientSecret, projectKey, baseURL, tokenURL})\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tos.Exit(1)\n\t}\n\trootPath, _ := os.Getwd()\n\tfor _, serviceName := range services {\n\t\tcurrentPath := cmd.Path(cmd.DefaultPathPattern, provider.GetName(), serviceName, cmd.DefaultPathOutput)\n\t\tif err := os.Chdir(currentPath); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tcmd := exec.Command(\"sh\", \"-c\", command)\n\t\tcmd.Stdout = os.Stdout\n\t\tcmd.Stderr = os.Stderr\n\t\terr = cmd.Run()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\terr := os.Chdir(rootPath)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "tests/datadog/README.md",
    "content": "# Testing the Datadog provider \n\nThe CLI script provided is used to test importing Datadog resources with terraformer. The tool will create resources using Terraform CLI and import them using terraformer. The imported resources will be stored in the `generated/` directory.\n\n_Note_: The script will create and destroy real resources. Never run this on a production Datadog organization.\n\n### Requirements \n* terraform version >= 0.12.x\n\n### Script usage\n\n**Terraform 0.12.x**\n\nRun the script from the projects root directory:\n\n```\ngo run ./tests/datadog/\n``` \n\n- Test should run successfully without exiting\n\n**Terraform 0.13.x**\n\nRun the script from the projects root directory and pass the terraform version using DATADOG_TF_VERSION env var:\n\n```\nDATADOG_TF_VERSION=0.13.x LOG_CMD_OUTPUT=true go run ./tests/datadog/\n```\n- Terraformer currently generates resources using terraform version 0.12.29 and HCLv1 standards. When using terraform version 0.13.x, the script will fail due to `outputs` diffs when running `terraform plan` on the generated resources. This is due to differences in how outputs are references in state files.\n\n- Manually ensure that generated diffs are regarding outputs only. E.g:\n\n```\nPlan: 0 to add, 0 to change, 0 to destroy.\n\nChanges to Outputs:\n    ~ datadog_dashboard_tfer--dashboard_gwh-002D-a7r-002D-cfs_id = \"<resource-ID>\" -> \"datadog_dashboard.tfer--dashboard_gwh-002D-a7r-002D-cfs.id\"\n```\n\n##### Available configuration options\n\n| Configuration Options     | Description        |\n| -------------             |:-------------      |\n| **DD_TEST_CLIENT_API_KEY**    | Datadog api key      |\n| **DD_TEST_CLIENT_APP_KEY**    | Datadog APP key      |\n| **DATADOG_HOST**              | The API Url. if you're working with \"EU\" version of Datadog, use `https://api.datadoghq.eu/`. Default: `https://api.datadoghq.com/`      |\n| **DATADOG_TF_VERSION**        | Terraform version installed. Pass the terraform version number if using Terraform version >= 0.13.x      |\n| **DATADOG_TERRAFORM_TARGET**    | Colon separated list of resource addresses to [target](https://www.terraform.io/docs/commands/plan.html#resource-targeting). Example: `DATADOG_TERRAFORM_TARGET=\"datadog_dashboard.free_dashboard_example:datadog_monitor.monitor_example\"`      |\n| **LOG_CMD_OUTPUT**    | Print outputs to stderr and stdout when running `terraform` commands. Default `false`      |\n\n**Frequently Asked Questions**\n\n```\n2020/10/26 15:08:34 Message: Error while importing resources. Error: fork/exec : no such file or directory\n```\n- Above error indicates that Terraformer is unable to locate the datadog provider executable. Manually pass the dir of the plugin's directory using env var `TF_PLUGIN_DIR`. E.g. `TF_PLUGIN_DIR=~/.terraform.d/`\n"
  },
  {
    "path": "tests/datadog/helper.go",
    "content": "package main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"os/exec\"\n\t\"regexp\"\n\t\"strconv\"\n\t\"strings\"\n\n\tdatadog_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/datadog\"\n)\n\nvar (\n\tcommandTerraformInit       = \"terraform init\"\n\tcommandTerraformPlan       = \"terraform plan -detailed-exitcode\"\n\tcommandTerraformDestroy    = \"terraform destroy -auto-approve\"\n\tcommandTerraformApply      = \"terraform apply -auto-approve\"\n\tcommandTerraformOutput     = \"terraform output\"\n\tcommandTerraformV13Upgrade = \"terraform 0.13upgrade -yes .\"\n\tdatadogResourcesPath       = \"tests/datadog/resources/\"\n)\n\ntype DatadogConfig struct {\n\tapiKey string\n\tappKey string\n\tapiURL string\n}\n\ntype TerraformConfig struct {\n\ttarget string\n}\n\ntype Config struct {\n\tDatadog      DatadogConfig\n\tTerraform    TerraformConfig\n\tlogCMDOutput bool\n\trootPath     string\n\ttfVersion    string\n}\n\nfunc getConfig() (*Config, error) {\n\tlogCMDOutput := false\n\tif envVar := os.Getenv(\"LOG_CMD_OUTPUT\"); envVar != \"\" {\n\t\tlogCMDOutputEnv, err := strconv.ParseBool(envVar)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlogCMDOutput = logCMDOutputEnv\n\t}\n\trootPath, _ := os.Getwd()\n\n\treturn &Config{\n\t\tDatadog: DatadogConfig{\n\t\t\tapiKey: os.Getenv(\"DD_TEST_CLIENT_API_KEY\"),\n\t\t\tappKey: os.Getenv(\"DD_TEST_CLIENT_APP_KEY\"),\n\t\t\tapiURL: os.Getenv(\"DATADOG_HOST\"),\n\t\t},\n\t\tTerraform: TerraformConfig{\n\t\t\ttarget: os.Getenv(\"DATADOG_TERRAFORM_TARGET\"),\n\t\t},\n\t\tlogCMDOutput: logCMDOutput,\n\t\trootPath:     rootPath,\n\t\ttfVersion:    os.Getenv(\"DATADOG_TF_VERSION\"),\n\t}, nil\n}\n\nfunc getAllServices(provider *datadog_terraforming.DatadogProvider) []string {\n\tvar services []string\n\tfor service := range provider.GetSupportedService() {\n\t\tif service == \"timeboard\" {\n\t\t\tcontinue\n\t\t}\n\t\tif service == \"screenboard\" {\n\t\t\tcontinue\n\t\t}\n\t\tservices = append(services, service)\n\t}\n\treturn services\n}\n\nfunc initializeDatadogProvider(cfg *Config) error {\n\t// Initialize the provider\n\tlog.Print(\"Initializing the Datadog provider\")\n\tif err := cmdRun(cfg, []string{commandTerraformInit}); err != nil {\n\t\treturn err\n\t}\n\tlog.Print(\"Successfully initialized  the Datadog provider\")\n\treturn nil\n}\n\nfunc createDatadogResource(cfg *Config) (*map[string][]string, error) {\n\t// Create terraform -target flags if targets are passed\n\tvar terraformTargets []string\n\tif v := cfg.Terraform.target; v != \"\" {\n\t\tvArr := strings.Split(v, \":\")\n\t\tfor _, terraformTarget := range vArr {\n\t\t\tterraformTargetFlag := fmt.Sprintf(\"-target=%s\", terraformTarget)\n\t\t\tterraformTargets = append(terraformTargets, terraformTargetFlag)\n\t\t}\n\t}\n\n\t// Create resources\n\tlog.Print(\"Creating resources\")\n\tif err := cmdRun(cfg, []string{commandTerraformApply, strings.Join(terraformTargets, \" \")}); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get output of created resources and parse the data into a map\n\toutput, err := terraformOutput()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\tresources := parseTerraformOutput(string(output))\n\tlog.Printf(\"Created resources: \\n%s\", string(output))\n\n\treturn resources, nil\n}\n\nfunc terraformOutput() ([]byte, error) {\n\toutput, err := exec.Command(\"sh\", \"-c\", commandTerraformOutput).Output()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\treturn output, nil\n}\n\nfunc terraformPlan(cfg *Config) error {\n\tlog.Print(\"Running terraform plan against resources\")\n\terr := cmdRun(cfg, []string{commandTerraformPlan})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Print(\"terraform plan did not generate diffs\")\n\treturn nil\n}\n\nfunc destroyDatadogResources(cfg *Config) error {\n\t// Destroy created resources in the /tests/datadog/resources directory\n\terr := os.Chdir(cfg.rootPath + \"/\" + datadogResourcesPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Print(\"Destroying resources\")\n\tif err := cmdRun(cfg, []string{commandTerraformDestroy}); err != nil {\n\t\treturn err\n\t}\n\t_ = os.Chdir(cfg.rootPath)\n\n\treturn nil\n}\n\nfunc parseTerraformOutput(output string) *map[string][]string {\n\toutputArr := strings.Split(output, \"\\n\")\n\tresources := map[string][]string{}\n\tfor _, resourceOutput := range outputArr {\n\t\tif len(resourceOutput) > 0 {\n\t\t\tresourceArr := strings.Split(resourceOutput, \" = \")\n\t\t\tresourceID := resourceArr[len(resourceArr)-1]\n\t\t\t// Get resource name\n\t\t\tre := regexp.MustCompile(\"_(.*?)(--|_)\")\n\t\t\tmatch := re.FindStringSubmatch(resourceArr[0])\n\t\t\tresourceName := match[1]\n\n\t\t\tresources[resourceName] = append(resources[resourceName], resourceID)\n\t\t}\n\t}\n\treturn &resources\n}\n\nfunc cmdRun(cfg *Config, args []string) error {\n\tterraformAPIKeyEnvVariable := fmt.Sprintf(\"DATADOG_API_KEY=%s\", cfg.Datadog.apiKey)\n\tterraformAppKeyEnvVariable := fmt.Sprintf(\"DATADOG_APP_KEY=%s\", cfg.Datadog.appKey)\n\n\tcmd := exec.Command(\"sh\", \"-c\", strings.Join(args, \" \"))\n\tcmd.Env = os.Environ()\n\tcmd.Env = append(cmd.Env, terraformAPIKeyEnvVariable, terraformAppKeyEnvVariable)\n\tif cfg.logCMDOutput {\n\t\tcmd.Stdout = os.Stdout\n\t\tcmd.Stderr = os.Stderr\n\t}\n\n\terr := cmd.Run()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\treturn nil\n}\n"
  },
  {
    "path": "tests/datadog/main.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strings\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/cmd\"\n\tdatadog_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/datadog\"\n)\n\nfunc main() {\n\tvar terraformerServices []string\n\tvar terraformerFilters []string\n\n\tprovider := &datadog_terraforming.DatadogProvider{}\n\tcfg, _ := getConfig()\n\n\t// CD into 'tests/datadog/resources'\n\terr := os.Chdir(datadogResourcesPath)\n\tif err != nil {\n\t\thandleFatalErr(cfg, err, \"Error changing directory: \")\n\t}\n\t// Run the terraform v13 upgrade command if applicable\n\tif strings.Contains(cfg.tfVersion, \"0.13.\") {\n\t\tif err := cmdRun(cfg, []string{commandTerraformV13Upgrade}); err != nil {\n\t\t\thandleFatalErr(cfg, err, \"Error running command 'terraform 0.13upgrade'\")\n\t\t}\n\t}\n\t// Initialize the Datadog provider in dir 'tests/datadog/resources'\n\terr = initializeDatadogProvider(cfg)\n\tif err != nil {\n\t\thandleFatalErr(cfg, err, \"Error initializing the Datadog provider: \")\n\t}\n\n\t// Create datadog resources\n\tresourcesMap, err := createDatadogResource(cfg)\n\tif err != nil {\n\t\thandleFatalErr(cfg, err, \"Error creating resources\")\n\t}\n\n\t// Get list of terraformerServices and terraformerFilters from created resources\n\tfor resource, resourceID := range *resourcesMap {\n\t\tterraformerServices = append(terraformerServices, resource)\n\t\tterraformerFilters = append(terraformerFilters, fmt.Sprintf(\"%s=%s\", resource, strings.Join(resourceID, \":\")))\n\t}\n\tif len(terraformerServices) == 0 {\n\t\tterraformerServices = getAllServices(provider)\n\t}\n\n\t// Delete the 'generated/' directory if it already exists\n\t_ = os.RemoveAll(\"generated/\")\n\n\t// Import created resources with Terraformer\n\terr = cmd.Import(provider, cmd.ImportOptions{\n\t\tResources:   terraformerServices,\n\t\tPathPattern: \"{output}/\",\n\t\tPathOutput:  cmd.DefaultPathOutput,\n\t\tState:       \"local\",\n\t\tConnect:     true,\n\t\tOutput:      \"hcl\",\n\t\tFilter:      terraformerFilters,\n\t\tVerbose:     true,\n\t}, []string{cfg.Datadog.apiKey, cfg.Datadog.appKey, cfg.Datadog.apiURL})\n\tif err != nil {\n\t\thandleFatalErr(cfg, err, \"Error while importing resources\")\n\t}\n\n\t// Run tests on created and imported resources\n\terr = terraformerResourcesTest(cfg, resourcesMap)\n\tif err != nil {\n\t\thandleFatalErr(cfg, err, \"Terraform resource test step failed\")\n\t}\n\n\t// Destroy created resources\n\terr = destroyDatadogResources(cfg)\n\tif err != nil {\n\t\tlog.Fatal(\"Error while destroying resources \", err)\n\t}\n\n\tlog.Print(\"Successfully created and imported resources with Terraformer\")\n}\n\nfunc terraformerResourcesTest(cfg *Config, resourcesMap *map[string][]string) error {\n\tif err := os.Chdir(\"generated/\"); err != nil {\n\t\treturn err\n\t}\n\n\t// Run TF 0.13 upgrade command if applicable\n\tif strings.Contains(cfg.tfVersion, \"0.13.\") {\n\t\tif err := cmdRun(cfg, []string{commandTerraformV13Upgrade}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Initialize Datadog provider in the 'generated/' directory\n\terr := initializeDatadogProvider(cfg)\n\tif err != nil {\n\t\thandleFatalErr(cfg, err, \"Error initializing the Datadog provider: \")\n\t}\n\n\t// Collect tf outputs from generated resources\n\tterraformerResourcesOutput, err := terraformOutput()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\tterraformResourcesMap := parseTerraformOutput(string(terraformerResourcesOutput))\n\n\t// Sort the map values\n\tfor _, v := range *terraformResourcesMap {\n\t\tsort.Strings(v)\n\t}\n\tfor _, v := range *resourcesMap {\n\t\tsort.Strings(v)\n\t}\n\n\tlog.Println(\"Comparing resource names and resources ids. \\n Created resources:\", resourcesMap, \"\\n Imported Resources:\", terraformResourcesMap)\n\tmatch := reflect.DeepEqual(resourcesMap, terraformResourcesMap)\n\tif match {\n\t\t// Run 'terraform plan' against the generated resources\n\t\t// Command will exit with exit code 2 if diff is produced\n\t\tlog.Println(\"Running terraform plan on generated resources. This should produce no diff\")\n\t\terr := terraformPlan(cfg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := os.Chdir(cfg.rootPath); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\treturn errors.New(\"imported resource names and/or ids did not match the created\")\n\t}\n\n\tif err := os.Chdir(cfg.rootPath); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\nfunc handleFatalErr(cfg *Config, err error, msg string) {\n\t// Destroy any lingering resources before exiting\n\tlog.Print(\"Destroying resources before exiting\")\n\tif err := destroyDatadogResources(cfg); err != nil {\n\t\tlog.Printf(\"Error while destroying resources: %s\", err)\n\t}\n\n\tlog.Fatalf(\"Message: %s. Error: %s\", msg, err)\n}\n"
  },
  {
    "path": "tests/datadog/resources/dashboard.tf",
    "content": "resource \"datadog_dashboard\" \"ordered_dashboard_example\" {\n  title         = \"Ordered Layout Dashboard\"\n  description   = \"Created using the Datadog provider in Terraform\"\n  layout_type   = \"ordered\"\n  is_read_only  = true\n\n  widget {\n    alert_graph_definition {\n      alert_id = \"895605\"\n      viz_type = \"timeseries\"\n      title = \"Widget Title\"\n      time = {\n        live_span = \"1h\"\n      }\n    }\n  }\n\n  widget {\n    alert_value_definition {\n      alert_id = \"895605\"\n      precision = 3\n      unit = \"b\"\n      text_align = \"center\"\n      title = \"Widget Title\"\n    }\n  }\n\n  widget {\n    alert_value_definition {\n      alert_id = \"895605\"\n      precision = 3\n      unit = \"b\"\n      text_align = \"center\"\n      title = \"Widget Title\"\n    }\n  }\n\n  widget {\n    change_definition {\n      request {\n        q = \"avg:system.load.1{env:staging} by {account}\"\n        change_type = \"absolute\"\n        compare_to = \"week_before\"\n        increase_good = true\n        order_by = \"name\"\n        order_dir = \"desc\"\n        show_present = true\n      }\n      title = \"Widget Title\"\n      time = {\n        live_span = \"1h\"\n      }\n    }\n  }\n\n  widget {\n    distribution_definition {\n      request {\n        q = \"avg:system.load.1{env:staging} by {account}\"\n        style {\n          palette = \"warm\"\n        }\n      }\n      title = \"Widget Title\"\n      time = {\n        live_span = \"1h\"\n      }\n    }\n  }\n\n  widget {\n    check_status_definition {\n      check = \"aws.ecs.agent_connected\"\n      grouping = \"cluster\"\n      group_by = [\"account\", \"cluster\"]\n      tags = [\"account:demo\", \"cluster:awseb-ruthebdog-env-8-dn3m6u3gvk\"]\n      title = \"Widget Title\"\n      time = {\n        live_span = \"1h\"\n      }\n    }\n  }\n\n  widget {\n    heatmap_definition {\n      request {\n        q = \"avg:system.load.1{env:staging} by {account}\"\n        style {\n          palette = \"warm\"\n        }\n      }\n      yaxis {\n        min = 1\n        max = 2\n        include_zero = true\n        scale = \"sqrt\"\n      }\n      title = \"Widget Title\"\n      time = {\n        live_span = \"1h\"\n      }\n    }\n  }\n\n  widget {\n    hostmap_definition {\n      request {\n        fill {\n          q = \"avg:system.load.1{*} by {host}\"\n        }\n        size {\n          q = \"avg:memcache.uptime{*} by {host}\"\n        }\n      }\n      node_type= \"container\"\n      group = [\"host\", \"region\"]\n      no_group_hosts = true\n      no_metric_hosts = true\n      scope = [\"region:us-east-1\", \"aws_account:727006795293\"]\n      style {\n        palette = \"yellow_to_green\"\n        palette_flip = true\n        fill_min = \"10\"\n        fill_max = \"20\"\n      }\n      title = \"Widget Title\"\n    }\n  }\n\n  widget {\n    note_definition {\n      content = \"note text\"\n      background_color = \"pink\"\n      font_size = \"14\"\n      text_align = \"center\"\n      show_tick = true\n      tick_edge = \"left\"\n      tick_pos = \"50%\"\n    }\n  }\n\n  widget {\n    query_value_definition {\n      request {\n        q = \"avg:system.load.1{env:staging} by {account}\"\n        aggregator = \"sum\"\n        conditional_formats {\n          comparator = \"<\"\n          value = \"2\"\n          palette = \"white_on_green\"\n        }\n        conditional_formats {\n          comparator = \">\"\n          value = \"2.2\"\n          palette = \"white_on_red\"\n        }\n      }\n      autoscale = true\n      custom_unit = \"xx\"\n      precision = \"4\"\n      text_align = \"right\"\n      title = \"Widget Title\"\n      time = {\n        live_span = \"1h\"\n      }\n    }\n  }\n\n  widget {\n    query_table_definition {\n      request {\n        q = \"avg:system.load.1{env:staging} by {account}\"\n        aggregator = \"sum\"\n        limit = \"10\"\n        conditional_formats {\n          comparator = \"<\"\n          value = \"2\"\n          palette = \"white_on_green\"\n        }\n        conditional_formats {\n          comparator = \">\"\n          value = \"2.2\"\n          palette = \"white_on_red\"\n        }\n      }\n      title = \"Widget Title\"\n      time = {\n        live_span = \"1h\"\n      }\n    }\n  }\n\n  widget {\n    scatterplot_definition {\n      request {\n        x {\n          q = \"avg:system.cpu.user{*} by {service, account}\"\n          aggregator = \"max\"\n        }\n        y {\n          q = \"avg:system.mem.used{*} by {service, account}\"\n          aggregator = \"min\"\n        }\n      }\n      color_by_groups = [\"account\", \"apm-role-group\"]\n      xaxis {\n        include_zero = true\n        label = \"x\"\n        min = \"1\"\n        max = \"2000\"\n        scale = \"pow\"\n      }\n      yaxis {\n        include_zero = false\n        label = \"y\"\n        min = \"5\"\n        max = \"2222\"\n        scale = \"log\"\n      }\n      title = \"Widget Title\"\n      time = {\n        live_span = \"1h\"\n      }\n    }\n  }\n\n  widget {\n    servicemap_definition {\n      service = \"master-db\"\n      filters = [\"env:prod\",\"datacenter:us1.prod.dog\"]\n      title = \"env: prod, datacenter:us1.prod.dog, service: master-db\"\n      title_size = \"16\"\n      title_align = \"left\"\n    }\n    layout = {\n      height = 43\n      width = 32\n      x = 5\n      y = 5\n    }\n  }\n\n  widget {\n    timeseries_definition {\n      request {\n        q= \"avg:system.cpu.user{app:general} by {env}\"\n        display_type = \"line\"\n        style {\n          palette = \"warm\"\n          line_type = \"dashed\"\n          line_width = \"thin\"\n        }\n        metadata {\n          expression = \"avg:system.cpu.user{app:general} by {env}\"\n          alias_name = \"Alpha\"\n        }\n      }\n      request {\n        log_query {\n          index = \"mcnulty\"\n          compute = {\n            aggregation = \"avg\"\n            facet = \"@duration\"\n            interval = 5000\n          }\n          search = {\n            query = \"status:info\"\n          }\n          group_by {\n            facet = \"host\"\n            limit = 10\n            sort = {\n              aggregation = \"avg\"\n              order = \"desc\"\n              facet = \"@duration\"\n            }\n          }\n        }\n        display_type = \"area\"\n      }\n      request {\n        apm_query {\n          index = \"apm-search\"\n          compute = {\n            aggregation = \"avg\"\n            facet = \"@duration\"\n            interval = 5000\n          }\n          search = {\n            query = \"type:web\"\n          }\n          group_by {\n            facet = \"resource_name\"\n            limit = 50\n            sort = {\n              aggregation = \"avg\"\n              order = \"desc\"\n              facet = \"@string_query.interval\"\n            }\n          }\n        }\n        display_type = \"bars\"\n      }\n      request {\n        process_query {\n          metric = \"process.stat.cpu.total_pct\"\n          search_by = \"error\"\n          filter_by = [\"active\"]\n          limit = 50\n        }\n        display_type = \"area\"\n      }\n      marker {\n        display_type = \"error dashed\"\n        label = \" z=6 \"\n        value = \"y = 4\"\n      }\n      marker {\n        display_type = \"ok solid\"\n        value = \"10 < y < 999\"\n        label = \" x=8 \"\n      }\n      title = \"Widget Title\"\n      show_legend = true\n      legend_size = \"2\"\n      time = {\n        live_span = \"1h\"\n      }\n      event {\n        q = \"sources:test tags:1\"\n      }\n      event {\n        q = \"sources:test tags:2\"\n      }\n      yaxis {\n        scale = \"log\"\n        include_zero = false\n        max = 100\n      }\n    }\n  }\n\n  widget {\n    toplist_definition {\n      request {\n        q= \"avg:system.cpu.user{app:general} by {env}\"\n        conditional_formats {\n          comparator = \"<\"\n          value = \"2\"\n          palette = \"white_on_green\"\n        }\n        conditional_formats {\n          comparator = \">\"\n          value = \"2.2\"\n          palette = \"white_on_red\"\n        }\n      }\n      title = \"Widget Title\"\n    }\n  }\n\n  widget {\n    group_definition {\n      layout_type = \"ordered\"\n      title = \"Group Widget\"\n\n      widget {\n        note_definition {\n          content = \"cluster note widget\"\n          background_color = \"pink\"\n          font_size = \"14\"\n          text_align = \"center\"\n          show_tick = true\n          tick_edge = \"left\"\n          tick_pos = \"50%\"\n        }\n      }\n\n      widget {\n        alert_graph_definition {\n          alert_id = \"123\"\n          viz_type = \"toplist\"\n          title = \"Alert Graph\"\n          time = {\n            live_span = \"1h\"\n          }\n        }\n      }\n    }\n  }\n\n  widget {\n    service_level_objective_definition {\n      title = \"Widget Title\"\n      view_type = \"detail\"\n      slo_id = \"56789\"\n      show_error_budget = true\n      view_mode = \"overall\"\n      time_windows = [\"7d\", \"previous_week\"]\n    }\n  }\n\n  template_variable {\n    name   = \"var_1\"\n    prefix = \"host\"\n    default = \"aws\"\n  }\n  template_variable {\n    name   = \"var_2\"\n    prefix = \"service_name\"\n    default = \"autoscaling\"\n  }\n\n  template_variable_preset {\n    name = \"preset_1\"\n    template_variable {\n      name = \"var_1\"\n      value = \"host.dc\"\n    }\n    template_variable {\n      name = \"var_2\"\n      value = \"my_service\"\n    }\n  }\n}\n\nresource \"datadog_dashboard\" \"free_dashboard_example\" {\n  title         = \"Free Layout Dashboard\"\n  description   = \"Created using the Datadog provider in Terraform\"\n  layout_type   = \"free\"\n  is_read_only  = false\n\n  widget {\n    event_stream_definition {\n      query = \"*\"\n      event_size = \"l\"\n      title = \"Widget Title\"\n      title_size = 16\n      title_align = \"left\"\n      time = {\n        live_span = \"1h\"\n      }\n    }\n    layout = {\n      height = 43\n      width = 32\n      x = 5\n      y = 5\n    }\n  }\n\n  widget {\n    event_timeline_definition {\n      query = \"*\"\n      title = \"Widget Title\"\n      title_size = 16\n      title_align = \"left\"\n      time = {\n        live_span = \"1h\"\n      }\n    }\n    layout = {\n      height = 9\n      width = 65\n      x = 42\n      y = 73\n    }\n  }\n\n  widget {\n    free_text_definition {\n      text = \"free text content\"\n      color = \"#d00\"\n      font_size = \"88\"\n      text_align = \"left\"\n    }\n    layout = {\n      height = 20\n      width = 30\n      x = 42\n      y = 5\n    }\n  }\n\n  widget {\n    iframe_definition {\n      url = \"http://google.com\"\n    }\n    layout = {\n      height = 46\n      width = 39\n      x = 111\n      y = 8\n    }\n  }\n\n  widget {\n    image_definition {\n      url = \"https://images.pexels.com/photos/67636/rose-blue-flower-rose-blooms-67636.jpeg?auto=compress&cs=tinysrgb&h=350\"\n      sizing = \"fit\"\n      margin = \"small\"\n    }\n    layout = {\n      height = 20\n      width = 30\n      x = 77\n      y = 7\n    }\n  }\n\n  widget {\n    log_stream_definition {\n      indexes = [\"main\"]\n      query = \"error\"\n      columns = [\"core_host\", \"core_service\", \"tag_source\"]\n      show_date_column = true\n      show_message_column = true\n      message_display = \"expanded-md\"\n      sort {\n        column = \"time\"\n        order = \"desc\"\n      }\n    }\n    layout = {\n      height = 36\n      width = 32\n      x = 5\n      y = 51\n    }\n  }\n\n  widget {\n    manage_status_definition {\n      color_preference = \"text\"\n      display_format = \"countsAndList\"\n      hide_zero_counts = true\n      query = \"type:metric\"\n      show_last_triggered = false\n      sort = \"status,asc\"\n      summary_type = \"monitors\"\n      title = \"Widget Title\"\n      title_size = 16\n      title_align = \"left\"\n    }\n    layout = {\n      height = 40\n      width = 30\n      x = 112\n      y = 55\n    }\n  }\n\n  widget {\n    trace_service_definition {\n      display_format = \"three_column\"\n      env = \"datad0g.com\"\n      service = \"alerting-cassandra\"\n      show_breakdown = true\n      show_distribution = true\n      show_errors = true\n      show_hits = true\n      show_latency = false\n      show_resource_list = false\n      size_format = \"large\"\n      span_name = \"cassandra.query\"\n      title = \"alerting-cassandra #env:datad0g.com\"\n      title_align = \"center\"\n      title_size = \"13\"\n      time = {\n        live_span = \"1h\"\n      }\n    }\n    layout = {\n      height = 38\n      width = 67\n      x = 40\n      y = 28\n    }\n  }\n\n  template_variable {\n    name   = \"var_1\"\n    prefix = \"host\"\n    default = \"aws\"\n  }\n  template_variable {\n    name   = \"var_2\"\n    prefix = \"service_name\"\n    default = \"autoscaling\"\n  }\n\n  template_variable_preset {\n    name = \"preset_1\"\n    template_variable {\n      name = \"var_1\"\n      value = \"host.dc\"\n    }\n    template_variable {\n      name = \"var_2\"\n      value = \"my_service\"\n    }\n  }\n}\n"
  },
  {
    "path": "tests/datadog/resources/downtime.tf",
    "content": "# Create a Datadog downtime for all monitors\nresource \"datadog_downtime\" \"downtime_example\" {\n  scope = [\"*\"]\n\n  recurrence {\n    type   = \"days\"\n    period = 1\n  }\n}\n"
  },
  {
    "path": "tests/datadog/resources/monitor.tf",
    "content": "# Create a new Datadog monitor\nresource \"datadog_monitor\" \"monitor_example\" {\n  name               = \"Name for monitor foo\"\n  type               = \"metric alert\"\n  message            = \"Monitor triggered. Notify: @hipchat-channel\"\n  escalation_message = \"Escalation message @pagerduty\"\n\n  query = \"avg(last_1h):avg:aws.ec2.cpu{environment:foo,host:foo} by {host} > 4\"\n\n  thresholds = {\n    ok                = 0\n    warning           = 2\n    warning_recovery  = 1\n    critical          = 4\n    critical_recovery = 3\n  }\n\n  notify_no_data    = false\n  renotify_interval = 60\n\n  notify_audit = false\n  timeout_h    = 60\n  include_tags = true\n\n  # ignore any changes in silenced value; using silenced is deprecated in favor of downtimes\n  lifecycle {\n    ignore_changes = [silenced]\n  }\n\n  tags = [\"foo:bar\", \"baz\"]\n}\n"
  },
  {
    "path": "tests/datadog/resources/outputs.tf",
    "content": "# Dashboards\noutput \"datadog_dashboard--ordered_dashboard_example\" {\n  value = datadog_dashboard.ordered_dashboard_example.id\n}\n\noutput \"datadog_dashboard--free_dashboard_example\" {\n  value = datadog_dashboard.free_dashboard_example.id\n}\n\n# Downtimes\noutput \"datadog_downtime--downtime_example\" {\n  value = datadog_downtime.downtime_example.id\n}\n\n# Monitors\noutput \"datadog_monitor--monitor_example\" {\n  value = datadog_monitor.monitor_example.id\n}\n\n# Synthetics\noutput \"datadog_synthetics_test--test_api_example\" {\n  value = datadog_synthetics_test.test_api_example.id\n}\n\n# Users\noutput \"datadog_user--user_example\" {\n  value = datadog_user.user_example.id\n}\n\noutput \"datadog_user--user_example_two\" {\n  value = datadog_user.user_example_two.id\n}\n\n"
  },
  {
    "path": "tests/datadog/resources/synthetics.tf",
    "content": "resource \"datadog_synthetics_test\" \"test_api_example\" {\n  type = \"api\"\n  subtype = \"http\"\n  request = {\n    method = \"GET\"\n    url = \"https://www.example.org\"\n  }\n  request_headers = {\n    Content-Type = \"application/json\"\n    Authentication = \"Token: 1234566789\"\n  }\n  assertion {\n    type = \"statusCode\"\n    operator = \"is\"\n    target = \"200\"\n  }\n  locations = [ \"aws:eu-central-1\" ]\n  options_list {\n    tick_every = 900\n\n    retry {\n      count = 2\n      interval = 300\n    }\n\n    monitor_options {\n      renotify_interval = 100\n    }\n  }\n  name = \"An API test on example.org\"\n  message = \"Notify @pagerduty\"\n  tags = [\"foo:bar\", \"foo\", \"env:test\"]\n\n  status = \"live\"\n}\n"
  },
  {
    "path": "tests/datadog/resources/user.tf",
    "content": "# Create a new Datadog user\nresource \"datadog_user\" \"user_example\" {\n  email  = \"new@example.com\"\n  handle = \"new@example.com\"\n  name   = \"New User\"\n}\n\nresource \"datadog_user\" \"user_example_two\" {\n  email  = \"new_two@example.com\"\n  handle = \"new_two@example.com\"\n  name   = \"New User\"\n}\n"
  },
  {
    "path": "tests/gcp/main.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"os/exec\"\n\t\"sort\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/cmd\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\tgcp_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/gcp\"\n)\n\nconst command = \"terraform init && terraform plan\"\n\nfunc main() {\n\tzone := \"europe-west1-c\"\n\tservices := []string{}\n\tprovider := &gcp_terraforming.GCPProvider{}\n\tfor service := range provider.GetSupportedService() {\n\t\tif service == \"images\" {\n\t\t\tcontinue\n\t\t}\n\t\tif service == \"iam\" {\n\t\t\tcontinue\n\t\t}\n\t\tif service == \"instanceTemplates\" {\n\t\t\tcontinue\n\t\t}\n\t\tif service == \"targetHttpProxies\" {\n\t\t\tcontinue\n\t\t}\n\t\tif service == \"monitoring\" {\n\t\t\tcontinue\n\t\t}\n\t\tif service == \"cloudsql\" {\n\t\t\tcontinue\n\t\t}\n\t\tif service == \"bigQuery\" {\n\t\t\tcontinue\n\t\t}\n\t\tservices = append(services, service)\n\t}\n\tsort.Strings(services)\n\tprovider = &gcp_terraforming.GCPProvider{\n\t\tProvider: terraformutils.Provider{},\n\t}\n\terr := cmd.Import(provider, cmd.ImportOptions{\n\t\tResources:   services,\n\t\tPathPattern: cmd.DefaultPathPattern,\n\t\tPathOutput:  cmd.DefaultPathOutput,\n\t\tState:       \"local\",\n\t\tZone:        \"europe-west1-a\",\n\t\tConnect:     true,\n\t}, []string{zone})\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tos.Exit(1)\n\t}\n\trootPath, _ := os.Getwd()\n\tfor _, serviceName := range services {\n\t\tcurrentPath := cmd.Path(cmd.DefaultPathPattern, provider.GetName(), serviceName, cmd.DefaultPathOutput)\n\t\tif err := os.Chdir(currentPath); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tcmd := exec.Command(\"sh\", \"-c\", command)\n\t\tcmd.Stdout = os.Stdout\n\t\tcmd.Stderr = os.Stderr\n\t\terr = cmd.Run()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\terr := os.Chdir(rootPath)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "tests/github/main.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"os/exec\"\n\t\"sort\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/cmd\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\tgithub_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/github\"\n)\n\nconst command = \"terraform init && terraform plan\"\n\nfunc main() {\n\torganization := \"\"\n\ttoken := os.Getenv(\"GITHUB_TOKEN\")\n\tservices := []string{}\n\tprovider := &github_terraforming.GithubProvider{}\n\tfor service := range provider.GetSupportedService() {\n\t\tservices = append(services, service)\n\t}\n\tsort.Strings(services)\n\tprovider = &github_terraforming.GithubProvider{\n\t\tProvider: terraformutils.Provider{},\n\t}\n\terr := cmd.Import(provider, cmd.ImportOptions{\n\t\tResources:   services,\n\t\tPathPattern: cmd.DefaultPathPattern,\n\t\tPathOutput:  cmd.DefaultPathOutput,\n\t\tState:       \"local\",\n\t\tConnect:     true,\n\t}, []string{organization, token})\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tos.Exit(1)\n\t}\n\trootPath, _ := os.Getwd()\n\tfor _, serviceName := range services {\n\t\tcurrentPath := cmd.Path(cmd.DefaultPathPattern, provider.GetName(), serviceName, cmd.DefaultPathOutput)\n\t\tif err := os.Chdir(currentPath); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tcmd := exec.Command(\"sh\", \"-c\", command)\n\t\tcmd.Stdout = os.Stdout\n\t\tcmd.Stderr = os.Stderr\n\t\terr = cmd.Run()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\terr := os.Chdir(rootPath)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "tests/octopusdeploy/README.md",
    "content": "# Testing the OctopusDeploy provider\n\nYou will need an OctopusDeploy server:\n\n```bash\ngit clone git@github.com:MattHodge/VagrantBoxes.git\ncd VagrantBoxes/OctopusDeployServer\nvagrant up\ncd -\n```\n\nDownload the provider (pick the right one for your platform):\n\n```bash\nPLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]')\nPLUGIN_DIR=.terraform/plugins/${PLATFORM}_amd64/\nPROVIDER=terraform-provider-octopusdeploy_${PLATFORM}_amd64_v0.5.0\nmkdir -p \"${PLUGIN_DIR}\"\ncd \"${PLUGIN_DIR}\"\ncurl -sLO \"https://github.com/OctopusDeploy/terraform-provider-octopusdeploy/releases/download/v0.5.0/${PROVIDER}.zip\"\nunzip \"${PROVIDER}.zip\"\nmv \"${PROVIDER}\" terraform-provider-octopusdeploy_v0.5.0\ncd -\n```\n\nRun `terraform` to create the resources (adjust the values in `provider.tf`):\n\n```bash\nterraform init\nterraform plan\nterraform apply --auto-approve\n```\n\nImport them back with `terraformer`:\n\n```bash\nterraformer import octopusdeploy \\\n  --server \"http://localhost:8081\" \\\n  --apikey \"API-YVLL2ML1XRIBUU8GKJKEMXKPWQ\" \\\n  -r accounts,environments,feeds,libraryvariablesets,lifecycles,projects,projectgroups,projecttriggers,tagsets\n```\n\nCompare the output from `generated/octopusdeploy` with the original files.\n"
  },
  {
    "path": "tests/octopusdeploy/channel.tf",
    "content": "resource \"octopusdeploy_channel\" \"helm\" {\n  name        = \"Helm\"\n  description = \"The Helm channel\"\n  project_id  = octopusdeploy_project.deploymark_api.id\n}\n"
  },
  {
    "path": "tests/octopusdeploy/environment.tf",
    "content": "resource \"octopusdeploy_environment\" \"stage\" {\n  name                         = \"Stage\"\n  description                  = \"Y (SS1)\"\n  use_guided_failure           = false\n  allow_dynamic_infrastructure = true\n}\n\nresource \"octopusdeploy_environment\" \"production\" {\n  name                         = \"Production\"\n  description                  = \"B, C, D, E, F & G and more\"\n  use_guided_failure           = true\n  allow_dynamic_infrastructure = true\n}\n"
  },
  {
    "path": "tests/octopusdeploy/feed.tf",
    "content": "resource \"octopusdeploy_feed\" \"feed\" {\n  name          = \"feedme\"\n  feed_type     = \"Helm\"\n  feed_uri      = \"https://charts.helm.sh/stable\"\n  username      = \"foo\"\n  password      = \"bar\"\n  enhanced_mode = false\n}\n"
  },
  {
    "path": "tests/octopusdeploy/library_variable_set.tf",
    "content": "resource \"octopusdeploy_library_variable_set\" \"foo\" {\n  name        = \"Account IDs\"\n  description = \"Ids of accounts\"\n}\n"
  },
  {
    "path": "tests/octopusdeploy/lifecycle.tf",
    "content": "resource \"octopusdeploy_lifecycle\" \"stage_prod\" {\n  name        = \"Stage-Production\"\n  description = \"Stage-Production Lifecycle\"\n\n  release_retention_policy {\n    unit             = \"Days\"\n    quantity_to_keep = 3\n  }\n\n  tentacle_retention_policy {\n    unit             = \"Items\"\n    quantity_to_keep = 3\n  }\n\n  phase {\n    name                                  = \"Stage\"\n    minimum_environments_before_promotion = 0\n    is_optional_phase                     = false\n    optional_deployment_targets           = [\"${octopusdeploy_environment.stage.id}\"]\n  }\n\n  phase {\n    name                                  = \"Production\"\n    minimum_environments_before_promotion = 0\n    is_optional_phase                     = false\n    optional_deployment_targets           = [\"${octopusdeploy_environment.production.id}\"]\n  }\n}\n"
  },
  {
    "path": "tests/octopusdeploy/main.tf",
    "content": "\n\n\n\n\n\n\n"
  },
  {
    "path": "tests/octopusdeploy/project.tf",
    "content": "resource \"octopusdeploy_project\" \"deploymark_api\" {\n  name                  = \"Deploymark API\"\n  description           = \"Annotate deployments\"\n  lifecycle_id          = octopusdeploy_lifecycle.stage_prod.id\n  project_group_id      = octopusdeploy_project_group.utilities.id\n  skip_machine_behavior = \"SkipUnavailableMachines\"\n\n  deployment_step {\n    windows_service {\n      executable_path                = \"batch_processor\\\\batch_processor_service.exe\"\n      service_name                   = \"Billing Batch Processor\"\n      step_name                      = \"Deploy Billing Batch Processor Windows Service\"\n      step_condition                 = \"failure\"\n      package                        = \"Billing.BatchProcessor\"\n      json_file_variable_replacement = \"appsettings.json\"\n\n      target_roles = [\n        \"Billing-Batch-Processor\",\n      ]\n    }\n\n    inline_script {\n      step_name   = \"Cleanup Temporary Files\"\n      script_type = \"PowerShell\"\n\n      script_body = <<EOF\n        $oldFiles = Get-ChildItem -Path 'C:\\billing_archived_jobs'\n        Remove-Item $oldFiles -Force -Recurse\n        EOF\n\n      target_roles = [\n        \"Billing-Batch-Processor\",\n      ]\n    }\n  }\n}\n"
  },
  {
    "path": "tests/octopusdeploy/project_group.tf",
    "content": "resource \"octopusdeploy_project_group\" \"utilities\" {\n  description = \"Maintenance activities and internal services\"\n  name        = \"Utilities\"\n}\n"
  },
  {
    "path": "tests/octopusdeploy/provider.tf",
    "content": "provider \"octopusdeploy\" {\n  address = \"http://localhost:8081/\"\n  apikey  = \"API-YVLL2ML1XRIBUU8GKJKEMXKPWQ\"\n}\n"
  },
  {
    "path": "tests/octopusdeploy/tagset.tf",
    "content": "resource \"octopusdeploy_tag_set\" \"DevOps\" {\n  name = \"DevOps\"\n  tag {\n    name  = \"Monitoring\"\n    color = \"#3692F2\"\n  }\n  tag {\n    name  = \"CI\"\n    color = \"#FF5733\"\n  }\n}\n"
  },
  {
    "path": "tests/openstack/main.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"os/exec\"\n\t\"sort\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/cmd\"\n\topenstack_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/openstack\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n)\n\nconst command = \"terraform init && terraform plan\"\n\nfunc main() {\n\tregion := \"RegionOne\"\n\tservices := []string{}\n\tprovider := &openstack_terraforming.OpenStackProvider{}\n\tfor service := range provider.GetSupportedService() {\n\t\tservices = append(services, service)\n\t}\n\tsort.Strings(services)\n\tprovider = &openstack_terraforming.OpenStackProvider{\n\t\tProvider: terraformutils.Provider{},\n\t}\n\terr := cmd.Import(provider, cmd.ImportOptions{\n\t\tResources:   services,\n\t\tPathPattern: cmd.DefaultPathPattern,\n\t\tPathOutput:  cmd.DefaultPathOutput,\n\t\tState:       \"local\",\n\t\tConnect:     true,\n\t}, []string{region})\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tos.Exit(1)\n\t}\n\trootPath, _ := os.Getwd()\n\tfor _, serviceName := range services {\n\t\tcurrentPath := cmd.Path(cmd.DefaultPathPattern, provider.GetName(), serviceName, cmd.DefaultPathOutput)\n\t\tif err := os.Chdir(currentPath); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tcmd := exec.Command(\"sh\", \"-c\", command)\n\t\tcmd.Stdout = os.Stdout\n\t\tcmd.Stderr = os.Stderr\n\t\terr = cmd.Run()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\terr := os.Chdir(rootPath)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "tests/rabbitmq/main.go",
    "content": "// Copyright 2018 The Terraformer Authors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//      http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\t\"os/exec\"\n\t\"sort\"\n\n\t\"github.com/GoogleCloudPlatform/terraformer/cmd\"\n\t\"github.com/GoogleCloudPlatform/terraformer/terraformutils\"\n\n\trabbitmq_terraforming \"github.com/GoogleCloudPlatform/terraformer/providers/rabbitmq\"\n)\n\nconst command = \"terraform init && terraform plan\"\n\nfunc main() {\n\tendpoint := os.Getenv(\"RABBITMQ_SERVER_URL\")\n\tusername := os.Getenv(\"RABBITMQ_USERNAME\")\n\tpassword := os.Getenv(\"RABBITMQ_PASSWORD\")\n\n\tservices := []string{}\n\tprovider := &rabbitmq_terraforming.RBTProvider{}\n\tfor service := range provider.GetSupportedService() {\n\t\tservices = append(services, service)\n\t}\n\tsort.Strings(services)\n\tprovider = &rabbitmq_terraforming.RBTProvider{\n\t\tProvider: terraformutils.Provider{},\n\t}\n\terr := cmd.Import(provider, cmd.ImportOptions{\n\t\tResources:   services,\n\t\tPathPattern: cmd.DefaultPathPattern,\n\t\tPathOutput:  cmd.DefaultPathOutput,\n\t\tState:       \"local\",\n\t\tConnect:     true,\n\t}, []string{endpoint, username, password})\n\tif err != nil {\n\t\tlog.Println(err)\n\t\tos.Exit(1)\n\t}\n\trootPath, _ := os.Getwd()\n\tfor _, serviceName := range services {\n\t\tcurrentPath := cmd.Path(cmd.DefaultPathPattern, provider.GetName(), serviceName, cmd.DefaultPathOutput)\n\t\tif err := os.Chdir(currentPath); err != nil {\n\t\t\tlog.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tcmd := exec.Command(\"sh\", \"-c\", command)\n\t\tcmd.Stdout = os.Stdout\n\t\tcmd.Stderr = os.Stderr\n\t\terr = cmd.Run()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\terr := os.Chdir(rootPath)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}\n}\n"
  }
]