├── .github └── workflows │ ├── lint-test-build.yaml │ └── release.yaml ├── .gitignore ├── .goreleaser.yml ├── INSTALL.md ├── LICENSE ├── Makefile ├── README.md ├── RELEASING.md ├── docs ├── data-sources │ └── hetznerdns_zone.md ├── index.md └── resources │ ├── hetznerdns_record.md │ └── hetznerdns_zone.md ├── go.mod ├── go.sum ├── hetznerdns ├── api │ ├── client.go │ ├── client_test.go │ ├── primary_server.go │ ├── record.go │ ├── zone.go │ └── zone_test.go ├── data_source_zone.go ├── data_source_zone_test.go ├── primary_server.go ├── primary_server_test.go ├── provider.go ├── provider_test.go ├── resource_record.go ├── resource_record_test.go ├── resource_zone.go └── resource_zone_test.go ├── main.go └── scripts └── gofmtcheck.sh /.github/workflows/lint-test-build.yaml: -------------------------------------------------------------------------------- 1 | name: CI Build 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | 8 | jobs: 9 | build: 10 | name: Lint-Test-Build 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Set up Go 14 | uses: actions/setup-go@v5 15 | with: 16 | go-version: 1.17 17 | - name: Check out code 18 | uses: actions/checkout@v4 19 | - name: Run linter 20 | run: make lint 21 | - name: Run acceptance tests 22 | env: 23 | HETZNER_DNS_API_TOKEN: ${{ secrets.HETZNER_DNS_API_TOKEN }} 24 | run: make testacc 25 | - name: Build 26 | run: make build 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: Release 2 | on: 3 | push: 4 | tags: 5 | - v* 6 | 7 | jobs: 8 | release: 9 | name: Release on GitHub 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Check out code 13 | uses: actions/checkout@v4 14 | - name: Set up go 15 | uses: actions/setup-go@v5 16 | with: 17 | go-version: 1.17 18 | - name: Create release on GitHub 19 | uses: goreleaser/goreleaser-action@v2 20 | with: 21 | version: latest 22 | args: release --rm-dist 23 | env: 24 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | .vscode 3 | .idea -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | builds: 2 | - env: 3 | - CGO_ENABLED=0 4 | goos: 5 | - linux 6 | - darwin 7 | - windows 8 | - freebsd 9 | ignore: 10 | - goos: darwin 11 | goarch: 386 12 | binary: '{{ .ProjectName }}_v{{ .Version }}' 13 | archives: 14 | - format: zip 15 | name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' 16 | checksum: 17 | name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' 18 | algorithm: sha256 19 | snapshot: 20 | name_template: "{{ .Tag }}-PREVIEW" 21 | changelog: 22 | sort: asc 23 | filters: 24 | exclude: 25 | - '^docs:' 26 | - '^test:' 27 | release: 28 | draft: true 29 | -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | # Installing and Using this Plugin 2 | 3 | This is a third-party provier, which is not maintained by Hashicorp. You have 4 | to download and install it on your own. Pick the binary for the target operating 5 | system from the [releases list](https://github.com/timohirt/terraform-provider-hetznerdns/releases) 6 | and download the archive. 7 | 8 | ## Installing the Provider 9 | 10 | ### Terraform 0.13 11 | 12 | Terraform 0.13 changed the [location of custom providers](https://www.terraform.io/upgrade-guides/0-13.html#new-filesystem-layout-for-local-copies-of-providers), in order to work 13 | nicly with the Terraform Registry. This means that you have to create or migrate 14 | to a slighly different directory structure where you put the provide binaries. 15 | 16 | ```bash 17 | $ mkdir -p ~/.terraform.d/plugins/github.com/timohirt/hetznerdns/1.0.5/linux_amd64 18 | $ tar xzf terraform-provider-hetznerdns_1.0.5_linux_amd64.tar.gz 19 | $ mv ./terraform-provider-hetznerdns ~/.terraform.d/plugins/github.com/timohirt/hetznerdns/1.0.5/linux_amd64/terraform-provider-hetznerdns_v1.0.5 20 | ``` 21 | 22 | As you can see above, the version as well as the operating system is now included in 23 | the path and filename. Make sure you pick the right binaries for the os and use `darwin_amd64` 24 | or `win_amd64` instead of `linux_amd64` if necessary. 25 | 26 | ### Using the Provider on your Local Machine 27 | 28 | Add the following to your `terraform.tf`. 29 | 30 | ```terraform 31 | terraform { 32 | required_providers { 33 | hetznerdns = { 34 | source = "github.com/timohirt/hetznerdns" 35 | } 36 | } 37 | required_version = ">= 1.0" 38 | } 39 | ``` 40 | 41 | ## Testing 42 | 43 | Next add a hetznerdns resource or data source to your project and run 44 | terraform init. 45 | 46 | ```bash 47 | $ cat << EOF > main.tf 48 | resource "hetznerdns_zone" "z1" { 49 | name = "my.domain.tld" 50 | ttl = 60 51 | } 52 | EOF 53 | $ terraform init 54 | 55 | Initializing the backend... 56 | 57 | Initializing provider plugins... 58 | 59 | Terraform has been successfully initialized! 60 | 61 | You may now begin working with Terraform. Try running "terraform plan" to see 62 | any changes that are required for your infrastructure. All Terraform commands 63 | should now work. 64 | 65 | If you ever set or change modules or backend configuration for Terraform, 66 | rerun this command to reinitialize your working directory. If you forget, other 67 | commands will detect it and remind you to do so if necessary. 68 | 69 | $ terraform plan 70 | provider.hetznerdns.apitoken 71 | The API access token to authenticate at Hetzner DNS API. 72 | 73 | Enter a value: 74 | ``` 75 | 76 | Enter your Hetzer DNS API key and hit enter. 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TEST?=$$(go list ./...) 2 | GOFMT_FILES?=$$(find . -name '*.go') 3 | 4 | BINARY_DIR=bin 5 | BINARY_NAME=terraform-provider-hetznerdns 6 | 7 | .PHONY: build testacc test lint fmt 8 | 9 | build: 10 | mkdir -p $(BINARY_DIR) 11 | go build -o $(BINARY_DIR)/$(BINARY_NAME) 12 | 13 | testacc: 14 | TF_LOG_PROVIDER=DEBUG TF_LOG=DEBUG TF_ACC=1 go test $(TEST) -v -timeout 180s 15 | 16 | test: 17 | go test $(TEST) || exit 1 18 | 19 | lint: 20 | @sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" 21 | 22 | fmt: 23 | gofmt -w $(GOFMT_FILES) 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This project is not maintained anymore 2 | 3 | Answerings and solving issues, reviewing and merging PRs, keeping dependencies up to date is a lot of work. As I don't need Hetzner DNS anymore, I decided to not work on this project anymore and dedicate my free time to other fun activities. 4 | 5 | Feel free to create pull requests and contribute to this project. I'll be merging them and publiching new releases. 6 | 7 | Another option is this fork: [germanbrew/terraform-provider-hetznerdns](https://github.com/germanbrew/terraform-provider-hetznerdns) 8 | 9 | ## Terraform Provider for Hetzner DNS 10 | 11 | ![CI Build](https://github.com/timohirt/terraform-provider-hetznerdns/workflows/CI%20Build/badge.svg?branch=master) 12 | ![GitHub release (latest by date)](https://img.shields.io/github/v/release/timohirt/terraform-provider-hetznerdns) 13 | ![GitHub](https://img.shields.io/github/license/timohirt/terraform-provider-hetznerdns) 14 | 15 | Read about what I learnt while [implementing this Terraform Provider](http://www.timohirt.de/blog/implementing-a-terraform-provider/). 16 | 17 | You can find resources and data sources 18 | [documentation](https://registry.terraform.io/providers/timohirt/hetznerdns/latest/docs) 19 | there or [here](docs). 20 | 21 | ## Requirements 22 | 23 | - [Terraform](https://www.terraform.io/downloads.html) > v1.0 24 | - [Go](https://golang.org/) 1.16 (to build the provider plugin) 25 | 26 | ## Installing and Using this Plugin 27 | 28 | You most likely want to download the provider from [Terraform 29 | Registry](https://registry.terraform.io/providers/timohirt/hetznerdns/latest/docs). 30 | If you want or need to install the provider locally, take a look at 31 | [INSTALL](./INSTALL.md). 32 | 33 | ### Using Provider from Terraform Registry (TF >= 1.0) 34 | 35 | This provider is published and available there. If you want to use it, just 36 | add the following to your `terraform.tf`: 37 | 38 | ```terraform 39 | terraform { 40 | required_providers { 41 | hetznerdns = { 42 | source = "timohirt/hetznerdns" 43 | version = "2.1.0" 44 | } 45 | } 46 | required_version = ">= 1.0" 47 | } 48 | ``` 49 | 50 | Then run `terraform init` to download the provider. 51 | 52 | ## Authentication 53 | 54 | Once installed you have three options to provide the required API token that 55 | is used to authenticate at the Hetzner DNS API. 56 | 57 | ### Enter API Token when needed 58 | 59 | You can enter it every time you run `terraform`. 60 | 61 | ### Configure the Provider to take the API Token from a Variable 62 | 63 | Add the following to your `terraform.tf`: 64 | 65 | ```terraform 66 | variable "hetznerdns_token" {} 67 | 68 | provider "hetznerdns" { 69 | apitoken = var.hetznerdns_token 70 | } 71 | ``` 72 | 73 | Now, assign your API token to `hetznerdns_token` in `terraform.tfvars`: 74 | 75 | ```terraform 76 | hetznerdns_token = "kkd993i3kkmm4m4m4" 77 | ``` 78 | 79 | You don't have to enter the API token anymore. 80 | 81 | ### Inject the API Token via the Environment 82 | 83 | Assign the API token to `HETZNER_DNS_API_TOKEN` env variable. 84 | 85 | ``` 86 | export HETZNER_DNS_API_TOKEN= 87 | ``` 88 | 89 | The provider uses this token and you don't have to enter it 90 | anymore. 91 | 92 | ### Example Usage 93 | 94 | ```terraform 95 | # Specify a zone for a domain (example.com) 96 | resource "hetznerdns_zone" "example_com" { 97 | name = "example.com" 98 | ttl = 60 99 | } 100 | 101 | # Handle root (example.com) 102 | resource "hetznerdns_record" "example_com_root" { 103 | zone_id = hetznerdns_zone.example_com.id 104 | name = "@" 105 | value = hcloud_server.server_name.ipv4_address 106 | type = "A" 107 | # You only need to set a TTL if it's different from the zone's TTL above 108 | ttl = 300 109 | } 110 | 111 | # Handle wildcard subdomain (*.example.com) 112 | resource "hetznerdns_record" "all_example_com" { 113 | zone_id = hetznerdns_zone.example_com.id 114 | name = "*" 115 | value = hcloud_server.server_name.ipv4_address 116 | type = "A" 117 | } 118 | 119 | # Handle specific subdomain (books.example.com) 120 | resource "hetznerdns_record" "books_example_com" { 121 | zone_id = hetznerdns_zone.example_com.id 122 | name = "books" 123 | value = hcloud_server.server_name.ipv4_address 124 | type = "A" 125 | } 126 | 127 | # Handle email (MX record with priority 10) 128 | resource "hetznerdns_record" "example_com_email" { 129 | zone_id = hetznerdns_zone.example_com.id 130 | name = "@" 131 | value = "10 mail.example.com" 132 | type = "MX" 133 | } 134 | 135 | # SPF record 136 | resource "hetznerdns_record" "example_com_spf" { 137 | zone_id = hetznerdns_zone.example_com.id 138 | name = "@" 139 | # The entire value needs to be enclosed in quotes in the zone file, if it contains a space or a quote. For Terraform, you need to escape these "inner" quotes: 140 | value = "\"v=spf1 ip4:1.2.3.4 -all\"" 141 | # Or let `jsonencode()` take care of the escaping: 142 | value = jsonencode("v=spf1 ip4:1.2.3.4 -all") 143 | type = "TXT" 144 | } 145 | 146 | # DKIM record 147 | locals { 148 | dkim = "v=DKIM1;h=sha256;k=rsa;s=email;p=abc..."} 149 | } 150 | resource "hetznerdns_record" "example_com_dkim" { 151 | zone_id = hetznerdns_zone.example_com.id 152 | name = "default._domainkey" 153 | type = "TXT" 154 | # Since the maximum length of a DNS record is 255, it needs to be split in 2 parts: 155 | value = join(" ", [ 156 | jsonencode(substr(local.dkim, 0, 255)), 157 | jsonencode(substr(local.dkim, 255, 255)), 158 | "" 159 | ]) 160 | # Alternative (works even if the string is longer than 510): 161 | value = join("\"", [ 162 | "", 163 | replace(local.dkim, "/(.{255})/", "$1\" \""), 164 | " " 165 | ]) 166 | } 167 | ``` 168 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | # Releasing and Publishing Provider 2 | 3 | A release of this provider includes publishing the new version 4 | at the Terraform registry. Therefore, a file containing hashes 5 | of the binaries must be singed with my private GPG key. 6 | 7 | First create a new tag and push it to GitHub. This starts a 8 | workflow which drafts a release. 9 | 10 | ```bash 11 | $ git tag v1.0.17 12 | $ git push --tags 13 | ``` 14 | 15 | Then navigate your browser to the GitHub [releases page of this repository](https://github.com/timohirt/terraform-provider-hetznerdns/releases). 16 | 17 | Download `terraform-provider-hetznerdns_1.0.17_SHA256SUMS` from the 18 | list of assets associated with this release. The version might by 19 | different. 20 | 21 | Now create a signature file using gpg. 22 | 23 | ```bash 24 | $ gpg --detach-sign ./terraform-provider-hetznerdns_1.0.17_SHA256SUMS 25 | ``` 26 | 27 | This create another file `terraform-provider-hetznerdns_1.0.17_SHA256SUMS.sig`. 28 | Add it to the assets of the current draft release. 29 | 30 | Then publish the release. Terraform registry adds the new release automatically. 31 | 32 | -------------------------------------------------------------------------------- /docs/data-sources/hetznerdns_zone.md: -------------------------------------------------------------------------------- 1 | # hetznerdns_zone Data Source 2 | 3 | Provides details about a Hetzner DNS Zone. 4 | 5 | ## Example Usage 6 | 7 | ```hcl 8 | data "hetznerdns_zone" "zone1" { 9 | name = "zone1.online" 10 | } 11 | ``` 12 | 13 | ## Argument Reference 14 | 15 | - `id` - (Required, string) The ID of the DNS zone. 16 | 17 | - `name` - (Required, string) Name of the DNS zone to get data from. 18 | 19 | - `ttl` - (Required, int) Time to live of this zone. -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # hetznerdns Provider 2 | 3 | This providers helps you automate management of DNS zones 4 | and records at Hetzner DNS. 5 | 6 | ## Example Usage 7 | 8 | ```hcl 9 | data "hetznerdns_zone" "dns_zone" { 10 | name = "example.com" 11 | } 12 | 13 | data "hcloud_server" "web" { 14 | name = "web1" 15 | } 16 | 17 | resource "hetznerdns_record" "web" { 18 | zone_id = data.hetznerdns_zone.dns_zone.id 19 | name = "www" 20 | value = hcloud_server.web.ipv4_address 21 | type = "A" 22 | ttl= 60 23 | } 24 | ``` 25 | 26 | ## Argument Reference 27 | 28 | The following arguments are supported: 29 | 30 | - `apitoken` - (Required, string) The Hetzner DNS API token. You can 31 | pass it using the env variable `HETZNER_DNS_API_TOKEN`as well. -------------------------------------------------------------------------------- /docs/resources/hetznerdns_record.md: -------------------------------------------------------------------------------- 1 | # hetznerdns_record Resource 2 | 3 | Provides a Hetzner DNS Records resource to create, update and delete DNS Records. 4 | 5 | ## Example Usage 6 | 7 | ```hcl 8 | data "hetznerdns_zone" "zone1" { 9 | name = "zone1.online" 10 | } 11 | 12 | resource "hetznerdns_record" "www" { 13 | zone_id = data.hetznerdns_zone.zone1.id 14 | name = "www" 15 | value = "192.168.1.1" 16 | type = "A" 17 | ttl= 60 18 | } 19 | ``` 20 | 21 | ## Argument Reference 22 | 23 | The following arguments are supported: 24 | 25 | - `zone_id` - (Required, string) Id of the DNS zone to create 26 | the record in. 27 | 28 | - `name` - (Required, string) Name of the DNS record to create. 29 | 30 | - `value` - (Required, string) The value of the record (eg. 192.168.1.1). 31 | For TXT records with quoted values, the quotes have to be escaped in Terraform 32 | (eg. `"v=spf1 include:_spf.google.com ~all"` is represented by 33 | `"\\"v=spf1 include:_spf.google.com ~all\\""` in Terraform). 34 | 35 | - `type` - (Required, string) The type of the record. 36 | 37 | - `ttl` - (Optional, int) Time to live of this record. 38 | 39 | ## Import 40 | 41 | A Record can be imported using its `id`. Use the API to get all records of 42 | a zone and then copy the id. 43 | 44 | ``` 45 | curl "https://dns.hetzner.com/api/v1/records" \ 46 | -H "Auth-API-Token: $HETZNER_DNS_API_TOKEN" | jq . 47 | 48 | { 49 | "records": [ 50 | { 51 | "id": "3d60921a49eb384b6335766a", 52 | "type": "TXT", 53 | "name": "google._domainkey", 54 | "value": "\"anything:with:param\"", 55 | "zone_id": "rMu2waTJPbHr4", 56 | "created": "2020-08-18 19:11:02.237 +0000 UTC", 57 | "modified": "2020-08-28 19:51:41.275 +0000 UTC" 58 | }, 59 | { 60 | "id": "ed2416cb6bc8a8055b22222", 61 | "type": "A", 62 | "name": "www", 63 | "value": "1.1.1.1", 64 | "zone_id": "rMu2waTJPbHr4", 65 | "created": "2020-08-27 20:55:38.745 +0000 UTC", 66 | "modified": "2020-08-27 20:55:38.745 +0000 UTC" 67 | } 68 | ] 69 | } 70 | ``` 71 | 72 | The command used above was copied from Hetzer DNS API docs. `jq` is 73 | used for formatting and is not required. Use the `id` to import a 74 | record. 75 | 76 | ``` 77 | terraform import hetznerdns_record.dkim_1 ed2416cb6bc8a8055b22222 78 | ``` 79 | -------------------------------------------------------------------------------- /docs/resources/hetznerdns_zone.md: -------------------------------------------------------------------------------- 1 | # hetznerdns_zone Resource 2 | 3 | Provides a Hetzner DNS Zone resource to create, update and delete DNS Zones. 4 | 5 | ## Example Usage 6 | 7 | ```hcl 8 | resource "hetznerdns_zone" "zone1" { 9 | name = "zone1.online" 10 | ttl = 3600 11 | } 12 | ``` 13 | 14 | ## Argument Reference 15 | 16 | The following arguments are supported: 17 | 18 | - `name` - (Required, string) Name of the DNS zone to create. Must be a valid 19 | domain with top level domain. Meaning `.de` or `.io`. Don't 20 | include sub domains on this level. So, no `sub..io`. The Hetzner API 21 | rejects attempts to create a zone with a sub domain name. Use a record to 22 | create the sub domain. 23 | 24 | - `ttl` - (Required, int) Time to live of this zone. 25 | 26 | ## Import 27 | 28 | A Zone can be imported using its `id`. Log in to the Hetzner DNS web frontend, 29 | navigate to the zone you want to import, and copy the id from the URL in your 30 | browser. 31 | 32 | ``` 33 | terraform import hetznerdns_zone.zone1 rMu2waTJPbHr4 34 | ``` 35 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/timohirt/terraform-provider-hetznerdns 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/hashicorp/go-retryablehttp v0.7.7 7 | github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1 8 | github.com/stretchr/testify v1.7.2 9 | ) 10 | -------------------------------------------------------------------------------- /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 | cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= 4 | cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= 5 | cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= 6 | cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= 7 | cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= 8 | cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= 9 | cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= 10 | cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= 11 | cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= 12 | cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= 13 | cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= 14 | cloud.google.com/go v0.61.0 h1:NLQf5e1OMspfNT1RAHOB3ublr1TW3YTXO8OiWwVjK2U= 15 | cloud.google.com/go v0.61.0/go.mod h1:XukKJg4Y7QsUu0Hxg3qQKUWR4VuWivmyMK2+rUyxAqw= 16 | cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= 17 | cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= 18 | cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= 19 | cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= 20 | cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= 21 | cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= 22 | cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= 23 | cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= 24 | cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= 25 | cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= 26 | cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= 27 | cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= 28 | cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= 29 | cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= 30 | cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= 31 | cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= 32 | cloud.google.com/go/storage v1.10.0 h1:STgFzyU5/8miMl0//zKh2aQeTyeaUH3WN9bSUiJ09bA= 33 | cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= 34 | dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= 35 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 36 | github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= 37 | github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= 38 | github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= 39 | github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= 40 | github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= 41 | github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= 42 | github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= 43 | github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= 44 | github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= 45 | github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= 46 | github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= 47 | github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= 48 | github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= 49 | github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= 50 | github.com/andybalholm/crlf v0.0.0-20171020200849-670099aa064f/go.mod h1:k8feO4+kXDxro6ErPXBRTJ/ro2mf0SsFG8s7doP9kJE= 51 | github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= 52 | github.com/apparentlymart/go-cidr v1.0.1 h1:NmIwLZ/KdsjIUlhf+/Np40atNXm/+lZ5txfTJ/SpF+U= 53 | github.com/apparentlymart/go-cidr v1.0.1/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= 54 | github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= 55 | github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I= 56 | github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= 57 | github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= 58 | github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= 59 | github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= 60 | github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= 61 | github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= 62 | github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= 63 | github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= 64 | github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= 65 | github.com/aws/aws-sdk-go v1.25.3 h1:uM16hIw9BotjZKMZlX05SN2EFtaWfi/NonPKIARiBLQ= 66 | github.com/aws/aws-sdk-go v1.25.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= 67 | github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= 68 | github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= 69 | github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= 70 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 71 | github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= 72 | github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= 73 | github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= 74 | github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= 75 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 76 | github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= 77 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 78 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 79 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 80 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 81 | github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= 82 | github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= 83 | github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 84 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 85 | github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= 86 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 87 | github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= 88 | github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= 89 | github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= 90 | github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= 91 | github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= 92 | github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= 93 | github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= 94 | github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= 95 | github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= 96 | github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34= 97 | github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= 98 | github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= 99 | github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4= 100 | github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= 101 | github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= 102 | github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= 103 | github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= 104 | github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= 105 | github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= 106 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 107 | github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 108 | github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 109 | github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= 110 | github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 111 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 112 | github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 113 | github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= 114 | github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= 115 | github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= 116 | github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= 117 | github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 118 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 119 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 120 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 121 | github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= 122 | github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= 123 | github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= 124 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 125 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 126 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 127 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 128 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 129 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 130 | github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= 131 | github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 132 | github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 133 | github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= 134 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 135 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 136 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 137 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 138 | github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 139 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 140 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 141 | github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= 142 | github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 143 | github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= 144 | github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= 145 | github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= 146 | github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= 147 | github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= 148 | github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= 149 | github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= 150 | github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= 151 | github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= 152 | github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= 153 | github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 154 | github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= 155 | github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= 156 | github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= 157 | github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= 158 | github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= 159 | github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= 160 | github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= 161 | github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= 162 | github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= 163 | github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= 164 | github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= 165 | github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= 166 | github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= 167 | github.com/hashicorp/go-getter v1.5.3 h1:NF5+zOlQegim+w/EUhSLh6QhXHmZMEeHLQzllkQ3ROU= 168 | github.com/hashicorp/go-getter v1.5.3/go.mod h1:BrrV/1clo8cCYu6mxvboYg+KutTiFnXjMEgDD8+i7ZI= 169 | github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= 170 | github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= 171 | github.com/hashicorp/go-hclog v0.16.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= 172 | github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= 173 | github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= 174 | github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= 175 | github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= 176 | github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= 177 | github.com/hashicorp/go-plugin v1.3.0/go.mod h1:F9eH4LrE/ZsRdbwhfjs9k9HoDUwAHnYtXdgmf1AVNs0= 178 | github.com/hashicorp/go-plugin v1.4.1 h1:6UltRQlLN9iZO513VveELp5xyaFxVD2+1OVylE+2E+w= 179 | github.com/hashicorp/go-plugin v1.4.1/go.mod h1:5fGEH17QVwTTcR0zV7yhDPLLmFX9YSZ38b18Udy6vYQ= 180 | github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU= 181 | github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk= 182 | github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= 183 | github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= 184 | github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 185 | github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= 186 | github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 187 | github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= 188 | github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= 189 | github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw= 190 | github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= 191 | github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 192 | github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 193 | github.com/hashicorp/hc-install v0.3.1 h1:VIjllE6KyAI1A244G8kTaHXy+TL5/XYzvrtFi8po/Yk= 194 | github.com/hashicorp/hc-install v0.3.1/go.mod h1:3LCdWcCDS1gaHC9mhHCGbkYfoY6vdsKohGjugbZdZak= 195 | github.com/hashicorp/hcl/v2 v2.3.0 h1:iRly8YaMwTBAKhn1Ybk7VSdzbnopghktCD031P8ggUE= 196 | github.com/hashicorp/hcl/v2 v2.3.0/go.mod h1:d+FwDBbOLvpAM3Z6J7gPj/VoAGkNe/gm352ZhjJ/Zv8= 197 | github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= 198 | github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= 199 | github.com/hashicorp/terraform-exec v0.15.0 h1:cqjh4d8HYNQrDoEmlSGelHmg2DYDh5yayckvJ5bV18E= 200 | github.com/hashicorp/terraform-exec v0.15.0/go.mod h1:H4IG8ZxanU+NW0ZpDRNsvh9f0ul7C0nHP+rUR/CHs7I= 201 | github.com/hashicorp/terraform-json v0.13.0 h1:Li9L+lKD1FO5RVFRM1mMMIBDoUHslOniyEi5CM+FWGY= 202 | github.com/hashicorp/terraform-json v0.13.0/go.mod h1:y5OdLBCT+rxbwnpxZs9kGL7R9ExU76+cpdY8zHwoazk= 203 | github.com/hashicorp/terraform-plugin-go v0.5.0 h1:+gCDdF0hcYCm0YBTxrP4+K1NGIS5ZKZBKDORBewLJmg= 204 | github.com/hashicorp/terraform-plugin-go v0.5.0/go.mod h1:PAVN26PNGpkkmsvva1qfriae5Arky3xl3NfzKa8XFVM= 205 | github.com/hashicorp/terraform-plugin-log v0.2.0 h1:rjflRuBqCnSk3UHOR25MP1G5BDLKktTA6lNjjcAnBfI= 206 | github.com/hashicorp/terraform-plugin-log v0.2.0/go.mod h1:E1kJmapEHzqu1x6M++gjvhzM2yMQNXPVWZRCB8sgYjg= 207 | github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1 h1:B9AocC+dxrCqcf4vVhztIkSkt3gpRjUkEka8AmZWGlQ= 208 | github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1/go.mod h1:FjM9DXWfP0w/AeOtJoSKHBZ01LqmaO6uP4bXhv3fekw= 209 | github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 h1:1FGtlkJw87UsTMg5s8jrekrHmUPUJaMcu6ELiVhQrNw= 210 | github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896/go.mod h1:bzBPnUIkI0RxauU8Dqo+2KrZZ28Cf48s8V6IHt3p4co= 211 | github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= 212 | github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= 213 | github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= 214 | github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= 215 | github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= 216 | github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= 217 | github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= 218 | github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= 219 | github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= 220 | github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= 221 | github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= 222 | github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= 223 | github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= 224 | github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= 225 | github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74= 226 | github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= 227 | github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= 228 | github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= 229 | github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= 230 | github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= 231 | github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= 232 | github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= 233 | github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= 234 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 235 | github.com/klauspost/compress v1.11.2 h1:MiK62aErc3gIiVEtyzKfeOHgW7atJb5g/KNX5m3c2nQ= 236 | github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= 237 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 238 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 239 | github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= 240 | github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= 241 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 242 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 243 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 244 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 245 | github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= 246 | github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= 247 | github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= 248 | github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA= 249 | github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= 250 | github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= 251 | github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= 252 | github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= 253 | github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= 254 | github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= 255 | github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= 256 | github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= 257 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 258 | github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= 259 | github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= 260 | github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= 261 | github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 262 | github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 263 | github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 264 | github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= 265 | github.com/mitchellh/cli v1.1.2/go.mod h1:6iaV0fGdElS6dPBx0EApTxHrcWvmJphyh2n8YBLPPZ4= 266 | github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= 267 | github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= 268 | github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= 269 | github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= 270 | github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= 271 | github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= 272 | github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= 273 | github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= 274 | github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= 275 | github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= 276 | github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= 277 | github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= 278 | github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= 279 | github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= 280 | github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 281 | github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= 282 | github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= 283 | github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= 284 | github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= 285 | github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758= 286 | github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce/go.mod h1:uFMI8w+ref4v2r9jz+c9i1IfIttS/OkmLfrk1jne5hs= 287 | github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= 288 | github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= 289 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 290 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 291 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 292 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 293 | github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= 294 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 295 | github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= 296 | github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= 297 | github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= 298 | github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= 299 | github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= 300 | github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= 301 | github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= 302 | github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= 303 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 304 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 305 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 306 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 307 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= 308 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 309 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 310 | github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= 311 | github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= 312 | github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ= 313 | github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= 314 | github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= 315 | github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= 316 | github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= 317 | github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= 318 | github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= 319 | github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= 320 | github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= 321 | github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 322 | github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 323 | github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 324 | github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= 325 | github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= 326 | github.com/zclconf/go-cty v1.9.1 h1:viqrgQwFl5UpSxc046qblj78wZXVDFnSOufaOTER+cc= 327 | github.com/zclconf/go-cty v1.9.1/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= 328 | github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= 329 | go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= 330 | go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= 331 | go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 332 | go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 333 | go.opencensus.io v0.22.4 h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto= 334 | go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 335 | golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= 336 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 337 | golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 338 | golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 339 | golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 340 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 341 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 342 | golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 343 | golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= 344 | golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= 345 | golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e h1:gsTQYXdTw2Gq7RBsWvlQ91b+aEQ6bXFUngBGuR8sPpI= 346 | golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 347 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 348 | golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 349 | golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= 350 | golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= 351 | golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= 352 | golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= 353 | golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= 354 | golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= 355 | golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= 356 | golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= 357 | golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= 358 | golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= 359 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 360 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 361 | golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 362 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 363 | golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 364 | golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 365 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 366 | golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= 367 | golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= 368 | golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= 369 | golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= 370 | golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= 371 | golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= 372 | golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= 373 | golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= 374 | golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= 375 | golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= 376 | golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 377 | golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= 378 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 379 | golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 380 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 381 | golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 382 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 383 | golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 384 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 385 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 386 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 387 | golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 388 | golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 389 | golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= 390 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 391 | golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 392 | golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 393 | golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 394 | golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 395 | golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 396 | golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 397 | golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 398 | golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 399 | golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 400 | golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= 401 | golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= 402 | golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= 403 | golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= 404 | golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= 405 | golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 406 | golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= 407 | golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 408 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 409 | golang.org/x/net v0.0.0-20210326060303-6b1517762897 h1:KrsHThm5nFk34YtATK1LsThyGhGbGe1olrte/HInHvs= 410 | golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k= 411 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 412 | golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 413 | golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 414 | golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 415 | golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw= 416 | golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= 417 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 418 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 419 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 420 | golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 421 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 422 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 423 | golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 424 | golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 425 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 426 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 427 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 428 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 429 | golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 430 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 431 | golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 432 | golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 433 | golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 434 | golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 435 | golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 436 | golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 437 | golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 438 | golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 439 | golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 440 | golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 441 | golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 442 | golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 443 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 444 | golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 445 | golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 446 | golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 447 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 448 | golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 449 | golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 450 | golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 451 | golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 452 | golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 453 | golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 454 | golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 455 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 456 | golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 457 | golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 458 | golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 459 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 460 | golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 461 | golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 462 | golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 463 | golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 464 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 465 | golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 466 | golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= 467 | golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 468 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= 469 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 470 | golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 471 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 472 | golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 473 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 474 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 475 | golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= 476 | golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 477 | golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 478 | golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 479 | golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 480 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 481 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 482 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 483 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 484 | golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 485 | golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 486 | golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 487 | golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 488 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 489 | golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 490 | golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 491 | golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= 492 | golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 493 | golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 494 | golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 495 | golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 496 | golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 497 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 498 | golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 499 | golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 500 | golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 501 | golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 502 | golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 503 | golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 504 | golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 505 | golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 506 | golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 507 | golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 508 | golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 509 | golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= 510 | golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= 511 | golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= 512 | golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= 513 | golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 514 | golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 515 | golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 516 | golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= 517 | golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed h1:+qzWo37K31KxduIYaBeMqJ8MUOyTayOQKpH9aDPLMSY= 518 | golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= 519 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 520 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 521 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 522 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 523 | google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= 524 | google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= 525 | google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= 526 | google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= 527 | google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= 528 | google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= 529 | google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= 530 | google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= 531 | google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= 532 | google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= 533 | google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= 534 | google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= 535 | google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= 536 | google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= 537 | google.golang.org/api v0.29.0 h1:BaiDisFir8O4IJxvAabCGGkQ6yCJegNQqSVoYUNAnbk= 538 | google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= 539 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 540 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 541 | google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 542 | google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= 543 | google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 544 | google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= 545 | google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= 546 | google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 547 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 548 | google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 549 | google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 550 | google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 551 | google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= 552 | google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 553 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 554 | google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= 555 | google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 556 | google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 557 | google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 558 | google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 559 | google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 560 | google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= 561 | google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= 562 | google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 563 | google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 564 | google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 565 | google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 566 | google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 567 | google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 568 | google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 569 | google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= 570 | google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= 571 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 572 | google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= 573 | google.golang.org/genproto v0.0.0-20200711021454-869866162049 h1:YFTFpQhgvrLrmxtiIncJxFXeCyq84ixuKWVCaCAi9Oc= 574 | google.golang.org/genproto v0.0.0-20200711021454-869866162049/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= 575 | google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= 576 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 577 | google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= 578 | google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= 579 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 580 | google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= 581 | google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 582 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 583 | google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 584 | google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= 585 | google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= 586 | google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= 587 | google.golang.org/grpc v1.32.0 h1:zWTV+LMdc3kaiJMSTOFz2UgSBgx8RNQoTGiZu3fR9S0= 588 | google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= 589 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 590 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 591 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 592 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 593 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 594 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 595 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 596 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 597 | google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= 598 | google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= 599 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 600 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 601 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 602 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 603 | gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 604 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 605 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 606 | gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= 607 | gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 608 | gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= 609 | gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= 610 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 611 | gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 612 | gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 613 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 614 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 615 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 616 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 617 | honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 618 | honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 619 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 620 | honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= 621 | honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= 622 | honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= 623 | rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= 624 | rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= 625 | rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= 626 | -------------------------------------------------------------------------------- /hetznerdns/api/client.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "bytes" 5 | "context" 6 | "encoding/json" 7 | "fmt" 8 | "io" 9 | "io/ioutil" 10 | "log" 11 | "net/http" 12 | "strings" 13 | "sync" 14 | 15 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 16 | 17 | "github.com/hashicorp/go-retryablehttp" 18 | ) 19 | 20 | // UnauthorizedError represents the message of a HTTP 401 response 21 | type UnauthorizedError ErrorMessage 22 | 23 | // UnprocessableEntityError represents the generic structure of a error response 24 | type UnprocessableEntityError struct { 25 | Error ErrorMessage `json:"error"` 26 | } 27 | 28 | // ErrorMessage is the message of an error response 29 | type ErrorMessage struct { 30 | Message string `json:"message"` 31 | } 32 | 33 | type createHTTPClient func() *http.Client 34 | 35 | func defaultCreateHTTPClient() *http.Client { 36 | retryableClient := retryablehttp.NewClient() 37 | retryableClient.CheckRetry = func(ctx context.Context, resp *http.Response, err error) (bool, error) { 38 | ok, err := retryablehttp.DefaultRetryPolicy(ctx, resp, err) 39 | if !ok && resp.StatusCode == http.StatusUnprocessableEntity { 40 | return true, nil 41 | } 42 | return ok, err 43 | } 44 | retryableClient.RetryMax = 10 45 | return retryableClient.StandardClient() 46 | } 47 | 48 | // Client for the Hetzner DNS API. 49 | type Client struct { 50 | requestLock sync.Mutex 51 | apiToken string 52 | createHTTPClient createHTTPClient 53 | } 54 | 55 | // NewClient creates a new API Client using a given api token. 56 | func NewClient(apiToken string) (*Client, diag.Diagnostics) { 57 | return &Client{apiToken: apiToken, createHTTPClient: defaultCreateHTTPClient}, nil 58 | } 59 | 60 | func (c *Client) doHTTPRequest(apiToken string, method string, url string, body io.Reader) (*http.Response, error) { 61 | client := c.createHTTPClient() 62 | 63 | log.Printf("[DEBUG] HTTP request to API %s %s", method, url) 64 | req, err := http.NewRequest(method, url, body) 65 | if err != nil { 66 | return nil, err 67 | } 68 | 69 | req.Header.Add("Auth-API-Token", apiToken) 70 | req.Header.Add("Accept", "application/json; charset=utf-8") 71 | if body != nil { 72 | req.Header.Set("Content-Type", "application/json; charset=utf-8") 73 | } 74 | 75 | resp, err := client.Do(req) 76 | 77 | if err != nil { 78 | return nil, err 79 | } 80 | 81 | if resp.StatusCode == http.StatusUnauthorized { 82 | unauthorizedError, err := parseUnauthorizedError(resp) 83 | if err != nil { 84 | return nil, err 85 | } 86 | return nil, fmt.Errorf("API returned HTTP 401 Unauthorized error with message: '%s'. Double check your API key is still valid", unauthorizedError.Message) 87 | 88 | } else if resp.StatusCode == http.StatusUnprocessableEntity { 89 | unprocessableEntityError, err := parseUnprocessableEntityError(resp) 90 | if err != nil { 91 | return nil, err 92 | } 93 | 94 | return nil, fmt.Errorf("API returned HTTP 422 Unprocessable Entity error with message: '%s'", unprocessableEntityError.Error.Message) 95 | } 96 | return resp, nil 97 | } 98 | 99 | func parseUnprocessableEntityError(resp *http.Response) (*UnprocessableEntityError, error) { 100 | body, err := ioutil.ReadAll(resp.Body) 101 | defer resp.Body.Close() 102 | 103 | if err != nil { 104 | return nil, fmt.Errorf("Error reading HTTP response body: %e", err) 105 | } 106 | var unprocessableEntityError UnprocessableEntityError 107 | err = parseJSON(body, &unprocessableEntityError) 108 | if err != nil { 109 | return nil, err 110 | } 111 | return &unprocessableEntityError, nil 112 | } 113 | 114 | func parseUnauthorizedError(resp *http.Response) (*UnauthorizedError, error) { 115 | var unauthorizedError UnauthorizedError 116 | err := readAndParseJSONBody(resp, &unauthorizedError) 117 | if err != nil { 118 | return nil, err 119 | } 120 | return &unauthorizedError, nil 121 | } 122 | 123 | func (c *Client) doGetRequest(url string) (*http.Response, error) { 124 | return c.doHTTPRequest(c.apiToken, http.MethodGet, url, nil) 125 | } 126 | 127 | func (c *Client) doDeleteRequest(url string) (*http.Response, error) { 128 | return c.doHTTPRequest(c.apiToken, http.MethodDelete, url, nil) 129 | } 130 | 131 | func (c *Client) doPostRequest(url string, bodyJSON interface{}) (*http.Response, error) { 132 | reqJSON, err := json.Marshal(bodyJSON) 133 | if err != nil { 134 | return nil, fmt.Errorf("Error serializing JSON body %s", err) 135 | } 136 | body := bytes.NewReader(reqJSON) 137 | 138 | // This lock ensures that only one Post request is sent to Hetzber API 139 | // at a time. See issue #5 for context. 140 | c.requestLock.Lock() 141 | response, err := c.doHTTPRequest(c.apiToken, http.MethodPost, url, body) 142 | c.requestLock.Unlock() 143 | 144 | return response, err 145 | } 146 | 147 | func (c *Client) doPutRequest(url string, bodyJSON interface{}) (*http.Response, error) { 148 | reqJSON, err := json.Marshal(bodyJSON) 149 | if err != nil { 150 | return nil, fmt.Errorf("Error serializing JSON body %s", err) 151 | } 152 | body := bytes.NewReader(reqJSON) 153 | 154 | // This lock ensures that only one Post request is sent to Hetzber API 155 | // at a time. See issue #5 for context. 156 | c.requestLock.Lock() 157 | response, err := c.doHTTPRequest(c.apiToken, http.MethodPut, url, body) 158 | c.requestLock.Unlock() 159 | 160 | return response, err 161 | } 162 | 163 | func readAndParseJSONBody(resp *http.Response, respType interface{}) error { 164 | body, err := ioutil.ReadAll(resp.Body) 165 | defer resp.Body.Close() 166 | 167 | if err != nil { 168 | return fmt.Errorf("Error reading HTTP response body %s", err) 169 | } 170 | 171 | return parseJSON(body, respType) 172 | } 173 | 174 | func parseJSON(data []byte, respType interface{}) error { 175 | return json.Unmarshal(data, &respType) 176 | } 177 | 178 | // GetZone reads the current state of a DNS zone 179 | func (c *Client) GetZone(id string) (*Zone, error) { 180 | resp, err := c.doGetRequest(fmt.Sprintf("https://dns.hetzner.com/api/v1/zones/%s", id)) 181 | if err != nil { 182 | return nil, fmt.Errorf("Error getting zone %s: %s", id, err) 183 | } 184 | 185 | if resp.StatusCode == http.StatusOK { 186 | var response GetZoneResponse 187 | err = readAndParseJSONBody(resp, &response) 188 | if err != nil { 189 | return nil, err 190 | } 191 | return &response.Zone, nil 192 | } else if resp.StatusCode == http.StatusNotFound { 193 | return nil, nil 194 | } 195 | 196 | return nil, fmt.Errorf("Error getting Zone. HTTP status %d unhandled", resp.StatusCode) 197 | } 198 | 199 | // UpdateZone takes the passed state and updates the respective Zone 200 | func (c *Client) UpdateZone(zone Zone) (*Zone, error) { 201 | resp, err := c.doPutRequest(fmt.Sprintf("https://dns.hetzner.com/api/v1/zones/%s", zone.ID), zone) 202 | if err != nil { 203 | return nil, fmt.Errorf("Error updating zone %s: %s", zone.ID, err) 204 | } 205 | 206 | if resp.StatusCode == http.StatusOK { 207 | var response ZoneResponse 208 | err = readAndParseJSONBody(resp, &response) 209 | if err != nil { 210 | return nil, err 211 | } 212 | return &response.Zone, nil 213 | } 214 | 215 | return nil, fmt.Errorf("Error updating Zone. HTTP status %d unhandled", resp.StatusCode) 216 | } 217 | 218 | // DeleteZone deletes a given DNS zone 219 | func (c *Client) DeleteZone(id string) error { 220 | resp, err := c.doDeleteRequest(fmt.Sprintf("https://dns.hetzner.com/api/v1/zones/%s", id)) 221 | if err != nil { 222 | return fmt.Errorf("Error deleting zone %s: %s", id, err) 223 | } 224 | 225 | if resp.StatusCode == http.StatusOK { 226 | return nil 227 | } 228 | return fmt.Errorf("Error deleting Zone. HTTP status %d unhandled", resp.StatusCode) 229 | } 230 | 231 | // GetZoneByName reads the current state of a DNS zone with a given name 232 | func (c *Client) GetZoneByName(name string) (*Zone, error) { 233 | resp, err := c.doGetRequest(fmt.Sprintf("https://dns.hetzner.com/api/v1/zones?name=%s", name)) 234 | if err != nil { 235 | return nil, fmt.Errorf("Error getting zone %s: %s", name, err) 236 | } 237 | 238 | if resp.StatusCode == http.StatusOK { 239 | var response *GetZonesByNameResponse 240 | err = readAndParseJSONBody(resp, &response) 241 | if err != nil { 242 | return nil, err 243 | } 244 | 245 | if len(response.Zones) != 1 { 246 | return nil, fmt.Errorf("Error getting zone '%s'. No matching zone or multiple matching zones found", name) 247 | } 248 | 249 | return &response.Zones[0], nil 250 | } else if resp.StatusCode == http.StatusNotFound { 251 | return nil, nil 252 | } 253 | 254 | return nil, fmt.Errorf("Error getting Zone. HTTP status %d unhandled", resp.StatusCode) 255 | } 256 | 257 | // CreateZoneOpts covers all parameters used to create a new DNS zone 258 | type CreateZoneOpts struct { 259 | Name string `json:"name"` 260 | TTL int `json:"ttl"` 261 | } 262 | 263 | // CreateZone creates a new DNS zone 264 | func (c *Client) CreateZone(opts CreateZoneOpts) (*Zone, error) { 265 | 266 | if !strings.Contains(opts.Name, ".") { 267 | return nil, fmt.Errorf("Error creating zone. The name '%s' is not a valid domain. It must correspond to the schema .", opts.Name) 268 | } 269 | 270 | reqBody := CreateZoneRequest{Name: opts.Name, TTL: opts.TTL} 271 | resp, err := c.doPostRequest("https://dns.hetzner.com/api/v1/zones", reqBody) 272 | if err != nil { 273 | return nil, fmt.Errorf("Error creating zone. %s", err) 274 | } 275 | 276 | if resp.StatusCode == http.StatusOK { 277 | var response CreateZoneResponse 278 | err = readAndParseJSONBody(resp, &response) 279 | if err != nil { 280 | return nil, err 281 | } 282 | 283 | return &response.Zone, nil 284 | } 285 | 286 | return nil, fmt.Errorf("Error creating Zone. HTTP status %d unhandled", resp.StatusCode) 287 | } 288 | 289 | // GetRecordByName reads the current state of a DNS Record with a given name and zone id 290 | func (c *Client) GetRecordByName(zoneID string, name string) (*Record, error) { 291 | resp, err := c.doGetRequest(fmt.Sprintf("https://dns.hetzner.com/api/v1/records?zone_id=%s", zoneID)) 292 | if err != nil { 293 | return nil, fmt.Errorf("Error getting record %s: %s", name, err) 294 | } 295 | 296 | if resp.StatusCode == http.StatusOK { 297 | var response *RecordsResponse 298 | err = readAndParseJSONBody(resp, &response) 299 | if err != nil { 300 | return nil, err 301 | } 302 | 303 | if len(response.Records) == 0 { 304 | return nil, fmt.Errorf("Error getting record '%s'. It seems there are no records in zone %s at all", name, zoneID) 305 | } 306 | 307 | for _, record := range response.Records { 308 | if record.Name == name { 309 | return &record, nil 310 | } 311 | } 312 | 313 | return nil, fmt.Errorf("Error getting record '%s'. There are records in zone %s, but %s isn't included", name, zoneID, name) 314 | } 315 | 316 | return nil, fmt.Errorf("Error getting Record. HTTP status %d unhandled", resp.StatusCode) 317 | } 318 | 319 | // GetRecord reads the current state of a DNS Record 320 | func (c *Client) GetRecord(recordID string) (*Record, error) { 321 | resp, err := c.doGetRequest(fmt.Sprintf("https://dns.hetzner.com/api/v1/records/%s", recordID)) 322 | if err != nil { 323 | return nil, fmt.Errorf("Error getting record %s: %s", recordID, err) 324 | } 325 | 326 | if resp.StatusCode == http.StatusOK { 327 | var response *RecordResponse 328 | err = readAndParseJSONBody(resp, &response) 329 | if err != nil { 330 | return nil, fmt.Errorf("Error Reading json response of get record %s request: %s", recordID, err) 331 | } 332 | 333 | return &response.Record, nil 334 | } else if resp.StatusCode == http.StatusNotFound { 335 | return nil, nil 336 | } 337 | 338 | return nil, fmt.Errorf("Error getting Record. HTTP status %d unhandled", resp.StatusCode) 339 | } 340 | 341 | // CreateRecordOpts covers all parameters used to create a new DNS record 342 | type CreateRecordOpts struct { 343 | ZoneID string `json:"zone_id"` 344 | Type string `json:"type"` 345 | Name string `json:"name"` 346 | Value string `json:"value"` 347 | TTL *int `json:"ttl,omitempty"` 348 | } 349 | 350 | // CreateRecord create a new DNS records 351 | func (c *Client) CreateRecord(opts CreateRecordOpts) (*Record, error) { 352 | reqBody := CreateRecordRequest{ZoneID: opts.ZoneID, Name: opts.Name, TTL: opts.TTL, Type: opts.Type, Value: opts.Value} 353 | resp, err := c.doPostRequest("https://dns.hetzner.com/api/v1/records", reqBody) 354 | if err != nil { 355 | return nil, fmt.Errorf("Error creating record %s: %s", opts.Name, err) 356 | } 357 | 358 | if resp.StatusCode == http.StatusOK { 359 | var response RecordResponse 360 | err = readAndParseJSONBody(resp, &response) 361 | if err != nil { 362 | return nil, err 363 | } 364 | 365 | return &response.Record, nil 366 | } 367 | 368 | return nil, fmt.Errorf("Error creating Record. HTTP status %d unhandled", resp.StatusCode) 369 | } 370 | 371 | // DeleteRecord deletes a given record 372 | func (c *Client) DeleteRecord(id string) error { 373 | resp, err := c.doDeleteRequest(fmt.Sprintf("https://dns.hetzner.com/api/v1/records/%s", id)) 374 | if err != nil { 375 | return fmt.Errorf("Error deleting zone %s: %s", id, err) 376 | } 377 | 378 | if resp.StatusCode == http.StatusOK { 379 | return nil 380 | } 381 | return fmt.Errorf("Error deleting Record. HTTP status %d unhandled", resp.StatusCode) 382 | } 383 | 384 | // UpdateRecord create a new DNS records 385 | func (c *Client) UpdateRecord(record Record) (*Record, error) { 386 | resp, err := c.doPutRequest(fmt.Sprintf("https://dns.hetzner.com/api/v1/records/%s", record.ID), record) 387 | if err != nil { 388 | return nil, fmt.Errorf("Error updating record %s: %s", record.ID, err) 389 | } 390 | 391 | if resp.StatusCode == http.StatusOK { 392 | var response RecordResponse 393 | err = readAndParseJSONBody(resp, &response) 394 | if err != nil { 395 | return nil, err 396 | } 397 | 398 | return &response.Record, nil 399 | } 400 | 401 | return nil, fmt.Errorf("Error creating Record. HTTP status %d unhandled", resp.StatusCode) 402 | } 403 | 404 | func (c *Client) GetPrimaryServer(id string) (*PrimaryServer, error) { 405 | resp, err := c.doGetRequest(fmt.Sprintf("https://dns.hetzner.com/api/v1/primary_servers/%s", id)) 406 | if err != nil { 407 | return nil, fmt.Errorf("Error getting primary server %s: %s", id, err) 408 | } 409 | 410 | if resp.StatusCode == http.StatusOK { 411 | var response *PrimaryServerResponse 412 | err = readAndParseJSONBody(resp, &response) 413 | if err != nil { 414 | return nil, fmt.Errorf("Error Reading json response of get primary server %s request: %s", id, err) 415 | } 416 | 417 | return &response.PrimaryServer, nil 418 | } else if resp.StatusCode == http.StatusNotFound { 419 | return nil, nil 420 | } 421 | 422 | return nil, fmt.Errorf("Error getting primary server. HTTP status %d unhandled", resp.StatusCode) 423 | } 424 | 425 | func (c *Client) CreatePrimaryServer(server CreatePrimaryServerRequest) (*PrimaryServer, error) { 426 | reqBody := CreatePrimaryServerRequest{ 427 | ZoneID: server.ZoneID, 428 | Address: server.Address, 429 | Port: server.Port, 430 | } 431 | resp, err := c.doPostRequest("https://dns.hetzner.com/api/v1/primary_servers", reqBody) 432 | if err != nil { 433 | return nil, fmt.Errorf("Error creating primary server %s: %s", server.Address, err) 434 | } 435 | 436 | if resp.StatusCode == http.StatusOK { 437 | var response PrimaryServerResponse 438 | err = readAndParseJSONBody(resp, &response) 439 | if err != nil { 440 | return nil, err 441 | } 442 | 443 | return &response.PrimaryServer, nil 444 | } 445 | 446 | return nil, fmt.Errorf("Error creating primary server. HTTP status %d unhandled", resp.StatusCode) 447 | } 448 | 449 | func (c *Client) UpdatePrimaryServer(server PrimaryServer) (*PrimaryServer, error) { 450 | resp, err := c.doPutRequest(fmt.Sprintf("https://dns.hetzner.com/api/v1/primary_servers/%s", server.ID), server) 451 | if err != nil { 452 | return nil, fmt.Errorf("Error updating primary server %s: %s", server.ID, err) 453 | } 454 | 455 | if resp.StatusCode == http.StatusOK { 456 | var response PrimaryServerResponse 457 | err = readAndParseJSONBody(resp, &response) 458 | if err != nil { 459 | return nil, err 460 | } 461 | 462 | return &response.PrimaryServer, nil 463 | } 464 | 465 | return nil, fmt.Errorf("Error updating primary server. HTTP status %d unhandled", resp.StatusCode) 466 | } 467 | 468 | func (c *Client) DeletePrimaryServer(id string) error { 469 | resp, err := c.doDeleteRequest(fmt.Sprintf("https://dns.hetzner.com/api/v1/primary_servers/%s", id)) 470 | if err != nil { 471 | return fmt.Errorf("Error deleting primary server %s: %s", id, err) 472 | } 473 | 474 | if resp.StatusCode == http.StatusOK { 475 | return nil 476 | } 477 | return fmt.Errorf("Error deleting primary server. HTTP status %d unhandled", resp.StatusCode) 478 | } 479 | -------------------------------------------------------------------------------- /hetznerdns/api/client_test.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "bytes" 5 | "io" 6 | "io/ioutil" 7 | "net/http" 8 | "testing" 9 | 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func TestClientCreateZoneSuccess(t *testing.T) { 14 | var requestBodyReader io.Reader 15 | responseBody := []byte(`{"zone":{"id":"12345","name":"mydomain.com","ttl":3600}}`) 16 | config := RequestConfig{responseHTTPStatus: http.StatusOK, requestBodyReader: &requestBodyReader, responseBodyJSON: responseBody} 17 | client := createTestClient(config) 18 | 19 | opts := CreateZoneOpts{Name: "mydomain.com", TTL: 3600} 20 | zone, err := client.CreateZone(opts) 21 | 22 | assert.NoError(t, err) 23 | assert.Equal(t, Zone{ID: "12345", Name: "mydomain.com", TTL: 3600}, *zone) 24 | assert.NotNil(t, requestBodyReader, "The request body should not be nil") 25 | jsonRequestBody, _ := ioutil.ReadAll(requestBodyReader) 26 | assert.Equal(t, `{"name":"mydomain.com","ttl":3600}`, string(jsonRequestBody)) 27 | } 28 | 29 | func TestClientCreateZoneInvalidDomain(t *testing.T) { 30 | responseBody := []byte(`{"zone":{"id":"","name":"","ttl":0,"registrar":"","legacy_dns_host":"","legacy_ns":null,"ns":null,"created":"","verified":"","modified":"","project":"","owner":"","permission":"","zone_type":{"id":"","name":"","description":"","prices":null},"status":"","paused":false,"is_secondary_dns":false,"txt_verification":{"name":"","token":""},"records_count":0},"error":{"message":"422 : invalid TLD","code":422}}`) 31 | config := RequestConfig{responseHTTPStatus: http.StatusUnprocessableEntity, responseBodyJSON: responseBody} 32 | 33 | client := createTestClient(config) 34 | opts := CreateZoneOpts{Name: "this.is.invalid", TTL: 3600} 35 | _, err := client.CreateZone(opts) 36 | 37 | assert.Error(t, err) 38 | assert.Contains(t, err.Error(), "API returned HTTP 422 Unprocessable Entity error with message: '422 : invalid TLD'") 39 | } 40 | 41 | func TestClientCreateZoneInvalidTLD(t *testing.T) { 42 | var irrelevantConfig RequestConfig 43 | client := createTestClient(irrelevantConfig) 44 | opts := CreateZoneOpts{Name: "thisisinvalid", TTL: 3600} 45 | _, err := client.CreateZone(opts) 46 | 47 | assert.Error(t, err) 48 | assert.Contains(t, err.Error(), "'thisisinvalid' is not a valid domain") 49 | } 50 | 51 | func TestClientUpdateZoneSuccess(t *testing.T) { 52 | zoneWithUpdates := Zone{ID: "12345678", Name: "zone1.online", TTL: 3600} 53 | zoneWithUpdatesJSON := `{"id":"12345678","name":"zone1.online","ttl":3600}` 54 | var requestBodyReader io.Reader 55 | responseBody := []byte(`{"zone":{"id":"12345678","name":"zone1.online","ttl":3600}}`) 56 | config := RequestConfig{responseHTTPStatus: http.StatusOK, requestBodyReader: &requestBodyReader, responseBodyJSON: responseBody} 57 | client := createTestClient(config) 58 | 59 | updatedZone, err := client.UpdateZone(zoneWithUpdates) 60 | 61 | assert.NoError(t, err) 62 | assert.Equal(t, zoneWithUpdates, *updatedZone) 63 | assert.NotNil(t, requestBodyReader, "The request body should not be nil") 64 | jsonRequestBody, _ := ioutil.ReadAll(requestBodyReader) 65 | assert.Equal(t, zoneWithUpdatesJSON, string(jsonRequestBody)) 66 | } 67 | 68 | func TestClientGetZone(t *testing.T) { 69 | responseBody := []byte(`{"zone":{"id":"12345678","name":"zone1.online","ttl":3600}}`) 70 | config := RequestConfig{responseHTTPStatus: http.StatusOK, responseBodyJSON: responseBody} 71 | client := createTestClient(config) 72 | 73 | zone, err := client.GetZone("12345678") 74 | 75 | assert.NoError(t, err) 76 | assert.Equal(t, Zone{ID: "12345678", Name: "zone1.online", TTL: 3600}, *zone) 77 | } 78 | 79 | func TestClientGetZoneReturnNilIfNotFound(t *testing.T) { 80 | config := RequestConfig{responseHTTPStatus: http.StatusNotFound} 81 | client := createTestClient(config) 82 | 83 | zone, err := client.GetZone("12345678") 84 | 85 | assert.NoError(t, err) 86 | assert.Nil(t, zone) 87 | } 88 | 89 | func TestClientGetZoneByName(t *testing.T) { 90 | responseBody := []byte(`{"zones":[{"id":"12345678","name":"zone1.online","ttl":3600}]}`) 91 | config := RequestConfig{responseHTTPStatus: http.StatusOK, responseBodyJSON: responseBody} 92 | client := createTestClient(config) 93 | 94 | zone, err := client.GetZoneByName("zone1.online") 95 | 96 | assert.NoError(t, err) 97 | assert.Equal(t, Zone{ID: "12345678", Name: "zone1.online", TTL: 3600}, *zone) 98 | } 99 | 100 | func TestClientGetZoneByNameReturnNilIfnotFound(t *testing.T) { 101 | config := RequestConfig{responseHTTPStatus: http.StatusNotFound} 102 | client := createTestClient(config) 103 | 104 | zone, err := client.GetZoneByName("zone1.online") 105 | 106 | assert.NoError(t, err) 107 | assert.Nil(t, zone) 108 | } 109 | 110 | func TestClientDeleteZone(t *testing.T) { 111 | config := RequestConfig{responseHTTPStatus: http.StatusOK} 112 | client := createTestClient(config) 113 | 114 | err := client.DeleteZone("irrelevant") 115 | 116 | assert.NoError(t, err) 117 | } 118 | 119 | func TestClientGetRecord(t *testing.T) { 120 | aTTL := 3600 121 | responseBody := []byte(`{"record":{"zone_id":"wwwlsksjjenm","id":"12345678","name":"zone1.online","ttl":3600,"type":"A","value":"192.168.1.1"}}`) 122 | config := RequestConfig{responseHTTPStatus: http.StatusOK, responseBodyJSON: responseBody} 123 | client := createTestClient(config) 124 | 125 | record, err := client.GetRecord("12345678") 126 | 127 | assert.NoError(t, err) 128 | assert.Equal(t, Record{ZoneID: "wwwlsksjjenm", ID: "12345678", Name: "zone1.online", TTL: &aTTL, Type: "A", Value: "192.168.1.1"}, *record) 129 | } 130 | 131 | func TestClientGetRecordWithUndefinedTTL(t *testing.T) { 132 | responseBody := []byte(`{"record":{"zone_id":"wwwlsksjjenm","id":"12345678","name":"zone1.online","type":"A","value":"192.168.1.1"}}`) 133 | config := RequestConfig{responseHTTPStatus: http.StatusOK, responseBodyJSON: responseBody} 134 | client := createTestClient(config) 135 | 136 | record, err := client.GetRecord("12345678") 137 | 138 | assert.NoError(t, err) 139 | assert.Equal(t, Record{ZoneID: "wwwlsksjjenm", ID: "12345678", Name: "zone1.online", TTL: nil, Type: "A", Value: "192.168.1.1"}, *record) 140 | } 141 | 142 | func TestClientGetRecordReturnNilIfNotFound(t *testing.T) { 143 | config := RequestConfig{responseHTTPStatus: http.StatusNotFound} 144 | client := createTestClient(config) 145 | 146 | record, err := client.GetRecord("irrelevant") 147 | 148 | assert.NoError(t, err) 149 | assert.Nil(t, record) 150 | } 151 | 152 | func TestClientCreateRecordSuccess(t *testing.T) { 153 | var requestBodyReader io.Reader 154 | responseBody := []byte(`{"record":{"zone_id":"wwwlsksjjenm","id":"12345678","name":"zone1.online","ttl":3600,"type":"A","value":"192.168.1.1"}}`) 155 | config := RequestConfig{responseHTTPStatus: http.StatusOK, requestBodyReader: &requestBodyReader, responseBodyJSON: responseBody} 156 | client := createTestClient(config) 157 | 158 | aTTL := 3600 159 | opts := CreateRecordOpts{ZoneID: "wwwlsksjjenm", Name: "zone1.online", TTL: &aTTL, Type: "A", Value: "192.168.1.1"} 160 | record, err := client.CreateRecord(opts) 161 | 162 | assert.NoError(t, err) 163 | assert.Equal(t, Record{ZoneID: "wwwlsksjjenm", ID: "12345678", Name: "zone1.online", TTL: &aTTL, Type: "A", Value: "192.168.1.1"}, *record) 164 | assert.NotNil(t, requestBodyReader, "The request body should not be nil") 165 | jsonRequestBody, _ := ioutil.ReadAll(requestBodyReader) 166 | assert.Equal(t, `{"zone_id":"wwwlsksjjenm","type":"A","name":"zone1.online","value":"192.168.1.1","ttl":3600}`, string(jsonRequestBody)) 167 | } 168 | 169 | func TestClientRecordZone(t *testing.T) { 170 | config := RequestConfig{responseHTTPStatus: http.StatusOK} 171 | client := createTestClient(config) 172 | 173 | err := client.DeleteRecord("irrelevant") 174 | 175 | assert.NoError(t, err) 176 | } 177 | 178 | func TestClientUpdateRecordSuccess(t *testing.T) { 179 | aTTL := 3600 180 | recordWithUpdates := Record{ZoneID: "wwwlsksjjenm", ID: "12345678", Name: "zone2.online", TTL: &aTTL, Type: "A", Value: "192.168.1.1"} 181 | recordWithUpdatesJSON := `{"zone_id":"wwwlsksjjenm","id":"12345678","type":"A","name":"zone2.online","value":"192.168.1.1","ttl":3600}` 182 | var requestBodyReader io.Reader 183 | responseBody := []byte(`{"record":{"zone_id":"wwwlsksjjenm","id":"12345678","type":"A","name":"zone2.online","value":"192.168.1.1","ttl":3600}}`) 184 | config := RequestConfig{responseHTTPStatus: http.StatusOK, requestBodyReader: &requestBodyReader, responseBodyJSON: responseBody} 185 | client := createTestClient(config) 186 | 187 | updatedRecord, err := client.UpdateRecord(recordWithUpdates) 188 | 189 | assert.NoError(t, err) 190 | assert.Equal(t, recordWithUpdates, *updatedRecord) 191 | assert.NotNil(t, requestBodyReader, "The request body should not be nil") 192 | jsonRequestBody, _ := ioutil.ReadAll(requestBodyReader) 193 | assert.Equal(t, recordWithUpdatesJSON, string(jsonRequestBody)) 194 | } 195 | 196 | func TestClientHandleUnauthorizedRequest(t *testing.T) { 197 | responseBody := []byte(`{"message":"Invalid API key"}`) 198 | config := RequestConfig{responseHTTPStatus: http.StatusUnauthorized, responseBodyJSON: responseBody} 199 | client := createTestClient(config) 200 | 201 | opts := CreateZoneOpts{Name: "mydomain.com", TTL: 3600} 202 | _, err := client.CreateZone(opts) 203 | 204 | assert.Error(t, err) 205 | assert.Contains(t, err.Error(), "'Invalid API key'", "Error message didn't contain error message from API.") 206 | } 207 | 208 | type RequestConfig struct { 209 | responseHTTPStatus int 210 | responseBodyJSON []byte 211 | requestBodyReader *io.Reader 212 | } 213 | 214 | func createTestClient(config RequestConfig) Client { 215 | fakeHTTPClient := TestClient{config: config} 216 | createFakeHTTPClient := func() *http.Client { 217 | return &http.Client{Transport: fakeHTTPClient} 218 | } 219 | return Client{apiToken: "irrelevant", createHTTPClient: createFakeHTTPClient} 220 | } 221 | 222 | type TestClient struct { 223 | config RequestConfig 224 | } 225 | 226 | // See https://golang.org/pkg/net/http/#RoundTripper 227 | func (f TestClient) RoundTrip(req *http.Request) (*http.Response, error) { 228 | if req.Body != nil && f.config.requestBodyReader != nil { 229 | *f.config.requestBodyReader = req.Body 230 | } 231 | 232 | var jsonBody io.ReadCloser = nil 233 | if f.config.responseBodyJSON != nil { 234 | jsonBody = ioutil.NopCloser(bytes.NewReader(f.config.responseBodyJSON)) 235 | } 236 | resp := http.Response{StatusCode: f.config.responseHTTPStatus, Body: jsonBody} 237 | return &resp, nil 238 | } 239 | -------------------------------------------------------------------------------- /hetznerdns/api/primary_server.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | type PrimaryServer struct { 4 | ID string `json:"id"` 5 | Port *int `json:"port"` 6 | ZoneID string `json:"zone_id"` 7 | Address string `json:"address"` 8 | } 9 | 10 | type CreatePrimaryServerRequest struct { 11 | Port *int `json:"port"` 12 | ZoneID string `json:"zone_id"` 13 | Address string `json:"address"` 14 | } 15 | 16 | type PrimaryServersResponse struct { 17 | PrimaryServers []PrimaryServer `json:"primary_servers"` 18 | } 19 | 20 | type PrimaryServerResponse struct { 21 | PrimaryServer PrimaryServer `json:"primary_server"` 22 | } 23 | -------------------------------------------------------------------------------- /hetznerdns/api/record.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // Record represents a record in a specific Zone 4 | type Record struct { 5 | ZoneID string `json:"zone_id"` 6 | ID string `json:"id"` 7 | Type string `json:"type"` 8 | Name string `json:"name"` 9 | Value string `json:"value"` 10 | TTL *int `json:"ttl,omitempty"` 11 | } 12 | 13 | // HasTTL returns true if a Record has a TTL set and false if TTL is undefined 14 | func (r *Record) HasTTL() bool { 15 | return r.TTL != nil 16 | } 17 | 18 | // CreateRecordRequest represents all data required to create a new record 19 | type CreateRecordRequest struct { 20 | ZoneID string `json:"zone_id"` 21 | Type string `json:"type"` 22 | Name string `json:"name"` 23 | Value string `json:"value"` 24 | TTL *int `json:"ttl,omitempty"` 25 | } 26 | 27 | // RecordsResponse represents a response from tha API containing a list of records 28 | type RecordsResponse struct { 29 | Records []Record `json:"records"` 30 | } 31 | 32 | // RecordResponse represents a response from the API containing only one record 33 | type RecordResponse struct { 34 | Record Record `json:"record"` 35 | } 36 | -------------------------------------------------------------------------------- /hetznerdns/api/zone.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | // Zone represents a DNS Zone 4 | type Zone struct { 5 | ID string `json:"id"` 6 | Name string `json:"name"` 7 | TTL int `json:"ttl"` 8 | } 9 | 10 | // CreateZoneRequest represents the body of a POST Zone request 11 | type CreateZoneRequest struct { 12 | Name string `json:"name"` 13 | TTL int `json:"ttl"` 14 | } 15 | 16 | // CreateZoneResponse represents the content of a POST Zone response 17 | type CreateZoneResponse struct { 18 | Zone Zone `json:"zone"` 19 | } 20 | 21 | // GetZoneResponse represents the content of a GET Zone request 22 | type GetZoneResponse struct { 23 | Zone Zone `json:"zone"` 24 | } 25 | 26 | // ZoneResponse represents the content of response containing a Zone 27 | type ZoneResponse struct { 28 | Zone Zone `json:"zone"` 29 | } 30 | 31 | // GetZonesByNameResponse represents the content of a GET Zones response 32 | type GetZonesByNameResponse struct { 33 | Zones []Zone `json:"zones"` 34 | } 35 | -------------------------------------------------------------------------------- /hetznerdns/api/zone_test.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "encoding/json" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func assertSerializeAndAssertEqual(t *testing.T, o interface{}, expectedJSON string) { 11 | computedJSON, err := json.Marshal(o) 12 | if err != nil { 13 | t.Fatal(err) 14 | } 15 | 16 | assert.Equal(t, string(computedJSON), string(expectedJSON)) 17 | } 18 | 19 | func TestCreateZoneRequestJson(t *testing.T) { 20 | req := CreateZoneRequest{Name: "aName", TTL: 60} 21 | expectedJSON := `{"name":"aName","ttl":60}` 22 | 23 | assertSerializeAndAssertEqual(t, req, expectedJSON) 24 | } 25 | 26 | func TestGetZoneResponseJson(t *testing.T) { 27 | resp := GetZoneResponse{Zone: Zone{ID: "aId", Name: "aName", TTL: 60}} 28 | expectedJSON := `{"zone":{"id":"aId","name":"aName","ttl":60}}` 29 | 30 | assertSerializeAndAssertEqual(t, resp, expectedJSON) 31 | } 32 | 33 | func TestGetZoneByNameResponseJson(t *testing.T) { 34 | resp := GetZonesByNameResponse{[]Zone{{ID: "aId", Name: "aName", TTL: 60}}} 35 | expectedJSON := `{"zones":[{"id":"aId","name":"aName","ttl":60}]}` 36 | 37 | assertSerializeAndAssertEqual(t, resp, expectedJSON) 38 | } 39 | 40 | func TestCreateZoneResponseJson(t *testing.T) { 41 | resp := CreateZoneResponse{Zone: Zone{ID: "aId", Name: "aName", TTL: 60}} 42 | expectedJSON := `{"zone":{"id":"aId","name":"aName","ttl":60}}` 43 | 44 | assertSerializeAndAssertEqual(t, resp, expectedJSON) 45 | } 46 | -------------------------------------------------------------------------------- /hetznerdns/data_source_zone.go: -------------------------------------------------------------------------------- 1 | package hetznerdns 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/timohirt/terraform-provider-hetznerdns/hetznerdns/api" 7 | 8 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 9 | ) 10 | 11 | func dataSourceHetznerDNSZone() *schema.Resource { 12 | return &schema.Resource{ 13 | Read: dataSourceHetznerDNSZoneRead, 14 | Schema: map[string]*schema.Schema{ 15 | "name": { 16 | Type: schema.TypeString, 17 | Required: true, 18 | }, 19 | "ttl": { 20 | Type: schema.TypeInt, 21 | Computed: true, 22 | }, 23 | }, 24 | } 25 | } 26 | 27 | func dataSourceHetznerDNSZoneRead(d *schema.ResourceData, m interface{}) error { 28 | client := m.(*api.Client) 29 | name, isNonZeroName := d.GetOk("name") 30 | if !isNonZeroName { 31 | return fmt.Errorf("Data source zone has no 'name' set") 32 | } 33 | 34 | zone, err := client.GetZoneByName(name.(string)) 35 | if err != nil { 36 | d.SetId("") 37 | return fmt.Errorf("Error getting zone state. %s", err) 38 | } 39 | 40 | if zone == nil { 41 | return fmt.Errorf("DNS zone '%s' doesn't exist", name.(string)) 42 | } 43 | 44 | d.Set("name", zone.Name) 45 | d.Set("ttl", zone.TTL) 46 | d.SetId(zone.ID) 47 | 48 | return nil 49 | } 50 | -------------------------------------------------------------------------------- /hetznerdns/data_source_zone_test.go: -------------------------------------------------------------------------------- 1 | package hetznerdns 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | "testing" 7 | 8 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" 9 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" 10 | ) 11 | 12 | func init() { 13 | resource.AddTestSweepers("data_source_zone", &resource.Sweeper{ 14 | Name: "hetznerdns_zone_data_source", 15 | }) 16 | } 17 | 18 | func TestAccHcloudDataSourceDatasources(t *testing.T) { 19 | // aName must be a valid DNS domain name with an existing TLD 20 | aName := fmt.Sprintf("%s.online", acctest.RandString(10)) 21 | aTTL := 60 22 | resource.Test(t, resource.TestCase{ 23 | PreCheck: func() { testAccAPITokenPresent(t) }, 24 | ProviderFactories: testAccProviders, 25 | Steps: []resource.TestStep{ 26 | { 27 | Config: testAccZoneDataSourceConfig(aName, aTTL), 28 | Check: resource.ComposeTestCheckFunc( 29 | resource.TestCheckResourceAttr( 30 | "data.hetznerdns_zone.zone1", "name", aName), 31 | resource.TestCheckResourceAttr( 32 | "data.hetznerdns_zone.zone1", "ttl", strconv.Itoa(aTTL)), 33 | resource.TestCheckResourceAttrSet("data.hetznerdns_zone.zone1", "id"), 34 | ), 35 | }, 36 | }, 37 | }) 38 | } 39 | 40 | func testAccZoneDataSourceConfig(name string, ttl int) string { 41 | return fmt.Sprintf(` 42 | resource "hetznerdns_zone" "zone1" { 43 | name = "%s" 44 | ttl = "%d" 45 | } 46 | 47 | data "hetznerdns_zone" "zone1" { 48 | name = "${hetznerdns_zone.zone1.name}" 49 | } 50 | `, name, ttl) 51 | } 52 | -------------------------------------------------------------------------------- /hetznerdns/primary_server.go: -------------------------------------------------------------------------------- 1 | package hetznerdns 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/timohirt/terraform-provider-hetznerdns/hetznerdns/api" 8 | "log" 9 | ) 10 | 11 | func resourcePrimaryServer() *schema.Resource { 12 | return &schema.Resource{ 13 | CreateContext: resourcePrimaryServerCreate, 14 | ReadContext: resourcePrimaryServerRead, 15 | UpdateContext: resourcePrimaryServerUpdate, 16 | DeleteContext: resourcePrimaryServerDelete, 17 | Importer: &schema.ResourceImporter{ 18 | StateContext: schema.ImportStatePassthroughContext, 19 | }, 20 | 21 | Schema: map[string]*schema.Schema{ 22 | "address": { 23 | Type: schema.TypeString, 24 | Required: true, 25 | }, 26 | "port": { 27 | Type: schema.TypeInt, 28 | Required: true, 29 | }, 30 | "zone_id": { 31 | Type: schema.TypeString, 32 | Required: true, 33 | ForceNew: true, 34 | }, 35 | }, 36 | } 37 | } 38 | 39 | func resourcePrimaryServerCreate(c context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 40 | log.Printf("[DEBUG] Creating primary server") 41 | client := m.(*api.Client) 42 | 43 | zoneID, zoneIDNonEmpty := d.GetOk("zone_id") 44 | if !zoneIDNonEmpty { 45 | return diag.Errorf("Zone ID of primary server not set") 46 | } 47 | 48 | address, addressNonEmpty := d.GetOk("address") 49 | if !addressNonEmpty { 50 | return diag.Errorf("Address of primaryServer not set") 51 | } 52 | 53 | port, portNonEmpty := d.GetOk("port") 54 | if !portNonEmpty { 55 | return diag.Errorf("Port of primary server not set") 56 | } 57 | portInt := port.(int) 58 | 59 | opts := api.CreatePrimaryServerRequest{ 60 | ZoneID: zoneID.(string), 61 | Address: address.(string), 62 | Port: &portInt, 63 | } 64 | 65 | record, err := client.CreatePrimaryServer(opts) 66 | if err != nil { 67 | log.Printf("[ERROR] Error creating primary server %s: %s", opts.Address, err) 68 | return diag.Errorf("Error creating primary server %s: %s", opts.Address, err) 69 | } 70 | 71 | d.SetId(record.ID) 72 | return resourcePrimaryServerRead(c, d, m) 73 | } 74 | 75 | func resourcePrimaryServerRead(c context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 76 | log.Printf("[DEBUG] Reading primary server") 77 | client := m.(*api.Client) 78 | 79 | id := d.Id() 80 | record, err := client.GetPrimaryServer(id) 81 | if err != nil { 82 | return diag.Errorf("Error getting primary server with id %s: %s", id, err) 83 | } 84 | 85 | if record == nil { 86 | log.Printf("[WARN] Primary server with id %s doesn't exist, removing it from state", id) 87 | d.SetId("") 88 | return nil 89 | } 90 | 91 | d.SetId(record.ID) 92 | d.Set("address", record.Address) 93 | d.Set("zone_id", record.ZoneID) 94 | d.Set("port", record.Port) 95 | 96 | return nil 97 | } 98 | 99 | func resourcePrimaryServerUpdate(c context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 100 | log.Printf("[DEBUG] Updating primary server") 101 | client := m.(*api.Client) 102 | 103 | id := d.Id() 104 | record, err := client.GetPrimaryServer(id) 105 | if err != nil { 106 | return diag.Errorf("Error getting primary server with id %s: %s", id, err) 107 | } 108 | 109 | if record == nil { 110 | log.Printf("[WARN] Primary server with id %s doesn't exist, removing it from state", id) 111 | d.SetId("") 112 | return nil 113 | } 114 | 115 | if d.HasChanges("address", "port") { 116 | record.Address = d.Get("address").(string) 117 | port := d.Get("port").(int) 118 | record.Port = &port 119 | 120 | record, err = client.UpdatePrimaryServer(*record) 121 | if err != nil { 122 | return diag.FromErr(err) 123 | } 124 | } 125 | 126 | return resourceRecordRead(c, d, m) 127 | } 128 | 129 | func resourcePrimaryServerDelete(c context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 130 | log.Printf("[DEBUG] Deleting resource record") 131 | 132 | client := m.(*api.Client) 133 | recordID := d.Id() 134 | 135 | err := client.DeletePrimaryServer(recordID) 136 | if err != nil { 137 | log.Printf("[ERROR] Error deleting primary server %s: %s", recordID, err) 138 | return diag.FromErr(err) 139 | } 140 | 141 | return nil 142 | } 143 | -------------------------------------------------------------------------------- /hetznerdns/primary_server_test.go: -------------------------------------------------------------------------------- 1 | package hetznerdns 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | "testing" 7 | 8 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" 9 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" 10 | ) 11 | 12 | const validPublicIpAddress = "167.182.9.17" 13 | 14 | func TestAccPrimaryServerResources(t *testing.T) { 15 | // aZoneName must be a valid DNS domain name with an existing TLD 16 | aZoneName := fmt.Sprintf("%s.online", acctest.RandString(10)) 17 | aZoneTTL := 60 18 | 19 | psAddress := validPublicIpAddress 20 | psPort := 53 21 | 22 | resource.Test(t, resource.TestCase{ 23 | PreCheck: func() { testAccAPITokenPresent(t) }, 24 | ProviderFactories: testAccProviders, 25 | Steps: []resource.TestStep{ 26 | { 27 | Config: testAccPrimaryServerResourceConfigCreate(aZoneName, aZoneTTL, psAddress, psPort), 28 | PreventDiskCleanup: true, 29 | Check: resource.ComposeTestCheckFunc( 30 | resource.TestCheckResourceAttrSet( 31 | "hetznerdns_primary_server.ps1", "id"), 32 | resource.TestCheckResourceAttr( 33 | "hetznerdns_primary_server.ps1", "address", psAddress), 34 | resource.TestCheckResourceAttr( 35 | "hetznerdns_primary_server.ps1", "port", strconv.Itoa(psPort)), 36 | ), 37 | }, 38 | }, 39 | }) 40 | } 41 | 42 | func testAccPrimaryServerResourceConfigCreate(aZoneName string, aZoneTTL int, psAddress string, psPort int) string { 43 | return fmt.Sprintf(` 44 | resource "hetznerdns_zone" "zone1" { 45 | name = "%s" 46 | ttl = %d 47 | } 48 | 49 | resource "hetznerdns_primary_server" "ps1" { 50 | zone_id = "${hetznerdns_zone.zone1.id}" 51 | address = "%s" 52 | port = %d 53 | } 54 | `, aZoneName, aZoneTTL, psAddress, psPort) 55 | } 56 | 57 | func TestAccTwoPrimaryServersResources(t *testing.T) { 58 | // aZoneName must be a valid DNS domain name with an existing TLD 59 | aZoneName := fmt.Sprintf("%s.online", acctest.RandString(10)) 60 | aZoneTTL := 60 61 | 62 | ps1Address := validPublicIpAddress 63 | ps1Port := 53 64 | 65 | ps2Address := "154.23.82.134" 66 | ps2Port := 53 67 | 68 | resource.Test(t, resource.TestCase{ 69 | PreCheck: func() { testAccAPITokenPresent(t) }, 70 | ProviderFactories: testAccProviders, 71 | Steps: []resource.TestStep{ 72 | { 73 | Config: testAccPrimaryServerResourceConfigCreateTwo(aZoneName, aZoneTTL, ps1Address, ps1Port, ps2Address, ps2Port), 74 | PreventDiskCleanup: true, 75 | Check: resource.ComposeTestCheckFunc( 76 | resource.TestCheckResourceAttrSet( 77 | "hetznerdns_primary_server.ps1", "id"), 78 | resource.TestCheckResourceAttrSet( 79 | "hetznerdns_primary_server.ps2", "id"), 80 | ), 81 | }, 82 | }, 83 | }) 84 | } 85 | 86 | func testAccPrimaryServerResourceConfigCreateTwo(aZoneName string, aTTL int, ps1Address string, ps1Port int, ps2Address string, ps2Port int) string { 87 | return fmt.Sprintf(` 88 | resource "hetznerdns_zone" "zone1" { 89 | name = "%s" 90 | ttl = %d 91 | } 92 | 93 | resource "hetznerdns_primary_server" "ps1" { 94 | zone_id = "${hetznerdns_zone.zone1.id}" 95 | address = "%s" 96 | port = %d 97 | } 98 | 99 | resource "hetznerdns_primary_server" "ps2" { 100 | zone_id = "${hetznerdns_zone.zone1.id}" 101 | address = "%s" 102 | port = %d 103 | } 104 | `, aZoneName, aTTL, ps1Address, ps1Port, ps2Address, ps2Port) 105 | } 106 | -------------------------------------------------------------------------------- /hetznerdns/provider.go: -------------------------------------------------------------------------------- 1 | package hetznerdns 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/timohirt/terraform-provider-hetznerdns/hetznerdns/api" 8 | ) 9 | 10 | // Provider creates and return a Terraform resource provider 11 | // for Hetzern DNS 12 | func Provider() *schema.Provider { 13 | return &schema.Provider{ 14 | Schema: map[string]*schema.Schema{ 15 | "apitoken": { 16 | Type: schema.TypeString, 17 | Required: true, 18 | DefaultFunc: schema.EnvDefaultFunc("HETZNER_DNS_API_TOKEN", nil), 19 | Description: "The API access token to authenticate at Hetzner DNS API.", 20 | }, 21 | }, 22 | ResourcesMap: map[string]*schema.Resource{ 23 | "hetznerdns_zone": resourceZone(), 24 | "hetznerdns_record": resourceRecord(), 25 | "hetznerdns_primary_server": resourcePrimaryServer(), 26 | }, 27 | DataSourcesMap: map[string]*schema.Resource{ 28 | "hetznerdns_zone": dataSourceHetznerDNSZone(), 29 | }, 30 | ConfigureContextFunc: configureProvider, 31 | } 32 | } 33 | 34 | func configureProvider(c context.Context, r *schema.ResourceData) (interface{}, diag.Diagnostics) { 35 | return api.NewClient(r.Get("apitoken").(string)) 36 | } 37 | -------------------------------------------------------------------------------- /hetznerdns/provider_test.go: -------------------------------------------------------------------------------- 1 | package hetznerdns 2 | 3 | import ( 4 | "os" 5 | "testing" 6 | 7 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 8 | ) 9 | 10 | var testAccProviders map[string]func() (*schema.Provider, error) 11 | 12 | func init() { 13 | testAccProviders = map[string]func() (*schema.Provider, error){ 14 | "hetznerdns": ProviderFactory, 15 | } 16 | } 17 | 18 | func ProviderFactory() (*schema.Provider, error) { 19 | return Provider(), nil 20 | } 21 | 22 | // See https://www.terraform.io/docs/plugins/provider.html 23 | func TestProvider(t *testing.T) { 24 | if err := Provider().InternalValidate(); err != nil { 25 | t.Fatalf("err: %s", err) 26 | } 27 | } 28 | 29 | // The Provider requires the API Token in env and thus it is required 30 | // to run the acceptance test as well. This function is used as a PreCheck 31 | // in TestCases and if the the token is not in env, it prints a message. 32 | func testAccAPITokenPresent(t *testing.T) { 33 | if v := os.Getenv("HETZNER_DNS_API_TOKEN"); v == "" { 34 | t.Fatal("HETZNER_DNS_API_TOKEN must be set for acceptance tests") 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /hetznerdns/resource_record.go: -------------------------------------------------------------------------------- 1 | package hetznerdns 2 | 3 | import ( 4 | "context" 5 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 6 | "log" 7 | 8 | "github.com/timohirt/terraform-provider-hetznerdns/hetznerdns/api" 9 | 10 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 11 | ) 12 | 13 | func resourceRecord() *schema.Resource { 14 | return &schema.Resource{ 15 | CreateContext: resourceRecordCreate, 16 | ReadContext: resourceRecordRead, 17 | UpdateContext: resourceRecordUpdate, 18 | DeleteContext: resourceRecordDelete, 19 | Importer: &schema.ResourceImporter{ 20 | StateContext: schema.ImportStatePassthroughContext, 21 | }, 22 | 23 | Schema: map[string]*schema.Schema{ 24 | "zone_id": { 25 | Type: schema.TypeString, 26 | Required: true, 27 | ForceNew: true, 28 | }, 29 | "type": { 30 | Type: schema.TypeString, 31 | Required: true, 32 | }, 33 | "name": { 34 | Type: schema.TypeString, 35 | Required: true, 36 | }, 37 | "value": { 38 | Type: schema.TypeString, 39 | Required: true, 40 | }, 41 | "ttl": { 42 | Type: schema.TypeInt, 43 | Optional: true, 44 | }, 45 | }, 46 | } 47 | } 48 | 49 | func resourceRecordCreate(c context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 50 | log.Printf("[DEBUG] Updating resource record") 51 | client := m.(*api.Client) 52 | 53 | zoneID, zoneIDNonEmpty := d.GetOk("zone_id") 54 | if !zoneIDNonEmpty { 55 | return diag.Errorf("Zone ID of record not set") 56 | } 57 | 58 | name, nameNonEmpty := d.GetOk("name") 59 | if !nameNonEmpty { 60 | return diag.Errorf("Name of record not set") 61 | } 62 | 63 | recordType, typeNonEmpty := d.GetOk("type") 64 | if !typeNonEmpty { 65 | return diag.Errorf("Type of record not set") 66 | } 67 | 68 | value, valueNonEmpty := d.GetOk("value") 69 | if !valueNonEmpty { 70 | return diag.Errorf("Value of record not set") 71 | } 72 | 73 | opts := api.CreateRecordOpts{ 74 | ZoneID: zoneID.(string), 75 | Name: name.(string), 76 | Type: recordType.(string), 77 | Value: value.(string), 78 | } 79 | 80 | tTL, tTLNonEmpty := d.GetOk("ttl") 81 | if tTLNonEmpty { 82 | nonEmptyTTL := tTL.(int) 83 | opts.TTL = &nonEmptyTTL 84 | } 85 | 86 | record, err := client.CreateRecord(opts) 87 | if err != nil { 88 | log.Printf("[ERROR] Error creating DNS record %s: %s", opts.Name, err) 89 | return diag.Errorf("Error creating DNS record %s: %s", opts.Name, err) 90 | } 91 | 92 | d.SetId(record.ID) 93 | return resourceRecordRead(c, d, m) 94 | } 95 | 96 | func resourceRecordRead(c context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 97 | log.Printf("[DEBUG] Reading resource record") 98 | client := m.(*api.Client) 99 | 100 | id := d.Id() 101 | record, err := client.GetRecord(id) 102 | if err != nil { 103 | return diag.Errorf("Error getting record with id %s: %s", id, err) 104 | } 105 | 106 | if record == nil { 107 | log.Printf("[WARN] DNS record with id %s doesn't exist, removing it from state", id) 108 | d.SetId("") 109 | return nil 110 | } 111 | 112 | d.SetId(record.ID) 113 | d.Set("name", record.Name) 114 | d.Set("zone_id", record.ZoneID) 115 | d.Set("type", record.Type) 116 | 117 | d.Set("ttl", nil) 118 | if record.HasTTL() { 119 | d.Set("ttl", record.TTL) 120 | } 121 | d.Set("value", record.Value) 122 | 123 | return nil 124 | } 125 | 126 | func resourceRecordUpdate(c context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 127 | log.Printf("[DEBUG] Updating resource record") 128 | client := m.(*api.Client) 129 | 130 | id := d.Id() 131 | record, err := client.GetRecord(id) 132 | if err != nil { 133 | return diag.Errorf("Error getting record with id %s: %s", id, err) 134 | } 135 | 136 | if record == nil { 137 | log.Printf("[WARN] DNS record with id %s doesn't exist, removing it from state", id) 138 | d.SetId("") 139 | return nil 140 | } 141 | 142 | if d.HasChanges("name", "ttl", "type", "value") { 143 | record.Name = d.Get("name").(string) 144 | 145 | record.TTL = nil 146 | ttl, ttlNonEmpty := d.GetOk("ttl") 147 | if ttlNonEmpty { 148 | ttl := ttl.(int) 149 | record.TTL = &ttl 150 | } 151 | record.Type = d.Get("type").(string) 152 | record.Value = d.Get("value").(string) 153 | 154 | record, err = client.UpdateRecord(*record) 155 | if err != nil { 156 | return diag.FromErr(err) 157 | } 158 | } 159 | 160 | return resourceRecordRead(c, d, m) 161 | } 162 | 163 | func resourceRecordDelete(c context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 164 | log.Printf("[DEBUG] Deleting resource record") 165 | 166 | client := m.(*api.Client) 167 | recordID := d.Id() 168 | 169 | err := client.DeleteRecord(recordID) 170 | if err != nil { 171 | log.Printf("[ERROR] Error deleting record %s: %s", recordID, err) 172 | return diag.FromErr(err) 173 | } 174 | 175 | return nil 176 | } 177 | -------------------------------------------------------------------------------- /hetznerdns/resource_record_test.go: -------------------------------------------------------------------------------- 1 | package hetznerdns 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | "testing" 7 | 8 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" 9 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" 10 | ) 11 | 12 | func TestAccRecordResources(t *testing.T) { 13 | // aZoneName must be a valid DNS domain name with an existing TLD 14 | aZoneName := fmt.Sprintf("%s.online", acctest.RandString(10)) 15 | aZoneTTL := 60 16 | 17 | aValue := "192.168.1.1" 18 | aName := acctest.RandString(10) 19 | aType := "A" 20 | aTTL := aZoneTTL * 2 21 | 22 | resource.Test(t, resource.TestCase{ 23 | PreCheck: func() { testAccAPITokenPresent(t) }, 24 | ProviderFactories: testAccProviders, 25 | Steps: []resource.TestStep{ 26 | { 27 | Config: testAccRecordResourceConfigCreate(aZoneName, aZoneTTL, aName, aType, aValue, aTTL), 28 | PreventDiskCleanup: true, 29 | Check: resource.ComposeTestCheckFunc( 30 | resource.TestCheckResourceAttrSet( 31 | "hetznerdns_record.record1", "id"), 32 | resource.TestCheckResourceAttr( 33 | "hetznerdns_record.record1", "type", aType), 34 | resource.TestCheckResourceAttr( 35 | "hetznerdns_record.record1", "name", aName), 36 | resource.TestCheckResourceAttr( 37 | "hetznerdns_record.record1", "value", aValue), 38 | resource.TestCheckResourceAttr( 39 | "hetznerdns_record.record1", "ttl", strconv.Itoa(aTTL)), 40 | ), 41 | }, 42 | }, 43 | }) 44 | } 45 | 46 | func testAccRecordResourceConfigCreate(aZoneName string, aZoneTTL int, aName string, aType string, aValue string, aTTL int) string { 47 | return fmt.Sprintf(` 48 | resource "hetznerdns_zone" "zone1" { 49 | name = "%s" 50 | ttl = %d 51 | } 52 | 53 | resource "hetznerdns_record" "record1" { 54 | zone_id = "${hetznerdns_zone.zone1.id}" 55 | type = "%s" 56 | name = "%s" 57 | value = "%s" 58 | ttl = %d 59 | } 60 | `, aZoneName, aZoneTTL, aType, aName, aValue, aTTL) 61 | } 62 | 63 | func TestAccRecordWithDefaultTTLResources(t *testing.T) { 64 | // aZoneName must be a valid DNS domain name with an existing TLD 65 | aZoneName := fmt.Sprintf("%s.online", acctest.RandString(10)) 66 | aZoneTTL := 3600 67 | 68 | aValue := "192.168.1.1" 69 | aName := acctest.RandString(10) 70 | aType := "A" 71 | 72 | resource.Test(t, resource.TestCase{ 73 | PreCheck: func() { testAccAPITokenPresent(t) }, 74 | ProviderFactories: testAccProviders, 75 | Steps: []resource.TestStep{ 76 | { 77 | Config: testAccRecordResourceConfigCreateWithDefaultTTL(aZoneName, aZoneTTL, aName, aType, aValue), 78 | PreventDiskCleanup: true, 79 | Check: resource.ComposeTestCheckFunc( 80 | resource.TestCheckResourceAttrSet( 81 | "hetznerdns_record.record1", "id"), 82 | resource.TestCheckResourceAttr( 83 | "hetznerdns_record.record1", "type", aType), 84 | resource.TestCheckResourceAttr( 85 | "hetznerdns_record.record1", "name", aName), 86 | resource.TestCheckResourceAttr( 87 | "hetznerdns_record.record1", "value", aValue), 88 | resource.TestCheckResourceAttr("hetznerdns_record.record1", "ttl.#", "0"), 89 | ), 90 | }, 91 | }, 92 | }) 93 | } 94 | 95 | func testAccRecordResourceConfigCreateWithDefaultTTL(aZoneName string, aZoneTTL int, aName string, aType string, aValue string) string { 96 | return fmt.Sprintf(` 97 | resource "hetznerdns_zone" "zone1" { 98 | name = "%s" 99 | ttl = %d 100 | } 101 | 102 | resource "hetznerdns_record" "record1" { 103 | zone_id = "${hetznerdns_zone.zone1.id}" 104 | type = "%s" 105 | name = "%s" 106 | value = "%s" 107 | } 108 | `, aZoneName, aZoneTTL, aType, aName, aValue) 109 | } 110 | 111 | func TestAccTwoRecordResources(t *testing.T) { 112 | // aZoneName must be a valid DNS domain name with an existing TLD 113 | aZoneName := fmt.Sprintf("%s.online", acctest.RandString(10)) 114 | 115 | aValue := "192.168.1.1" 116 | anotherValue := "192.168.1.2" 117 | aName := acctest.RandString(10) 118 | anotherName := acctest.RandString(10) 119 | aType := "A" 120 | aTTL := 60 121 | 122 | resource.Test(t, resource.TestCase{ 123 | PreCheck: func() { testAccAPITokenPresent(t) }, 124 | ProviderFactories: testAccProviders, 125 | Steps: []resource.TestStep{ 126 | { 127 | Config: testAccRecordResourceConfigCreateTwo(aZoneName, aName, anotherName, aType, aValue, anotherValue, aTTL), 128 | PreventDiskCleanup: true, 129 | Check: resource.ComposeTestCheckFunc( 130 | resource.TestCheckResourceAttrSet( 131 | "hetznerdns_record.record1", "id"), 132 | resource.TestCheckResourceAttrSet( 133 | "hetznerdns_record.record2", "id"), 134 | ), 135 | }, 136 | }, 137 | }) 138 | } 139 | 140 | func testAccRecordResourceConfigCreateTwo(aZoneName string, aName string, anotherName string, aType string, aValue string, anotherValue string, aTTL int) string { 141 | return fmt.Sprintf(` 142 | resource "hetznerdns_zone" "zone1" { 143 | name = "%s" 144 | ttl = %d 145 | } 146 | 147 | resource "hetznerdns_record" "record1" { 148 | zone_id = "${hetznerdns_zone.zone1.id}" 149 | type = "%s" 150 | name = "%s" 151 | value = "%s" 152 | ttl = %d 153 | } 154 | 155 | resource "hetznerdns_record" "record2" { 156 | zone_id = "${hetznerdns_zone.zone1.id}" 157 | type = "%s" 158 | name = "%s" 159 | value = "%s" 160 | ttl = %d 161 | } 162 | `, aZoneName, aTTL, aType, aName, aValue, aTTL, aType, anotherName, anotherValue, aTTL) 163 | } 164 | -------------------------------------------------------------------------------- /hetznerdns/resource_zone.go: -------------------------------------------------------------------------------- 1 | package hetznerdns 2 | 3 | import ( 4 | "context" 5 | "github.com/hashicorp/terraform-plugin-sdk/v2/diag" 6 | "log" 7 | 8 | "github.com/timohirt/terraform-provider-hetznerdns/hetznerdns/api" 9 | 10 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 11 | ) 12 | 13 | func resourceZone() *schema.Resource { 14 | return &schema.Resource{ 15 | CreateContext: resourceZoneCreate, 16 | ReadContext: resourceZoneRead, 17 | UpdateContext: resourceZoneUpdate, 18 | DeleteContext: resourceZoneDelete, 19 | Importer: &schema.ResourceImporter{ 20 | StateContext: schema.ImportStatePassthroughContext, 21 | }, 22 | 23 | Schema: map[string]*schema.Schema{ 24 | "name": { 25 | Type: schema.TypeString, 26 | Required: true, 27 | ForceNew: true, 28 | }, 29 | "ttl": { 30 | Type: schema.TypeInt, 31 | Required: true, 32 | }, 33 | }, 34 | } 35 | } 36 | 37 | func resourceZoneCreate(c context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 38 | log.Printf("[DEBUG] Creating resource zone") 39 | 40 | client := m.(*api.Client) 41 | 42 | var opts api.CreateZoneOpts 43 | if name, isOk := d.GetOk("name"); isOk { 44 | opts.Name = name.(string) 45 | } 46 | 47 | if ttl, isOk := d.GetOk("ttl"); isOk { 48 | opts.TTL = ttl.(int) 49 | } 50 | 51 | resp, err := client.CreateZone(opts) 52 | if err != nil { 53 | log.Printf("[ERROR] Creating resource zone failed: %s", err) 54 | d.SetId("") 55 | return diag.FromErr(err) 56 | } 57 | d.SetId(resp.ID) 58 | 59 | return resourceZoneRead(c, d, m) 60 | } 61 | 62 | func resourceZoneRead(c context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 63 | log.Printf("[DEBUG] Reading resource zone") 64 | client := m.(*api.Client) 65 | zoneID := d.Id() 66 | zone, err := client.GetZone(zoneID) 67 | if err != nil { 68 | log.Printf("[ERROR] Reading resource zone failed: %s", err) 69 | return diag.FromErr(err) 70 | } 71 | 72 | if zone == nil { 73 | log.Printf("[WARN] DNS zone with id %s doesn't exist, removing it from state", zoneID) 74 | d.SetId("") 75 | return nil 76 | } 77 | 78 | d.Set("name", zone.Name) 79 | d.Set("ttl", zone.TTL) 80 | 81 | return nil 82 | } 83 | 84 | func resourceZoneUpdate(c context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 85 | log.Printf("[DEBUG] Updating resource zone") 86 | client := m.(*api.Client) 87 | zoneID := d.Id() 88 | zone, err := client.GetZone(zoneID) 89 | if err != nil { 90 | return diag.FromErr(err) 91 | } 92 | 93 | if zone == nil { 94 | log.Printf("[WARN] DNS zone with id %s doesn't exist, removing it from state", zoneID) 95 | d.SetId("") 96 | return nil 97 | } 98 | 99 | d.Partial(true) 100 | if d.HasChange("ttl") { 101 | zone.TTL = d.Get("ttl").(int) 102 | zone, err = client.UpdateZone(*zone) 103 | if err != nil { 104 | return diag.FromErr(err) 105 | } 106 | } 107 | 108 | d.Partial(false) 109 | 110 | return resourceZoneRead(c, d, m) 111 | } 112 | 113 | func resourceZoneDelete(c context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { 114 | log.Printf("[DEBUG] Deleting resource zone") 115 | 116 | client := m.(*api.Client) 117 | zoneID := d.Id() 118 | 119 | err := client.DeleteZone(zoneID) 120 | if err != nil { 121 | log.Printf("[ERROR] Error deleting zone %s: %s", zoneID, err) 122 | return diag.FromErr(err) 123 | } 124 | 125 | return nil 126 | } 127 | -------------------------------------------------------------------------------- /hetznerdns/resource_zone_test.go: -------------------------------------------------------------------------------- 1 | package hetznerdns 2 | 3 | import ( 4 | "fmt" 5 | "strconv" 6 | "testing" 7 | 8 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" 9 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" 10 | ) 11 | 12 | func init() { 13 | resource.AddTestSweepers("resource_source_zone", &resource.Sweeper{ 14 | Name: "hetznerdns_zone_resource", 15 | }) 16 | } 17 | 18 | func TestAccZoneResources(t *testing.T) { 19 | // aName must be a valid DNS domain name with an existing TLD 20 | aName := fmt.Sprintf("%s.online", acctest.RandString(10)) 21 | aTTL := 60 22 | 23 | resource.Test(t, resource.TestCase{ 24 | PreCheck: func() { testAccAPITokenPresent(t) }, 25 | ProviderFactories: testAccProviders, 26 | Steps: []resource.TestStep{ 27 | { 28 | Config: testAccZoneResourceConfigCreate(aName, aTTL), 29 | PreventDiskCleanup: true, 30 | Check: resource.ComposeTestCheckFunc( 31 | resource.TestCheckResourceAttr( 32 | "hetznerdns_zone.zone1", "name", aName), 33 | resource.TestCheckResourceAttr( 34 | "hetznerdns_zone.zone1", "ttl", strconv.Itoa(aTTL)), 35 | ), 36 | }, 37 | }, 38 | }) 39 | } 40 | 41 | func testAccZoneResourceConfigCreate(name string, ttl int) string { 42 | return fmt.Sprintf(` 43 | resource "hetznerdns_zone" "zone1" { 44 | name = "%s" 45 | ttl = %d 46 | } 47 | `, name, ttl) 48 | } 49 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" 5 | plugin "github.com/hashicorp/terraform-plugin-sdk/v2/plugin" 6 | "github.com/timohirt/terraform-provider-hetznerdns/hetznerdns" 7 | ) 8 | 9 | func main() { 10 | plugin.Serve(&plugin.ServeOpts{ 11 | ProviderFunc: func() *schema.Provider { 12 | return hetznerdns.Provider() 13 | }, 14 | }) 15 | } 16 | -------------------------------------------------------------------------------- /scripts/gofmtcheck.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | echo "==> Checking that code complies with gofmt requirements..." 3 | files=$(gofmt -l `find . -name '*.go'`) 4 | if [[ -n ${files} ]]; then 5 | echo 'The following files do not comply with gofmt requirements:' 6 | echo "${files}" 7 | echo "Run \`make fmt\` to reformat your code." 8 | exit 1 9 | fi 10 | 11 | exit --------------------------------------------------------------------------------