├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── release.yaml ├── .gitignore ├── .goreleaser.yml ├── .run └── go build github.com_inwx_terraform-provider-inwx.run.xml ├── LICENSE ├── README.md ├── docs ├── data-sources │ └── inwx_domain_contact.md ├── index.md └── resources │ ├── inwx_automated_dnssec.md │ ├── inwx_dnssec_key.md │ ├── inwx_domain.md │ ├── inwx_domain_contact.md │ ├── inwx_glue_record.md │ ├── inwx_nameserver.md │ └── inwx_nameserver_record.md ├── go.mod ├── go.sum ├── inwx ├── internal │ ├── api │ │ └── client.go │ ├── data_source │ │ └── data_source_domain_contact.go │ └── resource │ │ ├── resource_automated_dnssec.go │ │ ├── resource_dnssec_key.go │ │ ├── resource_domain.go │ │ ├── resource_domain_contact.go │ │ ├── resource_glue_record.go │ │ ├── resource_nameserver.go │ │ └── resource_nameserver_record.go └── provider.go ├── main.go └── terraform-registry-manifest.json /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Checklist** 11 | - [ ] I have used the latest version of terraform (if not please provide a version number). 12 | - [ ] I have used the latest version of this terraform provider (if not please provide a version number). 13 | - [ ] I have provided a sample .tf configuration under "Additional context". 14 | - [ ] I have answered the following question: Is this issue reproducible in OT&E or only applies to live? 15 | 16 | **Describe the bug** 17 | A clear and concise description of what the bug is. 18 | 19 | **To Reproduce** 20 | Steps to reproduce the behavior: 21 | 1. Go to '...' 22 | 2. Click on '....' 23 | 3. Scroll down to '....' 24 | 4. See error 25 | 26 | **Expected behavior** 27 | A clear and concise description of what you expected to happen. 28 | 29 | **Screenshots** 30 | If applicable, add screenshots to help explain your problem. 31 | 32 | **Additional context** 33 | Add any other context about the problem here. 34 | 35 | Sample .tf configuration: 36 | ```terraform 37 | terraform { 38 | required_providers { 39 | inwx = { 40 | source = "inwx/inwx" 41 | version = ">= 1.0.0" 42 | } 43 | } 44 | } 45 | 46 | provider "inwx" { 47 | api_url = var.api_url 48 | tan = var.tan 49 | username = var.username 50 | } 51 | ``` 52 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[FEATURE]" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | # .github/workflows/release.yaml 2 | 3 | name: goreleaser 4 | 5 | on: 6 | push: 7 | tags: 8 | - '*' 9 | 10 | jobs: 11 | goreleaser: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout 15 | uses: actions/checkout@v3 16 | with: 17 | fetch-depth: 0 18 | - name: Set up Go 19 | uses: actions/setup-go@v3 20 | - name: Import GPG key 21 | id: import_gpg 22 | uses: crazy-max/ghaction-import-gpg@v6 23 | with: 24 | gpg_private_key: ${{ secrets.GPG_SIGNING_KEY }} 25 | passphrase: ${{ secrets.GPG_PASSPHRASE }} 26 | - name: Run GoReleaser 27 | uses: goreleaser/goreleaser-action@v6 28 | with: 29 | distribution: goreleaser 30 | version: '~> v2' 31 | args: release --clean 32 | env: 33 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 34 | GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | workspace_test 3 | terraform 4 | .idea 5 | dist 6 | terraform-provider-inwx 7 | -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | # Copied from https://github.com/hashicorp/terraform-provider-scaffolding/blob/master/.goreleaser.yml 2 | # as suggested at https://www.terraform.io/docs/registry/providers/publishing.html#using-goreleaser-locally 3 | # 4 | # Visit https://goreleaser.com for documentation on how to customize this 5 | # behavior. 6 | version: 2 7 | before: 8 | hooks: 9 | - go mod tidy 10 | builds: 11 | - env: 12 | - CGO_ENABLED=0 13 | mod_timestamp: '{{ .CommitTimestamp }}' 14 | flags: 15 | - -trimpath 16 | ldflags: 17 | - '-s -w -X github.com/inwx/terraform-provider-inwx/inwx/internal/api.version={{.Version}} -X github.com/inwx/terraform-provider-inwx/inwx/internal/api.commit={{.Commit}} -X github.com/inwx/terraform-provider-inwx/inwx/internal/api.date={{.Date}}' 18 | goos: 19 | - windows 20 | - linux 21 | - darwin 22 | goarch: 23 | - amd64 24 | - '386' 25 | - arm 26 | - arm64 27 | ignore: 28 | - goos: darwin 29 | goarch: '386' 30 | binary: '{{ .ProjectName }}_v{{ .Version }}' 31 | archives: 32 | - formats: [ 'zip' ] 33 | name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' 34 | checksum: 35 | name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' 36 | algorithm: sha256 37 | signs: 38 | - artifacts: checksum 39 | cmd: gpg2 40 | args: 41 | # if you are using this is a GitHub action or some other automated pipeline, you 42 | # need to pass the batch flag to indicate its not interactive. 43 | - "--batch" 44 | - "-u" 45 | - "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key 46 | - "--output" 47 | - "${signature}" 48 | - "--detach-sign" 49 | - "${artifact}" 50 | # release: 51 | # Visit your project's GitHub Releases page to publish this release. 52 | # draft: false 53 | changelog: 54 | use: github -------------------------------------------------------------------------------- /.run/go build github.com_inwx_terraform-provider-inwx.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 INWX GmbH 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. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | 5 |

