This is a huge release driven by the "simple" need to migrate the provider from TFSDK to Terraform Plugin Framework. Because the provider is already several years old, this represented an opportunity to improve how it works in accordance with refactoring required for TPF.
Great care was taken to avoid breaking changes, but please be mindful that this was an extensive set of changes!
To try this release candidate out, update your provider declaration like so:
terraform {
required_providers {
restapi = {
source = "Mastercard/restapi"
version = "3.0.0-rc1"
}
}
}
Changes
- Logging was revamped to use the terraform logging library across the board, so the level configured there will be the level used as the provider does it's work. The existing
debugparameter on the provider and objects will now only affect whether or not the client spits out the HTTP request and response to STDOUT as it work. This is separate and independent from the Terraform log stream and log level. - Moved to the latest terraform plugin framework. This should eliminate warnings (thanks for the report in #337, @twcchu) while also not affecting behaviors
- The default timeout for the HTTP client has been set to 30 seconds instead of "infinite"
- The provider now validates the URI provided is a parseable URI
- The provider now marks the password field as
sensitive. Thanks for the callout in #300, Dr-J-Watson!
Fixes
- Fixed some cases where some fields were not logged and clarify the request/response body in HTTP output. Thanks for the PR in #316, @rforen!
- Send empty JSON document (just
{}) when configured for (read|search|destroy_data) attributes - Correctly interpolate and append
{id}in paths which include query strings. Thanks for the PR in #339, @pregress! - Raise parameter errors when read_search's search key and value are not specified. Thanks for the report in #332, @toadjuane!
- Correctly inherit/append query string with read_search when the object has a query_string specified. Thanks for the heads up in #332, @zepeng811!
New
- In addition to username/password, added a new
bearer_tokenparameter to the provider in #301 - thanks, @Dr-J-Watson! - The provider now supports retries! To enable retry on failures (connection/TLS/etc errors or a 500-range response except 501), set max_attempts greater than 1 in
retries. Thanks for the idea in #315, @barrack1234! - Support
{id}interpolation inread_search.search_valueduring read operations. Thanks for the idea in @333, @toadjaune and the contribution in #295, @orgads! - Support a user-provided JSON patch to be applied during
read_searchoperations in case the API provides a response asymmetric to what was submitted. Thanks for the idea in #295, @orgads! - Add support for
ignore_server_additionswhich will watch for server changes only to fields present indata. Thanks for the PR in #336, @jor2! - Perform lazy client initialization to support planning when the URL for the provider isn't known yet. Thanks for the idea in #291, @A7exSchin
- Add
results_contains_objectto the data source to avoid a second read operation to the API. Thanks for the idea in #310, @cybrhwk!
Misc
- Obtain a clean HTTP client from terraform rather than the Go runtime. This avoids other providers possibly polluting the default client from affecting us.
- Along with revamping logging, the file name from which the log entry came is no longer logged.