-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Description
Version 2 of the Terraform Plugin SDK has been released and this codebase has been migrated to this newer version in order to support future enhancements such as:
- Performing acceptance testing against Terraform 0.13
- Gracefully interrupting Terraform operations (e.g. Control-c)
- Allowing resources to provide warning messages in the Terraform user interface
- Allowing schema validation to provide the file and line numbers of failing Terraform configuration source code
This type of change mostly affects open pull requests adjusting Go code import
statements and new data sources/resources. The fix is generally just to update the SDK imports.
For example, given the previous code imports in a pull request:
"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/terraform"
Can be replaced with their version 2 counterpart:
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
Additionally, some version 1 code imports are now internalized. Given these previous imports:
"github.com/hashicorp/terraform-plugin-sdk/helper/hashcode"
"github.com/hashicorp/terraform-plugin-sdk/helper/mutexkv"
They can be replaced with their internal counterpart:
"github.com/terraform-providers/terraform-provider-aws/aws/internal/hashcode"
"github.com/terraform-providers/terraform-provider-aws/aws/internal/mutexkv"
Some example errors when a pull request contains an older version of the SDK while the current code contains the newer version of the SDK includes:
cannot use headersConf() (value of type *"github.com/hashicorp/terraform-plugin-sdk/helper/schema".Set) as *"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema".Set value in argument to expandStringSet
cannot use testAccProviders (variable of type map[string]*schema.Provider) as map[string]"github.com/hashicorp/terraform-plugin-sdk/terraform".ResourceProvider value in struct literal
panic: gob: registering duplicate types for "*tfdiags.rpcFriendlyDiag": *tfdiags.rpcFriendlyDiag != *tfdiags.rpcFriendlyDiag
An automated bot response will occur for pull requests containing the old imports that are updated after today, however existing pull requests may require the import updates above.