6 | 7 | INWX Terraform Provider 8 | ========= 9 | 10 | INWX Terraform Provider is a plugin for Terraform/OpenTofu that allows registration and management of domains and their domain contacts. This plugin is on Terraform Registry: https://registry.terraform.io/providers/inwx/inwx 11 | 12 | Documentation 13 | ------ 14 | You can find a detailed description of the provider and all resources under [docs/](docs/) or at https://registry.terraform.io/providers/inwx/inwx/. 15 | 16 | If you still experience any kind of problems don't hesitate to contact our [support via email](mailto:support@inwx.de). 17 | 18 | ------- 19 | 20 | License 21 | ---- 22 | 23 | MIT 24 | -------------------------------------------------------------------------------- /docs/data-sources/inwx_domain_contact.md: -------------------------------------------------------------------------------- 1 | # Data Source: inwx_domain_contact 2 | 3 | Provides a INWX domain contact resource. Needed for [inwx_domain](inwx_domain.md). 4 | 5 | ## Example Usage 6 | 7 | ```terraform 8 | data "inwx_domain_contact" "example_person" { 9 | id = 1 10 | type = "PERSON" 11 | name = "Example Person" 12 | street_address = "Example Street 0" 13 | city = "Example City" 14 | postal_code = 00000 15 | state_province = "Example State" 16 | country_code = "EX" 17 | phone_number = "+00.00000000000" 18 | email = "person@example.invalid" 19 | } 20 | 21 | output "inwx_domain_contact" { 22 | value = data.inwx_domain_contact.example_person 23 | } 24 | ``` 25 | 26 | ## Argument Reference 27 | 28 | * `id` - (Required) Numerical id of domain contact resource 29 | * `type` - (Optional) Type of contact. One of: `ORG`, `PERSON`, `ROLE` 30 | * `name` - (Optional) First and lastname of the contact 31 | * `organization` - (Optional) The legal name of the organization. Required for types other than person 32 | * `street_address` - (Optional) Street Address of the contact 33 | * `city` - (Optional) City of the contact 34 | * `postal_code` - (Optional) Postal Code/Zipcode of the contact 35 | * `state_province` - (Optional) State/Province name of the contact 36 | * `country_code` - (Optional) Country code of the contact. Must be two characters 37 | * `phone_number` - (Optional) Phone number of the contact 38 | * `fax` - (Optional) Fax number of the contact 39 | * `email` - (Optional) Contact email address 40 | * `remarks` - (Optional) Custom description of the contact 41 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # INWX Provider 2 | 3 | The INWX Provider can be used to register and manage domains and their domain contacts. Additionally it offers full support for nameserver and DNSSEC management. 4 | 5 | ## Resources 6 | 7 | #### Domains 8 | - [inwx_domain](resources/inwx_domain.md) - register and manage domains 9 | - [inwx_domain_contact](resources/inwx_domain_contact.md) - domain contacts, which are needed for [inwx_domain](resources/inwx_domain.md) 10 | - [inwx_glue_record](resources/inwx_glue_record.md) - register und manage glue records 11 | 12 | #### Anycast DNS 13 | - [inwx_nameserver](resources/inwx_nameserver.md) - zones on the INWX Anycast nameserver network (50+ locations worldwide) 14 | - [inwx_nameserver_record](resources/inwx_nameserver_record.md) - records in a zone of [inwx_nameserver](resources/inwx_nameserver.md) 15 | 16 | #### DNSSEC 17 | - [inwx_automated_dnssec](resources/inwx_automated_dnssec.md) - DNSSEC for a [inwx_domain](resources/inwx_domain.md) resource, if it uses [inwx_nameserver](resources/inwx_nameserver.md) 18 | - [inwx_dnssec_key](resources/inwx_dnssec_key.md) - DNSSEC for a [inwx_domain](resources/inwx_domain.md) resource, if it does not use [inwx_nameserver](resources/inwx_nameserver.md) 19 | 20 | ## Example Usage 21 | 22 | **Terraform 0.13+** 23 | 24 | ```terraform 25 | terraform { 26 | required_providers { 27 | inwx = { 28 | source = "inwx/inwx" 29 | version = ">= 1.0.0" 30 | } 31 | } 32 | } 33 | 34 | // API configuration 35 | provider "inwx" { 36 | api_url = "https://api.ote.domrobot.com/jsonrpc/" 37 | username = "example-user" 38 | password = "redacted" 39 | tan = "000000" 40 | } 41 | 42 | // contact used for domains 43 | resource "inwx_domain_contact" "example_person" { 44 | type = "PERSON" 45 | name = "Example Person" 46 | street_address = "Example Street 0" 47 | city = "Example City" 48 | postal_code = 00000 49 | state_province = "Example State" 50 | country_code = "EX" 51 | phone_number = "+00.00000000000" 52 | email = "person@example.invalid" 53 | } 54 | 55 | // manage domains 56 | resource "inwx_domain" "example_com" { 57 | name = "example.com" 58 | nameservers = [ 59 | // if you want to use inwx ns, create a zone with inwx_nameserver 60 | "ns.inwx.de", 61 | "ns2.inwx.de" 62 | ] 63 | period = "1Y" 64 | renewal_mode = "AUTORENEW" 65 | transfer_lock = true 66 | contacts { 67 | // references to terraform managed contact "example_person" 68 | registrant = inwx_domain_contact.example_person.id 69 | admin = inwx_domain_contact.example_person.id 70 | tech = inwx_domain_contact.example_person.id 71 | billing = inwx_domain_contact.example_person.id 72 | } 73 | extra_data = { 74 | // Enable whois proxy, trustee or provide data like company number if needed 75 | //"WHOIS-PROTECTION": "1", 76 | //"ACCEPT-TRUSTEE-TAC": "1", 77 | //"COMPANY-NUMBER": "123", 78 | } 79 | } 80 | 81 | // zone in anycast dns 82 | resource "inwx_nameserver" "example_com_nameserver" { 83 | domain = "example.com" 84 | type = "MASTER" 85 | nameservers = [ 86 | "ns.inwx.de", 87 | "ns2.inwx.de" 88 | ] 89 | } 90 | 91 | // nameserver record for a zone from above 92 | resource "inwx_nameserver_record" "example_com_txt_1" { 93 | domain = "example.com" 94 | type = "TXT" 95 | content = "DNS records with terraform" 96 | } 97 | 98 | // dnssec when inwx nameservers are used 99 | resource "inwx_automated_dnssec" "example_com" { 100 | domain = "example.com" 101 | } 102 | 103 | // dnssec for external nameservers 104 | resource "inwx_dnssec_key" "example_com" { 105 | domain = "example.com" 106 | public_key = "ac12c2..." 107 | algorithm = "SHA256" 108 | } 109 | 110 | // glue record 111 | resource "inwx_glue_record" "example_com_glue_1" { 112 | hostname = "example.com" 113 | ip = [ 114 | "192.168.0.1" 115 | ] 116 | } 117 | ``` 118 | 119 | For additional examples and information, please check the linked resource documentations above. 120 | 121 | ## Argument Reference 122 | 123 | * `api_url` - (Optional) URL of the RPC API endpoint. Use `https://api.domrobot.com/jsonrpc/` for production and `https://api.ote.domrobot.com/jsonrpc/` for testing. Default: `https://api.domrobot.com/jsonrpc/`. Can be passed as `INWX_API_URL` env var. 124 | * `username` - (Required) Login username of the api. Can be passed as `INWX_USERNAME` env var. 125 | * `password` - (Required) Login password of the api. Can be passed as `INWX_PASSWORD` env var. 126 | * `tan` - (Optional) [mobile tan](https://www.inwx.com/en/offer/mobiletan). Can be passed as `INWX_TAN` env var. -------------------------------------------------------------------------------- /docs/resources/inwx_automated_dnssec.md: -------------------------------------------------------------------------------- 1 | # Resource: inwx_automated_dnssec 2 | 3 | Automated DNSSEC management for a domain. INWX will create and manage the keys and send them to the domain registry. If you do not use INWX nameservers, use [inwx_dnssec_key](inwx_dnssec_key.md) instead. 4 | 5 | ## Example Usage 6 | 7 | ```terraform 8 | resource "inwx_automated_dnssec" "example_com" { 9 | domain = "example.com" 10 | } 11 | ``` 12 | 13 | ## Argument Reference 14 | 15 | * `domain` - (Required) Name of the domain 16 | -------------------------------------------------------------------------------- /docs/resources/inwx_dnssec_key.md: -------------------------------------------------------------------------------- 1 | # Resource: inwx_dnssec_key 2 | 3 | Provides a INWX DNSSEC key resource. This will send your dnssec keys to the domain registry. If you use INWX nameservers, use [inwx_automated_dnssec](inwx_automated_dnssec.md) instead, and INWX will create and manage the keys. 4 | 5 | ## Example Usage 6 | 7 | ```terraform 8 | resource "inwx_dnssec_key" "example_com" { 9 | domain = "example.com" 10 | public_key = "ac12c2..." 11 | algorithm = "SHA256" 12 | } 13 | ``` 14 | 15 | ## Argument Reference 16 | 17 | * `domain` - (Required) Name of the domain 18 | * `public_key` - (Required) Public key of the domain 19 | * `algorithm` - (Required) Algorithm used for the public key 20 | 21 | ## Import 22 | 23 | INWX DNSSEC keys can be imported using the domain name and digest e.g., 24 | 25 | ``` 26 | $ terraform import inwx_dnssec_key.example_com example.com/4E1243BD22C66E76C2BA9EDDC1F91394E57F9F83 27 | ``` 28 | 29 | ## CDS / CDNSKEY 30 | 31 | INWX supports CDS for .ch, .li, .se, .nu. If you use this record we will import your keys automatically after a few days. -------------------------------------------------------------------------------- /docs/resources/inwx_domain.md: -------------------------------------------------------------------------------- 1 | # Resource: inwx_domain 2 | 3 | Provides a INWX domain resource. 4 | 5 | ## Example Usage 6 | 7 | ```terraform 8 | resource "inwx_domain" "example_com" { 9 | name = "example.com" 10 | nameservers = [ 11 | // if you want to use inwx ns, create a zone with inwx_nameserver 12 | "ns.inwx.de", 13 | "ns2.inwx.de" 14 | ] 15 | period = "1Y" 16 | renewal_mode = "AUTORENEW" 17 | transfer_lock = true 18 | contacts { 19 | registrant = 2147483647 // id of contact 20 | admin = 2147483647 // id of contact 21 | tech = 2147483647 // id of contact 22 | billing = 2147483647 // id of contact 23 | } 24 | extra_data = { 25 | // Enable whois proxy, trustee or provide data like company number if needed 26 | //"WHOIS-PROTECTION": "1", 27 | //"ACCEPT-TRUSTEE-TAC": "1", 28 | //"COMPANY-NUMBER": "123", 29 | } 30 | } 31 | ``` 32 | 33 | ### Full Example With Terraform Managed Contacts 34 | 35 | ```terraform 36 | resource "inwx_domain_contact" "example_person" { 37 | type = "PERSON" 38 | name = "Example Person" 39 | street_address = "Example Street 0" 40 | city = "Example City" 41 | postal_code = 00000 42 | state_province = "Example State" 43 | country_code = "EX" 44 | phone_number = "+00.00000000000" 45 | email = "person@example.invalid" 46 | } 47 | 48 | resource "inwx_domain" "example_com" { 49 | name = "example.com" 50 | nameservers = [ 51 | // if you want to use inwx ns, create a zone with inwx_nameserver 52 | "ns.inwx.de", 53 | "ns2.inwx.de" 54 | ] 55 | period = "1Y" 56 | renewal_mode = "AUTOEXPIRE" 57 | transfer_lock = true 58 | contacts { 59 | // references to terraform managed contact "example_person" 60 | registrant = inwx_domain_contact.example_person.id 61 | admin = inwx_domain_contact.example_person.id 62 | tech = inwx_domain_contact.example_person.id 63 | billing = inwx_domain_contact.example_person.id 64 | } 65 | extra_data = { 66 | // Enable whois proxy, trustee or provide data like company number if needed 67 | //"WHOIS-PROTECTION": "1", 68 | //"ACCEPT-TRUSTEE-TAC": "1", 69 | //"COMPANY-NUMBER": "123", 70 | } 71 | } 72 | ``` 73 | 74 | ## Argument Reference 75 | 76 | * `name` - (Required) Name of the domain 77 | * `nameservers` - (Required) Set of nameservers of the domain. Min Items: 1 78 | * `period` - (Required) Registration period of the domain. Valid types: https://www.inwx.de/en/help/apidoc/f/ch03.html#type.period 79 | * `renewal_mode` - (Optional) Renewal mode of the domain. One of: `AUTORENEW`, `AUTODELETE`, `AUTOEXPIRE`. Default: `AUTORENEW` 80 | * `transfer_lock` - (Optional) Whether the domain transfer lock should be enabled. Default: `true` 81 | * `contacts` - (Required) Contacts of the domain 82 | * `extra_data` - (Optional) Extra data, needed for some jurisdictions. Valid extra data types: https://www.inwx.de/en/help/apidoc/f/ch03.html#type.extdata 83 | 84 | ### Nested Fields 85 | 86 | `contacts` 87 | * `registrant` - (Required) Id of the registrant contact 88 | * `admin` - (Required) Id of the admin contact 89 | * `tech` - (Required) Id of the tech contact 90 | * `billing` - (Required) Id of the billing contact 91 | 92 | ## Attribute Reference 93 | 94 | * `id` - Name of the domain 95 | 96 | ## Import 97 | 98 | INWX Domains can be imported using the domain name, e.g., 99 | 100 | ``` 101 | $ terraform import inwx_domain.example_com "example.com" 102 | ``` 103 | 104 | ## Caveats 105 | 106 | ### Extra Data 107 | 108 | When extra data is set, e.g. `WHOIS-PROTECTION`, our system sometimes adds other readonly extra data to the domain. 109 | In this example `WHOIS-CURRENCY` is added to the domain. Terraform cannot manage this extra data, so it is recommended 110 | to ignore these side effects explicitly as they occur: 111 | 112 | ```terraform 113 | resource "inwx_domain" "example_com" { 114 | // ... 115 | extra_data = { 116 | "WHOIS-PROTECTION": "1" 117 | } 118 | 119 | lifecycle { 120 | ignore_changes = [ 121 | extra_data["WHOIS-CURRENCY"], // ignore WHOIS-CURRENCY 122 | ] 123 | } 124 | } 125 | ``` 126 | -------------------------------------------------------------------------------- /docs/resources/inwx_domain_contact.md: -------------------------------------------------------------------------------- 1 | # Resource: inwx_domain_contact 2 | 3 | Provides a INWX domain contact resource. Needed for [inwx_domain](inwx_domain.md). 4 | 5 | ## Example Usage 6 | 7 | ```terraform 8 | resource "inwx_domain_contact" "example_person" { 9 | type = "PERSON" 10 | name = "Example Person" 11 | street_address = "Example Street 0" 12 | city = "Example City" 13 | postal_code = 00000 14 | state_province = "Example State" 15 | country_code = "EX" 16 | phone_number = "+00.00000000000" 17 | email = "person@example.invalid" 18 | } 19 | ``` 20 | 21 | ## Argument Reference 22 | 23 | * `type` - (Required) Type of contact. One of: `ORG`, `PERSON`, `ROLE` 24 | * `name` - (Required) First and lastname of the contact 25 | * `organization` - (Optional) The legal name of the organization. Required for types other than person 26 | * `street_address` - (Required) Street Address of the contact 27 | * `city` - (Required) City of the contact 28 | * `postal_code` - (Required) Postal Code/Zipcode of the contact 29 | * `state_province` - (Optional) State/Province name of the contact 30 | * `country_code` - (Required) Country code of the contact. Must be two characters 31 | * `phone_number` - (Required) Phone number of the contact 32 | * `fax` - (Optional) Fax number of the contact 33 | * `email` - (Required) Contact email address 34 | * `remarks` - (Optional) Custom description of the contact 35 | 36 | ## Attribute Reference 37 | 38 | In addition to all arguments above, the following attributes are exported: 39 | 40 | * `id` - Id of the contact 41 | 42 | ## Import 43 | 44 | INWX domain contacts can be imported using the `id`, e.g., 45 | 46 | ``` 47 | $ terraform import inwx_domain_contact 2147483647 48 | ``` 49 | -------------------------------------------------------------------------------- /docs/resources/inwx_glue_record.md: -------------------------------------------------------------------------------- 1 | # Resource: inwx_glue_record 2 | 3 | Provides a INWX glue record resource. 4 | 5 | ## Example Usage 6 | 7 | ```terraform 8 | resource "inwx_glue_record" "example_com_glue_1" { 9 | hostname = "example.com" 10 | ip = [ 11 | "192.168.0.1" 12 | ] 13 | } 14 | ``` 15 | 16 | ## Argument Reference 17 | 18 | * `hostname` - (Required) Name of host 19 | * `ip` - (Required) Ip address(es) 20 | * `testing` - (Optional) Execute command in testing mode. Default: `false` 21 | 22 | ## Attribute Reference 23 | 24 | In addition to all arguments above, the following attributes are exported: 25 | 26 | * `id` - Id of the glue record 27 | 28 | ## Import 29 | 30 | INWX glue records can be imported using the `id`, e.g., 31 | 32 | ``` 33 | $ terraform import inwx_glue_record example.com:2147483647 34 | ``` 35 | -------------------------------------------------------------------------------- /docs/resources/inwx_nameserver.md: -------------------------------------------------------------------------------- 1 | # Resource: inwx_nameserver 2 | 3 | Provides a INWX nameserver zone resource on the anycast nameserver network (50+ locations worldwide). Needed if you use INWX nameservers for [inwx_domain](inwx_domain.md). Use [inwx_nameserver_record](inwx_nameserver_record.md) to create records in the zone. 4 | 5 | ## Example Usage 6 | 7 | ```terraform 8 | // primary 9 | resource "inwx_nameserver" "example_com_nameserver" { 10 | domain = "example.com" 11 | type = "MASTER" 12 | nameservers = [ 13 | "ns.inwx.de", 14 | "ns2.inwx.de" 15 | ] 16 | } 17 | 18 | // or secondary 19 | resource "inwx_nameserver" "example_com_nameserver" { 20 | domain = "example.com" 21 | type = "SLAVE" 22 | master_ip = "1.2.3.4" 23 | } 24 | ``` 25 | 26 | ## Argument Reference 27 | 28 | * `domain` - (Required) Name of the domain 29 | * `type` - (Required) Type of the nameserver zone. One of: `MASTER`, `SLAVE` 30 | * `nameservers` - (Required) List of nameservers 31 | * `master_ip` - (Optional) Master IP address 32 | * `web` - (Optional) Web nameserver entry 33 | * `mail` - (Optional) Mail nameserver entry 34 | * `soa_mail` - (Optional) Email address for SOA record 35 | * `url_redirect_type` - (Optional) Type of the url redirection. One of: `HEADER301`, `HEADER302`, `FRAME` 36 | * `url_redirect_title` - (Optional) Title of the frame redirection 37 | * `url_redirect_description` - (Optional) Description of the frame redirection 38 | * `url_redirect_fav_icon` - (Optional) FavIcon of the frame redirection 39 | * `url_redirect_keywords` - (Optional) Keywords of the frame redirection 40 | * `testing` - (Optional) Execute command in testing mode. Default: `false` 41 | * `ignore_existing` - (Optional) Ignore existing. Default: `false` 42 | 43 | ## Import 44 | 45 | INWX nameserver zones can be imported using the `id`, e.g., 46 | 47 | ``` 48 | $ terraform import inwx_nameserver example.com:2147483647 49 | ``` 50 | -------------------------------------------------------------------------------- /docs/resources/inwx_nameserver_record.md: -------------------------------------------------------------------------------- 1 | # Resource: inwx_nameserver_record 2 | 3 | Provides a INWX nameserver record resource. A zone has to exist to add records to it. The zone can be created with [inwx_nameserver](inwx_nameserver.md). 4 | 5 | ## Example Usage 6 | 7 | ```terraform 8 | resource "inwx_nameserver_record" "example_com_txt_1" { 9 | domain = "example.com" 10 | type = "TXT" 11 | content = "DNS records with terraform" 12 | } 13 | ``` 14 | 15 | ## Argument Reference 16 | 17 | * `domain` - (Required) Name of the domain 18 | * `type` - (Required) Type of the nameserver record. One of: `A`, `AAAA`, `AFSDB`, `ALIAS`, `CAA`, `CERT`, `CNAME`, 19 | `HINFO`, `KEY`, `LOC`, `MX`, `NAPTR`, `NS`, `OPENPGPKEY`, `PTR`, `RP`, `SMIMEA`, `SOA`, `SRV`, `SSHFP`, `TLSA`, `TXT`, 20 | `URI`, `URL` 21 | * `ro_id` - (Optional) DNS domain id 22 | * `content` - (Required) Content of the nameserver record 23 | * `name` - (Optional) Name of the nameserver record 24 | * `ttl` - (Optional) TTL (time to live) of the nameserver record. Default: `3600` 25 | * `prio` - (Optional) Priority of the nameserver record. Default: `0` 26 | * `url_redirect_type` - (Optional) Type of the url redirection. One of: `HEADER301`, `HEADER302`, `FRAME` 27 | * `url_redirect_title` - (Optional) Title of the frame redirection 28 | * `url_redirect_description` - (Optional) Description of the frame redirection 29 | * `url_redirect_fav_icon` - (Optional) FavIcon of the frame redirection 30 | * `url_redirect_keywords` - (Optional) Keywords of the frame redirection 31 | * `url_append` - (Optional) Append the path for redirection. Default: `false` 32 | * `testing` - (Optional) Execute command in testing mode. Default: `false` 33 | 34 | ## Attribute Reference 35 | 36 | In addition to all arguments above, the following attributes are exported: 37 | 38 | * `id` - Id of the nameserver record 39 | 40 | ## Import 41 | 42 | INWX nameserver records can be imported using the `id`, e.g., 43 | 44 | ``` 45 | $ terraform import inwx_nameserver_record example.com:2147483647 46 | ``` 47 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/inwx/terraform-provider-inwx 2 | 3 | go 1.18 4 | 5 | require ( 6 | github.com/go-logr/logr v1.2.2 7 | github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 8 | github.com/hashicorp/terraform-plugin-sdk/v2 v2.13.0 9 | github.com/orirawlings/persistent-cookiejar v0.3.2 10 | github.com/pkg/errors v0.9.1 11 | ) 12 | 13 | require ( 14 | github.com/agext/levenshtein v1.2.2 // indirect 15 | github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect 16 | github.com/fatih/color v1.7.0 // indirect 17 | github.com/frankban/quicktest v1.14.4 // indirect 18 | github.com/golang/protobuf v1.5.2 // indirect 19 | github.com/google/go-cmp v0.5.9 // indirect 20 | github.com/hashicorp/errwrap v1.0.0 // indirect 21 | github.com/hashicorp/go-hclog v1.2.0 // indirect 22 | github.com/hashicorp/go-multierror v1.1.1 // indirect 23 | github.com/hashicorp/go-plugin v1.4.3 // indirect 24 | github.com/hashicorp/go-uuid v1.0.2 // indirect 25 | github.com/hashicorp/go-version v1.4.0 // indirect 26 | github.com/hashicorp/hcl/v2 v2.11.1 // indirect 27 | github.com/hashicorp/logutils v1.0.0 // indirect 28 | github.com/hashicorp/terraform-plugin-go v0.8.0 // indirect 29 | github.com/hashicorp/terraform-plugin-log v0.3.0 // indirect 30 | github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 // indirect 31 | github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect 32 | github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect 33 | github.com/kr/pretty v0.3.1 // indirect 34 | github.com/mattn/go-colorable v0.1.12 // indirect 35 | github.com/mattn/go-isatty v0.0.14 // indirect 36 | github.com/mitchellh/copystructure v1.2.0 // indirect 37 | github.com/mitchellh/go-testing-interface v1.14.1 // indirect 38 | github.com/mitchellh/go-wordwrap v1.0.0 // indirect 39 | github.com/mitchellh/mapstructure v1.4.3 // indirect 40 | github.com/mitchellh/reflectwalk v1.0.2 // indirect 41 | github.com/oklog/run v1.0.0 // indirect 42 | github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect 43 | github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect 44 | github.com/vmihailenco/tagparser v0.1.1 // indirect 45 | github.com/zclconf/go-cty v1.10.0 // indirect 46 | go4.org v0.0.0-20190313082347-94abd6928b1d // indirect 47 | golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect 48 | golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect 49 | golang.org/x/text v0.3.7 // indirect 50 | google.golang.org/appengine v1.6.6 // indirect 51 | google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect 52 | google.golang.org/grpc v1.45.0 // indirect 53 | google.golang.org/protobuf v1.27.1 // indirect 54 | gopkg.in/retry.v1 v1.0.3 // indirect 55 | ) 56 | -------------------------------------------------------------------------------- /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/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= 5 | github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= 6 | github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= 7 | github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= 8 | github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= 9 | github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= 10 | github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= 11 | github.com/andybalholm/crlf v0.0.0-20171020200849-670099aa064f/go.mod h1:k8feO4+kXDxro6ErPXBRTJ/ro2mf0SsFG8s7doP9kJE= 12 | github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= 13 | github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= 14 | github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= 15 | github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= 16 | github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I= 17 | github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= 18 | github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= 19 | github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= 20 | github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= 21 | github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= 22 | github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= 23 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 24 | github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= 25 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 26 | github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= 27 | github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= 28 | github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= 29 | github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 30 | github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 31 | github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 32 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 33 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 34 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 35 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 36 | github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= 37 | github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 38 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 39 | github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= 40 | github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= 41 | github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= 42 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 43 | github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= 44 | github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= 45 | github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= 46 | github.com/frankban/quicktest v1.2.2/go.mod h1:Qh/WofXFeiAFII1aEBu529AtJo6Zg2VHscnEsbBnJ20= 47 | github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= 48 | github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= 49 | github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= 50 | github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= 51 | github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= 52 | github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= 53 | github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= 54 | github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= 55 | github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= 56 | github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= 57 | github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= 58 | github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= 59 | github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= 60 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 61 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 62 | github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 63 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 64 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 65 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 66 | github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= 67 | github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= 68 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 69 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 70 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 71 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 72 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 73 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 74 | github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 75 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 76 | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= 77 | github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= 78 | github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 79 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 80 | github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 81 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 82 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 83 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 84 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 85 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 86 | github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 87 | github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= 88 | github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= 89 | github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 90 | github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 91 | github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= 92 | github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= 93 | github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= 94 | github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= 95 | github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= 96 | github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= 97 | github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= 98 | github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= 99 | github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= 100 | github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= 101 | github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXcJdM= 102 | github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= 103 | github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= 104 | github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= 105 | github.com/hashicorp/go-plugin v1.4.3 h1:DXmvivbWD5qdiBts9TpBC7BYL1Aia5sxbRgQB+v6UZM= 106 | github.com/hashicorp/go-plugin v1.4.3/go.mod h1:5fGEH17QVwTTcR0zV7yhDPLLmFX9YSZ38b18Udy6vYQ= 107 | github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 108 | github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= 109 | github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 110 | github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= 111 | github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= 112 | github.com/hashicorp/go-version v1.4.0 h1:aAQzgqIrRKRa7w75CKpbBxYsmUoPjzVm1W59ca1L0J4= 113 | github.com/hashicorp/go-version v1.4.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= 114 | github.com/hashicorp/hc-install v0.3.1/go.mod h1:3LCdWcCDS1gaHC9mhHCGbkYfoY6vdsKohGjugbZdZak= 115 | github.com/hashicorp/hcl/v2 v2.11.1 h1:yTyWcXcm9XB0TEkyU/JCRU6rYy4K+mgLtzn2wlrJbcc= 116 | github.com/hashicorp/hcl/v2 v2.11.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg= 117 | github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= 118 | github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= 119 | github.com/hashicorp/terraform-exec v0.16.0/go.mod h1:wB5JHmjxZ/YVNZuv9npAXKmz5pGyxy8PSi0GRR0+YjA= 120 | github.com/hashicorp/terraform-json v0.13.0/go.mod h1:y5OdLBCT+rxbwnpxZs9kGL7R9ExU76+cpdY8zHwoazk= 121 | github.com/hashicorp/terraform-plugin-go v0.8.0 h1:MvY43PcDj9VlBjYifBWCO/6j1wf106xU8d5Tob/WRs0= 122 | github.com/hashicorp/terraform-plugin-go v0.8.0/go.mod h1:E3GuvfX0Pz2Azcl6BegD6t51StXsVZMOYQoGO8mkHM0= 123 | github.com/hashicorp/terraform-plugin-log v0.3.0 h1:NPENNOjaJSVX0f7JJTl4f/2JKRPQ7S2ZN9B4NSqq5kA= 124 | github.com/hashicorp/terraform-plugin-log v0.3.0/go.mod h1:EjueSP/HjlyFAsDqt+okpCPjkT4NDynAe32AeDC4vps= 125 | github.com/hashicorp/terraform-plugin-sdk/v2 v2.13.0 h1:MyzzWWHOQgYCsoJZEC9YgDqyZoG8pftt2pcYG30A+Do= 126 | github.com/hashicorp/terraform-plugin-sdk/v2 v2.13.0/go.mod h1:TPjMXvpPNWagHzYOmVPzzRRIBTuaLVukR+esL08tgzg= 127 | github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 h1:1FGtlkJw87UsTMg5s8jrekrHmUPUJaMcu6ELiVhQrNw= 128 | github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896/go.mod h1:bzBPnUIkI0RxauU8Dqo+2KrZZ28Cf48s8V6IHt3p4co= 129 | github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= 130 | github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= 131 | github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= 132 | github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= 133 | github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= 134 | github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= 135 | github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= 136 | github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= 137 | github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= 138 | github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74= 139 | github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= 140 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 141 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 142 | github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= 143 | github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= 144 | github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 145 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 146 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 147 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 148 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 149 | github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= 150 | github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= 151 | github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 152 | github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= 153 | github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= 154 | github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= 155 | github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= 156 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 157 | github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= 158 | github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= 159 | github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= 160 | github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= 161 | github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= 162 | github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= 163 | github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= 164 | github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= 165 | github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= 166 | github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= 167 | github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= 168 | github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= 169 | github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= 170 | github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= 171 | github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= 172 | github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= 173 | github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= 174 | github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758= 175 | github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce/go.mod h1:uFMI8w+ref4v2r9jz+c9i1IfIttS/OkmLfrk1jne5hs= 176 | github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= 177 | github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= 178 | github.com/orirawlings/persistent-cookiejar v0.3.2 h1:6SZYaE3s8H+x1Xdw+E8mslO1OXLme6HZMv95pjiwEPU= 179 | github.com/orirawlings/persistent-cookiejar v0.3.2/go.mod h1:mndFQuhWIsBaloT/dZPibBxlWfFA9R1EraeTTcSOf8A= 180 | github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= 181 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 182 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 183 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 184 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 185 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 186 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 187 | github.com/rogpeppe/clock v0.0.0-20190514195947-2896927a307a h1:3QH7VyOaaiUHNrA9Se4YQIRkDTCw1EJls9xTUCaCeRM= 188 | github.com/rogpeppe/clock v0.0.0-20190514195947-2896927a307a/go.mod h1:4r5QyqhjIWCcK8DO4KMclc5Iknq5qVBAlbYYzAbUScQ= 189 | github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= 190 | github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= 191 | github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= 192 | github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= 193 | github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= 194 | github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= 195 | github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= 196 | github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= 197 | github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= 198 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 199 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 200 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 201 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 202 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 203 | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= 204 | github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= 205 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 206 | github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= 207 | github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= 208 | github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= 209 | github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U= 210 | github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= 211 | github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= 212 | github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= 213 | github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= 214 | github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 215 | github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= 216 | github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= 217 | github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= 218 | github.com/zclconf/go-cty v1.9.1/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= 219 | github.com/zclconf/go-cty v1.10.0 h1:mp9ZXQeIcN8kAwuqorjH+Q+njbJKjLrvB2yIh4q7U+0= 220 | github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= 221 | github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= 222 | go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= 223 | go4.org v0.0.0-20190313082347-94abd6928b1d h1:JkRdGP3zvTtTbabWSAC6n67ka30y7gOzWAah4XYJSfw= 224 | go4.org v0.0.0-20190313082347-94abd6928b1d/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= 225 | golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 226 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 227 | golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 228 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 229 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 230 | golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= 231 | golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= 232 | golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 233 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 234 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 235 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 236 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 237 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 238 | golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 239 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 240 | golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 241 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 242 | golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 243 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 244 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 245 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 246 | golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 247 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 248 | golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 249 | golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 250 | golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 251 | golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 252 | golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 253 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 254 | golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= 255 | golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= 256 | golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 257 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 258 | golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 259 | golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 260 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 261 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 262 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 263 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 264 | golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 265 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 266 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 267 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 268 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 269 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 270 | golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 271 | golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 272 | golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 273 | golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 274 | golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 275 | golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 276 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 277 | golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 278 | golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 279 | golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 280 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 281 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 282 | golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 283 | golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= 284 | golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 285 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 286 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 287 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 288 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 289 | golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 290 | golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= 291 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 292 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 293 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 294 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 295 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 296 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 297 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 298 | golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= 299 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 300 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 301 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 302 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 303 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 304 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 305 | google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 306 | google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= 307 | google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 308 | google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 309 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 310 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 311 | google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 312 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 313 | google.golang.org/genproto v0.0.0-20200711021454-869866162049/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 314 | google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d h1:92D1fum1bJLKSdr11OJ+54YeCMCGYIygTA7R/YZxH5M= 315 | google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 316 | google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= 317 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 318 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 319 | google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= 320 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 321 | google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 322 | google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= 323 | google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= 324 | google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= 325 | google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= 326 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 327 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 328 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 329 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 330 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 331 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 332 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 333 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 334 | google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= 335 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 336 | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= 337 | google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 338 | google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= 339 | google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 340 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 341 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 342 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 343 | gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 344 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 345 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 346 | gopkg.in/retry.v1 v1.0.3 h1:a9CArYczAVv6Qs6VGoLMio99GEs7kY9UzSF9+LD+iGs= 347 | gopkg.in/retry.v1 v1.0.3/go.mod h1:FJkXmWiMaAo7xB+xhvDF59zhfjDWyzmyAxiT4dB688g= 348 | gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= 349 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 350 | gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 351 | gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 352 | gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 353 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= 354 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 355 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 356 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 357 | -------------------------------------------------------------------------------- /inwx/internal/api/client.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "bytes" 5 | "context" 6 | "encoding/json" 7 | "fmt" 8 | "github.com/go-logr/logr" 9 | cookiejar "github.com/orirawlings/persistent-cookiejar" 10 | "github.com/pkg/errors" 11 | "net/http" 12 | "net/url" 13 | "os" 14 | "runtime" 15 | "sync" 16 | ) 17 | 18 | var ( 19 | version = "dev" 20 | commit = "none" 21 | date = "unknown" 22 | ) 23 | 24 | const ( 25 | COMMAND_SUCCESSFUL float64 = 1000 26 | COMMAND_SUCCESSFUL_PENDING float64 = 1001 27 | ) 28 | 29 | type Response map[string]interface{} 30 | 31 | func (r Response) Code() float64 { 32 | return r["code"].(float64) 33 | } 34 | 35 | func (r Response) ApiError() string { 36 | jsonStr, err := json.Marshal(r) 37 | if err != nil { 38 | return fmt.Sprintf("could not parse error: %w", err) 39 | } 40 | return string(jsonStr) 41 | } 42 | 43 | type Client struct { 44 | httpClient *http.Client 45 | logger *logr.Logger 46 | BaseURL *url.URL 47 | Username string 48 | Password string 49 | Debug bool 50 | jar *cookiejar.Jar 51 | mu sync.Mutex 52 | } 53 | 54 | func NewClient(username string, password string, baseURL *url.URL, logger *logr.Logger, debug bool) (*Client, error) { 55 | logger.V(10).Info("initializing new http client") 56 | 57 | jar, err := cookiejar.New(&cookiejar.Options{ 58 | PersistSessionCookies: true, 59 | }) 60 | if err != nil { 61 | return nil, errors.WithStack(fmt.Errorf("could not create http client cookie jar: %w", err)) 62 | } 63 | 64 | httpClient := &http.Client{ 65 | Transport: &http.Transport{ 66 | DisableCompression: true, 67 | }, 68 | Jar: jar, 69 | } 70 | 71 | return &Client{ 72 | httpClient: httpClient, 73 | logger: logger, 74 | BaseURL: baseURL, 75 | Username: username, 76 | Password: password, 77 | Debug: debug, 78 | jar: jar, 79 | }, nil 80 | } 81 | 82 | func (c *Client) _Call(ctx context.Context, method string, parameters map[string]interface{}, expectResponseBody bool) (Response, error) { 83 | c.mu.Lock() 84 | defer c.mu.Unlock() 85 | 86 | requestBody := map[string]interface{}{} 87 | requestBody["method"] = method 88 | requestBody["params"] = parameters 89 | requestJsonBody, err := json.Marshal(requestBody) 90 | if err != nil { 91 | return nil, errors.WithStack(fmt.Errorf("could not marshal rpc request parameters to json: %w", err)) 92 | } 93 | 94 | if c.Debug { 95 | fmt.Printf("Request (%s): %s", method, requestJsonBody) 96 | c.logger.Info(fmt.Sprintf("Request (%s): %s", method, requestJsonBody)) 97 | } 98 | 99 | err = c.jar.Save() 100 | if err != nil { 101 | return nil, errors.WithStack(fmt.Errorf("could not save cookies: %w", err)) 102 | } 103 | 104 | request, err := http.NewRequest("POST", c.BaseURL.String(), bytes.NewReader(requestJsonBody)) 105 | if err != nil { 106 | return nil, errors.WithStack(fmt.Errorf("could not create rpc request: %w", err)) 107 | } 108 | request = request.WithContext(ctx) 109 | request.Header.Set("content-type", "application/json; charset=UTF-8") 110 | if os.Getenv("INWX_OPTOUT_USERAGENT") == "true" { 111 | request.Header.Set("User-Agent", fmt.Sprintf("terraform-provider-inwx/%s (%s; %s; %s) terraform/sdkv2 (+https://terraform.io)", version, runtime.Version(), runtime.GOOS, runtime.GOARCH)) 112 | } 113 | post, err := c.httpClient.Do(request) 114 | if err != nil { 115 | return nil, errors.WithStack(fmt.Errorf("could not execute rpc request: %w", err)) 116 | } 117 | 118 | var response map[string]interface{} 119 | if expectResponseBody { // not all requests return a response 120 | err = json.NewDecoder(post.Body).Decode(&response) 121 | if err != nil { 122 | return nil, errors.WithStack(fmt.Errorf("could not unmarshal rpc response to json: %w, %s, %s, %s", err, requestJsonBody, c.BaseURL.String(), post.Status)) 123 | } 124 | 125 | // Make sure body is valid json before debug message 126 | if c.Debug { 127 | c.logger.Info(fmt.Sprintf("Request (%s): %s", method, post.Body)) 128 | } 129 | } 130 | 131 | err = c.jar.Save() 132 | if err != nil { 133 | return nil, errors.WithStack(fmt.Errorf("could not save cookies: %w", err)) 134 | } 135 | 136 | if expectResponseBody { 137 | return response, nil 138 | } 139 | return nil, nil 140 | } 141 | 142 | func (c *Client) CallNoParams(ctx context.Context, method string) (Response, error) { 143 | return c.Call(ctx, method, map[string]interface{}{}) 144 | } 145 | 146 | func (c *Client) Call(ctx context.Context, method string, parameters map[string]interface{}) (Response, error) { 147 | return c._Call(ctx, method, parameters, true) 148 | } 149 | 150 | func (c *Client) CallNoResponseBody(ctx context.Context, method string, parameters map[string]interface{}) error { 151 | _, err := c._Call(ctx, method, parameters, false) 152 | return err 153 | } 154 | 155 | func (c *Client) Logout(ctx context.Context) (Response, error) { 156 | return c.CallNoParams(ctx, "account.logout") 157 | } 158 | -------------------------------------------------------------------------------- /inwx/internal/data_source/data_source_domain_contact.go: -------------------------------------------------------------------------------- 1 | package data_source 2 | 3 | import ( 4 | "context" 5 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 6 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 7 | "github.com/inwx/terraform-provider-inwx/inwx/internal/resource" 8 | "strings" 9 | ) 10 | 11 | func DomainContactDataSource() *schema.Resource { 12 | validContactTypes := []string{ 13 | "ORG", 14 | "PERSON", 15 | "ROLE", 16 | } 17 | 18 | return &schema.Resource{ 19 | Schema: map[string]*schema.Schema{ 20 | "id": { 21 | Type: schema.TypeInt, 22 | Required: true, 23 | }, 24 | "type": { 25 | Type: schema.TypeString, 26 | Optional: true, 27 | Description: "Type of contact. One of: " + strings.Join(validContactTypes, ", "), 28 | }, 29 | "name": { 30 | Type: schema.TypeString, 31 | Optional: true, 32 | Description: "First and lastname of the contact", 33 | }, 34 | "organization": { 35 | Type: schema.TypeString, 36 | Optional: true, 37 | Description: "The legal name of the organization. Required for types other than person", 38 | }, 39 | "street_address": { 40 | Type: schema.TypeString, 41 | Optional: true, 42 | Description: "Street Address of the contact", 43 | }, 44 | "city": { 45 | Type: schema.TypeString, 46 | Optional: true, 47 | Description: "City of the contact", 48 | }, 49 | "postal_code": { 50 | Type: schema.TypeString, 51 | Optional: true, 52 | Description: "Postal Code/Zipcode of the contact", 53 | }, 54 | "state_province": { 55 | Type: schema.TypeString, 56 | Optional: true, 57 | Description: "State/Province name of the contact", 58 | }, 59 | "country_code": { 60 | Type: schema.TypeString, 61 | Optional: true, 62 | Description: "Country code of the contact. Must be two characters", 63 | }, 64 | "phone_number": { 65 | Type: schema.TypeString, 66 | Optional: true, 67 | Description: "Phone number of the contact", 68 | }, 69 | "fax": { 70 | Type: schema.TypeString, 71 | Optional: true, 72 | Description: "Fax number of the contact", 73 | }, 74 | "email": { 75 | Type: schema.TypeString, 76 | Optional: true, 77 | Description: "Contact email address", 78 | }, 79 | "remarks": { 80 | Type: schema.TypeString, 81 | Optional: true, 82 | Description: "Custom description of the contact", 83 | }, 84 | }, 85 | ReadContext: resourceContactRead, 86 | Description: "Data source provides information about a domain contact", 87 | } 88 | } 89 | 90 | func resourceContactRead(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { 91 | parameters := map[string]interface{}{ 92 | "id": data.Get("id").(int), 93 | "wide": 2, 94 | } 95 | 96 | return resource.AbstractResourceContactRead(ctx, data, meta, parameters) 97 | } 98 | -------------------------------------------------------------------------------- /inwx/internal/resource/resource_automated_dnssec.go: -------------------------------------------------------------------------------- 1 | package resource 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | 7 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 8 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 9 | "github.com/inwx/terraform-provider-inwx/inwx/internal/api" 10 | ) 11 | 12 | func AutomatedDNSSECResource() *schema.Resource { 13 | return &schema.Resource{ 14 | CreateContext: resourceAutomatedDNSSECCreate, 15 | DeleteContext: resourceAutomatedDNSSECDelete, 16 | ReadContext: resourceAutomatedDNSSECRead, 17 | Schema: map[string]*schema.Schema{ 18 | "domain": { 19 | Description: "Name of the domain", 20 | Type: schema.TypeString, 21 | Required: true, 22 | ForceNew: true, 23 | }, 24 | }, 25 | Description: "Manages automated DNSSEC for a domain", 26 | DeprecationMessage: "", 27 | Importer: &schema.ResourceImporter{ 28 | StateContext: schema.ImportStatePassthroughContext, 29 | }, 30 | } 31 | } 32 | 33 | func resourceAutomatedDNSSECRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 34 | var diags diag.Diagnostics 35 | client := m.(*api.Client) 36 | 37 | domain := d.Get("domain").(string) 38 | if domain == "" { 39 | domain = d.Id() 40 | if err := d.Set("domain", domain); err != nil { 41 | return diag.FromErr(err) 42 | } 43 | } 44 | 45 | parameters := map[string]interface{}{ 46 | "domains": []string{domain}, 47 | } 48 | 49 | call, err := client.Call(ctx, "dnssec.info", parameters) 50 | if err != nil { 51 | diags = append(diags, diag.Diagnostic{ 52 | Severity: diag.Error, 53 | Summary: "Could not read DNSSEC info", 54 | Detail: err.Error(), 55 | }) 56 | return diags 57 | } 58 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 59 | diags = append(diags, diag.Diagnostic{ 60 | Severity: diag.Error, 61 | Summary: "Could not read DNSSEC info", 62 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 63 | }) 64 | return diags 65 | } 66 | 67 | resData, ok := call["resData"].(map[string]any) 68 | if !ok { 69 | d.SetId("") // Clear ID if resData is not found 70 | return diags 71 | } 72 | 73 | data, ok := resData["data"].([]any) 74 | if !ok || len(data) == 0 { 75 | d.SetId("") // Clear ID if no data found 76 | return diags 77 | } 78 | 79 | found := false 80 | for _, item := range data { 81 | domainInfo, ok := item.(map[string]any) 82 | if !ok { 83 | continue 84 | } 85 | 86 | if domainInfo["domain"].(string) == domain && domainInfo["dnssecStatus"].(string) == "AUTO" { 87 | d.SetId(domain) 88 | found = true 89 | break 90 | } 91 | } 92 | 93 | if !found { 94 | d.SetId("") // Clear ID if no matching record found 95 | } 96 | 97 | return diags 98 | } 99 | 100 | func resourceAutomatedDNSSECCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 101 | var diags diag.Diagnostics 102 | client := m.(*api.Client) 103 | 104 | parameters := map[string]interface{}{ 105 | "domainName": d.Get("domain").(string), 106 | } 107 | 108 | call, err := client.Call(ctx, "dnssec.enablednssec", parameters) 109 | if err != nil { 110 | diags = append(diags, diag.Diagnostic{ 111 | Severity: diag.Error, 112 | Summary: "Could not enable automated DNSSEC", 113 | Detail: err.Error(), 114 | }) 115 | return diags 116 | } 117 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 118 | diags = append(diags, diag.Diagnostic{ 119 | Severity: diag.Error, 120 | Summary: "Could not enable automated DNSSEC", 121 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 122 | }) 123 | return diags 124 | } 125 | 126 | d.SetId(d.Get("domain").(string)) 127 | 128 | return diags 129 | } 130 | 131 | func resourceAutomatedDNSSECDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 132 | var diags diag.Diagnostics 133 | client := m.(*api.Client) 134 | 135 | parameters := map[string]interface{}{ 136 | "domainName": d.Get("domain").(string), 137 | } 138 | 139 | call, err := client.Call(ctx, "dnssec.disablednssec", parameters) 140 | if err != nil { 141 | diags = append(diags, diag.Diagnostic{ 142 | Severity: diag.Error, 143 | Summary: "Could not disable automated DNSSEC", 144 | Detail: err.Error(), 145 | }) 146 | return diags 147 | } 148 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 149 | diags = append(diags, diag.Diagnostic{ 150 | Severity: diag.Error, 151 | Summary: "Could not disable automated DNSSEC", 152 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 153 | }) 154 | return diags 155 | } 156 | 157 | return diags 158 | } 159 | -------------------------------------------------------------------------------- /inwx/internal/resource/resource_dnssec_key.go: -------------------------------------------------------------------------------- 1 | package resource 2 | 3 | import ( 4 | "context" 5 | "errors" 6 | "fmt" 7 | "strconv" 8 | "strings" 9 | 10 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 11 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 12 | "github.com/inwx/terraform-provider-inwx/inwx/internal/api" 13 | ) 14 | 15 | func DNSSECKeyResource() *schema.Resource { 16 | return &schema.Resource{ 17 | CreateContext: resourceDNSSECKeyCreate, 18 | ReadContext: resourceDNSSECKeyRead, 19 | DeleteContext: resourceDNSSECKeyDelete, 20 | Importer: &schema.ResourceImporter{ 21 | StateContext: func(ctx context.Context, d *schema.ResourceData, m interface{}) ([]*schema.ResourceData, error) { 22 | parts := strings.Split(d.Id(), "/") 23 | if len(parts) != 2 { 24 | return nil, errors.New("invalid resource import specifier. Use: terraform import /") 25 | } 26 | 27 | _ = d.Set("domain", parts[0]) 28 | _ = d.Set("digest", parts[1]) 29 | 30 | return []*schema.ResourceData{d}, nil 31 | }, 32 | }, 33 | Schema: map[string]*schema.Schema{ 34 | "domain": { 35 | Description: "Name of the domain", 36 | Type: schema.TypeString, 37 | Required: true, 38 | ForceNew: true, 39 | }, 40 | "public_key": { 41 | Description: "Public key of the domain", 42 | Type: schema.TypeString, 43 | Required: true, 44 | ForceNew: true, 45 | }, 46 | "algorithm": { 47 | Description: "Algorithm used for the public key", 48 | Type: schema.TypeInt, 49 | Required: true, 50 | ForceNew: true, 51 | }, 52 | "digest": { 53 | Description: "Computed digest for the public key", 54 | Type: schema.TypeString, 55 | Computed: true, 56 | }, 57 | "digest_type": { 58 | Description: "Digest type", 59 | Type: schema.TypeInt, 60 | Computed: true, 61 | }, 62 | "flag": { 63 | Description: "Key flag (256=ZSK, 257=KSK)", 64 | Type: schema.TypeInt, 65 | Computed: true, 66 | }, 67 | "key_tag": { 68 | Description: "Key tag", 69 | Type: schema.TypeInt, 70 | Computed: true, 71 | }, 72 | "status": { 73 | Description: "DNSSEC status", 74 | Type: schema.TypeString, 75 | Computed: true, 76 | }, 77 | }, 78 | } 79 | } 80 | 81 | func resourceDNSSECKeyCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 82 | var diags diag.Diagnostics 83 | client := m.(*api.Client) 84 | 85 | parameters := map[string]interface{}{ 86 | "domainName": d.Get("domain").(string), 87 | "dnskey": fmt.Sprintf( 88 | "%s. IN DNSKEY 257 3 %d %s", 89 | d.Get("domain").(string), 90 | d.Get("algorithm").(int), 91 | d.Get("public_key").(string), 92 | ), 93 | "calculateDigest": true, 94 | } 95 | 96 | call, err := client.Call(ctx, "dnssec.adddnskey", parameters) 97 | if err != nil { 98 | diags = append(diags, diag.Diagnostic{ 99 | Severity: diag.Error, 100 | Summary: "Could not add DNSKEY", 101 | Detail: err.Error(), 102 | }) 103 | return diags 104 | } 105 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 106 | diags = append(diags, diag.Diagnostic{ 107 | Severity: diag.Error, 108 | Summary: "Could not add DNSKEY", 109 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 110 | }) 111 | return diags 112 | } 113 | 114 | resData := call["resData"].(map[string]interface{}) 115 | 116 | parts := strings.Split(resData["ds"].(string), " ") 117 | if len(parts) != 4 { 118 | diags = append(diags, diag.Diagnostic{ 119 | Severity: diag.Error, 120 | Summary: "Could not parse returned DS", 121 | Detail: fmt.Sprintf("API response not in expected format. Got response: %s", resData["ds"]), 122 | }) 123 | return diags 124 | } 125 | 126 | d.Set("digest", parts[3]) 127 | 128 | resourceDNSSECKeyRead(ctx, d, m) 129 | 130 | return diags 131 | } 132 | 133 | func resourceDNSSECKeyRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 134 | var diags diag.Diagnostics 135 | client := m.(*api.Client) 136 | 137 | parameters := map[string]interface{}{ 138 | "domainName": d.Get("domain").(string), 139 | "digest": d.Get("digest").(string), 140 | "active": 1, 141 | } 142 | 143 | call, err := client.Call(ctx, "dnssec.listkeys", parameters) 144 | if err != nil { 145 | diags = append(diags, diag.Diagnostic{ 146 | Severity: diag.Error, 147 | Summary: "Could not get DNSSEC keys", 148 | Detail: err.Error(), 149 | }) 150 | return diags 151 | } 152 | if call.Code() != api.COMMAND_SUCCESSFUL { 153 | diags = append(diags, diag.Diagnostic{ 154 | Severity: diag.Error, 155 | Summary: "Could not get DNSSEC keys", 156 | Detail: fmt.Sprintf("API response not status code 1000. Got response: %s", call.ApiError()), 157 | }) 158 | return diags 159 | } 160 | 161 | resData := call["resData"].([]interface{}) 162 | key := resData[0].(map[string]interface{}) 163 | 164 | d.SetId(key["id"].(string)) 165 | d.Set("domain", key["ownerName"].(string)) 166 | d.Set("public_key", key["publicKey"].(string)) 167 | d.Set("digest", key["digest"].(string)) 168 | d.Set("status", key["status"].(string)) 169 | 170 | if i, err := strconv.Atoi(key["algorithmId"].(string)); err == nil { 171 | d.Set("algorithm", i) 172 | } else { 173 | diags = append(diags, diag.Diagnostic{ 174 | Severity: diag.Error, 175 | Summary: "algorithm: failed to parse int from string", 176 | Detail: err.Error(), 177 | }) 178 | } 179 | 180 | if i, err := strconv.Atoi(key["digestTypeId"].(string)); err == nil { 181 | d.Set("digest_type", i) 182 | } else { 183 | diags = append(diags, diag.Diagnostic{ 184 | Severity: diag.Error, 185 | Summary: "digest_type: failed to parse int from string", 186 | Detail: err.Error(), 187 | }) 188 | } 189 | 190 | if i, err := strconv.Atoi(key["flagId"].(string)); err == nil { 191 | d.Set("flag", i) 192 | } else { 193 | diags = append(diags, diag.Diagnostic{ 194 | Severity: diag.Error, 195 | Summary: "flag: failed to parse int from string", 196 | Detail: err.Error(), 197 | }) 198 | } 199 | 200 | if i, err := strconv.Atoi(key["keyTag"].(string)); err == nil { 201 | d.Set("key_tag", i) 202 | } else { 203 | diags = append(diags, diag.Diagnostic{ 204 | Severity: diag.Error, 205 | Summary: "key_tag: failed to parse int from string", 206 | Detail: err.Error(), 207 | }) 208 | } 209 | 210 | return diags 211 | } 212 | 213 | func resourceDNSSECKeyDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 214 | var diags diag.Diagnostics 215 | client := m.(*api.Client) 216 | 217 | parameters := map[string]interface{}{ 218 | "key": d.Id(), 219 | } 220 | 221 | call, err := client.Call(ctx, "dnssec.deletednskey", parameters) 222 | if err != nil { 223 | diags = append(diags, diag.Diagnostic{ 224 | Severity: diag.Error, 225 | Summary: "Could not delete DNSKEY", 226 | Detail: err.Error(), 227 | }) 228 | return diags 229 | } 230 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 231 | diags = append(diags, diag.Diagnostic{ 232 | Severity: diag.Error, 233 | Summary: "Could not delete DNSKEY", 234 | Detail: fmt.Sprintf("API response not status code 1000 pr 1001. Got response: %s", call.ApiError()), 235 | }) 236 | return diags 237 | } 238 | 239 | return diags 240 | } 241 | -------------------------------------------------------------------------------- /inwx/internal/resource/resource_domain.go: -------------------------------------------------------------------------------- 1 | package resource 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "github.com/hashicorp/go-cty/cty" 7 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 8 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 9 | "github.com/inwx/terraform-provider-inwx/inwx/internal/api" 10 | "strings" 11 | ) 12 | 13 | func DomainResource() *schema.Resource { 14 | validRenewalModes := []string{ 15 | "AUTORENEW", 16 | "AUTODELETE", 17 | "AUTOEXPIRE", 18 | } 19 | 20 | return &schema.Resource{ 21 | CreateContext: resourceDomainCreate, 22 | ReadContext: resourceDomainRead, 23 | UpdateContext: resourceDomainUpdate, 24 | DeleteContext: resourceDomainDelete, 25 | Importer: &schema.ResourceImporter{ 26 | StateContext: func(ctx context.Context, data *schema.ResourceData, i interface{}) ([]*schema.ResourceData, error) { 27 | data.Set("name", data.Id()) 28 | return schema.ImportStatePassthroughContext(ctx, data, i) 29 | }, 30 | }, 31 | Schema: map[string]*schema.Schema{ 32 | "name": { 33 | Type: schema.TypeString, 34 | Description: "Name of the domain", 35 | Required: true, 36 | }, 37 | "nameservers": { 38 | Type: schema.TypeSet, 39 | Elem: &schema.Schema{ 40 | Type: schema.TypeString, 41 | MinItems: 1, 42 | }, 43 | Optional: true, 44 | Description: "Set of nameservers of the domain", 45 | }, 46 | "period": { 47 | Type: schema.TypeString, 48 | Required: true, 49 | Description: "Registration period of the domain", 50 | }, 51 | "renewal_mode": { 52 | Type: schema.TypeString, 53 | Optional: true, 54 | Default: "AUTORENEW", 55 | Description: "Renewal mode of the domain. One of: " + strings.Join(validRenewalModes, ", "), 56 | ValidateDiagFunc: func(i interface{}, path cty.Path) diag.Diagnostics { 57 | var diags diag.Diagnostics 58 | for _, validRenewalMode := range validRenewalModes { 59 | if validRenewalMode == i.(string) { 60 | return diags 61 | } 62 | } 63 | 64 | diags = append(diags, diag.Diagnostic{ 65 | Severity: diag.Error, 66 | Summary: "Invalid contact type", 67 | Detail: "Must be one of: " + strings.Join(validRenewalModes, ", "), 68 | AttributePath: path, 69 | }) 70 | return diags 71 | }, 72 | }, 73 | "transfer_lock": { 74 | Type: schema.TypeBool, 75 | Optional: true, 76 | Default: true, 77 | Description: "Whether the domain transfer lock should be enabled", 78 | }, 79 | "contacts": { 80 | Type: schema.TypeSet, 81 | Required: true, 82 | MaxItems: 1, 83 | MinItems: 1, 84 | Elem: contactsSchemaResource(), 85 | Description: "Contacts of the domain", 86 | }, 87 | "extra_data": { 88 | Type: schema.TypeMap, 89 | Optional: true, 90 | Default: map[string]string{}, 91 | Elem: &schema.Schema{Type: schema.TypeString}, 92 | Description: "Extra data, needed for some jurisdictions", 93 | }, 94 | }, 95 | } 96 | } 97 | 98 | func contactsSchemaResource() *schema.Resource { 99 | return &schema.Resource{ 100 | Schema: map[string]*schema.Schema{ 101 | "registrant": { 102 | Type: schema.TypeInt, 103 | Required: true, 104 | Description: "Id of the registrant contact", 105 | }, 106 | "admin": { 107 | Type: schema.TypeInt, 108 | Required: true, 109 | Description: "Id of the admin contact", 110 | }, 111 | "tech": { 112 | Type: schema.TypeInt, 113 | Required: true, 114 | Description: "Id of the tech contact", 115 | }, 116 | "billing": { 117 | Type: schema.TypeInt, 118 | Required: true, 119 | Description: "Id of the billing contact", 120 | }, 121 | }, 122 | } 123 | } 124 | 125 | func resourceDomainCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 126 | var diags diag.Diagnostics 127 | client := m.(*api.Client) 128 | 129 | // map value interface{} is actually an 'int' value, but we cannot parse it correctly here 130 | contactIds := d.Get("contacts").(*schema.Set).List()[0].(map[string]interface{}) 131 | 132 | parameters := map[string]interface{}{ 133 | "domain": d.Get("name").(string), 134 | "ns": d.Get("nameservers").(*schema.Set).List(), 135 | "period": d.Get("period").(string), 136 | "registrant": contactIds["registrant"], 137 | "admin": contactIds["admin"], 138 | "tech": contactIds["tech"], 139 | "billing": contactIds["billing"], 140 | "transferLock": d.Get("transfer_lock").(bool), 141 | "renewalMode": d.Get("renewal_mode").(string), 142 | } 143 | if extraData, ok := d.GetOk("extra_data"); ok { 144 | parameters["extData"] = extraData 145 | } 146 | 147 | call, err := client.Call(ctx, "domain.create", parameters) 148 | if err != nil { 149 | diags = append(diags, diag.Diagnostic{ 150 | Severity: diag.Error, 151 | Summary: "Could not create domain", 152 | Detail: err.Error(), 153 | }) 154 | return diags 155 | } 156 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 157 | diags = append(diags, diag.Diagnostic{ 158 | Severity: diag.Error, 159 | Summary: "Could not create domain", 160 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 161 | }) 162 | return diags 163 | } 164 | 165 | d.SetId(d.Get("name").(string)) 166 | 167 | return diags 168 | } 169 | 170 | func resourceDomainRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { 171 | var diags diag.Diagnostics 172 | client := meta.(*api.Client) 173 | 174 | parameters := map[string]interface{}{ 175 | "domain": d.Id(), 176 | "wide": 2, 177 | } 178 | 179 | call, err := client.Call(ctx, "domain.info", parameters) 180 | if err != nil { 181 | diags = append(diags, diag.Diagnostic{ 182 | Severity: diag.Error, 183 | Summary: "Could not get domain info", 184 | Detail: err.Error(), 185 | }) 186 | return diags 187 | } 188 | if call.Code() != api.COMMAND_SUCCESSFUL { 189 | diags = append(diags, diag.Diagnostic{ 190 | Severity: diag.Error, 191 | Summary: "Could not get domain info", 192 | Detail: fmt.Sprintf("API response not status code 1000. Got response: %s", call.ApiError()), 193 | }) 194 | return diags 195 | } 196 | 197 | resData := call["resData"].(map[string]interface{}) 198 | d.Set("name", resData["domain"]) 199 | d.Set("nameservers", resData["ns"]) 200 | d.Set("period", resData["period"]) 201 | d.Set("renewal_mode", resData["renewalMode"]) 202 | d.Set("transfer_lock", resData["transferLock"]) 203 | 204 | contacts := map[string]interface{}{} 205 | contacts["registrant"] = int(resData["registrant"].(float64)) 206 | contacts["admin"] = int(resData["admin"].(float64)) 207 | contacts["tech"] = int(resData["tech"].(float64)) 208 | contacts["billing"] = int(resData["billing"].(float64)) 209 | 210 | d.Set("contacts", schema.NewSet(schema.HashResource(contactsSchemaResource()), []interface{}{contacts})) 211 | d.Set("extra_data", resData["extData"]) 212 | 213 | return diags 214 | } 215 | 216 | func resourceDomainUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { 217 | var diags diag.Diagnostics 218 | client := meta.(*api.Client) 219 | 220 | if d.HasChange("name") { 221 | diags = append(diags, diag.Diagnostic{ 222 | Severity: diag.Error, 223 | Summary: "domain 'name' cannot be updated", 224 | }) 225 | return diags 226 | } 227 | 228 | parameters := map[string]interface{}{ 229 | "domain": d.Get("name"), 230 | } 231 | 232 | if d.HasChange("nameservers") { 233 | parameters["ns"] = d.Get("nameservers").(*schema.Set).List() 234 | } 235 | if d.HasChange("period") { 236 | parameters["period"] = d.Get("period") 237 | } 238 | if d.HasChange("renewal_mode") { 239 | parameters["renewalMode"] = d.Get("renewal_mode") 240 | } 241 | if d.HasChange("transfer_lock") { 242 | parameters["transferLock"] = d.Get("transfer_lock") 243 | } 244 | if d.HasChange("contacts") { 245 | contacts := d.Get("contacts").(*schema.Set).List()[0].(map[string]interface{}) 246 | parameters["registrant"] = contacts["registrant"] 247 | parameters["admin"] = contacts["admin"] 248 | parameters["tech"] = contacts["tech"] 249 | parameters["billing"] = contacts["billing"] 250 | } 251 | if d.HasChange("extra_data") { 252 | parameters["extData"] = d.Get("extra_data") 253 | } 254 | 255 | call, err := client.Call(ctx, "domain.update", parameters) 256 | if err != nil { 257 | diags = append(diags, diag.Diagnostic{ 258 | Severity: diag.Error, 259 | Summary: "Could not get domain info", 260 | Detail: err.Error(), 261 | }) 262 | return diags 263 | } 264 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 265 | diags = append(diags, diag.Diagnostic{ 266 | Severity: diag.Error, 267 | Summary: "Could not get domain info", 268 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 269 | }) 270 | return diags 271 | } 272 | 273 | return diags 274 | } 275 | 276 | func resourceDomainDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { 277 | var diags diag.Diagnostics 278 | client := meta.(*api.Client) 279 | 280 | parameters := map[string]interface{}{ 281 | "domain": d.Get("name"), 282 | } 283 | 284 | call, err := client.Call(ctx, "domain.delete", parameters) 285 | if err != nil { 286 | diags = append(diags, diag.Diagnostic{ 287 | Severity: diag.Error, 288 | Summary: "Could not delete domain", 289 | Detail: err.Error(), 290 | }) 291 | return diags 292 | } 293 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 294 | diags = append(diags, diag.Diagnostic{ 295 | Severity: diag.Error, 296 | Summary: "Could not delete domain", 297 | Detail: fmt.Sprintf("API response not status code 1000 pr 1001. Got response: %s", call.ApiError()), 298 | }) 299 | return diags 300 | } 301 | 302 | return diags 303 | } 304 | 305 | func validateCountryCode(i interface{}, path cty.Path) diag.Diagnostics { 306 | var diags diag.Diagnostics 307 | countryCode := i.(string) 308 | if len(countryCode) != 2 { 309 | diags = append(diags, diag.Diagnostic{ 310 | Severity: diag.Error, 311 | Summary: "Could not validate country code", 312 | Detail: fmt.Sprintf("Expected a two digit country code, got '%s' "+ 313 | "with (%d) digits", countryCode, len(countryCode)), 314 | AttributePath: path, 315 | }) 316 | return diags 317 | } 318 | return diags 319 | } 320 | -------------------------------------------------------------------------------- /inwx/internal/resource/resource_domain_contact.go: -------------------------------------------------------------------------------- 1 | package resource 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "reflect" 7 | "strconv" 8 | "strings" 9 | 10 | "github.com/hashicorp/go-cty/cty" 11 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 12 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 13 | "github.com/inwx/terraform-provider-inwx/inwx/internal/api" 14 | ) 15 | 16 | type Contact struct { 17 | Type string 18 | Name string 19 | Organization string 20 | StreetAddress string 21 | City string 22 | PostalCode string 23 | StateProvince string 24 | CountryCode string 25 | PhoneNumber string 26 | FaxNumber string 27 | Email string 28 | Remarks string 29 | } 30 | 31 | func DomainContactResource() *schema.Resource { 32 | validContactTypes := []string{ 33 | "ORG", 34 | "PERSON", 35 | "ROLE", 36 | } 37 | 38 | return &schema.Resource{ 39 | CreateContext: resourceContactCreate, 40 | ReadContext: resourceContactRead, 41 | UpdateContext: resourceContactUpdate, 42 | DeleteContext: resourceContactDelete, 43 | Importer: &schema.ResourceImporter{ 44 | StateContext: schema.ImportStatePassthroughContext, 45 | }, 46 | Schema: map[string]*schema.Schema{ 47 | "type": { 48 | Type: schema.TypeString, 49 | Required: true, 50 | Description: "Type of contact. One of: " + strings.Join(validContactTypes, ", "), 51 | ValidateDiagFunc: func(i interface{}, path cty.Path) diag.Diagnostics { 52 | var diags diag.Diagnostics 53 | for _, validContactType := range validContactTypes { 54 | if validContactType == i.(string) { 55 | return diags 56 | } 57 | } 58 | 59 | diags = append(diags, diag.Diagnostic{ 60 | Severity: diag.Error, 61 | Summary: "Invalid contact type", 62 | Detail: "Must be one of: " + strings.Join(validContactTypes, ", "), 63 | AttributePath: path, 64 | }) 65 | return diags 66 | }, 67 | }, 68 | "name": { 69 | Type: schema.TypeString, 70 | Required: true, 71 | Description: "First and lastname of the contact", 72 | }, 73 | "organization": { 74 | Type: schema.TypeString, 75 | Optional: true, 76 | Description: "The legal name of the organization. Required for types other than person", 77 | }, 78 | "street_address": { 79 | Type: schema.TypeString, 80 | Required: true, 81 | Description: "Street Address of the contact", 82 | }, 83 | "city": { 84 | Type: schema.TypeString, 85 | Required: true, 86 | Description: "City of the contact", 87 | }, 88 | "postal_code": { 89 | Type: schema.TypeString, 90 | Required: true, 91 | Description: "Postal Code/Zipcode of the contact", 92 | }, 93 | "state_province": { 94 | Type: schema.TypeString, 95 | Optional: true, 96 | Description: "State/Province name of the contact", 97 | }, 98 | "country_code": { 99 | Type: schema.TypeString, 100 | Required: true, 101 | ValidateDiagFunc: validateCountryCode, 102 | Description: "Country code of the contact. Must be two characters", 103 | }, 104 | "phone_number": { 105 | Type: schema.TypeString, 106 | Required: true, 107 | Description: "Phone number of the contact", 108 | }, 109 | "fax": { 110 | Type: schema.TypeString, 111 | Optional: true, 112 | Description: "Fax number of the contact", 113 | }, 114 | "email": { 115 | Type: schema.TypeString, 116 | Required: true, 117 | Description: "Contact email address", 118 | }, 119 | "remarks": { 120 | Type: schema.TypeString, 121 | Optional: true, 122 | Description: "Custom description of the contact", 123 | ValidateDiagFunc: func(i interface{}, path cty.Path) diag.Diagnostics { 124 | var diags diag.Diagnostics 125 | remarks := i.(string) 126 | if len(remarks) > 255 { 127 | diags = append(diags, diag.Diagnostic{ 128 | Severity: diag.Error, 129 | Summary: "Remarks is too long", 130 | Detail: "Maximum allowed length is 255 characters", 131 | AttributePath: path, 132 | }) 133 | } 134 | return diags 135 | }, 136 | }, 137 | }, 138 | } 139 | } 140 | 141 | func resourceContactCreate(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { 142 | var diags diag.Diagnostics 143 | client := meta.(*api.Client) 144 | 145 | contact := expandContactFromResourceData(data) 146 | 147 | parameters := map[string]interface{}{ 148 | "type": contact.Type, 149 | "name": contact.Name, 150 | "street": contact.StreetAddress, 151 | "city": contact.City, 152 | "pc": contact.PostalCode, 153 | "sp": contact.StateProvince, 154 | "cc": contact.CountryCode, 155 | "voice": contact.PhoneNumber, 156 | "email": contact.Email, 157 | } 158 | if contact.Organization != "" { 159 | parameters["org"] = contact.Organization 160 | } 161 | if contact.StateProvince != "" { 162 | parameters["sp"] = contact.StateProvince 163 | } 164 | if contact.FaxNumber != "" { 165 | parameters["fax"] = contact.FaxNumber 166 | } 167 | if contact.Remarks != "" { 168 | parameters["remarks"] = contact.Remarks 169 | } 170 | 171 | call, err := client.Call(ctx, "contact.create", parameters) 172 | if err != nil { 173 | diags = append(diags, diag.Diagnostic{ 174 | Severity: diag.Error, 175 | Summary: "Could not create contact", 176 | Detail: err.Error(), 177 | }) 178 | return diags 179 | } 180 | 181 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 182 | diags = append(diags, diag.Diagnostic{ 183 | Severity: diag.Error, 184 | Summary: "Could not create contact", 185 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 186 | }) 187 | return diags 188 | } 189 | 190 | rawId := call["resData"].(map[string]interface{})["id"] 191 | switch id := rawId.(type) { 192 | case string: 193 | // When contact already exists: id = string 194 | data.SetId(id) 195 | case float64: 196 | // When contact does not already exist: id = float64 ... 197 | data.SetId(strconv.Itoa(int(id))) 198 | default: 199 | diags = append(diags, diag.Diagnostic{ 200 | Severity: diag.Error, 201 | Summary: "Unknown type", 202 | Detail: fmt.Sprintf("API returned unknown type for contact id: %s", reflect.TypeOf(rawId)), 203 | }) 204 | return diags 205 | } 206 | 207 | return diags 208 | } 209 | 210 | func AbstractResourceContactRead(ctx context.Context, data *schema.ResourceData, meta interface{}, parameters map[string]interface{}) diag.Diagnostics { 211 | var diags diag.Diagnostics 212 | client := meta.(*api.Client) 213 | 214 | call, err := client.Call(ctx, "contact.info", parameters) 215 | if err != nil { 216 | diags = append(diags, diag.Diagnostic{ 217 | Severity: diag.Error, 218 | Summary: "Could not get contact info", 219 | Detail: err.Error(), 220 | }) 221 | return diags 222 | } 223 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 224 | diags = append(diags, diag.Diagnostic{ 225 | Severity: diag.Error, 226 | Summary: "Could not get contact info", 227 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 228 | }) 229 | return diags 230 | } 231 | 232 | contact := expandContactFromInfoResponse(call["resData"].(map[string]interface{})["contact"].(map[string]interface{})) 233 | 234 | data.Set("type", contact.Type) 235 | data.Set("name", contact.Name) 236 | if contact.Organization != "" { 237 | data.Set("organization", contact.Organization) 238 | } 239 | data.Set("street_address", contact.StreetAddress) 240 | data.Set("city", contact.City) 241 | data.Set("postal_code", contact.PostalCode) 242 | if contact.StateProvince != "" { 243 | data.Set("state_province", contact.StateProvince) 244 | } 245 | data.Set("country_code", contact.CountryCode) 246 | data.Set("phone_number", contact.PhoneNumber) 247 | if contact.FaxNumber != "" { 248 | data.Set("fax", contact.FaxNumber) 249 | } 250 | data.Set("email", contact.Email) 251 | if contact.Remarks != "" { 252 | data.Set("remarks", contact.Remarks) 253 | } 254 | data.SetId(call["resData"].(map[string]interface{})["contact"].(map[string]interface{})["id"].(string)) 255 | 256 | return diags 257 | } 258 | 259 | func resourceContactRead(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { 260 | var diags diag.Diagnostics 261 | 262 | contactId, err := strconv.Atoi(data.Id()) 263 | if err != nil { 264 | diags = append(diags, diag.Diagnostic{ 265 | Severity: diag.Error, 266 | Summary: "Could not read numerical contact id", 267 | Detail: err.Error(), 268 | }) 269 | return diags 270 | } 271 | parameters := map[string]interface{}{ 272 | "id": contactId, 273 | "wide": 2, 274 | } 275 | 276 | return AbstractResourceContactRead(ctx, data, meta, parameters) 277 | } 278 | 279 | func resourceContactUpdate(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { 280 | var diags diag.Diagnostics 281 | client := meta.(*api.Client) 282 | 283 | parameters := map[string]interface{}{ 284 | "id": data.Id(), 285 | } 286 | 287 | if data.HasChange("type") { 288 | diags = append(diags, diag.Diagnostic{ 289 | Severity: diag.Error, 290 | Summary: "contact 'type' cannot be updated.", 291 | }) 292 | return diags 293 | } 294 | if data.HasChange("name") { 295 | parameters["name"] = data.Get("name") 296 | } 297 | if data.HasChange("organization") { 298 | parameters["org"] = data.Get("organization") 299 | } 300 | if data.HasChange("street_address") { 301 | parameters["street"] = data.Get("street_address") 302 | } 303 | if data.HasChange("city") { 304 | parameters["city"] = data.Get("city") 305 | } 306 | if data.HasChange("postal_code") { 307 | parameters["pc"] = data.Get("postal_code") 308 | } 309 | if data.HasChange("state_province") { 310 | parameters["sp"] = data.Get("state_province") 311 | } 312 | if data.HasChange("country_code") { 313 | parameters["cc"] = data.Get("country_code") 314 | } 315 | if data.HasChange("phone_number") { 316 | parameters["voice"] = data.Get("phone_number") 317 | } 318 | if data.HasChange("fax") { 319 | parameters["fax"] = data.Get("fax") 320 | } 321 | if data.HasChange("email") { 322 | parameters["email"] = data.Get("email") 323 | } 324 | if data.HasChange("remarks") { 325 | parameters["remarks"] = data.Get("remarks") 326 | } 327 | 328 | call, err := client.Call(ctx, "contact.update", parameters) 329 | if err != nil { 330 | diags = append(diags, diag.Diagnostic{ 331 | Severity: diag.Error, 332 | Summary: "Could not update contact", 333 | Detail: err.Error(), 334 | }) 335 | return diags 336 | } 337 | 338 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 339 | diags = append(diags, diag.Diagnostic{ 340 | Severity: diag.Error, 341 | Summary: "Could not update contact", 342 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 343 | }) 344 | return diags 345 | } 346 | 347 | return diags 348 | } 349 | 350 | func resourceContactDelete(ctx context.Context, data *schema.ResourceData, meta interface{}) diag.Diagnostics { 351 | var diags diag.Diagnostics 352 | client := meta.(*api.Client) 353 | 354 | contactId, err := strconv.Atoi(data.Id()) 355 | if err != nil { 356 | diags = append(diags, diag.Diagnostic{ 357 | Severity: diag.Error, 358 | Summary: "Could not read numerical contact id", 359 | Detail: err.Error(), 360 | }) 361 | return diags 362 | } 363 | parameters := map[string]interface{}{ 364 | "id": contactId, 365 | } 366 | call, err := client.Call(ctx, "contact.delete", parameters) 367 | if err != nil { 368 | diags = append(diags, diag.Diagnostic{ 369 | Severity: diag.Error, 370 | Summary: "Could not delete contact", 371 | Detail: err.Error(), 372 | }) 373 | return diags 374 | } 375 | 376 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 377 | diags = append(diags, diag.Diagnostic{ 378 | Severity: diag.Error, 379 | Summary: "Could not delete contact", 380 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 381 | }) 382 | return diags 383 | } 384 | 385 | return diags 386 | } 387 | 388 | func expandContactFromResourceData(data *schema.ResourceData) *Contact { 389 | var organization string 390 | if dataOrganization, ok := data.GetOk("organization"); ok { 391 | organization = dataOrganization.(string) 392 | } 393 | var stateProvince string 394 | if dataStateProvince, ok := data.GetOk("state_province"); ok { 395 | stateProvince = dataStateProvince.(string) 396 | } 397 | var fax string 398 | if dataFax, ok := data.GetOk("fax"); ok { 399 | fax = dataFax.(string) 400 | } 401 | var remarks string 402 | if dataRemarks, ok := data.GetOk("remarks"); ok { 403 | remarks = dataRemarks.(string) 404 | } 405 | 406 | return &Contact{ 407 | Type: data.Get("type").(string), 408 | Name: data.Get("name").(string), 409 | Organization: organization, 410 | StreetAddress: data.Get("street_address").(string), 411 | City: data.Get("city").(string), 412 | PostalCode: data.Get("postal_code").(string), 413 | StateProvince: stateProvince, 414 | CountryCode: data.Get("country_code").(string), 415 | PhoneNumber: data.Get("phone_number").(string), 416 | FaxNumber: fax, 417 | Email: data.Get("email").(string), 418 | Remarks: remarks, 419 | } 420 | } 421 | 422 | func expandContactFromInfoResponse(contactData map[string]interface{}) *Contact { 423 | var organization string 424 | if dataOrganization, ok := contactData["org"]; ok { 425 | organization = dataOrganization.(string) 426 | } 427 | var stateProvince string 428 | if dataStateProvince, ok := contactData["sp"]; ok { 429 | stateProvince = dataStateProvince.(string) 430 | } 431 | var fax string 432 | if dataFax, ok := contactData["fax"]; ok { 433 | fax = dataFax.(string) 434 | } 435 | var remarks string 436 | if dataRemarks, ok := contactData["remarks"]; ok { 437 | remarks = dataRemarks.(string) 438 | } 439 | 440 | return &Contact{ 441 | Type: contactData["type"].(string), 442 | Name: contactData["name"].(string), 443 | Organization: organization, 444 | StreetAddress: contactData["street"].(string), 445 | City: contactData["city"].(string), 446 | PostalCode: contactData["pc"].(string), 447 | StateProvince: stateProvince, 448 | CountryCode: contactData["cc"].(string), 449 | PhoneNumber: contactData["voice"].(string), 450 | FaxNumber: fax, 451 | Email: contactData["email"].(string), 452 | Remarks: remarks, 453 | } 454 | } 455 | -------------------------------------------------------------------------------- /inwx/internal/resource/resource_glue_record.go: -------------------------------------------------------------------------------- 1 | package resource 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "strconv" 7 | "strings" 8 | 9 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 10 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 11 | "github.com/inwx/terraform-provider-inwx/inwx/internal/api" 12 | ) 13 | 14 | func resourceGlueRecordParseId(id string) (string, string, error) { 15 | parts := strings.Split(id, ":") 16 | 17 | if len(parts) != 2 || parts[0] == "" || parts[1] == "" { 18 | return "", "", fmt.Errorf("unexpected format of ID (%s), expected attribute1:attribute2", id) 19 | } 20 | 21 | return parts[0], parts[1], nil 22 | } 23 | 24 | func GlueRecordResource() *schema.Resource { 25 | return &schema.Resource{ 26 | CreateContext: resourceGlueRecordCreate, 27 | ReadContext: resourceGlueRecordRead, 28 | UpdateContext: resourceGlueRecordUpdate, 29 | DeleteContext: resourceGlueRecordDelete, 30 | Importer: &schema.ResourceImporter{ 31 | StateContext: func(ctx context.Context, d *schema.ResourceData, i interface{}) ([]*schema.ResourceData, error) { 32 | hostname, id, err := resourceGlueRecordParseId(d.Id()) 33 | if err != nil { 34 | return nil, err 35 | } 36 | 37 | d.Set("hostname", hostname) 38 | d.SetId(fmt.Sprintf("%s:%s", hostname, id)) 39 | 40 | return []*schema.ResourceData{d}, nil 41 | }, 42 | }, 43 | Schema: map[string]*schema.Schema{ 44 | "hostname": { 45 | Description: "Name of host", 46 | Type: schema.TypeString, 47 | Required: true, 48 | }, 49 | "ip": { 50 | Description: "Ip address(es)", 51 | Type: schema.TypeList, 52 | Elem: &schema.Schema{ 53 | Type: schema.TypeString, 54 | }, 55 | Required: true, 56 | }, 57 | "status": { 58 | Description: "Status of the hostname", 59 | Type: schema.TypeString, 60 | Computed: true, 61 | }, 62 | "testing": { 63 | Description: "Execute command in testing mode", 64 | Type: schema.TypeBool, 65 | Required: false, 66 | Optional: true, 67 | }, 68 | }, 69 | } 70 | } 71 | 72 | func resourceGlueRecordCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 73 | var diags diag.Diagnostics 74 | client := m.(*api.Client) 75 | 76 | hostname := d.Get("hostname").(string) 77 | 78 | parameters := map[string]interface{}{ 79 | "hostname": hostname, 80 | "ip": d.Get("ip").([]interface{}), 81 | } 82 | 83 | if testing, ok := d.GetOk("testing"); ok { 84 | parameters["testing"] = testing 85 | } 86 | 87 | call, err := client.Call(ctx, "host.create", parameters) 88 | if err != nil { 89 | diags = append(diags, diag.Diagnostic{ 90 | Severity: diag.Error, 91 | Summary: "Could not create glue host", 92 | Detail: err.Error(), 93 | }) 94 | return diags 95 | } 96 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 97 | diags = append(diags, diag.Diagnostic{ 98 | Severity: diag.Error, 99 | Summary: "Could not create glue host", 100 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 101 | }) 102 | return diags 103 | } 104 | 105 | resData := call["resData"].(map[string]any) 106 | roId := strconv.Itoa(int(resData["roId"].(float64))) 107 | 108 | d.SetId(fmt.Sprintf("%s:%s", hostname, roId)) 109 | 110 | return resourceGlueRecordRead(ctx, d, m) 111 | } 112 | 113 | func resourceGlueRecordRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 114 | var diags diag.Diagnostics 115 | client := m.(*api.Client) 116 | 117 | hostname, roId, err := resourceGlueRecordParseId(d.Id()) 118 | if err != nil { 119 | diags = append(diags, diag.Diagnostic{ 120 | Severity: diag.Error, 121 | Summary: "Could not parse id", 122 | Detail: err.Error(), 123 | }) 124 | return diags 125 | } 126 | 127 | parameters := map[string]interface{}{ 128 | "hostname": hostname, 129 | "roId": roId, 130 | } 131 | 132 | call, err := client.Call(ctx, "host.info", parameters) 133 | if err != nil { 134 | diags = append(diags, diag.Diagnostic{ 135 | Severity: diag.Error, 136 | Summary: "Could not get glue record info", 137 | Detail: err.Error(), 138 | }) 139 | return diags 140 | } 141 | if call.Code() != api.COMMAND_SUCCESSFUL { 142 | diags = append(diags, diag.Diagnostic{ 143 | Severity: diag.Error, 144 | Summary: "Could not get glue record info", 145 | Detail: fmt.Sprintf("API response not status code 1000. Got response: %s", call.ApiError()), 146 | }) 147 | return diags 148 | } 149 | 150 | resData, ok := call["resData"].(map[string]any) 151 | if !ok { 152 | diags = append(diags, diag.Diagnostic{ 153 | Severity: diag.Error, 154 | Summary: "Could not get glue record info", 155 | Detail: "unexpected response format: missing resData", 156 | }) 157 | return diags 158 | } 159 | 160 | // Check if the returned record matches our ID 161 | roIdFloat, ok := resData["roId"].(float64) 162 | if !ok { 163 | diags = append(diags, diag.Diagnostic{ 164 | Severity: diag.Error, 165 | Summary: "Could not get glue record info", 166 | Detail: "unexpected response format: missing or invalid roId", 167 | }) 168 | return diags 169 | } 170 | 171 | if hostname+":"+strconv.Itoa(int(roIdFloat)) != d.Id() { 172 | d.SetId("") // Resource not found 173 | return diags 174 | } 175 | 176 | d.Set("hostname", resData["hostname"].(string)) 177 | if status, ok := resData["status"].(string); ok { 178 | d.Set("status", status) 179 | } 180 | if ips, ok := resData["ip"].([]interface{}); ok { 181 | d.Set("ip", ips) 182 | } 183 | 184 | return diags 185 | } 186 | 187 | func resourceGlueRecordUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 188 | var diags diag.Diagnostics 189 | client := m.(*api.Client) 190 | 191 | _, roId, err := resourceGlueRecordParseId(d.Id()) 192 | if err != nil { 193 | diags = append(diags, diag.Diagnostic{ 194 | Severity: diag.Error, 195 | Summary: "Could not parse id", 196 | Detail: err.Error(), 197 | }) 198 | return diags 199 | } 200 | 201 | parameters := map[string]interface{}{ 202 | "roId": roId, 203 | "ip": d.Get("ip").([]interface{}), 204 | } 205 | 206 | if d.HasChange("hostname") { 207 | parameters["hostname"] = d.Get("hostname").(string) 208 | } 209 | if testing, ok := d.GetOk("testing"); ok && d.HasChange("testing") { 210 | parameters["testing"] = testing 211 | } 212 | 213 | err = client.CallNoResponseBody(ctx, "host.update", parameters) 214 | if err != nil { 215 | diags = append(diags, diag.Diagnostic{ 216 | Severity: diag.Error, 217 | Summary: "Could not update glue record", 218 | Detail: err.Error(), 219 | }) 220 | return diags 221 | } 222 | 223 | return diags 224 | } 225 | 226 | func resourceGlueRecordDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 227 | var diags diag.Diagnostics 228 | client := m.(*api.Client) 229 | 230 | hostname, roId, err := resourceGlueRecordParseId(d.Id()) 231 | if err != nil { 232 | diags = append(diags, diag.Diagnostic{ 233 | Severity: diag.Error, 234 | Summary: "Could not parse id", 235 | Detail: err.Error(), 236 | }) 237 | return diags 238 | } 239 | 240 | parameters := map[string]interface{}{ 241 | "hostname": hostname, 242 | "roId": roId, 243 | } 244 | 245 | if testing, ok := d.GetOk("testing"); ok { 246 | parameters["testing"] = testing 247 | } 248 | 249 | err = client.CallNoResponseBody(ctx, "host.delete", parameters) 250 | if err != nil { 251 | diags = append(diags, diag.Diagnostic{ 252 | Severity: diag.Error, 253 | Summary: "Could not delete glue record", 254 | Detail: err.Error(), 255 | }) 256 | return diags 257 | } 258 | 259 | return diags 260 | } 261 | -------------------------------------------------------------------------------- /inwx/internal/resource/resource_nameserver.go: -------------------------------------------------------------------------------- 1 | package resource 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "strconv" 7 | "strings" 8 | 9 | "github.com/hashicorp/go-cty/cty" 10 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 11 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 12 | "github.com/inwx/terraform-provider-inwx/inwx/internal/api" 13 | ) 14 | 15 | func resourceNameserverParseId(id string) (string, string, error) { 16 | parts := strings.Split(id, ":") 17 | 18 | if len(parts) != 2 || parts[0] == "" || parts[1] == "" { 19 | return "", "", fmt.Errorf("unexpected format of ID (%s), expected attribute1:attribute2", id) 20 | } 21 | 22 | return parts[0], parts[1], nil 23 | } 24 | 25 | func NameserverResource() *schema.Resource { 26 | validTypes := []string{ 27 | "MASTER", "SLAVE", 28 | } 29 | 30 | validUrlRedirectTypes := []string{ 31 | "HEADER301", "HEADER302", "FRAME", 32 | } 33 | 34 | return &schema.Resource{ 35 | CreateContext: resourceNameserverCreate, 36 | ReadContext: resourceNameserverRead, 37 | UpdateContext: resourceNameserverUpdate, 38 | DeleteContext: resourceNameserverDelete, 39 | Importer: &schema.ResourceImporter{ 40 | StateContext: func(ctx context.Context, d *schema.ResourceData, i interface{}) ([]*schema.ResourceData, error) { 41 | domain, id, err := resourceNameserverParseId(d.Id()) 42 | if err != nil { 43 | return nil, err 44 | } 45 | 46 | err = d.Set("domain", domain) 47 | if err != nil { 48 | return nil, err 49 | } 50 | d.SetId(fmt.Sprintf("%s:%s", domain, id)) 51 | 52 | diags := resourceNameserverRead(ctx, d, i) 53 | if diags.HasError() { 54 | return nil, fmt.Errorf("failed to read nameserver data: %v", diags[0].Summary) 55 | } 56 | 57 | return []*schema.ResourceData{d}, nil 58 | }, 59 | }, 60 | Schema: map[string]*schema.Schema{ 61 | "domain": { 62 | Description: "Domain name", 63 | Type: schema.TypeString, 64 | Required: true, 65 | ForceNew: true, 66 | }, 67 | "type": { 68 | Description: "Type of the nameserver. One of: " + strings.Join(validTypes, ", "), 69 | Type: schema.TypeString, 70 | Required: true, 71 | ValidateDiagFunc: func(i interface{}, path cty.Path) diag.Diagnostics { 72 | var diags diag.Diagnostics 73 | for _, validRecordType := range validTypes { 74 | if validRecordType == i.(string) { 75 | return diags 76 | } 77 | } 78 | 79 | diags = append(diags, diag.Diagnostic{ 80 | Severity: diag.Error, 81 | Summary: "Invalid type type", 82 | Detail: "Must be one of: " + strings.Join(validTypes, ", "), 83 | AttributePath: path, 84 | }) 85 | return diags 86 | }, 87 | ForceNew: false, 88 | }, 89 | "nameservers": { 90 | Description: "List of nameservers", 91 | Type: schema.TypeList, 92 | Elem: &schema.Schema{ 93 | Type: schema.TypeString, 94 | }, 95 | Required: true, 96 | ForceNew: false, 97 | }, 98 | "master_ip": { 99 | Description: "Master IP address", 100 | Type: schema.TypeString, 101 | Optional: true, 102 | ForceNew: false, 103 | }, 104 | "web": { 105 | Description: "Web nameserver entry", 106 | Type: schema.TypeString, 107 | Optional: true, 108 | ForceNew: false, 109 | }, 110 | "mail": { 111 | Description: "Mail nameserver entry", 112 | Type: schema.TypeString, 113 | Optional: true, 114 | ForceNew: false, 115 | }, 116 | "soa_mail": { 117 | Description: "Email address for SOA record", 118 | Type: schema.TypeString, 119 | Optional: true, 120 | ForceNew: true, 121 | }, 122 | "url_redirect_type": { 123 | Description: "Type of the url redirection. One of: " + strings.Join(validUrlRedirectTypes, ", "), 124 | Type: schema.TypeString, 125 | Optional: true, 126 | ValidateDiagFunc: func(i interface{}, path cty.Path) diag.Diagnostics { 127 | var diags diag.Diagnostics 128 | for _, validUrlRedirectType := range validUrlRedirectTypes { 129 | if validUrlRedirectType == i.(string) { 130 | return diags 131 | } 132 | } 133 | 134 | diags = append(diags, diag.Diagnostic{ 135 | Severity: diag.Error, 136 | Summary: "Invalid url_redirect_type", 137 | Detail: "Must be one of: " + strings.Join(validUrlRedirectTypes, ", "), 138 | AttributePath: path, 139 | }) 140 | return diags 141 | }, 142 | ForceNew: false, 143 | }, 144 | "url_redirect_title": { 145 | Description: "Title of the frame redirection", 146 | Type: schema.TypeString, 147 | Optional: true, 148 | ForceNew: false, 149 | }, 150 | "url_redirect_description": { 151 | Description: "Description of the frame redirection", 152 | Type: schema.TypeString, 153 | Optional: true, 154 | ForceNew: false, 155 | }, 156 | "url_redirect_fav_icon": { 157 | Description: "FavIcon of the frame redirection", 158 | Type: schema.TypeString, 159 | Optional: true, 160 | ForceNew: false, 161 | }, 162 | "url_redirect_keywords": { 163 | Description: "Keywords of the frame redirection", 164 | Type: schema.TypeString, 165 | Optional: true, 166 | ForceNew: false, 167 | }, 168 | "testing": { 169 | Description: "Execute command in testing mode", 170 | Type: schema.TypeBool, 171 | Required: false, 172 | Optional: true, 173 | ForceNew: false, 174 | }, 175 | "ignore_existing": { 176 | Description: "Ignore existing", 177 | Type: schema.TypeBool, 178 | Optional: true, 179 | ForceNew: true, 180 | }, 181 | }, 182 | } 183 | } 184 | 185 | // buildNameserverParameters builds the common parameter map used by both create and update operations 186 | func buildNameserverParameters(d *schema.ResourceData) map[string]interface{} { 187 | parameters := map[string]interface{}{ 188 | "domain": d.Get("domain").(string), 189 | "type": d.Get("type").(string), 190 | } 191 | 192 | // Add optional parameters if they exist 193 | if ns, ok := d.GetOk("nameservers"); ok { 194 | parameters["ns"] = ns 195 | } 196 | if masterIp, ok := d.GetOk("master_ip"); ok { 197 | parameters["masterIp"] = masterIp 198 | } 199 | if web, ok := d.GetOk("web"); ok { 200 | parameters["web"] = web 201 | } 202 | if mail, ok := d.GetOk("mail"); ok { 203 | parameters["mail"] = mail 204 | } 205 | if urlRedirectType, ok := d.GetOk("url_redirect_type"); ok { 206 | parameters["urlRedirectType"] = urlRedirectType 207 | } 208 | if urlRedirectTitle, ok := d.GetOk("url_redirect_title"); ok { 209 | parameters["urlRedirectTitle"] = urlRedirectTitle 210 | } 211 | if urlRedirectDescription, ok := d.GetOk("url_redirect_description"); ok { 212 | parameters["urlRedirectDescription"] = urlRedirectDescription 213 | } 214 | if urlRedirectFavIcon, ok := d.GetOk("url_redirect_fav_icon"); ok { 215 | parameters["urlRedirectFavIcon"] = urlRedirectFavIcon 216 | } 217 | if urlRedirectKeywords, ok := d.GetOk("url_redirect_keywords"); ok { 218 | parameters["urlRedirectKeywords"] = urlRedirectKeywords 219 | } 220 | if testing, ok := d.GetOk("testing"); ok { 221 | parameters["testing"] = testing 222 | } 223 | 224 | return parameters 225 | } 226 | 227 | // createOrUpdateNameserver handles both create and update operations 228 | func createOrUpdateNameserver(ctx context.Context, d *schema.ResourceData, m interface{}, isCreate bool) diag.Diagnostics { 229 | var diags diag.Diagnostics 230 | client := m.(*api.Client) 231 | 232 | parameters := buildNameserverParameters(d) 233 | 234 | // Add create-specific parameters 235 | if isCreate { 236 | if ignoreExisting, ok := d.GetOk("ignore_existing"); ok { 237 | parameters["ignoreExisting"] = ignoreExisting 238 | } 239 | } 240 | 241 | // Determine the API endpoint 242 | endpoint := "nameserver.update" 243 | if isCreate { 244 | endpoint = "nameserver.create" 245 | } 246 | 247 | call, err := client.Call(ctx, endpoint, parameters) 248 | if err != nil { 249 | diags = append(diags, diag.Diagnostic{ 250 | Severity: diag.Error, 251 | Summary: fmt.Sprintf("Could not %s nameserver record", map[bool]string{true: "add", false: "update"}[isCreate]), 252 | Detail: err.Error(), 253 | }) 254 | return diags 255 | } 256 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 257 | diags = append(diags, diag.Diagnostic{ 258 | Severity: diag.Error, 259 | Summary: fmt.Sprintf("Could not %s nameserver record", map[bool]string{true: "add", false: "update"}[isCreate]), 260 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 261 | }) 262 | return diags 263 | } 264 | 265 | // Set the ID for newly created resources 266 | if isCreate { 267 | resData := call["resData"].(map[string]any) 268 | d.SetId(d.Get("domain").(string) + ":" + strconv.Itoa(int(resData["roId"].(float64)))) 269 | } 270 | 271 | // Read the resource to ensure the Terraform state is up to date 272 | return resourceNameserverRead(ctx, d, m) 273 | } 274 | 275 | func resourceNameserverCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 276 | return createOrUpdateNameserver(ctx, d, m, true) 277 | } 278 | 279 | func resourceNameserverRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 280 | var diags diag.Diagnostics 281 | client := m.(*api.Client) 282 | 283 | parameters := map[string]interface{}{ 284 | "domain": d.Get("domain"), 285 | } 286 | 287 | call, err := client.Call(ctx, "nameserver.info", parameters) 288 | if err != nil { 289 | return diags 290 | } 291 | 292 | if resData, ok := call["resData"]; ok { 293 | resData := resData.(map[string]any) 294 | 295 | // Helper function to safely set values 296 | setValue := func(key string, field string) { 297 | if val, ok := resData[key]; ok { 298 | err := d.Set(field, val) 299 | if err != nil { 300 | diags = append(diags, diag.Diagnostic{ 301 | Severity: diag.Error, 302 | Summary: fmt.Sprintf("Could not set %s", field), 303 | Detail: fmt.Sprintf("Expected %s. %s", field, err.Error()), 304 | }) 305 | } 306 | } 307 | } 308 | 309 | var nsInterface []interface{} 310 | // Check if "record" key exists and is an array 311 | if records, ok := resData["record"].([]interface{}); ok { 312 | for _, item := range records { 313 | // Convert item to a map 314 | if recordMap, ok := item.(map[string]interface{}); ok { 315 | // Check if "type" is "NS" and get "content" 316 | if recordType, ok := recordMap["type"].(string); ok && recordType == "NS" { 317 | if content, ok := recordMap["content"].(string); ok { 318 | nsInterface = append(nsInterface, content) 319 | } 320 | } 321 | // Check if "type" is "SOA" and get "content" 322 | if recordType, ok := recordMap["type"].(string); ok && recordType == "SOA" { 323 | if content, ok := recordMap["content"].(string); ok { 324 | // soa-content split 325 | parts := strings.Fields(content) 326 | if len(parts) > 1 { 327 | // second part is rname 328 | rname := parts[1] 329 | 330 | soaMail := transformRname(rname) 331 | 332 | if err := d.Set("soa_mail", soaMail); err != nil { 333 | diags = append(diags, diag.Diagnostic{ 334 | Severity: diag.Error, 335 | Summary: fmt.Sprintf("Could not set %s", rname), 336 | Detail: fmt.Sprintf("Expected %s. %s", rname, err.Error()), 337 | }) 338 | } 339 | } 340 | } 341 | } 342 | } 343 | } 344 | } 345 | if err := d.Set("nameservers", nsInterface); err != nil { 346 | diags = append(diags, diag.Diagnostic{ 347 | Severity: diag.Error, 348 | Summary: fmt.Sprintf("Could not set nameservers %s", err.Error()), 349 | Detail: fmt.Sprintf("Expected %s. %s", nsInterface, err.Error()), 350 | }) 351 | } 352 | 353 | setValue("domain", "domain") 354 | setValue("type", "type") 355 | setValue("masterIp", "master_ip") 356 | } 357 | 358 | return diags 359 | } 360 | 361 | func resourceNameserverDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 362 | var diags diag.Diagnostics 363 | client := m.(*api.Client) 364 | 365 | parameters := map[string]interface{}{ 366 | "domain": d.Get("domain"), 367 | } 368 | 369 | if testing, ok := d.GetOk("testing"); ok { 370 | parameters["testing"] = testing 371 | } 372 | 373 | err := client.CallNoResponseBody(ctx, "nameserver.delete", parameters) 374 | if err != nil { 375 | diags = append(diags, diag.Diagnostic{ 376 | Severity: diag.Error, 377 | Summary: "Could not delete nameserver record", 378 | Detail: err.Error(), 379 | }) 380 | return diags 381 | } 382 | 383 | return diags 384 | } 385 | 386 | // convert soa rname to email 387 | func transformRname(rname string) string { 388 | // split rname into labels by . 389 | labels := strings.Split(rname, ".") 390 | 391 | if len(labels) < 2 { 392 | return rname 393 | } 394 | 395 | // first part is username the rest is the domain 396 | username := labels[0] 397 | domain := strings.Join(labels[1:], ".") 398 | 399 | // unescape "\." in username 400 | username = strings.ReplaceAll(username, `\.`, ".") 401 | 402 | return username + "@" + domain 403 | } 404 | 405 | func resourceNameserverUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 406 | return createOrUpdateNameserver(ctx, d, m, false) 407 | } 408 | -------------------------------------------------------------------------------- /inwx/internal/resource/resource_nameserver_record.go: -------------------------------------------------------------------------------- 1 | package resource 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "github.com/hashicorp/go-cty/cty" 7 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 8 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 9 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" 10 | "github.com/inwx/terraform-provider-inwx/inwx/internal/api" 11 | "strconv" 12 | "strings" 13 | ) 14 | 15 | func resourceNameserverRecordParseId(id string) (string, string, error) { 16 | parts := strings.Split(id, ":") 17 | 18 | if len(parts) != 2 || parts[0] == "" || parts[1] == "" { 19 | return "", "", fmt.Errorf("unexpected format of ID (%s), expected attribute1:attribute2", id) 20 | } 21 | 22 | return parts[0], parts[1], nil 23 | } 24 | 25 | func NameserverRecordResource() *schema.Resource { 26 | validRecordTypes := []string{ 27 | "A", "AAAA", "AFSDB", "ALIAS", "CAA", "CERT", "CNAME", "HINFO", "KEY", "LOC", "MX", "NAPTR", "NS", "OPENPGPKEY", 28 | "PTR", "RP", "SMIMEA", "SOA", "SRV", "SSHFP", "TLSA", "TXT", "URI", "URL", 29 | } 30 | 31 | validUrlRedirectTypes := []string{ 32 | "HEADER301", "HEADER302", "FRAME", 33 | } 34 | 35 | return &schema.Resource{ 36 | CreateContext: resourceNameserverRecordCreate, 37 | ReadContext: resourceNameserverRecordRead, 38 | UpdateContext: resourceNameserverRecordUpdate, 39 | DeleteContext: resourceNameserverRecordDelete, 40 | Importer: &schema.ResourceImporter{ 41 | StateContext: func(ctx context.Context, d *schema.ResourceData, i interface{}) ([]*schema.ResourceData, error) { 42 | domain, id, err := resourceNameserverRecordParseId(d.Id()) 43 | 44 | if err != nil { 45 | return nil, err 46 | } 47 | 48 | d.Set("domain", domain) 49 | d.SetId(fmt.Sprintf("%s:%s", domain, id)) 50 | 51 | return []*schema.ResourceData{d}, nil 52 | }, 53 | }, 54 | Schema: map[string]*schema.Schema{ 55 | "domain": { 56 | Description: "Domain name", 57 | Type: schema.TypeString, 58 | Required: true, 59 | }, 60 | "ro_id": { 61 | Description: "DNS domain id", 62 | Type: schema.TypeInt, 63 | Optional: true, 64 | }, 65 | "type": { 66 | Description: "Type of the nameserver record. One of: " + strings.Join(validRecordTypes, ", "), 67 | Type: schema.TypeString, 68 | Required: true, 69 | ValidateDiagFunc: func(i interface{}, path cty.Path) diag.Diagnostics { 70 | var diags diag.Diagnostics 71 | for _, validRecordType := range validRecordTypes { 72 | if validRecordType == i.(string) { 73 | return diags 74 | } 75 | } 76 | 77 | diags = append(diags, diag.Diagnostic{ 78 | Severity: diag.Error, 79 | Summary: "Invalid type type", 80 | Detail: "Must be one of: " + strings.Join(validRecordTypes, ", "), 81 | AttributePath: path, 82 | }) 83 | return diags 84 | }, 85 | }, 86 | "content": { 87 | Description: "Content of the nameserver record", 88 | Type: schema.TypeString, 89 | Required: true, 90 | }, 91 | "name": { 92 | Description: "Name of the nameserver record", 93 | Type: schema.TypeString, 94 | Optional: true, 95 | }, 96 | "ttl": { 97 | Description: "TTL (time to live) of the nameserver record", 98 | ValidateFunc: validation.IntAtLeast(300), 99 | Type: schema.TypeInt, 100 | Optional: true, 101 | Default: 3600, 102 | }, 103 | "prio": { 104 | Description: "Priority of the nameserver record", 105 | Type: schema.TypeInt, 106 | Optional: true, 107 | Default: 0, 108 | }, 109 | "url_redirect_type": { 110 | Description: "Type of the url redirection. One of: " + strings.Join(validUrlRedirectTypes, ", "), 111 | Type: schema.TypeString, 112 | Optional: true, 113 | ValidateDiagFunc: func(i interface{}, path cty.Path) diag.Diagnostics { 114 | var diags diag.Diagnostics 115 | for _, validUrlRedirectType := range validUrlRedirectTypes { 116 | if validUrlRedirectType == i.(string) { 117 | return diags 118 | } 119 | } 120 | 121 | diags = append(diags, diag.Diagnostic{ 122 | Severity: diag.Error, 123 | Summary: "Invalid url_redirect_type", 124 | Detail: "Must be one of: " + strings.Join(validUrlRedirectTypes, ", "), 125 | AttributePath: path, 126 | }) 127 | return diags 128 | }, 129 | }, 130 | "url_redirect_title": { 131 | Description: "Title of the frame redirection", 132 | Type: schema.TypeString, 133 | Optional: true, 134 | }, 135 | "url_redirect_description": { 136 | Description: "Description of the frame redirection", 137 | Type: schema.TypeString, 138 | Optional: true, 139 | }, 140 | "url_redirect_fav_icon": { 141 | Description: "FavIcon of the frame redirection", 142 | Type: schema.TypeString, 143 | Optional: true, 144 | }, 145 | "url_redirect_keywords": { 146 | Description: "Keywords of the frame redirection", 147 | Type: schema.TypeString, 148 | Optional: true, 149 | }, 150 | "url_append": { 151 | Description: "Append the path for redirection", 152 | Type: schema.TypeBool, 153 | Required: false, 154 | Optional: true, 155 | }, 156 | "testing": { 157 | Description: "Execute command in testing mode", 158 | Type: schema.TypeBool, 159 | Required: false, 160 | Optional: true, 161 | }, 162 | }, 163 | } 164 | } 165 | 166 | func resourceNameserverRecordCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 167 | var diags diag.Diagnostics 168 | client := m.(*api.Client) 169 | 170 | domain := d.Get("domain").(string) 171 | 172 | parameters := map[string]interface{}{ 173 | "domain": domain, 174 | "type": d.Get("type").(string), 175 | "content": d.Get("content").(string), 176 | } 177 | 178 | if roId, ok := d.GetOk("ro_id"); ok { 179 | parameters["roId"] = roId 180 | } 181 | if name, ok := d.GetOk("name"); ok { 182 | parameters["name"] = name 183 | } 184 | if ttl, ok := d.GetOk("ttl"); ok { 185 | parameters["ttl"] = ttl 186 | } 187 | if prio, ok := d.GetOk("prio"); ok { 188 | parameters["prio"] = prio 189 | } 190 | if urlRedirectType, ok := d.GetOk("url_redirect_type"); ok { 191 | parameters["urlRedirectType"] = urlRedirectType 192 | } 193 | if urlRedirectTitle, ok := d.GetOk("url_redirect_title"); ok { 194 | parameters["urlRedirectTitle"] = urlRedirectTitle 195 | } 196 | if urlRedirectDescription, ok := d.GetOk("url_redirect_description"); ok { 197 | parameters["urlRedirectDescription"] = urlRedirectDescription 198 | } 199 | if urlRedirectFavIcon, ok := d.GetOk("url_redirect_fav_icon"); ok { 200 | parameters["urlRedirectFavIcon"] = urlRedirectFavIcon 201 | } 202 | if urlRedirectKeywords, ok := d.GetOk("url_redirect_keywords"); ok { 203 | parameters["urlRedirectKeywords"] = urlRedirectKeywords 204 | } 205 | if urlAppend, ok := d.GetOk("url_append"); ok { 206 | parameters["urlAppend"] = urlAppend 207 | } 208 | if testing, ok := d.GetOk("testing"); ok { 209 | parameters["testing"] = testing 210 | } 211 | 212 | call, err := client.Call(ctx, "nameserver.createRecord", parameters) 213 | if err != nil { 214 | diags = append(diags, diag.Diagnostic{ 215 | Severity: diag.Error, 216 | Summary: "Could not add nameserver record", 217 | Detail: err.Error(), 218 | }) 219 | return diags 220 | } 221 | if call.Code() != api.COMMAND_SUCCESSFUL && call.Code() != api.COMMAND_SUCCESSFUL_PENDING { 222 | diags = append(diags, diag.Diagnostic{ 223 | Severity: diag.Error, 224 | Summary: "Could not add nameserver record", 225 | Detail: fmt.Sprintf("API response not status code 1000 or 1001. Got response: %s", call.ApiError()), 226 | }) 227 | return diags 228 | } 229 | 230 | resData := call["resData"].(map[string]any) 231 | 232 | d.SetId(domain + ":" + strconv.Itoa(int(resData["id"].(float64)))) 233 | 234 | resourceNameserverRecordRead(ctx, d, m) 235 | 236 | return diags 237 | } 238 | 239 | func resourceNameserverRecordRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 240 | var diags diag.Diagnostics 241 | client := m.(*api.Client) 242 | 243 | parameters := map[string]interface{}{ 244 | "domain": d.Get("domain"), 245 | } 246 | 247 | call, err := client.Call(ctx, "nameserver.info", parameters) 248 | if err != nil { 249 | diags = append(diags, diag.Diagnostic{ 250 | Severity: diag.Error, 251 | Summary: "Could not get nameserver info", 252 | Detail: err.Error(), 253 | }) 254 | return diags 255 | } 256 | if call.Code() != api.COMMAND_SUCCESSFUL { 257 | diags = append(diags, diag.Diagnostic{ 258 | Severity: diag.Error, 259 | Summary: "Could not get nameserver info", 260 | Detail: fmt.Sprintf("API response not status code 1000. Got response: %s", call.ApiError()), 261 | }) 262 | return diags 263 | } 264 | 265 | records := call["resData"].(map[string]any)["record"].([]any) 266 | 267 | for _, record := range records { 268 | recordt := record.(map[string]any) 269 | 270 | if d.Get("domain").(string)+":"+strconv.Itoa(int(recordt["id"].(float64))) == d.Id() { 271 | d.Set("domain", d.Get("domain").(string)) 272 | d.Set("type", recordt["type"].(string)) 273 | d.Set("content", recordt["content"].(string)) 274 | 275 | if val, ok := recordt["name"]; ok { 276 | d.Set("name", val.(string)) 277 | } 278 | if val, ok := recordt["urlRedirectType"]; ok { 279 | d.Set("url_redirect_type", val.(string)) 280 | } 281 | if val, ok := recordt["urlRedirectType"]; ok { 282 | d.Set("url_redirect_type", val.(string)) 283 | } 284 | if val, ok := recordt["urlRedirectTitle"]; ok { 285 | d.Set("url_redirect_title", val.(string)) 286 | } 287 | if val, ok := recordt["urlRedirectDescription"]; ok { 288 | d.Set("url_redirect_description", val.(string)) 289 | } 290 | if val, ok := recordt["urlRedirectKeywords"]; ok { 291 | d.Set("url_redirect_keywords", val.(string)) 292 | } 293 | if val, ok := recordt["urlRedirectFavIcon"]; ok { 294 | d.Set("url_redirect_fav_icon", val.(string)) 295 | } 296 | if val, ok := recordt["urlAppend"]; ok { 297 | d.Set("url_append", val.(bool)) 298 | } 299 | if val, ok := recordt["testing"]; ok { 300 | d.Set("testing", val.(bool)) 301 | } 302 | if val, ok := recordt["ttl"]; ok { 303 | d.Set("ttl", val.(float64)) 304 | } 305 | if val, ok := recordt["prio"]; ok { 306 | d.Set("prio", val.(float64)) 307 | } 308 | 309 | return diags 310 | } 311 | } 312 | 313 | // If the resource is not found, mark it as removed 314 | d.SetId("") 315 | return nil 316 | } 317 | 318 | func resourceNameserverRecordUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 319 | var diags diag.Diagnostics 320 | client := m.(*api.Client) 321 | 322 | _, id, err := resourceNameserverRecordParseId(d.Id()) 323 | if err != nil { 324 | diags = append(diags, diag.Diagnostic{ 325 | Severity: diag.Error, 326 | Summary: "Could not parse id", 327 | Detail: err.Error(), 328 | }) 329 | return diags 330 | } 331 | 332 | parameters := map[string]interface{}{ 333 | "id": id, 334 | } 335 | 336 | if d.HasChange("type") { 337 | parameters["type"] = d.Get("type").(string) 338 | } 339 | if d.HasChange("content") { 340 | parameters["content"] = d.Get("content").(string) 341 | } 342 | 343 | if name, ok := d.GetOk("name"); ok && d.HasChange("name") { 344 | parameters["name"] = name 345 | } 346 | if ttl, ok := d.GetOk("ttl"); ok && d.HasChange("ttl") { 347 | parameters["ttl"] = ttl 348 | } 349 | if prio, ok := d.GetOk("prio"); ok && d.HasChange("prio") { 350 | parameters["prio"] = prio 351 | } 352 | if urlRedirectType, ok := d.GetOk("url_redirect_type"); ok && d.HasChange("url_redirect_type") { 353 | parameters["urlRedirectType"] = urlRedirectType 354 | } 355 | if urlRedirectTitle, ok := d.GetOk("url_redirect_title"); ok && d.HasChange("url_redirect_title") { 356 | parameters["urlRedirectTitle"] = urlRedirectTitle 357 | } 358 | if urlRedirectDescription, ok := d.GetOk("url_redirect_description"); ok && d.HasChange("url_redirect_description") { 359 | parameters["urlRedirectDescription"] = urlRedirectDescription 360 | } 361 | if urlRedirectFavIcon, ok := d.GetOk("url_redirect_fav_icon"); ok && d.HasChange("url_redirect_fav_icon") { 362 | parameters["urlRedirectFavIcon"] = urlRedirectFavIcon 363 | } 364 | if urlRedirectKeywords, ok := d.GetOk("url_redirect_keywords"); ok && d.HasChange("url_redirect_keywords") { 365 | parameters["urlRedirectKeywords"] = urlRedirectKeywords 366 | } 367 | if urlAppend, ok := d.GetOk("url_append"); ok && d.HasChange("url_append") { 368 | parameters["urlAppend"] = urlAppend 369 | } 370 | if testing, ok := d.GetOk("testing"); ok && d.HasChange("testing") { 371 | parameters["testing"] = testing 372 | } 373 | 374 | err = client.CallNoResponseBody(ctx, "nameserver.updateRecord", parameters) 375 | if err != nil { 376 | diags = append(diags, diag.Diagnostic{ 377 | Severity: diag.Error, 378 | Summary: "Could not update nameserver record", 379 | Detail: err.Error(), 380 | }) 381 | return diags 382 | } 383 | 384 | return resourceNameserverRecordRead(ctx, d, m) 385 | } 386 | 387 | func resourceNameserverRecordDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 388 | var diags diag.Diagnostics 389 | client := m.(*api.Client) 390 | 391 | _, id, err := resourceNameserverRecordParseId(d.Id()) 392 | if err != nil { 393 | diags = append(diags, diag.Diagnostic{ 394 | Severity: diag.Error, 395 | Summary: "Could not parse id", 396 | Detail: err.Error(), 397 | }) 398 | return diags 399 | } 400 | 401 | parameters := map[string]interface{}{ 402 | "id": id, 403 | } 404 | 405 | if testing, ok := d.GetOk("testing"); ok { 406 | parameters["testing"] = testing 407 | } 408 | 409 | err = client.CallNoResponseBody(ctx, "nameserver.deleteRecord", parameters) 410 | if err != nil { 411 | diags = append(diags, diag.Diagnostic{ 412 | Severity: diag.Error, 413 | Summary: "Could not delete nameserver record", 414 | Detail: err.Error(), 415 | }) 416 | return diags 417 | } 418 | 419 | return diags 420 | } 421 | -------------------------------------------------------------------------------- /inwx/provider.go: -------------------------------------------------------------------------------- 1 | package inwx 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "github.com/inwx/terraform-provider-inwx/inwx/internal/data_source" 7 | "net/url" 8 | 9 | "github.com/go-logr/logr" 10 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 11 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 12 | "github.com/inwx/terraform-provider-inwx/inwx/internal/api" 13 | "github.com/inwx/terraform-provider-inwx/inwx/internal/resource" 14 | ) 15 | 16 | func Provider() *schema.Provider { 17 | return &schema.Provider{ 18 | Schema: map[string]*schema.Schema{ 19 | "api_url": { 20 | Type: schema.TypeString, 21 | Description: "URL of the RPC API endpoint. Use `https://api.domrobot.com/jsonrpc/` " + 22 | "for production and `https://api.ote.domrobot.com/jsonrpc/` for tests. " + 23 | "Can be passed as `INWX_API_URL` env var.", 24 | Optional: true, 25 | DefaultFunc: schema.EnvDefaultFunc("INWX_API_URL", "https://api.domrobot.com/jsonrpc/"), 26 | }, 27 | "username": { 28 | Type: schema.TypeString, 29 | Description: "Login username of the api. Can be passed as `INWX_USERNAME` env var.", 30 | Required: true, 31 | Sensitive: true, 32 | DefaultFunc: schema.EnvDefaultFunc("INWX_USERNAME", nil), 33 | }, 34 | "password": { 35 | Type: schema.TypeString, 36 | Description: "Login password of the api. Can be passed as `INWX_PASSWORD` env var.", 37 | Required: true, 38 | Sensitive: true, 39 | DefaultFunc: schema.EnvDefaultFunc("INWX_PASSWORD", nil), 40 | }, 41 | "tan": { 42 | Type: schema.TypeString, 43 | Description: "Mobile-TAN to unlock account. Can be passed as `INWX_TAN` env var.", 44 | Optional: true, 45 | Sensitive: true, 46 | DefaultFunc: schema.EnvDefaultFunc("INWX_TAN", nil), 47 | }, 48 | }, 49 | ResourcesMap: map[string]*schema.Resource{ 50 | "inwx_domain": resource.DomainResource(), 51 | "inwx_domain_contact": resource.DomainContactResource(), 52 | "inwx_dnssec_key": resource.DNSSECKeyResource(), 53 | "inwx_nameserver_record": resource.NameserverRecordResource(), 54 | "inwx_automated_dnssec": resource.AutomatedDNSSECResource(), 55 | "inwx_nameserver": resource.NameserverResource(), 56 | "inwx_glue_record": resource.GlueRecordResource(), 57 | }, 58 | DataSourcesMap: map[string]*schema.Resource{ 59 | "inwx_domain_contact": data_source.DomainContactDataSource(), 60 | }, 61 | ConfigureContextFunc: configureContext, 62 | } 63 | } 64 | 65 | func configureContext(ctx context.Context, data *schema.ResourceData) (interface{}, diag.Diagnostics) { 66 | var diags diag.Diagnostics 67 | 68 | username := data.Get("username").(string) 69 | password := data.Get("password").(string) 70 | apiUrl, err := url.Parse(data.Get("api_url").(string)) 71 | if err != nil { 72 | diags = append(diags, diag.Diagnostic{ 73 | Severity: diag.Error, 74 | Summary: "Could not configure context", 75 | Detail: fmt.Sprintf("Could not parse api_url: %w", err), 76 | }) 77 | return nil, diags 78 | } 79 | logger := logr.Discard() 80 | 81 | client, err := api.NewClient(username, password, apiUrl, &logger, false) 82 | if err != nil { 83 | diags = append(diags, diag.Diagnostic{ 84 | Severity: diag.Error, 85 | Summary: "Could not configure context", 86 | Detail: fmt.Sprintf("Could not create http client: %w", err), 87 | }) 88 | return nil, diags 89 | } 90 | 91 | loginParams := map[string]interface{}{ 92 | "user": username, 93 | "pass": password, 94 | } 95 | call, err := client.Call(ctx, "account.login", loginParams) 96 | if err != nil { 97 | diags = append(diags, diag.Diagnostic{ 98 | Severity: diag.Error, 99 | Summary: "Could not configure context", 100 | Detail: fmt.Sprintf("Could not authenticate at api via account.login: %w", err), 101 | }) 102 | return nil, diags 103 | } 104 | if call.Code() != api.COMMAND_SUCCESSFUL { 105 | diags = append(diags, diag.Diagnostic{ 106 | Severity: diag.Error, 107 | Summary: "Could not configure context", 108 | Detail: fmt.Sprintf("Could not authenticate at api via account.login. "+ 109 | "Got response: %s", call.ApiError()), 110 | }) 111 | return nil, diags 112 | } 113 | 114 | call, err = client.Call(ctx, "account.info", map[string]interface{}{}) 115 | 116 | if tan, ok := data.GetOk("tan"); ok && call.Code() == 2200 && tan != "" { 117 | call, err := client.Call(ctx, "account.unlock", map[string]interface{}{ 118 | "tan": tan, 119 | }) 120 | if err != nil { 121 | diags = append(diags, diag.Diagnostic{ 122 | Severity: diag.Error, 123 | Summary: "Could not unlock account", 124 | Detail: fmt.Sprintf("Could not authenticate at api via account.unlock: %w", err), 125 | }) 126 | return nil, diags 127 | } 128 | if call.Code() != api.COMMAND_SUCCESSFUL { 129 | diags = append(diags, diag.Diagnostic{ 130 | Severity: diag.Error, 131 | Summary: "Could not unlock account", 132 | Detail: fmt.Sprintf("Could not authenticate at api via account.unlock. "+ 133 | "Got response: %s", call.ApiError()), 134 | }) 135 | return nil, diags 136 | } 137 | } 138 | 139 | return client, diags 140 | } 141 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 6 | "github.com/hashicorp/terraform-plugin-sdk/v2/plugin" 7 | "github.com/inwx/terraform-provider-inwx/inwx" 8 | ) 9 | 10 | // Provider documentation generation. 11 | //go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-name inwx 12 | 13 | func main() { 14 | var debug bool 15 | 16 | flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve") 17 | flag.Parse() 18 | 19 | opts := &plugin.ServeOpts{ 20 | Debug: debug, 21 | ProviderFunc: func() *schema.Provider { 22 | return inwx.Provider() 23 | }, 24 | ProviderAddr: "inwx/inwx", 25 | } 26 | 27 | plugin.Serve(opts) 28 | } 29 | -------------------------------------------------------------------------------- /terraform-registry-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "metadata": { 4 | "protocol_versions": ["5.0"] 5 | } 6 | } --------------------------------------------------------------------------------