Skip to content

Commit dbc9b51

Browse files
committed
Merge remote-tracking branch 'upstream/master' into pulumi-master
2 parents 328eb4f + 6f728bc commit dbc9b51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+5557
-5461
lines changed

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ commands:
1616
jobs:
1717
"docker-go114 build":
1818
docker:
19-
- image: circleci/golang:1.14
19+
- image: docker.mirror.hashicorp.services/circleci/golang:1.14
2020
steps:
2121
- get_dependencies
2222
- run: go build ./...
2323
"docker-go114 test":
2424
docker:
25-
- image: circleci/golang:1.14
25+
- image: docker.mirror.hashicorp.services/circleci/golang:1.14
2626
environment:
2727
TF_ACC_TERRAFORM_VERSION: "0.12.26"
2828
parameters:
@@ -44,19 +44,19 @@ jobs:
4444
path: << parameters.test_results >>
4545
"docker-go114 vet":
4646
docker:
47-
- image: circleci/golang:1.14
47+
- image: docker.mirror.hashicorp.services/circleci/golang:1.14
4848
steps:
4949
- get_dependencies
5050
- run: go vet ./...
5151
"docker-go114 gofmt":
5252
docker:
53-
- image: circleci/golang:1.14
53+
- image: docker.mirror.hashicorp.services/circleci/golang:1.14
5454
steps:
5555
- get_dependencies
5656
- run: ./scripts/gofmtcheck.sh
5757
"docker-go114 release":
5858
docker:
59-
- image: circleci/golang:1.14
59+
- image: docker.mirror.hashicorp.services/circleci/golang:1.14
6060
steps:
6161
- add_ssh_keys:
6262
fingerprints:

.go-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.14.2
1+
1.14.9

