├── .changes ├── header.tpl.md ├── unreleased │ └── .gitkeep ├── v0.2.0.md └── v0.3.0.md ├── .changie.yaml ├── .github ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug-report.md │ ├── config.yml │ ├── feature-request.md │ └── support-request.md ├── dependabot.yaml ├── pull-request-template.md └── workflows │ ├── dependabot-changie.yaml │ ├── release.yaml │ ├── tests.yaml │ └── triage.yaml ├── .gitignore ├── .goreleaser.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── Taskfile.yml ├── docs ├── index.md └── resources │ ├── content_type.md │ ├── environment.md │ ├── global_field.md │ ├── locale.md │ └── webhook.md ├── examples └── resources │ ├── contentstack_content_type │ └── resource.tf │ ├── contentstack_environment │ └── resource.tf │ ├── contentstack_global_field │ └── resource.tf │ ├── contentstack_locale │ └── resource.tf │ └── contentstack_webhook │ └── resource.tf ├── go.mod ├── go.sum ├── internal └── provider │ ├── errors.go │ ├── helpers.go │ ├── helpers_test.go │ ├── provider.go │ ├── resource_content_type.go │ ├── resource_environment.go │ ├── resource_global_field.go │ ├── resource_locale.go │ └── resource_webhook.go ├── main.go ├── terraform-registry-manifest.json └── tools └── tools.go /.changes/header.tpl.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), 6 | and is generated by [Changie](https://github.com/miniscruff/changie). 7 | -------------------------------------------------------------------------------- /.changes/unreleased/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/labd/terraform-provider-contentstack/024f4a06f5f59bd2dc8bd0bcf9737c72c76036a4/.changes/unreleased/.gitkeep -------------------------------------------------------------------------------- /.changes/v0.2.0.md: -------------------------------------------------------------------------------- 1 | ## 0.2.0 (2022-06-07) 2 | 3 | - Add the `contentstack_content_type` resource. 4 | - Add the `contentstack_locale` resource. 5 | 6 | 7 | ## 0.1.1 (2022-06-03) 8 | 9 | - Add the `contentstack_global_field` resource. 10 | 11 | 12 | ## 0.1.0 (2022-06-03) 13 | 14 | Initial release of the contentstack terraform provider. It currently only 15 | supports managing webhooks via the `contentstack_webhook` resource. 16 | -------------------------------------------------------------------------------- /.changes/v0.3.0.md: -------------------------------------------------------------------------------- 1 | ## v0.3.0 - 2025-03-24 2 | ### Added 3 | * Updated metafiles 4 | * Adds `contentstact_environment` resource 5 | * Support for branches at provider level 6 | ### Fixed 7 | * Updated generate test 8 | * Fixed inconsistent webhook result after apply 9 | ### Dependency 10 | * chore(deps): bump the github-actions group across 1 directory with 8 updates 11 | * chore(deps): bump the github-actions group across 1 directory with 3 updates 12 | -------------------------------------------------------------------------------- /.changie.yaml: -------------------------------------------------------------------------------- 1 | changesDir: .changes 2 | unreleasedDir: unreleased 3 | headerPath: header.tpl.md 4 | changelogPath: CHANGELOG.md 5 | versionExt: md 6 | versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}' 7 | kindFormat: '### {{.Kind}}' 8 | changeFormat: '* {{.Body}}' 9 | kinds: 10 | - label: Added 11 | auto: minor 12 | - label: Changed 13 | auto: major 14 | - label: Deprecated 15 | auto: minor 16 | - label: Removed 17 | auto: major 18 | - label: Fixed 19 | auto: patch 20 | - label: Security 21 | auto: patch 22 | - label: Dependency 23 | auto: patch 24 | newlines: 25 | afterChangelogHeader: 1 26 | beforeChangelogVersion: 1 27 | endOfVersion: 1 28 | envPrefix: CHANGIE_ 29 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @labd/go 2 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | . 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platform 2 | github: [labd] 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: When you are running into an issue 4 | title: '' 5 | labels: bug, triage 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Version information 11 | - **terraform**: _Please specify the version of Terraform you are using._ 12 | - **terraform provider**: _Please specify the version of the provider you are using._ 13 | 14 | ### Describe the bug 15 | A clear and concise description of what the bug is. 16 | 17 | ### To Reproduce 18 | Steps to reproduce the behavior. 19 | 20 | ### Expected behavior 21 | A clear and concise description of what you expected to happen. 22 | 23 | ### Screenshots 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | ### Additional context 27 | Add any other context about the problem here. 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: When you are missing a specific feature 4 | title: '' 5 | labels: enhancement, triage 6 | assignees: '' 7 | 8 | --- 9 | 10 | Describe the feature you would like to see implemented. Please provide as much 11 | detail as possible. If you have a specific use case, please provide that as 12 | well. 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/support-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Support request 3 | about: When you have a generic question 4 | title: '' 5 | labels: question, triage 6 | assignees: '' 7 | 8 | --- 9 | 10 | Describe your question here. Please provide as much detail as possible. If you 11 | have a specific use case, please provide that as well. 12 | ``` 13 | -------------------------------------------------------------------------------- /.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gomod" 4 | directory: "/" 5 | schedule: 6 | interval: "monthly" 7 | day: tuesday 8 | commit-message: 9 | prefix: "chore(deps)" 10 | groups: 11 | go: 12 | patterns: 13 | - "*" 14 | 15 | - package-ecosystem: "github-actions" 16 | directory: "/" 17 | schedule: 18 | interval: "monthly" 19 | day: tuesday 20 | commit-message: 21 | prefix: "chore(deps)" 22 | groups: 23 | github-actions: 24 | patterns: 25 | - "*" 26 | -------------------------------------------------------------------------------- /.github/pull-request-template.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | Fixes # 14 | 15 | ### NEW FEATURES | UPGRADE NOTES | ENHANCEMENTS | BUG FIXES | EXPERIMENTS 16 | 17 | 26 | 27 | - 28 | -------------------------------------------------------------------------------- /.github/workflows/dependabot-changie.yaml: -------------------------------------------------------------------------------- 1 | name: Dependabot add changie file 2 | on: 3 | pull_request: 4 | types: [opened] 5 | 6 | permissions: 7 | pull-requests: write 8 | issues: write 9 | repository-projects: write 10 | contents: write 11 | 12 | jobs: 13 | dependabot-changie: 14 | runs-on: ubuntu-latest 15 | if: github.actor == 'dependabot[bot]' 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v4 19 | 20 | - name: Fetch Dependabot metadata 21 | id: dependabot-metadata 22 | uses: dependabot/fetch-metadata@v2 23 | with: 24 | github-token: "${{ secrets.GITHUB_TOKEN }}" 25 | 26 | - name: Create change file 27 | uses: miniscruff/changie-action@v2 28 | with: 29 | version: latest 30 | args: new --body "${{ github.event.pull_request.title }}" --kind Dependency 31 | 32 | - uses: stefanzweifel/git-auto-commit-action@v5 33 | with: 34 | commit_message: "chore(deps): add changelog for dependabot updates" 35 | commit_user_name: "dependabot[bot]" 36 | commit_user_email: "dependabot[bot]@users.noreply.github.com" 37 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: release 2 | on: 3 | workflow_dispatch: 4 | 5 | jobs: 6 | goreleaser: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout 10 | uses: actions/checkout@v4 11 | with: 12 | fetch-depth: 0 13 | 14 | - name: Set up Go 15 | uses: actions/setup-go@v5 16 | with: 17 | go-version-file: go.mod 18 | 19 | - name: Import GPG key 20 | id: import_gpg 21 | uses: paultyng/ghaction-import-gpg@v2.1.0 22 | env: 23 | GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} 24 | PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} 25 | 26 | - name: Run GoReleaser 27 | uses: goreleaser/goreleaser-action@v6 28 | with: 29 | version: latest 30 | args: release --clean 31 | env: 32 | GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} 33 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 34 | -------------------------------------------------------------------------------- /.github/workflows/tests.yaml: -------------------------------------------------------------------------------- 1 | # This GitHub action runs your tests for each commit push and/or PR. Optionally 2 | # you can turn it on using a cron schedule for regular testing. 3 | # 4 | name: Tests 5 | on: 6 | push: 7 | paths-ignore: 8 | - 'README.md' 9 | 10 | jobs: 11 | generate: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: actions/setup-go@v5 16 | with: 17 | go-version-file: 'go.mod' 18 | cache: true 19 | - uses: hashicorp/setup-terraform@v3 20 | - run: go generate ./... 21 | - name: git diff 22 | run: | 23 | git diff --compact-summary --exit-code || \ 24 | (echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1) 25 | 26 | test: 27 | runs-on: ubuntu-latest 28 | steps: 29 | - uses: actions/checkout@v4 30 | 31 | - name: Set up Go 32 | uses: actions/setup-go@v5 33 | with: 34 | go-version-file: 'go.mod' 35 | cache: true 36 | 37 | - name: golangci-lint 38 | continue-on-error: true 39 | uses: golangci/golangci-lint-action@v6 40 | with: 41 | args: --issues-exit-code=0 --timeout=5m 42 | 43 | - name: Run tests 44 | run: go test -race -coverprofile=coverage.out -covermode=atomic -coverpkg=./... -v ./... 45 | 46 | - name: Upload to codecov 47 | uses: codecov/codecov-action@v5 48 | with: 49 | verbose: true 50 | 51 | changie: 52 | runs-on: ubuntu-latest 53 | needs: [test, generate] 54 | if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' 55 | permissions: 56 | contents: write 57 | pull-requests: write 58 | actions: write 59 | steps: 60 | - uses: actions/checkout@v4 61 | with: 62 | fetch-depth: 0 63 | 64 | - name: Prepare release 65 | uses: labd/changie-release-action@v0.6.0 66 | with: 67 | github-token: ${{ secrets.GITHUB_TOKEN }} 68 | release-workflow: 'release.yaml' 69 | 70 | -------------------------------------------------------------------------------- /.github/workflows/triage.yaml: -------------------------------------------------------------------------------- 1 | name: Triage 2 | 3 | on: 4 | pull_request: 5 | types: 6 | - opened 7 | issues: 8 | types: 9 | - opened 10 | 11 | jobs: 12 | add_to_project: 13 | name: Push issue or PR to board 14 | runs-on: ubuntu-latest 15 | steps: 16 | - name: get app token 17 | id: get-app-token 18 | uses: labd/action-gh-app-token@main 19 | with: 20 | app-id: ${{ secrets.RD_APP_ID }} 21 | private-key: ${{ secrets.RD_APP_PRIVATE_KEY }} 22 | installation-id: ${{ secrets.RD_APP_INSTALLATION_ID }} 23 | - name: set to project board 24 | uses: actions/add-to-project@v1.0.2 25 | with: 26 | project-url: https://github.com/orgs/labd/projects/3 27 | github-token: ${{ steps.get-app-token.outputs.app-token }} 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .terraform/ 2 | .terraform.lock.hcl 3 | *.tfstate 4 | *.backup 5 | 6 | /main.tf 7 | /terraform-provider-contentstack_* 8 | /terraform-provider-contentstack 9 | 10 | /.idea 11 | /.vscode 12 | /local 13 | -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | project_name: terraform-provider-contentstack 3 | 4 | builds: 5 | - env: 6 | # goreleaser does not work with CGO, it could also complicate 7 | # usage by users in CI/CD systems like Terraform Cloud where 8 | # they are unable to install libraries. 9 | - CGO_ENABLED=0 10 | mod_timestamp: '{{ .CommitTimestamp }}' 11 | flags: 12 | - -trimpath 13 | ldflags: 14 | - '-s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}}' 15 | goos: 16 | - freebsd 17 | - windows 18 | - linux 19 | - darwin 20 | goarch: 21 | - amd64 22 | - '386' 23 | - arm 24 | - arm64 25 | ignore: 26 | - goos: darwin 27 | goarch: '386' 28 | binary: '{{ .ProjectName }}_v{{ .Version }}' 29 | 30 | archives: 31 | - format: zip 32 | name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' 33 | 34 | checksum: 35 | name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' 36 | algorithm: sha256 37 | 38 | changelog: 39 | sort: asc 40 | filters: 41 | exclude: 42 | - "^docs:" 43 | - "^test:" 44 | 45 | signs: 46 | - artifacts: checksum 47 | args: 48 | # if you are using this is a GitHub action or some other automated pipeline, you 49 | # need to pass the batch flag to indicate its not interactive. 50 | - "--batch" 51 | - "--local-user" 52 | - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key 53 | - "--output" 54 | - "${signature}" 55 | - "--detach-sign" 56 | - "${artifact}" 57 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), 6 | and is generated by [Changie](https://github.com/miniscruff/changie). 7 | 8 | 9 | ## v0.3.0 - 2025-03-24 10 | ### Added 11 | * Updated metafiles 12 | * Adds `contentstact_environment` resource 13 | * Support for branches at provider level 14 | ### Fixed 15 | * Updated generate test 16 | * Fixed inconsistent webhook result after apply 17 | ### Dependency 18 | * chore(deps): bump the github-actions group across 1 directory with 8 updates 19 | * chore(deps): bump the github-actions group across 1 directory with 3 updates 20 | 21 | ## 0.2.0 (2022-06-07) 22 | 23 | - Add the `contentstack_content_type` resource. 24 | - Add the `contentstack_locale` resource. 25 | 26 | 27 | ## 0.1.1 (2022-06-03) 28 | 29 | - Add the `contentstack_global_field` resource. 30 | 31 | 32 | ## 0.1.0 (2022-06-03) 33 | 34 | Initial release of the contentstack terraform provider. It currently only 35 | supports managing webhooks via the `contentstack_webhook` resource. 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Lab Digital 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Contentstack Terraform Provider 2 | 3 | The Terraform provider for [Contentstack](https://www.contentstack.com/) allows 4 | you to configure your Contentstack stack with infrastructure-as-code principles. 5 | 6 | ## Usage 7 | 8 | The full documentation is available via https://registry.terraform.io/providers/labd/contentstack/latest/docs 9 | 10 | Add the following to your terraform project: 11 | 12 | ```hcl 13 | terraform { 14 | required_providers { 15 | contentstack = { 16 | source = "labd/contentstack" 17 | } 18 | } 19 | } 20 | ``` 21 | 22 | ## Authors 23 | 24 | This project is developed by [Lab Digital](https://www.labdigital.nl). We 25 | welcome additional contributors. Please see our 26 | [GitHub repository](https://github.com/labd/terraform-provider-contentstack) 27 | for more information. 28 | -------------------------------------------------------------------------------- /Taskfile.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | tasks: 4 | format: 5 | cmds: 6 | - go fmt ./... 7 | 8 | test: 9 | cmds: 10 | - go test -v ./... 11 | 12 | docs: 13 | cmds: 14 | - go generate 15 | 16 | coverage-html: 17 | cmds: 18 | - go test -race -coverprofile=coverage.txt -covermode=atomic -coverpkg=./... ./... 19 | - go tool cover -html=coverage.txt 20 | 21 | coverage: 22 | cmds: 23 | - go test -race -coverprofile=coverage.txt -covermode=atomic -coverpkg=./... ./... 24 | - go tool cover -func=coverage.txt 25 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | # generated by https://github.com/hashicorp/terraform-plugin-docs 3 | page_title: "contentstack Provider" 4 | subcategory: "" 5 | description: |- 6 | 7 | --- 8 | 9 | # contentstack Provider 10 | 11 | 12 | 13 | 14 | 15 | 16 | ## Schema 17 | 18 | ### Optional 19 | 20 | - `api_key` (String) The API key is a unique key assigned to each stack. 21 | - `auth_token` (String, Sensitive) The Authtoken is a read-write token used to make authorized CMA requests, and it is a user-specific token. 22 | - `base_url` (String) The BaseURL, e.g. https://eu-api.contentstack.com/. See https://www.contentstack.com/docs/developers/apis/content-management-api/#base-url 23 | - `branch` (String) The branch to manage resources in. If not specified, the main branch will be used. 24 | - `management_token` (String, Sensitive) Management Tokens are stack-level tokens, with no users attached to them. 25 | -------------------------------------------------------------------------------- /docs/resources/content_type.md: -------------------------------------------------------------------------------- 1 | --- 2 | # generated by https://github.com/hashicorp/terraform-plugin-docs 3 | page_title: "contentstack_content_type Resource - terraform-provider-contentstack" 4 | subcategory: "" 5 | description: |- 6 | Content type defines the structure or schema of a page or a section of 7 | your web or mobile property. To create content for your application, you 8 | are required to first create a content type, and then create entries 9 | using the content type. 10 | 11 | Note: Removing a field or modifying its properties may result in data 12 | loss or invalidate field visibility rules. 13 | --- 14 | 15 | # contentstack_content_type (Resource) 16 | 17 | Content type defines the structure or schema of a page or a section of 18 | your web or mobile property. To create content for your application, you 19 | are required to first create a content type, and then create entries 20 | using the content type. 21 | 22 | Note: Removing a field or modifying its properties may result in data 23 | loss or invalidate field visibility rules. 24 | 25 | ## Example Usage 26 | 27 | ```terraform 28 | terraform { 29 | required_providers { 30 | contentstack = { 31 | source = "labd/contentstack" 32 | } 33 | } 34 | } 35 | 36 | provider "contentstack" { 37 | base_url = "https://eu-api.contentstack.com/" 38 | api_key = "" 39 | management_token = "" 40 | } 41 | 42 | 43 | resource "contentstack_content_type" "my_field" { 44 | title = "test something" 45 | uid = "foobar" 46 | description = "someting" 47 | 48 | schema = jsonencode(jsondecode(< 83 | ## Schema 84 | 85 | ### Required 86 | 87 | - `title` (String) 88 | 89 | ### Optional 90 | 91 | - `description` (String) 92 | - `schema` (String) The schema as JSON. Use jsonencode(jsonecode()) to work around wrong changes. 93 | - `uid` (String) 94 | 95 | 96 | -------------------------------------------------------------------------------- /docs/resources/environment.md: -------------------------------------------------------------------------------- 1 | --- 2 | # generated by https://github.com/hashicorp/terraform-plugin-docs 3 | page_title: "contentstack_environment Resource - terraform-provider-contentstack" 4 | subcategory: "" 5 | description: |- 6 | Contentstack environment are designated destinations to which you can publish 7 | your content. Environments are global, meaning they are available across all 8 | branches of your stack. An environment can also have a list of URLs to be used 9 | as a prefix for published content. 10 | --- 11 | 12 | # contentstack_environment (Resource) 13 | 14 | Contentstack environment are designated destinations to which you can publish 15 | your content. Environments are global, meaning they are available across all 16 | branches of your stack. An environment can also have a list of URLs to be used 17 | as a prefix for published content. 18 | 19 | ## Example Usage 20 | 21 | ```terraform 22 | terraform { 23 | required_providers { 24 | contentstack = { 25 | source = "labd/contentstack" 26 | } 27 | } 28 | } 29 | 30 | provider "contentstack" { 31 | base_url = "https://eu-api.contentstack.com/" 32 | api_key = "" 33 | management_token = "" 34 | } 35 | 36 | resource "contentstack_environment" "production" { 37 | name = "production" 38 | 39 | url { 40 | locale = "nl" 41 | url = "https://www.labdigital.nl/" 42 | } 43 | 44 | url { 45 | locale = "gb" 46 | url = "http://example.com" 47 | } 48 | } 49 | ``` 50 | 51 | 52 | ## Schema 53 | 54 | ### Required 55 | 56 | - `name` (String) 57 | 58 | ### Optional 59 | 60 | - `url` (Block List) (see [below for nested schema](#nestedblock--url)) 61 | 62 | ### Read-Only 63 | 64 | - `uid` (String) 65 | 66 | 67 | ### Nested Schema for `url` 68 | 69 | Required: 70 | 71 | - `locale` (String) 72 | - `url` (String) 73 | 74 | 75 | -------------------------------------------------------------------------------- /docs/resources/global_field.md: -------------------------------------------------------------------------------- 1 | --- 2 | # generated by https://github.com/hashicorp/terraform-plugin-docs 3 | page_title: "contentstack_global_field Resource - terraform-provider-contentstack" 4 | subcategory: "" 5 | description: |- 6 | A Global field is a reusable field (or group of fields) that you can 7 | define once and reuse in any content type within your stack. This 8 | eliminates the need (and thereby time and efforts) to create the same 9 | set of fields repeatedly in multiple content types. 10 | --- 11 | 12 | # contentstack_global_field (Resource) 13 | 14 | A Global field is a reusable field (or group of fields) that you can 15 | define once and reuse in any content type within your stack. This 16 | eliminates the need (and thereby time and efforts) to create the same 17 | set of fields repeatedly in multiple content types. 18 | 19 | ## Example Usage 20 | 21 | ```terraform 22 | terraform { 23 | required_providers { 24 | contentstack = { 25 | source = "labd/contentstack" 26 | } 27 | } 28 | } 29 | 30 | provider "contentstack" { 31 | base_url = "https://eu-api.contentstack.com/" 32 | api_key = "" 33 | management_token = "" 34 | } 35 | 36 | 37 | resource "contentstack_global_field" "my_field" { 38 | title = "test something" 39 | uid = "foobar" 40 | description = "someting" 41 | maintain_revisions = true 42 | 43 | schema = jsonencode(jsondecode(< 78 | ## Schema 79 | 80 | ### Required 81 | 82 | - `title` (String) 83 | - `uid` (String) 84 | 85 | ### Optional 86 | 87 | - `description` (String) 88 | - `maintain_revisions` (Boolean) 89 | - `schema` (String) The schema as JSON. Use jsonencode(jsonecode()) to work around wrong changes. 90 | 91 | 92 | -------------------------------------------------------------------------------- /docs/resources/locale.md: -------------------------------------------------------------------------------- 1 | --- 2 | # generated by https://github.com/hashicorp/terraform-plugin-docs 3 | page_title: "contentstack_locale Resource - terraform-provider-contentstack" 4 | subcategory: "" 5 | description: |- 6 | Contentstack offers multilingual support, which allows you to create 7 | entries in any language of your choice. When creating entries in other 8 | languages, they inherit data initially from the fallback language until 9 | they are localized. 10 | --- 11 | 12 | # contentstack_locale (Resource) 13 | 14 | Contentstack offers multilingual support, which allows you to create 15 | entries in any language of your choice. When creating entries in other 16 | languages, they inherit data initially from the fallback language until 17 | they are localized. 18 | 19 | ## Example Usage 20 | 21 | ```terraform 22 | terraform { 23 | required_providers { 24 | contentstack = { 25 | source = "labd/contentstack" 26 | } 27 | } 28 | } 29 | 30 | provider "contentstack" { 31 | base_url = "https://eu-api.contentstack.com/" 32 | api_key = "" 33 | management_token = "" 34 | } 35 | 36 | 37 | resource "contentstack_locale" "nl" { 38 | name = "Nederlands" 39 | code = "nl-nl" 40 | fallback_locale = "nl" 41 | } 42 | ``` 43 | 44 | 45 | ## Schema 46 | 47 | ### Required 48 | 49 | - `name` (String) 50 | 51 | ### Optional 52 | 53 | - `code` (String) 54 | - `fallback_locale` (String) 55 | 56 | ### Read-Only 57 | 58 | - `uid` (String) 59 | 60 | 61 | -------------------------------------------------------------------------------- /docs/resources/webhook.md: -------------------------------------------------------------------------------- 1 | --- 2 | # generated by https://github.com/hashicorp/terraform-plugin-docs 3 | page_title: "contentstack_webhook Resource - terraform-provider-contentstack" 4 | subcategory: "" 5 | description: |- 6 | A webhook is a user-defined HTTP callback. It is a mechanism that sends 7 | real-time information to any third-party app or service. 8 | --- 9 | 10 | # contentstack_webhook (Resource) 11 | 12 | A webhook is a user-defined HTTP callback. It is a mechanism that sends 13 | real-time information to any third-party app or service. 14 | 15 | ## Example Usage 16 | 17 | ```terraform 18 | terraform { 19 | required_providers { 20 | contentstack = { 21 | source = "labd/contentstack" 22 | } 23 | } 24 | } 25 | 26 | provider "contentstack" { 27 | base_url = "https://eu-api.contentstack.com/" 28 | api_key = "" 29 | management_token = "" 30 | } 31 | 32 | 33 | resource "contentstack_webhook" "mywebhook" { 34 | name = "test" 35 | 36 | destination { 37 | target_url = "http://example.com" 38 | http_basic_auth = "user" 39 | http_basic_password = "password" 40 | 41 | custom_headers = [{ 42 | header_name = "Custom" 43 | value = "testing" 44 | }] 45 | } 46 | 47 | channels = ["assets.create"] 48 | branches = ["main"] 49 | 50 | retry_policy = "manual" 51 | disabled = false 52 | concise_payload = true 53 | } 54 | ``` 55 | 56 | 57 | ## Schema 58 | 59 | ### Required 60 | 61 | - `destination` (Block List, Min: 1) (see [below for nested schema](#nestedblock--destination)) 62 | - `name` (String) 63 | - `retry_policy` (String) should be set to `manual` 64 | 65 | ### Optional 66 | 67 | - `branches` (List of String) 68 | - `channels` (List of String) 69 | - `concise_payload` (Boolean) allows you to send a concise JSON payload to the target URL when a specific event occurs. To send a comprehensive JSON payload, you can set its value to false. 70 | - `disabled` (Boolean) allows you to enable or disable the webhook. 71 | 72 | ### Read-Only 73 | 74 | - `uid` (String) 75 | 76 | 77 | ### Nested Schema for `destination` 78 | 79 | Required: 80 | 81 | - `http_basic_auth` (String) 82 | - `http_basic_password` (String, Sensitive) 83 | - `target_url` (String) 84 | 85 | Optional: 86 | 87 | - `custom_headers` (Attributes List) (see [below for nested schema](#nestedatt--destination--custom_headers)) 88 | 89 | 90 | ### Nested Schema for `destination.custom_headers` 91 | 92 | Optional: 93 | 94 | - `header_name` (String) 95 | - `value` (String) 96 | 97 | 98 | -------------------------------------------------------------------------------- /examples/resources/contentstack_content_type/resource.tf: -------------------------------------------------------------------------------- 1 | 2 | terraform { 3 | required_providers { 4 | contentstack = { 5 | source = "labd/contentstack" 6 | } 7 | } 8 | } 9 | 10 | provider "contentstack" { 11 | base_url = "https://eu-api.contentstack.com/" 12 | api_key = "" 13 | management_token = "" 14 | } 15 | 16 | 17 | resource "contentstack_content_type" "my_field" { 18 | title = "test something" 19 | uid = "foobar" 20 | description = "someting" 21 | 22 | schema = jsonencode(jsondecode(< ../contentstack-go-sdk 14 | 15 | require ( 16 | github.com/Masterminds/goutils v1.1.1 // indirect 17 | github.com/Masterminds/semver/v3 v3.1.1 // indirect 18 | github.com/Masterminds/sprig/v3 v3.2.2 // indirect 19 | github.com/armon/go-radix v1.0.0 // indirect 20 | github.com/bgentry/speakeasy v0.1.0 // indirect 21 | github.com/davecgh/go-spew v1.1.1 // indirect 22 | github.com/fatih/color v1.13.0 // indirect 23 | github.com/golang/protobuf v1.5.2 // indirect 24 | github.com/google/go-cmp v0.5.8 // indirect 25 | github.com/google/uuid v1.3.0 // indirect 26 | github.com/hashicorp/errwrap v1.1.0 // indirect 27 | github.com/hashicorp/go-checkpoint v0.5.0 // indirect 28 | github.com/hashicorp/go-cleanhttp v0.5.2 // indirect 29 | github.com/hashicorp/go-hclog v1.2.0 // indirect 30 | github.com/hashicorp/go-multierror v1.1.1 // indirect 31 | github.com/hashicorp/go-plugin v1.4.4 // indirect 32 | github.com/hashicorp/go-uuid v1.0.3 // indirect 33 | github.com/hashicorp/go-version v1.5.0 // indirect 34 | github.com/hashicorp/hc-install v0.3.2 // indirect 35 | github.com/hashicorp/terraform-exec v0.16.1 // indirect 36 | github.com/hashicorp/terraform-json v0.14.0 // indirect 37 | github.com/hashicorp/terraform-plugin-log v0.4.0 // indirect 38 | github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 // indirect 39 | github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect 40 | github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect 41 | github.com/huandu/xstrings v1.3.2 // indirect 42 | github.com/imdario/mergo v0.3.13 // indirect 43 | github.com/mattn/go-colorable v0.1.12 // indirect 44 | github.com/mattn/go-isatty v0.0.14 // indirect 45 | github.com/mitchellh/cli v1.1.4 // indirect 46 | github.com/mitchellh/copystructure v1.2.0 // indirect 47 | github.com/mitchellh/go-testing-interface v1.14.1 // indirect 48 | github.com/mitchellh/reflectwalk v1.0.2 // indirect 49 | github.com/oklog/run v1.0.0 // indirect 50 | github.com/pmezard/go-difflib v1.0.0 // indirect 51 | github.com/posener/complete v1.2.3 // indirect 52 | github.com/russross/blackfriday v1.6.0 // indirect 53 | github.com/shopspring/decimal v1.3.1 // indirect 54 | github.com/spf13/cast v1.5.0 // indirect 55 | github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect 56 | github.com/vmihailenco/tagparser v0.1.1 // indirect 57 | github.com/zclconf/go-cty v1.10.0 // indirect 58 | golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect 59 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect 60 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect 61 | golang.org/x/text v0.3.7 // indirect 62 | google.golang.org/appengine v1.6.6 // indirect 63 | google.golang.org/genproto v0.0.0-20200711021454-869866162049 // indirect 64 | google.golang.org/grpc v1.46.0 // indirect 65 | google.golang.org/protobuf v1.28.0 // indirect 66 | gopkg.in/yaml.v3 v3.0.0 // indirect 67 | ) 68 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 3 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 4 | github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= 5 | github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= 6 | github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= 7 | github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= 8 | github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= 9 | github.com/Masterminds/sprig/v3 v3.2.0/go.mod h1:tWhwTbUTndesPNeF0C900vKoq283u6zp4APT9vaF3SI= 10 | github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= 11 | github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= 12 | github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= 13 | github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= 14 | github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= 15 | github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= 16 | github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= 17 | github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= 18 | github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= 19 | github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= 20 | github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= 21 | github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= 22 | github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= 23 | github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= 24 | github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= 25 | github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= 26 | github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= 27 | github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= 28 | github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= 29 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 30 | github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 31 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 32 | github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= 33 | github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= 34 | github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= 35 | github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 36 | github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 37 | github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 38 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 39 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 40 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 41 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 42 | github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= 43 | github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= 44 | github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 45 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 46 | github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= 47 | github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= 48 | github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= 49 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 50 | github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= 51 | github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= 52 | github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= 53 | github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= 54 | github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= 55 | github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 56 | github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= 57 | github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= 58 | github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= 59 | github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= 60 | github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34= 61 | github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= 62 | github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= 63 | github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4= 64 | github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= 65 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 66 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 67 | github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 68 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 69 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 70 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 71 | github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= 72 | github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= 73 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 74 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 75 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 76 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 77 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 78 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 79 | github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 80 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 81 | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= 82 | github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= 83 | github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 84 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 85 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 86 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 87 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 88 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 89 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 90 | github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 91 | github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= 92 | github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 93 | github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 94 | github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 95 | github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= 96 | github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 97 | github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= 98 | github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= 99 | github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= 100 | github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= 101 | github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= 102 | github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= 103 | github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= 104 | github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= 105 | github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= 106 | github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= 107 | github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM= 108 | github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= 109 | github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= 110 | github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= 111 | github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= 112 | github.com/hashicorp/go-plugin v1.4.4 h1:NVdrSdFRt3SkZtNckJ6tog7gbpRrcbOjQi/rgF7JYWQ= 113 | github.com/hashicorp/go-plugin v1.4.4/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s= 114 | github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 115 | github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= 116 | github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 117 | github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= 118 | github.com/hashicorp/go-version v1.4.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= 119 | github.com/hashicorp/go-version v1.5.0 h1:O293SZ2Eg+AAYijkVK3jR786Am1bhDEh2GHT0tIVE5E= 120 | github.com/hashicorp/go-version v1.5.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= 121 | github.com/hashicorp/hc-install v0.3.2 h1:oiQdJZvXmkNcRcEOOfM5n+VTsvNjWQeOjfAoO6dKSH8= 122 | github.com/hashicorp/hc-install v0.3.2/go.mod h1:xMG6Tr8Fw1WFjlxH0A9v61cW15pFwgEGqEz0V4jisHs= 123 | github.com/hashicorp/terraform-exec v0.16.1 h1:NAwZFJW2L2SaCBVZoVaH8LPImLOGbPLkSHy0IYbs2uE= 124 | github.com/hashicorp/terraform-exec v0.16.1/go.mod h1:aj0lVshy8l+MHhFNoijNHtqTJQI3Xlowv5EOsEaGO7M= 125 | github.com/hashicorp/terraform-json v0.14.0 h1:sh9iZ1Y8IFJLx+xQiKHGud6/TSUCM0N8e17dKDpqV7s= 126 | github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZbIYnAIkEyqP2pNSckM= 127 | github.com/hashicorp/terraform-plugin-docs v0.9.0 h1:CEu7NToNWRR2os6DfT/Du2s+8qzXHyIcZQ10oiMdbJs= 128 | github.com/hashicorp/terraform-plugin-docs v0.9.0/go.mod h1:47ZcsxMUJxAjGzHf+dZ9q78oYf4PeJxO1N+i5XDtXBc= 129 | github.com/hashicorp/terraform-plugin-framework v0.8.1-0.20220531184835-f0051665855e h1:REbZm3U836gmsGm0A+geB/dB4nlTtGp+HoGbqL0sruo= 130 | github.com/hashicorp/terraform-plugin-framework v0.8.1-0.20220531184835-f0051665855e/go.mod h1:E6ctFL3UC/4F8jW+9lyGZ6LDpW55BwvyVRGw0dEQBhc= 131 | github.com/hashicorp/terraform-plugin-go v0.9.1 h1:vXdHaQ6aqL+OF076nMSBV+JKPdmXlzG5mzVDD04WyPs= 132 | github.com/hashicorp/terraform-plugin-go v0.9.1/go.mod h1:ItjVSlQs70otlzcCwlPcU8FRXLdO973oYFRZwAOxy8M= 133 | github.com/hashicorp/terraform-plugin-log v0.4.0 h1:F3eVnm8r2EfQCe2k9blPIiF/r2TT01SHijXnS7bujvc= 134 | github.com/hashicorp/terraform-plugin-log v0.4.0/go.mod h1:9KclxdunFownr4pIm1jdmwKRmE4d6HVG2c9XDq47rpg= 135 | github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 h1:1FGtlkJw87UsTMg5s8jrekrHmUPUJaMcu6ELiVhQrNw= 136 | github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896/go.mod h1:bzBPnUIkI0RxauU8Dqo+2KrZZ28Cf48s8V6IHt3p4co= 137 | github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= 138 | github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= 139 | github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= 140 | github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= 141 | github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= 142 | github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= 143 | github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= 144 | github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= 145 | github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= 146 | github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= 147 | github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= 148 | github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= 149 | github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= 150 | github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= 151 | github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= 152 | github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= 153 | github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= 154 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 155 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 156 | github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= 157 | github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= 158 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 159 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 160 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 161 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 162 | github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= 163 | github.com/labd/contentstack-go-sdk v0.1.0 h1:lxBbGBkIlileNn2+VrVG6XP776Llxy9i4THPBA01xTU= 164 | github.com/labd/contentstack-go-sdk v0.1.0/go.mod h1:J17aqV8NOcmFfkkotnAljlt6Ctwlu21Ieeo/0BPLNtg= 165 | github.com/labd/contentstack-go-sdk v0.1.0 h1:lxBbGBkIlileNn2+VrVG6XP776Llxy9i4THPBA01xTU= 166 | github.com/labd/contentstack-go-sdk v0.1.0/go.mod h1:J17aqV8NOcmFfkkotnAljlt6Ctwlu21Ieeo/0BPLNtg= 167 | github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= 168 | github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= 169 | github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= 170 | github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= 171 | github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= 172 | github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= 173 | github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= 174 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 175 | github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= 176 | github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= 177 | github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= 178 | github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= 179 | github.com/mitchellh/cli v1.1.4 h1:qj8czE26AU4PbiaPXK5uVmMSM+V5BYsFBiM9HhGRLUA= 180 | github.com/mitchellh/cli v1.1.4/go.mod h1:vTLESy5mRhKOs9KDp0/RATawxP1UqBmdrpVRMnpcvKQ= 181 | github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= 182 | github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= 183 | github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= 184 | github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= 185 | github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= 186 | github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= 187 | github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= 188 | github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= 189 | github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= 190 | github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= 191 | github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= 192 | github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758= 193 | github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= 194 | github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= 195 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 196 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 197 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 198 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 199 | github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= 200 | github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= 201 | github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= 202 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 203 | github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= 204 | github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= 205 | github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= 206 | github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= 207 | github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= 208 | github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= 209 | github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= 210 | github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 211 | github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= 212 | github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= 213 | github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= 214 | github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= 215 | github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= 216 | github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= 217 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 218 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 219 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 220 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 221 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 222 | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 223 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 224 | github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= 225 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 226 | github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= 227 | github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U= 228 | github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= 229 | github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= 230 | github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= 231 | github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= 232 | github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= 233 | github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= 234 | github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= 235 | github.com/zclconf/go-cty v1.10.0 h1:mp9ZXQeIcN8kAwuqorjH+Q+njbJKjLrvB2yIh4q7U+0= 236 | github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= 237 | github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= 238 | go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= 239 | golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 240 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 241 | golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 242 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 243 | golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 244 | golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= 245 | golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= 246 | golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 247 | golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= 248 | golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 249 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 250 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 251 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 252 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 253 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 254 | golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 255 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 256 | golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 257 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 258 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 259 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 260 | golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 261 | golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 262 | golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 263 | golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 264 | golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 265 | golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 266 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 267 | golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= 268 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= 269 | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 270 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 271 | golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 272 | golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 273 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 274 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 275 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 276 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 277 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 278 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 279 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 280 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 281 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 282 | golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 283 | golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 284 | golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 285 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 286 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 287 | golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 288 | golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 289 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 290 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 291 | golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 292 | golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 293 | golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 294 | golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 295 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 296 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 297 | golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 298 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= 299 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 300 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 301 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 302 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 303 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 304 | golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 305 | golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= 306 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 307 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 308 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 309 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 310 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 311 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 312 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 313 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 314 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 315 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 316 | google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 317 | google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= 318 | google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 319 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 320 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 321 | google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 322 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 323 | google.golang.org/genproto v0.0.0-20200711021454-869866162049 h1:YFTFpQhgvrLrmxtiIncJxFXeCyq84ixuKWVCaCAi9Oc= 324 | google.golang.org/genproto v0.0.0-20200711021454-869866162049/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 325 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 326 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 327 | google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= 328 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 329 | google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= 330 | google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= 331 | google.golang.org/grpc v1.46.0 h1:oCjezcn6g6A75TGoKYBPgKmVBLexhYLM6MebdrPApP8= 332 | google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= 333 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 334 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 335 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 336 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 337 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 338 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 339 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 340 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 341 | google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= 342 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 343 | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= 344 | google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 345 | google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 346 | google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= 347 | google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= 348 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 349 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 350 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 351 | gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 352 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 353 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 354 | gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= 355 | gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= 356 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 357 | gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 358 | gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 359 | gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 360 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 361 | gopkg.in/yaml.v3 v3.0.0 h1:hjy8E9ON/egN1tAYqKb61G10WtihqetD4sz2H+8nIeA= 362 | gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 363 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 364 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 365 | -------------------------------------------------------------------------------- /internal/provider/errors.go: -------------------------------------------------------------------------------- 1 | package provider 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | 7 | "github.com/hashicorp/terraform-plugin-framework/diag" 8 | "github.com/labd/contentstack-go-sdk/management" 9 | ) 10 | 11 | func processRemoteError(e error) diag.Diagnostics { 12 | var diags diag.Diagnostics 13 | 14 | switch err := e.(type) { 15 | 16 | case *management.ErrorMessage: 17 | errors := []string{} 18 | for fieldName, fieldErrors := range err.Errors { 19 | for _, msg := range fieldErrors { 20 | errors = append(errors, fmt.Sprintf(" %s - %s", fieldName, msg)) 21 | } 22 | } 23 | diags.AddError(err.ErrorMessage, strings.Join(errors, "\n")) 24 | 25 | default: 26 | diags.AddError(e.Error(), e.Error()) 27 | } 28 | return diags 29 | 30 | } 31 | 32 | func IsNotFoundError(e error) bool { 33 | if e == nil { 34 | return false 35 | } 36 | 37 | if err, ok := e.(*management.ErrorMessage); ok { 38 | return err.ErrorCode == 404 39 | } 40 | 41 | return false 42 | } 43 | -------------------------------------------------------------------------------- /internal/provider/helpers.go: -------------------------------------------------------------------------------- 1 | package provider 2 | 3 | import ( 4 | "fmt" 5 | "github.com/labd/contentstack-go-sdk/management" 6 | "reflect" 7 | 8 | "github.com/hashicorp/terraform-plugin-framework/diag" 9 | "github.com/hashicorp/terraform-plugin-go/tftypes" 10 | ) 11 | 12 | func processResponse(resp any, input any) diag.Diagnostics { 13 | var diags diag.Diagnostics 14 | 15 | // Branches are only returned when the user has the contentstack plan 16 | // supporting this feature. We check if the interface has a field Branches, 17 | // if it has and it is empty we assume it's not part of the plan. Copy the 18 | // input value in that case so that terraform doesn't see vanishing 19 | // elements. 20 | t := reflect.TypeOf(resp) 21 | if _, ok := t.Elem().FieldByName("Branches"); ok { 22 | v := reflect.ValueOf(resp) 23 | branches := v.Elem().FieldByName("Branches") 24 | 25 | if branches.Len() == 0 { 26 | // Copy value from input to resp 27 | t := reflect.ValueOf(input).Elem().FieldByName("Branches") 28 | branches.Set(t) 29 | 30 | diags.AddAttributeWarning( 31 | tftypes.NewAttributePath().WithAttributeName("branches"), 32 | "Branches are not part of your plan.", 33 | "Branches are not part of your plan. Please contact support@contentstack.com to upgrade your plan.", 34 | ) 35 | } 36 | } 37 | 38 | return diags 39 | } 40 | 41 | func copyHttpBasicPasswords(wd []management.WebhookDestination, data WebhookDestinationSlice) ([]management.WebhookDestination, error) { 42 | cd := make([]management.WebhookDestination, 0, len(wd)) 43 | 44 | for _, d := range wd { 45 | planned := data.FindByTargetURLAndHttpBasicAuth(d.TargetURL, d.HttpBasicAuth) 46 | if planned == nil { 47 | return nil, fmt.Errorf("d %s not found in planned state", d.TargetURL) 48 | } 49 | 50 | d.HttpBasicPassword = planned.HttpBasicPassword.Value 51 | cd = append(cd, d) 52 | } 53 | return cd, nil 54 | } 55 | -------------------------------------------------------------------------------- /internal/provider/helpers_test.go: -------------------------------------------------------------------------------- 1 | package provider 2 | 3 | import ( 4 | "github.com/hashicorp/terraform-plugin-framework/types" 5 | "testing" 6 | 7 | "github.com/labd/contentstack-go-sdk/management" 8 | "github.com/stretchr/testify/assert" 9 | ) 10 | 11 | type MockResponse struct { 12 | Branches []string 13 | } 14 | 15 | type MockInput struct { 16 | Branches []string 17 | } 18 | 19 | func TestProcessResponseWithBranches(t *testing.T) { 20 | resp := &MockResponse{Branches: []string{}} 21 | input := &MockInput{Branches: []string{"branch1"}} 22 | 23 | diags := processResponse(resp, input) 24 | 25 | assert.Len(t, diags, 1) 26 | assert.Equal(t, "branch1", resp.Branches[0]) 27 | } 28 | 29 | func TestProcessResponseWithoutBranchesField(t *testing.T) { 30 | resp := &struct{ NoBranchesField string }{} 31 | input := &MockInput{Branches: []string{"branch1"}} 32 | 33 | diags := processResponse(resp, input) 34 | 35 | assert.Len(t, diags, 0) 36 | } 37 | 38 | func TestCopyHttpBasicPasswordsSuccess(t *testing.T) { 39 | wd := []management.WebhookDestination{ 40 | {TargetURL: "http://example.com", HttpBasicAuth: "auth1"}, 41 | } 42 | data := WebhookDestinationSlice{ 43 | {TargetURL: types.String{Value: "http://example.com"}, HttpBasicAuth: types.String{Value: "auth1"}, HttpBasicPassword: types.String{Value: "password1"}}, 44 | } 45 | 46 | result, err := copyHttpBasicPasswords(wd, data) 47 | 48 | assert.NoError(t, err) 49 | assert.Equal(t, "password1", result[0].HttpBasicPassword) 50 | } 51 | 52 | func TestCopyHttpBasicPasswordsNotFound(t *testing.T) { 53 | wd := []management.WebhookDestination{ 54 | {TargetURL: "http://example.com", HttpBasicAuth: "auth1"}, 55 | } 56 | data := WebhookDestinationSlice{} 57 | 58 | result, err := copyHttpBasicPasswords(wd, data) 59 | 60 | assert.Error(t, err) 61 | assert.Nil(t, result) 62 | } 63 | -------------------------------------------------------------------------------- /internal/provider/provider.go: -------------------------------------------------------------------------------- 1 | package provider 2 | 3 | import ( 4 | "context" 5 | "net/http" 6 | 7 | "github.com/hashicorp/terraform-plugin-framework/diag" 8 | "github.com/hashicorp/terraform-plugin-framework/tfsdk" 9 | "github.com/hashicorp/terraform-plugin-framework/types" 10 | "github.com/labd/contentstack-go-sdk/management" 11 | ) 12 | 13 | func New(version string) func() tfsdk.Provider { 14 | return func() tfsdk.Provider { 15 | return &provider{version: version} 16 | } 17 | } 18 | 19 | type provider struct { 20 | stack *management.StackInstance 21 | client *management.Client 22 | version string 23 | } 24 | 25 | // GetSchema 26 | func (p *provider) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics) { 27 | return tfsdk.Schema{ 28 | Attributes: map[string]tfsdk.Attribute{ 29 | "base_url": { 30 | Type: types.StringType, 31 | Optional: true, 32 | Description: "The BaseURL, e.g. https://eu-api.contentstack.com/. See https://www.contentstack.com/docs/developers/apis/content-management-api/#base-url", 33 | }, 34 | "api_key": { 35 | Type: types.StringType, 36 | Optional: true, 37 | Description: "The API key is a unique key assigned to each stack.", 38 | }, 39 | "management_token": { 40 | Type: types.StringType, 41 | Optional: true, 42 | Sensitive: true, 43 | Description: "Management Tokens are stack-level tokens, with no users attached to them.", 44 | }, 45 | "auth_token": { 46 | Type: types.StringType, 47 | Optional: true, 48 | Sensitive: true, 49 | Description: "The Authtoken is a read-write token used to make authorized CMA requests, and it is a user-specific token.", 50 | }, 51 | "branch": { 52 | Type: types.StringType, 53 | Optional: true, 54 | Description: "The branch to manage resources in. If not specified, the main branch will be used.", 55 | }, 56 | }, 57 | }, nil 58 | } 59 | 60 | // Provider schema struct 61 | type providerData struct { 62 | BaseURL types.String `tfsdk:"base_url"` 63 | AuthToken types.String `tfsdk:"auth_token"` 64 | ApiKey types.String `tfsdk:"api_key"` 65 | ManagementToken types.String `tfsdk:"management_token"` 66 | Branch types.String `tfsdk:"branch"` 67 | } 68 | 69 | func (p *provider) Configure(ctx context.Context, req tfsdk.ConfigureProviderRequest, resp *tfsdk.ConfigureProviderResponse) { 70 | 71 | // Retrieve provider data from configuration 72 | var config providerData 73 | diags := req.Config.Get(ctx, &config) 74 | resp.Diagnostics.Append(diags...) 75 | if resp.Diagnostics.HasError() { 76 | return 77 | } 78 | 79 | cfg := management.ClientConfig{ 80 | BaseURL: config.BaseURL.Value, 81 | AuthToken: config.AuthToken.Value, 82 | HTTPClient: &http.Client{ 83 | Transport: management.DebugTransport, 84 | }, 85 | } 86 | 87 | c, err := management.NewClient(cfg) 88 | if err != nil { 89 | resp.Diagnostics.AddError( 90 | "Unable to create client", 91 | "Unable to create contentstack client:\n\n"+err.Error(), 92 | ) 93 | return 94 | } 95 | 96 | stackAuth := management.StackAuth{ 97 | ApiKey: config.ApiKey.Value, 98 | ManagementToken: config.ManagementToken.Value, 99 | Branch: config.Branch.Value, 100 | } 101 | 102 | instance, err := c.Stack(&stackAuth) 103 | if err != nil { 104 | resp.Diagnostics.AddError( 105 | "Unable to create stack client", 106 | "Unable to create contentstack stack client:\n\n"+err.Error(), 107 | ) 108 | return 109 | } 110 | 111 | p.client = c 112 | p.stack = instance 113 | } 114 | 115 | // GetResources - Defines provider resources 116 | func (p *provider) GetResources(_ context.Context) (map[string]tfsdk.ResourceType, diag.Diagnostics) { 117 | return map[string]tfsdk.ResourceType{ 118 | "contentstack_content_type": resourceContentTypeType{}, 119 | "contentstack_environment": resourceEnvironmentType{}, 120 | "contentstack_global_field": resourceGlobalFieldType{}, 121 | "contentstack_locale": resourceLocaleType{}, 122 | "contentstack_webhook": resourceWebhookType{}, 123 | }, nil 124 | } 125 | 126 | // GetDataSources - Defines provider data sources 127 | func (p *provider) GetDataSources(_ context.Context) (map[string]tfsdk.DataSourceType, diag.Diagnostics) { 128 | return map[string]tfsdk.DataSourceType{}, nil 129 | } 130 | -------------------------------------------------------------------------------- /internal/provider/resource_content_type.go: -------------------------------------------------------------------------------- 1 | package provider 2 | 3 | import ( 4 | "context" 5 | "encoding/json" 6 | "fmt" 7 | 8 | "github.com/hashicorp/terraform-plugin-framework/diag" 9 | "github.com/hashicorp/terraform-plugin-framework/tfsdk" 10 | "github.com/hashicorp/terraform-plugin-framework/types" 11 | "github.com/hashicorp/terraform-plugin-go/tftypes" 12 | "github.com/labd/contentstack-go-sdk/management" 13 | ) 14 | 15 | type resourceContentTypeType struct{} 16 | 17 | type ContentTypeData struct { 18 | UID types.String `tfsdk:"uid"` 19 | Title types.String `tfsdk:"title"` 20 | Description types.String `tfsdk:"description"` 21 | Schema types.String `tfsdk:"schema"` 22 | } 23 | 24 | // Global Field Resource schema 25 | func (r resourceContentTypeType) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics) { 26 | return tfsdk.Schema{ 27 | Description: ` 28 | Content type defines the structure or schema of a page or a section of 29 | your web or mobile property. To create content for your application, you 30 | are required to first create a content type, and then create entries 31 | using the content type. 32 | 33 | Note: Removing a field or modifying its properties may result in data 34 | loss or invalidate field visibility rules. 35 | `, 36 | Attributes: map[string]tfsdk.Attribute{ 37 | "uid": { 38 | Type: types.StringType, 39 | Optional: true, 40 | Computed: true, 41 | }, 42 | "title": { 43 | Type: types.StringType, 44 | Required: true, 45 | }, 46 | "description": { 47 | Type: types.StringType, 48 | Optional: true, 49 | }, 50 | "schema": { 51 | Type: types.StringType, 52 | Optional: true, 53 | Description: "The schema as JSON. Use jsonencode(jsonecode()) to work around wrong changes.", 54 | }, 55 | }, 56 | }, nil 57 | } 58 | 59 | // New resource instance 60 | func (r resourceContentTypeType) NewResource(_ context.Context, p tfsdk.Provider) (tfsdk.Resource, diag.Diagnostics) { 61 | return resourceContentType{ 62 | p: *(p.(*provider)), 63 | }, nil 64 | } 65 | 66 | type resourceContentType struct { 67 | p provider 68 | } 69 | 70 | func (r resourceContentType) Create(ctx context.Context, req tfsdk.CreateResourceRequest, resp *tfsdk.CreateResourceResponse) { 71 | var plan ContentTypeData 72 | diags := req.Plan.Get(ctx, &plan) 73 | resp.Diagnostics.Append(diags...) 74 | if resp.Diagnostics.HasError() { 75 | return 76 | } 77 | 78 | input := NewContentTypeInput(&plan) 79 | resource, err := r.p.stack.ContentTypeCreate(ctx, *input) 80 | if err != nil { 81 | diags := processRemoteError(err) 82 | resp.Diagnostics.Append(diags...) 83 | return 84 | } 85 | 86 | diags = processResponse(resource, input) 87 | resp.Diagnostics.Append(diags...) 88 | 89 | // Write to state. 90 | state := NewContentTypeData(resource) 91 | MergeContentType(state, &plan) 92 | diags = resp.State.Set(ctx, state) 93 | resp.Diagnostics.Append(diags...) 94 | } 95 | 96 | func (r resourceContentType) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) { 97 | var state ContentTypeData 98 | diags := req.State.Get(ctx, &state) 99 | resp.Diagnostics.Append(diags...) 100 | if resp.Diagnostics.HasError() { 101 | return 102 | } 103 | 104 | resource, err := r.p.stack.ContentTypeFetch(ctx, state.UID.Value) 105 | if err != nil { 106 | if IsNotFoundError(err) { 107 | d := diag.NewErrorDiagnostic( 108 | "Error retrieving global field", 109 | fmt.Sprintf("The global field with UID %s was not found.", state.UID.Value)) 110 | resp.Diagnostics.Append(d) 111 | } else { 112 | diags := processRemoteError(err) 113 | resp.Diagnostics.Append(diags...) 114 | } 115 | return 116 | } 117 | 118 | curr := NewContentTypeInput(&state) 119 | diags = processResponse(resource, curr) 120 | resp.Diagnostics.Append(diags...) 121 | 122 | // Set state 123 | newState := NewContentTypeData(resource) 124 | diags = resp.State.Set(ctx, &newState) 125 | resp.Diagnostics.Append(diags...) 126 | } 127 | 128 | func (r resourceContentType) Delete(ctx context.Context, req tfsdk.DeleteResourceRequest, resp *tfsdk.DeleteResourceResponse) { 129 | var state ContentTypeData 130 | diags := req.State.Get(ctx, &state) 131 | resp.Diagnostics.Append(diags...) 132 | if resp.Diagnostics.HasError() { 133 | return 134 | } 135 | 136 | // Delete order by calling API 137 | err := r.p.stack.ContentTypeDelete(ctx, state.UID.Value) 138 | if err != nil { 139 | diags = processRemoteError(err) 140 | resp.Diagnostics.Append(diags...) 141 | return 142 | } 143 | 144 | // Remove resource from state 145 | resp.State.RemoveResource(ctx) 146 | } 147 | 148 | func (r resourceContentType) Update(ctx context.Context, req tfsdk.UpdateResourceRequest, resp *tfsdk.UpdateResourceResponse) { 149 | // Get plan values 150 | var plan ContentTypeData 151 | diags := req.Plan.Get(ctx, &plan) 152 | resp.Diagnostics.Append(diags...) 153 | if resp.Diagnostics.HasError() { 154 | return 155 | } 156 | 157 | // Get current state 158 | var state ContentTypeData 159 | diags = req.State.Get(ctx, &state) 160 | resp.Diagnostics.Append(diags...) 161 | if resp.Diagnostics.HasError() { 162 | return 163 | } 164 | 165 | input := NewContentTypeInput(&plan) 166 | resource, err := r.p.stack.ContentTypeUpdate(ctx, state.UID.Value, *input) 167 | if err != nil { 168 | diags = processRemoteError(err) 169 | resp.Diagnostics.Append(diags...) 170 | return 171 | } 172 | 173 | diags = processResponse(resource, input) 174 | resp.Diagnostics.Append(diags...) 175 | 176 | // Set state 177 | result := NewContentTypeData(resource) 178 | MergeContentType(result, &plan) 179 | diags = resp.State.Set(ctx, result) 180 | resp.Diagnostics.Append(diags...) 181 | } 182 | 183 | func (r resourceContentType) ImportState(ctx context.Context, req tfsdk.ImportResourceStateRequest, resp *tfsdk.ImportResourceStateResponse) { 184 | tfsdk.ResourceImportStatePassthroughID(ctx, tftypes.NewAttributePath().WithAttributeName("id"), req, resp) 185 | } 186 | 187 | func NewContentTypeData(field *management.ContentType) *ContentTypeData { 188 | 189 | schemaContent, err := field.Schema.MarshalJSON() 190 | if err != nil { 191 | panic(err) 192 | } 193 | 194 | state := &ContentTypeData{ 195 | UID: types.String{Value: field.UID}, 196 | Title: types.String{Value: field.Title}, 197 | Description: types.String{Value: field.Description}, 198 | Schema: types.String{Value: string(schemaContent)}, 199 | } 200 | return state 201 | } 202 | 203 | func NewContentTypeInput(field *ContentTypeData) *management.ContentTypeInput { 204 | 205 | input := &management.ContentTypeInput{ 206 | UID: &field.UID.Value, 207 | Title: &field.Title.Value, 208 | Description: &field.Description.Value, 209 | Schema: json.RawMessage(field.Schema.Value), 210 | } 211 | 212 | return input 213 | } 214 | 215 | func MergeContentType(out *ContentTypeData, in *ContentTypeData) { 216 | out.Schema = in.Schema 217 | } 218 | -------------------------------------------------------------------------------- /internal/provider/resource_environment.go: -------------------------------------------------------------------------------- 1 | package provider 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/hashicorp/terraform-plugin-framework/diag" 8 | "github.com/hashicorp/terraform-plugin-framework/tfsdk" 9 | "github.com/hashicorp/terraform-plugin-framework/types" 10 | "github.com/hashicorp/terraform-plugin-go/tftypes" 11 | "github.com/labd/contentstack-go-sdk/management" 12 | ) 13 | 14 | type resourceEnvironmentType struct{} 15 | 16 | type EnvironmentData struct { 17 | UID types.String `tfsdk:"uid"` 18 | Name types.String `tfsdk:"name"` 19 | URLs []EnvironmentUrlData `tfsdk:"url"` 20 | } 21 | 22 | type EnvironmentUrlData struct { 23 | Locale types.String `tfsdk:"locale"` 24 | URL types.String `tfsdk:"url"` 25 | } 26 | 27 | // Environment Resource schema 28 | func (r resourceEnvironmentType) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics) { 29 | return tfsdk.Schema{ 30 | Description: ` 31 | Contentstack environment are designated destinations to which you can publish 32 | your content. Environments are global, meaning they are available across all 33 | branches of your stack. An environment can also have a list of URLs to be used 34 | as a prefix for published content. 35 | `, 36 | Attributes: map[string]tfsdk.Attribute{ 37 | "uid": { 38 | Type: types.StringType, 39 | Computed: true, 40 | }, 41 | "name": { 42 | Type: types.StringType, 43 | Required: true, 44 | }, 45 | }, 46 | Blocks: map[string]tfsdk.Block{ 47 | "url": { 48 | NestingMode: tfsdk.BlockNestingModeList, 49 | Blocks: map[string]tfsdk.Block{}, 50 | MinItems: 0, 51 | Attributes: map[string]tfsdk.Attribute{ 52 | "locale": { 53 | Type: types.StringType, 54 | Required: true, 55 | }, 56 | "url": { 57 | Type: types.StringType, 58 | Required: true, 59 | }, 60 | }, 61 | }, 62 | }, 63 | }, nil 64 | } 65 | 66 | // New resource instance 67 | func (r resourceEnvironmentType) NewResource(_ context.Context, p tfsdk.Provider) (tfsdk.Resource, diag.Diagnostics) { 68 | return resourceEnvironment{ 69 | p: *(p.(*provider)), 70 | }, nil 71 | } 72 | 73 | type resourceEnvironment struct { 74 | p provider 75 | } 76 | 77 | func (r resourceEnvironment) Create(ctx context.Context, req tfsdk.CreateResourceRequest, resp *tfsdk.CreateResourceResponse) { 78 | var plan EnvironmentData 79 | diags := req.Plan.Get(ctx, &plan) 80 | resp.Diagnostics.Append(diags...) 81 | if resp.Diagnostics.HasError() { 82 | return 83 | } 84 | 85 | input := NewEnvironmentInput(&plan) 86 | environment, err := r.p.stack.EnvironmentCreate(ctx, *input) 87 | if err != nil { 88 | diags := processRemoteError(err) 89 | resp.Diagnostics.Append(diags...) 90 | return 91 | } 92 | 93 | diags = processResponse(environment, input) 94 | resp.Diagnostics.Append(diags...) 95 | 96 | // Write to state 97 | state := NewEnvironmentData(environment) 98 | diags = resp.State.Set(ctx, state) 99 | resp.Diagnostics.Append(diags...) 100 | } 101 | 102 | func (r resourceEnvironment) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) { 103 | var state EnvironmentData 104 | diags := req.State.Get(ctx, &state) 105 | resp.Diagnostics.Append(diags...) 106 | if resp.Diagnostics.HasError() { 107 | return 108 | } 109 | 110 | environment, err := r.p.stack.EnvironmentFetch(ctx, state.Name.Value) 111 | if err != nil { 112 | if IsNotFoundError(err) { 113 | d := diag.NewErrorDiagnostic( 114 | "Error retrieving environment", 115 | fmt.Sprintf("The environment with Name %s was not found.", state.Name.Value)) 116 | resp.Diagnostics.Append(d) 117 | } else { 118 | diags := processRemoteError(err) 119 | resp.Diagnostics.Append(diags...) 120 | } 121 | return 122 | } 123 | 124 | curr := NewEnvironmentInput(&state) 125 | diags = processResponse(environment, curr) 126 | resp.Diagnostics.Append(diags...) 127 | 128 | // Set state 129 | newState := NewEnvironmentData(environment) 130 | diags = resp.State.Set(ctx, &newState) 131 | resp.Diagnostics.Append(diags...) 132 | } 133 | 134 | func (r resourceEnvironment) Delete(ctx context.Context, req tfsdk.DeleteResourceRequest, resp *tfsdk.DeleteResourceResponse) { 135 | var state EnvironmentData 136 | diags := req.State.Get(ctx, &state) 137 | resp.Diagnostics.Append(diags...) 138 | if resp.Diagnostics.HasError() { 139 | return 140 | } 141 | 142 | // Delete environment by calling API 143 | err := r.p.stack.EnvironmentDelete(ctx, state.Name.Value) 144 | if err != nil { 145 | diags = processRemoteError(err) 146 | resp.Diagnostics.Append(diags...) 147 | return 148 | } 149 | 150 | // Remove resource from state 151 | resp.State.RemoveResource(ctx) 152 | } 153 | 154 | func (r resourceEnvironment) Update(ctx context.Context, req tfsdk.UpdateResourceRequest, resp *tfsdk.UpdateResourceResponse) { 155 | // Get plan values 156 | var plan EnvironmentData 157 | diags := req.Plan.Get(ctx, &plan) 158 | resp.Diagnostics.Append(diags...) 159 | if resp.Diagnostics.HasError() { 160 | return 161 | } 162 | 163 | // Get current state 164 | var state EnvironmentData 165 | diags = req.State.Get(ctx, &state) 166 | resp.Diagnostics.Append(diags...) 167 | if resp.Diagnostics.HasError() { 168 | return 169 | } 170 | 171 | input := NewEnvironmentInput(&plan) 172 | environment, err := r.p.stack.EnvironmentUpdate(ctx, state.Name.Value, *input) 173 | if err != nil { 174 | diags = processRemoteError(err) 175 | resp.Diagnostics.Append(diags...) 176 | return 177 | } 178 | 179 | diags = processResponse(environment, input) 180 | resp.Diagnostics.Append(diags...) 181 | 182 | // Set state 183 | result := NewEnvironmentData(environment) 184 | diags = resp.State.Set(ctx, result) 185 | resp.Diagnostics.Append(diags...) 186 | } 187 | 188 | func (r resourceEnvironment) ImportState(ctx context.Context, req tfsdk.ImportResourceStateRequest, resp *tfsdk.ImportResourceStateResponse) { 189 | tfsdk.ResourceImportStatePassthroughID(ctx, tftypes.NewAttributePath().WithAttributeName("id"), req, resp) 190 | } 191 | 192 | func NewEnvironmentData(environment *management.Environment) *EnvironmentData { 193 | urls := []EnvironmentUrlData{} 194 | for i := range environment.URLs { 195 | s := environment.URLs[i] 196 | 197 | url := EnvironmentUrlData{ 198 | Locale: types.String{Value: s.Locale}, 199 | URL: types.String{Value: s.URL}, 200 | } 201 | 202 | urls = append(urls, url) 203 | } 204 | 205 | state := &EnvironmentData{ 206 | UID: types.String{Value: environment.UID}, 207 | Name: types.String{Value: environment.Name}, 208 | URLs: urls, 209 | } 210 | return state 211 | } 212 | 213 | func NewEnvironmentInput(environment *EnvironmentData) *management.EnvironmentInput { 214 | urls := []management.EnvironmentUrl{} 215 | for i := range environment.URLs { 216 | s := environment.URLs[i] 217 | url := management.EnvironmentUrl{ 218 | Locale: s.Locale.Value, 219 | URL: s.URL.Value, 220 | } 221 | 222 | urls = append(urls, url) 223 | } 224 | 225 | input := &management.EnvironmentInput{ 226 | Name: environment.Name.Value, 227 | URLs: urls, 228 | } 229 | 230 | return input 231 | } 232 | -------------------------------------------------------------------------------- /internal/provider/resource_global_field.go: -------------------------------------------------------------------------------- 1 | package provider 2 | 3 | import ( 4 | "context" 5 | "encoding/json" 6 | "fmt" 7 | 8 | "github.com/hashicorp/terraform-plugin-framework/diag" 9 | "github.com/hashicorp/terraform-plugin-framework/tfsdk" 10 | "github.com/hashicorp/terraform-plugin-framework/types" 11 | "github.com/hashicorp/terraform-plugin-go/tftypes" 12 | "github.com/labd/contentstack-go-sdk/management" 13 | ) 14 | 15 | type resourceGlobalFieldType struct{} 16 | 17 | type GlobalFieldData struct { 18 | UID types.String `tfsdk:"uid"` 19 | Title types.String `tfsdk:"title"` 20 | Description types.String `tfsdk:"description"` 21 | MaintainRevisions types.Bool `tfsdk:"maintain_revisions"` 22 | Schema types.String `tfsdk:"schema"` 23 | } 24 | 25 | // Global Field Resource schema 26 | func (r resourceGlobalFieldType) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics) { 27 | return tfsdk.Schema{ 28 | Description: ` 29 | A Global field is a reusable field (or group of fields) that you can 30 | define once and reuse in any content type within your stack. This 31 | eliminates the need (and thereby time and efforts) to create the same 32 | set of fields repeatedly in multiple content types. 33 | `, 34 | Attributes: map[string]tfsdk.Attribute{ 35 | "uid": { 36 | Type: types.StringType, 37 | Required: true, 38 | }, 39 | "title": { 40 | Type: types.StringType, 41 | Required: true, 42 | }, 43 | "maintain_revisions": { 44 | Type: types.BoolType, 45 | Optional: true, 46 | }, 47 | "description": { 48 | Type: types.StringType, 49 | Optional: true, 50 | }, 51 | "schema": { 52 | Type: types.StringType, 53 | Optional: true, 54 | Description: "The schema as JSON. Use jsonencode(jsonecode()) to work around wrong changes.", 55 | }, 56 | }, 57 | }, nil 58 | } 59 | 60 | // New resource instance 61 | func (r resourceGlobalFieldType) NewResource(_ context.Context, p tfsdk.Provider) (tfsdk.Resource, diag.Diagnostics) { 62 | return resourceGlobalField{ 63 | p: *(p.(*provider)), 64 | }, nil 65 | } 66 | 67 | type resourceGlobalField struct { 68 | p provider 69 | } 70 | 71 | func (r resourceGlobalField) Create(ctx context.Context, req tfsdk.CreateResourceRequest, resp *tfsdk.CreateResourceResponse) { 72 | var plan GlobalFieldData 73 | diags := req.Plan.Get(ctx, &plan) 74 | resp.Diagnostics.Append(diags...) 75 | if resp.Diagnostics.HasError() { 76 | return 77 | } 78 | 79 | input := NewGlobalFieldInput(&plan) 80 | resource, err := r.p.stack.GlobalFieldCreate(ctx, *input) 81 | if err != nil { 82 | diags := processRemoteError(err) 83 | resp.Diagnostics.Append(diags...) 84 | return 85 | } 86 | 87 | diags = processResponse(resource, input) 88 | resp.Diagnostics.Append(diags...) 89 | 90 | // Write to state. 91 | state := NewGlobalFieldData(resource) 92 | MergeGlobalField(state, &plan) 93 | diags = resp.State.Set(ctx, state) 94 | resp.Diagnostics.Append(diags...) 95 | } 96 | 97 | func (r resourceGlobalField) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) { 98 | var state GlobalFieldData 99 | diags := req.State.Get(ctx, &state) 100 | resp.Diagnostics.Append(diags...) 101 | if resp.Diagnostics.HasError() { 102 | return 103 | } 104 | 105 | resource, err := r.p.stack.GlobalFieldFetch(ctx, state.UID.Value) 106 | if err != nil { 107 | if IsNotFoundError(err) { 108 | d := diag.NewErrorDiagnostic( 109 | "Error retrieving global field", 110 | fmt.Sprintf("The global field with UID %s was not found.", state.UID.Value)) 111 | resp.Diagnostics.Append(d) 112 | } else { 113 | diags := processRemoteError(err) 114 | resp.Diagnostics.Append(diags...) 115 | } 116 | return 117 | } 118 | 119 | curr := NewGlobalFieldInput(&state) 120 | diags = processResponse(resource, curr) 121 | resp.Diagnostics.Append(diags...) 122 | 123 | // Set state 124 | newState := NewGlobalFieldData(resource) 125 | diags = resp.State.Set(ctx, &newState) 126 | resp.Diagnostics.Append(diags...) 127 | } 128 | 129 | func (r resourceGlobalField) Delete(ctx context.Context, req tfsdk.DeleteResourceRequest, resp *tfsdk.DeleteResourceResponse) { 130 | var state GlobalFieldData 131 | diags := req.State.Get(ctx, &state) 132 | resp.Diagnostics.Append(diags...) 133 | if resp.Diagnostics.HasError() { 134 | return 135 | } 136 | 137 | // Delete order by calling API 138 | err := r.p.stack.GlobalFieldDelete(ctx, state.UID.Value) 139 | if err != nil { 140 | diags = processRemoteError(err) 141 | resp.Diagnostics.Append(diags...) 142 | return 143 | } 144 | 145 | // Remove resource from state 146 | resp.State.RemoveResource(ctx) 147 | } 148 | 149 | func (r resourceGlobalField) Update(ctx context.Context, req tfsdk.UpdateResourceRequest, resp *tfsdk.UpdateResourceResponse) { 150 | // Get plan values 151 | var plan GlobalFieldData 152 | diags := req.Plan.Get(ctx, &plan) 153 | resp.Diagnostics.Append(diags...) 154 | if resp.Diagnostics.HasError() { 155 | return 156 | } 157 | 158 | // Get current state 159 | var state GlobalFieldData 160 | diags = req.State.Get(ctx, &state) 161 | resp.Diagnostics.Append(diags...) 162 | if resp.Diagnostics.HasError() { 163 | return 164 | } 165 | 166 | input := NewGlobalFieldInput(&plan) 167 | resource, err := r.p.stack.GlobalFieldUpdate(ctx, state.UID.Value, *input) 168 | if err != nil { 169 | diags = processRemoteError(err) 170 | resp.Diagnostics.Append(diags...) 171 | return 172 | } 173 | 174 | diags = processResponse(resource, input) 175 | resp.Diagnostics.Append(diags...) 176 | 177 | // Set state 178 | result := NewGlobalFieldData(resource) 179 | MergeGlobalField(result, &plan) 180 | diags = resp.State.Set(ctx, result) 181 | resp.Diagnostics.Append(diags...) 182 | } 183 | 184 | func (r resourceGlobalField) ImportState(ctx context.Context, req tfsdk.ImportResourceStateRequest, resp *tfsdk.ImportResourceStateResponse) { 185 | tfsdk.ResourceImportStatePassthroughID(ctx, tftypes.NewAttributePath().WithAttributeName("id"), req, resp) 186 | } 187 | 188 | func NewGlobalFieldData(field *management.GlobalField) *GlobalFieldData { 189 | 190 | schemaContent, err := field.Schema.MarshalJSON() 191 | if err != nil { 192 | panic(err) 193 | } 194 | 195 | state := &GlobalFieldData{ 196 | UID: types.String{Value: field.UID}, 197 | Title: types.String{Value: field.Title}, 198 | Description: types.String{Value: field.Description}, 199 | MaintainRevisions: types.Bool{Value: field.MaintainRevisions}, 200 | Schema: types.String{Value: string(schemaContent)}, 201 | } 202 | return state 203 | } 204 | 205 | func NewGlobalFieldInput(field *GlobalFieldData) *management.GlobalFieldInput { 206 | 207 | input := &management.GlobalFieldInput{ 208 | UID: &field.UID.Value, 209 | Title: &field.Title.Value, 210 | Description: &field.Description.Value, 211 | MaintainRevisions: field.MaintainRevisions.Value, 212 | Schema: json.RawMessage(field.Schema.Value), 213 | } 214 | 215 | return input 216 | } 217 | 218 | func MergeGlobalField(out *GlobalFieldData, in *GlobalFieldData) { 219 | out.Schema = in.Schema 220 | } 221 | -------------------------------------------------------------------------------- /internal/provider/resource_locale.go: -------------------------------------------------------------------------------- 1 | package provider 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/hashicorp/terraform-plugin-framework/diag" 8 | "github.com/hashicorp/terraform-plugin-framework/tfsdk" 9 | "github.com/hashicorp/terraform-plugin-framework/types" 10 | "github.com/hashicorp/terraform-plugin-go/tftypes" 11 | "github.com/labd/contentstack-go-sdk/management" 12 | ) 13 | 14 | type resourceLocaleType struct{} 15 | 16 | type LocaleData struct { 17 | UID types.String `tfsdk:"uid"` 18 | Name types.String `tfsdk:"name"` 19 | Code types.String `tfsdk:"code"` 20 | FallbackLocale types.String `tfsdk:"fallback_locale"` 21 | } 22 | 23 | // Global Field Resource schema 24 | func (r resourceLocaleType) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics) { 25 | return tfsdk.Schema{ 26 | Description: ` 27 | Contentstack offers multilingual support, which allows you to create 28 | entries in any language of your choice. When creating entries in other 29 | languages, they inherit data initially from the fallback language until 30 | they are localized. 31 | `, 32 | Attributes: map[string]tfsdk.Attribute{ 33 | "uid": { 34 | Type: types.StringType, 35 | Computed: true, 36 | }, 37 | "name": { 38 | Type: types.StringType, 39 | Required: true, 40 | }, 41 | "code": { 42 | Type: types.StringType, 43 | Optional: true, 44 | }, 45 | "fallback_locale": { 46 | Type: types.StringType, 47 | Optional: true, 48 | }, 49 | }, 50 | }, nil 51 | } 52 | 53 | // New resource instance 54 | func (r resourceLocaleType) NewResource(_ context.Context, p tfsdk.Provider) (tfsdk.Resource, diag.Diagnostics) { 55 | return resourceLocale{ 56 | p: *(p.(*provider)), 57 | }, nil 58 | } 59 | 60 | type resourceLocale struct { 61 | p provider 62 | } 63 | 64 | func (r resourceLocale) Create(ctx context.Context, req tfsdk.CreateResourceRequest, resp *tfsdk.CreateResourceResponse) { 65 | var plan LocaleData 66 | diags := req.Plan.Get(ctx, &plan) 67 | resp.Diagnostics.Append(diags...) 68 | if resp.Diagnostics.HasError() { 69 | return 70 | } 71 | 72 | input := NewLocaleInput(&plan) 73 | resource, err := r.p.stack.LocaleCreate(ctx, *input) 74 | if err != nil { 75 | diags := processRemoteError(err) 76 | resp.Diagnostics.Append(diags...) 77 | return 78 | } 79 | 80 | diags = processResponse(resource, input) 81 | resp.Diagnostics.Append(diags...) 82 | 83 | // Write to state. 84 | state := NewLocaleData(resource) 85 | diags = MergeLocaleResponse(state, &plan) 86 | resp.Diagnostics.Append(diags...) 87 | 88 | diags = resp.State.Set(ctx, state) 89 | resp.Diagnostics.Append(diags...) 90 | } 91 | 92 | func (r resourceLocale) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) { 93 | var state LocaleData 94 | diags := req.State.Get(ctx, &state) 95 | resp.Diagnostics.Append(diags...) 96 | if resp.Diagnostics.HasError() { 97 | return 98 | } 99 | 100 | resource, err := r.p.stack.LocaleFetch(ctx, state.Code.Value) 101 | if err != nil { 102 | if IsNotFoundError(err) { 103 | d := diag.NewErrorDiagnostic( 104 | "Error retrieving locale", 105 | fmt.Sprintf("The locale %s was not found.", state.Code.Value)) 106 | resp.Diagnostics.Append(d) 107 | } else { 108 | diags := processRemoteError(err) 109 | resp.Diagnostics.Append(diags...) 110 | } 111 | return 112 | } 113 | 114 | curr := NewLocaleInput(&state) 115 | diags = processResponse(resource, curr) 116 | resp.Diagnostics.Append(diags...) 117 | 118 | // Set state 119 | newState := NewLocaleData(resource) 120 | diags = resp.State.Set(ctx, &newState) 121 | resp.Diagnostics.Append(diags...) 122 | } 123 | 124 | func (r resourceLocale) Delete(ctx context.Context, req tfsdk.DeleteResourceRequest, resp *tfsdk.DeleteResourceResponse) { 125 | var state LocaleData 126 | diags := req.State.Get(ctx, &state) 127 | resp.Diagnostics.Append(diags...) 128 | if resp.Diagnostics.HasError() { 129 | return 130 | } 131 | 132 | // Delete order by calling API 133 | err := r.p.stack.LocaleDelete(ctx, state.Code.Value) 134 | if err != nil { 135 | diags = processRemoteError(err) 136 | resp.Diagnostics.Append(diags...) 137 | return 138 | } 139 | 140 | // Remove resource from state 141 | resp.State.RemoveResource(ctx) 142 | } 143 | 144 | func (r resourceLocale) Update(ctx context.Context, req tfsdk.UpdateResourceRequest, resp *tfsdk.UpdateResourceResponse) { 145 | // Get plan values 146 | var plan LocaleData 147 | diags := req.Plan.Get(ctx, &plan) 148 | resp.Diagnostics.Append(diags...) 149 | if resp.Diagnostics.HasError() { 150 | return 151 | } 152 | 153 | // Get current state 154 | var state LocaleData 155 | diags = req.State.Get(ctx, &state) 156 | resp.Diagnostics.Append(diags...) 157 | if resp.Diagnostics.HasError() { 158 | return 159 | } 160 | 161 | input := NewLocaleInput(&plan) 162 | resource, err := r.p.stack.LocaleUpdate(ctx, state.Code.Value, *input) 163 | if err != nil { 164 | diags = processRemoteError(err) 165 | resp.Diagnostics.Append(diags...) 166 | return 167 | } 168 | 169 | diags = processResponse(resource, input) 170 | resp.Diagnostics.Append(diags...) 171 | 172 | // Set state 173 | result := NewLocaleData(resource) 174 | diags = MergeLocaleResponse(result, &plan) 175 | resp.Diagnostics.Append(diags...) 176 | 177 | diags = resp.State.Set(ctx, result) 178 | resp.Diagnostics.Append(diags...) 179 | } 180 | 181 | func (r resourceLocale) ImportState(ctx context.Context, req tfsdk.ImportResourceStateRequest, resp *tfsdk.ImportResourceStateResponse) { 182 | tfsdk.ResourceImportStatePassthroughID(ctx, tftypes.NewAttributePath().WithAttributeName("id"), req, resp) 183 | } 184 | 185 | func NewLocaleData(field *management.Locale) *LocaleData { 186 | state := &LocaleData{ 187 | UID: types.String{Value: field.UID}, 188 | Name: types.String{Value: field.Name}, 189 | Code: types.String{Value: field.Code}, 190 | FallbackLocale: types.String{Value: field.FallbackLocale}, 191 | } 192 | return state 193 | } 194 | 195 | func NewLocaleInput(field *LocaleData) *management.LocaleInput { 196 | 197 | input := &management.LocaleInput{ 198 | Name: field.Name.Value, 199 | Code: field.Code.Value, 200 | FallbackLocale: field.FallbackLocale.Value, 201 | } 202 | 203 | return input 204 | } 205 | 206 | func MergeLocaleResponse(out *LocaleData, in *LocaleData) diag.Diagnostics { 207 | var diags diag.Diagnostics 208 | 209 | if in.FallbackLocale != out.FallbackLocale { 210 | diags.AddAttributeWarning( 211 | tftypes.NewAttributePath().WithAttributeName("fallback_locale"), 212 | "Contentstack modified fallback_locale", 213 | fmt.Sprintf( 214 | "Contentstack set the fallback_locale to a different value then requested. Requested was %s but value is %s", 215 | in.FallbackLocale.Value, out.FallbackLocale.Value)) 216 | } 217 | return diags 218 | } 219 | -------------------------------------------------------------------------------- /internal/provider/resource_webhook.go: -------------------------------------------------------------------------------- 1 | package provider 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/hashicorp/terraform-plugin-framework/diag" 8 | "github.com/hashicorp/terraform-plugin-framework/tfsdk" 9 | "github.com/hashicorp/terraform-plugin-framework/types" 10 | "github.com/hashicorp/terraform-plugin-go/tftypes" 11 | "github.com/labd/contentstack-go-sdk/management" 12 | ) 13 | 14 | type resourceWebhookType struct{} 15 | 16 | type WebhookData struct { 17 | UID types.String `tfsdk:"uid"` 18 | Name types.String `tfsdk:"name"` 19 | Branches []types.String `tfsdk:"branches"` 20 | Channels []types.String `tfsdk:"channels"` 21 | RetryPolicy types.String `tfsdk:"retry_policy"` 22 | ConcisePayload types.Bool `tfsdk:"concise_payload"` 23 | Disabled types.Bool `tfsdk:"disabled"` 24 | Destinations WebhookDestinationSlice `tfsdk:"destination"` 25 | } 26 | 27 | type WebhookDestinationSlice []WebhookDestinationData 28 | 29 | func (s *WebhookDestinationSlice) FindByTargetURLAndHttpBasicAuth(t, a string) *WebhookDestinationData { 30 | for i := range *s { 31 | if (*s)[i].TargetURL.Value == t && (*s)[i].HttpBasicAuth.Value == a { 32 | return &(*s)[i] 33 | } 34 | } 35 | return nil 36 | } 37 | 38 | type WebhookDestinationData struct { 39 | TargetURL types.String `tfsdk:"target_url"` 40 | HttpBasicAuth types.String `tfsdk:"http_basic_auth"` 41 | HttpBasicPassword types.String `tfsdk:"http_basic_password"` 42 | CustomHeaders []WebhookCustomHeaderData `tfsdk:"custom_headers"` 43 | } 44 | 45 | type WebhookCustomHeaderData struct { 46 | Name types.String `tfsdk:"header_name"` 47 | Value types.String `tfsdk:"value"` 48 | } 49 | 50 | func (r resourceWebhookType) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics) { 51 | return tfsdk.Schema{ 52 | Description: ` 53 | A webhook is a user-defined HTTP callback. It is a mechanism that sends 54 | real-time information to any third-party app or service. 55 | `, 56 | Attributes: map[string]tfsdk.Attribute{ 57 | "uid": { 58 | Type: types.StringType, 59 | Computed: true, 60 | }, 61 | "name": { 62 | Type: types.StringType, 63 | Required: true, 64 | }, 65 | "branches": { 66 | Type: types.ListType{ 67 | ElemType: types.StringType, 68 | }, 69 | Optional: true, 70 | }, 71 | "channels": { 72 | Type: types.ListType{ 73 | ElemType: types.StringType, 74 | }, 75 | Optional: true, 76 | }, 77 | "retry_policy": { 78 | Type: types.StringType, 79 | Required: true, 80 | Description: "should be set to `manual`", 81 | }, 82 | "disabled": { 83 | Type: types.BoolType, 84 | Optional: true, 85 | Description: "allows you to enable or disable the webhook.", 86 | }, 87 | "concise_payload": { 88 | Type: types.BoolType, 89 | Optional: true, 90 | Description: "allows you to send a concise JSON payload to the target URL when a specific event occurs. To send a comprehensive JSON payload, you can set its value to false.", 91 | }, 92 | }, 93 | Blocks: map[string]tfsdk.Block{ 94 | "destination": { 95 | NestingMode: tfsdk.BlockNestingModeList, 96 | Blocks: map[string]tfsdk.Block{}, 97 | MinItems: 1, 98 | Validators: []tfsdk.AttributeValidator{}, 99 | Attributes: map[string]tfsdk.Attribute{ 100 | "target_url": { 101 | Type: types.StringType, 102 | Required: true, 103 | }, 104 | "http_basic_auth": { 105 | Type: types.StringType, 106 | Required: true, 107 | }, 108 | "http_basic_password": { 109 | Type: types.StringType, 110 | Required: true, 111 | Sensitive: true, 112 | }, 113 | "custom_headers": { 114 | Optional: true, 115 | Attributes: tfsdk.ListNestedAttributes(map[string]tfsdk.Attribute{ 116 | "header_name": { 117 | Type: types.StringType, 118 | Required: true, 119 | }, 120 | "value": { 121 | Type: types.StringType, 122 | Required: true, 123 | }, 124 | }), 125 | }, 126 | }, 127 | }, 128 | }, 129 | }, nil 130 | } 131 | 132 | func (r resourceWebhookType) NewResource(_ context.Context, p tfsdk.Provider) (tfsdk.Resource, diag.Diagnostics) { 133 | return resourceWebhook{ 134 | p: *(p.(*provider)), 135 | }, nil 136 | } 137 | 138 | type resourceWebhook struct { 139 | p provider 140 | } 141 | 142 | func (r resourceWebhook) Create(ctx context.Context, req tfsdk.CreateResourceRequest, resp *tfsdk.CreateResourceResponse) { 143 | var plan WebhookData 144 | diags := req.Plan.Get(ctx, &plan) 145 | resp.Diagnostics.Append(diags...) 146 | if resp.Diagnostics.HasError() { 147 | return 148 | } 149 | 150 | input := NewWebhookInput(&plan) 151 | webhook, err := r.p.stack.WebHookCreate(ctx, *input) 152 | if err != nil { 153 | resp.Diagnostics.Append(processRemoteError(err)...) 154 | return 155 | } 156 | 157 | diags = processResponse(webhook, input) 158 | resp.Diagnostics.Append(diags...) 159 | 160 | //Set actual password as state 161 | webhook.Destinations, err = copyHttpBasicPasswords(webhook.Destinations, plan.Destinations) 162 | if err != nil { 163 | resp.Diagnostics.AddError("Error copying http basic passwords", err.Error()) 164 | return 165 | } 166 | 167 | // Write to state 168 | state := NewWebhookData(webhook) 169 | diags = resp.State.Set(ctx, state) 170 | resp.Diagnostics.Append(diags...) 171 | } 172 | 173 | func (r resourceWebhook) Read(ctx context.Context, req tfsdk.ReadResourceRequest, resp *tfsdk.ReadResourceResponse) { 174 | var state WebhookData 175 | diags := req.State.Get(ctx, &state) 176 | resp.Diagnostics.Append(diags...) 177 | if resp.Diagnostics.HasError() { 178 | return 179 | } 180 | 181 | webhook, err := r.p.stack.WebHookFetch(ctx, state.UID.Value) 182 | if err != nil { 183 | if IsNotFoundError(err) { 184 | d := diag.NewErrorDiagnostic( 185 | "Error retrieving webhook", 186 | fmt.Sprintf("The webhook with UID %s was not found.", state.UID.Value)) 187 | resp.Diagnostics.Append(d) 188 | } else { 189 | diags := processRemoteError(err) 190 | resp.Diagnostics.Append(diags...) 191 | } 192 | return 193 | } 194 | 195 | //Set actual password as state 196 | webhook.Destinations, err = copyHttpBasicPasswords(webhook.Destinations, state.Destinations) 197 | if err != nil { 198 | resp.Diagnostics.AddError("Error copying http basic passwords", err.Error()) 199 | return 200 | } 201 | 202 | curr := NewWebhookInput(&state) 203 | diags = processResponse(webhook, curr) 204 | resp.Diagnostics.Append(diags...) 205 | 206 | // Set state 207 | newState := NewWebhookData(webhook) 208 | diags = resp.State.Set(ctx, &newState) 209 | resp.Diagnostics.Append(diags...) 210 | } 211 | 212 | func (r resourceWebhook) Delete(ctx context.Context, req tfsdk.DeleteResourceRequest, resp *tfsdk.DeleteResourceResponse) { 213 | var state WebhookData 214 | diags := req.State.Get(ctx, &state) 215 | resp.Diagnostics.Append(diags...) 216 | if resp.Diagnostics.HasError() { 217 | return 218 | } 219 | 220 | // Delete order by calling API 221 | err := r.p.stack.WebHookDelete(ctx, state.UID.Value) 222 | if err != nil { 223 | diags = processRemoteError(err) 224 | resp.Diagnostics.Append(diags...) 225 | return 226 | } 227 | 228 | // Remove resource from state 229 | resp.State.RemoveResource(ctx) 230 | } 231 | 232 | func (r resourceWebhook) Update(ctx context.Context, req tfsdk.UpdateResourceRequest, resp *tfsdk.UpdateResourceResponse) { 233 | // Get plan values 234 | var plan WebhookData 235 | diags := req.Plan.Get(ctx, &plan) 236 | resp.Diagnostics.Append(diags...) 237 | if resp.Diagnostics.HasError() { 238 | return 239 | } 240 | 241 | // Get current state 242 | var state WebhookData 243 | diags = req.State.Get(ctx, &state) 244 | resp.Diagnostics.Append(diags...) 245 | if resp.Diagnostics.HasError() { 246 | return 247 | } 248 | 249 | input := NewWebhookInput(&plan) 250 | webhook, err := r.p.stack.WebHookUpdate(ctx, state.UID.Value, *input) 251 | if err != nil { 252 | diags = processRemoteError(err) 253 | resp.Diagnostics.Append(diags...) 254 | return 255 | } 256 | 257 | webhook.Destinations, err = copyHttpBasicPasswords(webhook.Destinations, plan.Destinations) 258 | if err != nil { 259 | resp.Diagnostics.AddError("Error copying http basic passwords", err.Error()) 260 | return 261 | } 262 | 263 | diags = processResponse(webhook, input) 264 | resp.Diagnostics.Append(diags...) 265 | 266 | // Set state 267 | result := NewWebhookData(webhook) 268 | diags = resp.State.Set(ctx, result) 269 | resp.Diagnostics.Append(diags...) 270 | } 271 | 272 | func (r resourceWebhook) ImportState(ctx context.Context, req tfsdk.ImportResourceStateRequest, resp *tfsdk.ImportResourceStateResponse) { 273 | tfsdk.ResourceImportStatePassthroughID(ctx, tftypes.NewAttributePath().WithAttributeName("id"), req, resp) 274 | } 275 | 276 | func NewWebhookData(webhook *management.WebHook) *WebhookData { 277 | var branches []types.String 278 | for i := range webhook.Branches { 279 | branches = append(branches, types.String{Value: webhook.Branches[i]}) 280 | } 281 | 282 | var channels []types.String 283 | for i := range webhook.Channels { 284 | channels = append(channels, types.String{Value: webhook.Channels[i]}) 285 | } 286 | 287 | var destinations []WebhookDestinationData 288 | for i := range webhook.Destinations { 289 | s := webhook.Destinations[i] 290 | 291 | dest := WebhookDestinationData{ 292 | TargetURL: types.String{Value: s.TargetURL}, 293 | HttpBasicAuth: types.String{Value: s.HttpBasicAuth}, 294 | HttpBasicPassword: types.String{Value: s.HttpBasicPassword}, 295 | } 296 | 297 | for j := range s.CustomHeaders { 298 | header := WebhookCustomHeaderData{ 299 | Name: types.String{Value: s.CustomHeaders[j].Name}, 300 | Value: types.String{Value: s.CustomHeaders[j].Value}, 301 | } 302 | dest.CustomHeaders = append(dest.CustomHeaders, header) 303 | } 304 | 305 | destinations = append(destinations, dest) 306 | } 307 | 308 | state := &WebhookData{ 309 | UID: types.String{Value: webhook.UID}, 310 | Name: types.String{Value: webhook.Name}, 311 | RetryPolicy: types.String{Value: webhook.RetryPolicy}, 312 | ConcisePayload: types.Bool{Value: webhook.ConcisePayload}, 313 | Disabled: types.Bool{Value: webhook.Disabled}, 314 | Channels: channels, 315 | Branches: branches, 316 | Destinations: destinations, 317 | } 318 | return state 319 | } 320 | 321 | func NewWebhookInput(webhook *WebhookData) *management.WebHookInput { 322 | var destinations []management.WebhookDestination 323 | for i := range webhook.Destinations { 324 | s := webhook.Destinations[i] 325 | dest := management.WebhookDestination{ 326 | TargetURL: s.TargetURL.Value, 327 | HttpBasicAuth: s.HttpBasicAuth.Value, 328 | HttpBasicPassword: s.HttpBasicPassword.Value, 329 | } 330 | 331 | for j := range s.CustomHeaders { 332 | header := management.WebhookHeader{ 333 | Name: s.CustomHeaders[j].Name.Value, 334 | Value: s.CustomHeaders[j].Value.Value, 335 | } 336 | dest.CustomHeaders = append(dest.CustomHeaders, header) 337 | } 338 | destinations = append(destinations, dest) 339 | } 340 | 341 | input := &management.WebHookInput{ 342 | Name: webhook.Name.Value, 343 | RetryPolicy: webhook.RetryPolicy.Value, 344 | Destinations: destinations, 345 | ConcisePayload: webhook.ConcisePayload.Value, 346 | } 347 | for i := range webhook.Channels { 348 | input.Channels = append(input.Channels, webhook.Channels[i].Value) 349 | } 350 | for i := range webhook.Branches { 351 | input.Branches = append(input.Branches, webhook.Branches[i].Value) 352 | } 353 | 354 | return input 355 | } 356 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "flag" 6 | 7 | "github.com/hashicorp/terraform-plugin-framework/providerserver" 8 | 9 | "github.com/labd/terraform-provider-contentstack/internal/provider" 10 | ) 11 | 12 | // Run "go generate" to format example terraform files and generate the docs for the registry/website 13 | 14 | // If you do not have terraform installed, you can remove the formatting command, but its suggested to 15 | // ensure the documentation is formatted properly. 16 | //go:generate terraform fmt -recursive ./examples/ 17 | 18 | // Run the docs generation tool, check its repository for more information on how it works and how docs 19 | // can be customized. 20 | //go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs 21 | 22 | var ( 23 | // these will be set by the goreleaser configuration 24 | // to appropriate values for the compiled binary 25 | version string = "dev" 26 | 27 | // goreleaser can also pass the specific commit if you want 28 | // commit string = "" 29 | ) 30 | 31 | func main() { 32 | var debugMode bool 33 | 34 | flag.BoolVar(&debugMode, "debug", false, "set to true to run the provider with support for debuggers like delve") 35 | flag.Parse() 36 | 37 | providerserver.Serve(context.Background(), provider.New(version), providerserver.ServeOpts{ 38 | Address: "registry.terraform.io/labd/contentstack", 39 | Debug: debugMode, 40 | }) 41 | } 42 | -------------------------------------------------------------------------------- /terraform-registry-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "metadata": { 4 | "protocol_versions": ["5.0"] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tools/tools.go: -------------------------------------------------------------------------------- 1 | //go:build tools 2 | // +build tools 3 | 4 | package tools 5 | 6 | import ( 7 | // document generation 8 | 9 | _ "github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs" 10 | ) 11 | --------------------------------------------------------------------------------