CHANGELOG.md

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,71 @@
1-
# 2.0.2 (Unreleased)
1+
# 2.4.0 (Unreleased)
2+
3+
ENHANCEMENTS
4+
5+
* Support `Unwrap` on SDK errors [GH-647]
6+
* Allow for `nil` errors in `diag.FromErr` [GH-623]
7+
* Added `validation.ToDiagFunc` helper to translate legacy validation functions into Diagnostics-aware validation functions. [GH-611]
8+
* Disable Checkpoint network connections during acceptance testing unless a Terraform binary needs to be installed. [GH-663]
9+
10+
BUG FIXES
11+
12+
* Check for `nil` errors prior to invoking `ErrorCheck` [GH-646]
13+
* More reliable handling of logging [GH-639]
14+
* Modified error text to make golint and go vet happy when a non-empty plan is found in testing and an empty plan was expected [GH-596]
15+
* Add `UseJSONNumber` to `helper/schema.Resource` to make it possible to represent large numbers precisely. Setting to `true` will make numbers appear as `json.Number` in `StateUpgrader`s instead of as `float64`. [GH-662]
16+
* Fix logs sometimes appearing in test output when running acceptance tests. [GH-665]
17+
18+
NOTES
19+
20+
We have removed the deprecation of the non-diagnostic version of validation until the build-in validations are ported to the new format.
21+
22+
# 2.3.0 (November 20, 2020)
23+
24+
ENHANCEMENTS
25+
26+
* `helper/schema.ResourceData` now has `HasChangeExcept` and `HasChangesExcept` methods to check if the resource has changes _besides_ a given key or list of keys. ([#558](https://github.com/hashicorp/terraform-plugin-sdk/issues/558))
27+
* `helper/resource.TestCase` now has an `ErrorCheck` property that can be set to a function, allowing the programmatic determination of whether to ignore an error or not. ([#592](https://github.com/hashicorp/terraform-plugin-sdk/issues/592))
28+
29+
# 2.2.0 (November 02, 2020)
30+
31+
FEATURES
32+
* Updated to use the new [`terraform-plugin-go`](https://github.com/hashicorp/terraform-plugin-go) library as a foundation for the SDK, enabling it to be used with [`terraform-plugin-mux`](https://github.com/hashicorp/terraform-plugin-mux) ([#630](https://github.com/hashicorp/terraform-plugin-sdk/issues/630))
33+
* Added the `TestCase.ProtoV5ProviderFactories` property to allow testing providers created with `terraform-plugin-go` with the `helper/resource` test framework. ([#630](https://github.com/hashicorp/terraform-plugin-sdk/issues/630))
34+
35+
# 2.1.0 (October 27, 2020)
36+
37+
FEATURES
38+
* Relaxed validation in `InternalValidate` for explicitly set `id` attributes ([#613](https://github.com/hashicorp/terraform-plugin-sdk/issues/613))
39+
* Ported TypeSet test check funcs essential for migrating to V2 of the SDK ([#614](https://github.com/hashicorp/terraform-plugin-sdk/issues/614))
40+
* Improved debug output for how to manually invoke the Terraform CLI ([#615](https://github.com/hashicorp/terraform-plugin-sdk/issues/615))
41+
42+
# 2.0.4 (October 06, 2020)
43+
44+
BUG FIXES
45+
* Fix a bug that would pass the post-destroy state to `helper/resource.TestCase.CheckDestroy` instead of the documented pre-destroy state ([#591](https://github.com/hashicorp/terraform-plugin-sdk/issues/591))
46+
* Clean up the final remaining places where test numbers or dangling resources warnings could be omitted from errors ([#578](https://github.com/hashicorp/terraform-plugin-sdk/issues/578))
47+
* Stop considering plans empty when they include data source changes ([#594](https://github.com/hashicorp/terraform-plugin-sdk/issues/594))
48+
49+
# 2.0.3 (September 15, 2020)
50+
51+
BUG FIXES
52+
53+
* Fixed a bug that would incorrectly mark tests using TestStep.ImportStateVerify as failed if they tested a resource with custom timeouts ([#576](https://github.com/hashicorp/terraform-plugin-sdk/issues/576))
54+
* Fixed a bug where errors destroying infrastructure after tests wouldn't be reported ([#581](https://github.com/hashicorp/terraform-plugin-sdk/issues/581))
55+
* Fixed a bug where test steps that expected a non-empty plan would fail because they had an empty plan, erroneously ([#580](https://github.com/hashicorp/terraform-plugin-sdk/issues/580))
56+
* Fixed a bug where the plan output shown when an unexpected diff was encountered during testing would be shown in JSON instead of a human-readable format ([#584](https://github.com/hashicorp/terraform-plugin-sdk/issues/584))
57+
58+
# 2.0.2 (September 10, 2020)
259

360
BUG FIXES
461

5-
* Fixed bug where state is read from the wrong workspace during import tests. [GH-552]
6-
* Fixed bug where the resource could belong to another provider when finding the resource state to check during import tests [GH-522]
7-
* Removed excessive logging when ExpectNonEmptyPlan was successfully matched [GH-556]
8-
* Fixed bug where state from data sources, which can't be imported, would be surfaced during ImportStateVerify [GH-555]
9-
* Fixed bug that ignored ExpectError when testing state imports [GH-550]
10-
* Fixed bug that sometimes prevented TestStep numbers from appearing in error output [GH-557]
11-
* Fixed bug that would ignore `TestStep.Destroy` when running tests. [GH-563]
12-
* Fixed bug where reattach info would not be supplied during tests. [GH-567]
62+
* Fixed bug where state is read from the wrong workspace during import tests. ([#552](https://github.com/hashicorp/terraform-plugin-sdk/issues/552))
63+
* Fixed bug where the resource could belong to another provider when finding the resource state to check during import tests ([#522](https://github.com/hashicorp/terraform-plugin-sdk/issues/522))
64+
* Removed excessive logging when ExpectNonEmptyPlan was successfully matched ([#556](https://github.com/hashicorp/terraform-plugin-sdk/issues/556))
65+
* Fixed bug where state from data sources, which can't be imported, would be surfaced during ImportStateVerify ([#555](https://github.com/hashicorp/terraform-plugin-sdk/issues/555))
66+
* Fixed bug that ignored ExpectError when testing state imports ([#550](https://github.com/hashicorp/terraform-plugin-sdk/issues/550))
67+
* Fixed bug that sometimes prevented TestStep numbers from appearing in error output ([#557](https://github.com/hashicorp/terraform-plugin-sdk/issues/557))
68+
* Fixed bug that would ignore `TestStep.Destroy` when running tests. ([#563](https://github.com/hashicorp/terraform-plugin-sdk/issues/563))
1369

1470
# 2.0.1 (August 10, 2020)
1571

Makefile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ test: fmtcheck generate
88
generate:
99
go generate ./...
1010

11-
# We separate the protobuf generation because most development tasks on
12-
# Terraform do not involve changing protobuf files and protoc is not a
13-
# go-gettable dependency and so getting it installed can be inconvenient.
14-
#
15-
# If you are working on changes to protobuf interfaces you may either use
16-
# this target or run the individual scripts below directly.
17-
protobuf:
18-
bash scripts/protobuf-check.sh
19-
bash internal/tfplugin5/generate.sh
20-
2111
fmt:
2212
gofmt -w $(GOFMT_FILES)
2313

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@ Terraform itself is a tool for building, changing, and versioning infrastructure
88

99
## Terraform CLI Compatibility
1010

11-
| Terraform CLI | SDK v1.x | SDK v2.x |
12-
|---|---|---|
13-
| 0.11 | Yes | No |
14-
| 0.12 | Yes* | Yes |
15-
| 0.13 | Yes* | Yes |
11+
Terraform 0.12.0 or later is needed for version 2.0.0 and later of the Plugin SDK.
1612

17-
_* SDK v1.x supports both Terraform 0.12 and 0.13, but in order to maintain compatibility with Terraform 0.11, it cannot take advantage of new features that are only available in newer versions._
13+
When running provider tests, Terraform 0.12.26 or later is needed for version 2.0.0 and later of the Plugin SDK. Users can still use any version after 0.12.0.
14+
15+
## Go Compatibility
16+
17+
The Terraform Plugin SDK is built in Go, and uses the [support policy](https://golang.org/doc/devel/release.html#policy) of Go as its support policy. The two latest major releases of Go are supported by the SDK.
18+
19+
Currently, that means Go **1.14** or later must be used when building a provider with the SDK.
20+
21+
## Getting Started
22+
23+
See the [Call APIs with Terraform Providers](https://learn.hashicorp.com/collections/terraform/providers) guide on [learn.hashicorp.com](https://learn.hashicorp.com) for a guided tour of provider development.
1824

1925
## Documentation
2026

@@ -49,6 +55,10 @@ See [Extending Terraform](https://www.terraform.io/docs/extend/index.html) secti
4955

5056
Migrating to the standalone SDK v1 is covered on the [Plugin SDK section](https://www.terraform.io/docs/extend/plugin-sdk.html) of the website.
5157

58+
## Migrating to SDK v2 from SDK v1
59+
60+
Migrating to the v2 release of the SDK is covered in the [v2 Upgrade Guide](https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html) of the website.
61+
5262
## Versioning
5363

5464
The Terraform Plugin SDK is a [Go module](https://github.com/golang/go/wiki/Modules) versioned using [semantic versioning](https://semver.org/).

diag/helpers.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import "fmt"
1010
// return diag.FromErr(err)
1111
// }
1212
func FromErr(err error) Diagnostics {
13+
if err == nil {
14+
return nil
15+
}
1316
return Diagnostics{
1417
Diagnostic{
1518
Severity: Error,

go.mod

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,22 @@ require (
1212
github.com/davecgh/go-spew v1.1.1
1313
github.com/go-test/deep v1.0.3
1414
github.com/golang/mock v1.4.3
15-
github.com/golang/protobuf v1.4.2
1615
github.com/golang/snappy v0.0.1
17-
github.com/google/go-cmp v0.5.0
16+
github.com/google/go-cmp v0.5.2
1817
github.com/hashicorp/errwrap v1.0.0
1918
github.com/hashicorp/go-cleanhttp v0.5.1
2019
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
21-
github.com/hashicorp/go-getter v1.4.2-0.20200106182914-9813cbd4eb02 // indirect
22-
github.com/hashicorp/go-hclog v0.9.2
20+
github.com/hashicorp/go-getter v1.5.0 // indirect
21+
github.com/hashicorp/go-hclog v0.15.0
2322
github.com/hashicorp/go-multierror v1.0.0
24-
github.com/hashicorp/go-plugin v1.3.0
23+
github.com/hashicorp/go-plugin v1.4.0
2524
github.com/hashicorp/go-uuid v1.0.1
2625
github.com/hashicorp/go-version v1.2.1
2726
github.com/hashicorp/hcl/v2 v2.3.0
2827
github.com/hashicorp/logutils v1.0.0
29-
github.com/hashicorp/terraform-exec v0.9.0
30-
github.com/hashicorp/terraform-json v0.5.0
31-
github.com/hashicorp/terraform-plugin-test/v2 v2.1.1
28+
github.com/hashicorp/terraform-exec v0.12.0
29+
github.com/hashicorp/terraform-json v0.8.0
30+
github.com/hashicorp/terraform-plugin-go v0.1.0
3231
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
3332
github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba
3433
github.com/kylelemons/godebug v1.1.0 // indirect
@@ -38,10 +37,8 @@ require (
3837
github.com/mitchellh/mapstructure v1.1.2
3938
github.com/mitchellh/reflectwalk v1.0.1
4039
github.com/pierrec/lz4 v2.0.5+incompatible
41-
github.com/ulikunitz/xz v0.5.7 // indirect
42-
github.com/vmihailenco/msgpack v4.0.1+incompatible // indirect
4340
github.com/zclconf/go-cty v1.2.1
4441
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
4542
golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed
46-
google.golang.org/grpc v1.30.0
43+
google.golang.org/grpc v1.32.0
4744
)

0 commit comments

Comments
 (0)