-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade SDK to v2.x & Drop Terraform 0.11 support #246
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is the result of running the tf-sdk-migrator tool
This complex API behavior (https://github.com/hashicorp/terraform-provider-tfe/blob/1836332f965b90962c2b852b86baa7b9482bbcac/website/docs/r/team_access.html.markdown#L41-L52) was bound to have _something_ to change in V2 of the SDK. Per hashicorp/terraform-plugin-sdk@83c83c4 : These schema validations are now not allowed for computed attributes, as it is assumed that computed attributes are *always* computed; this API, however, relies on the fact that a user can specify either "access" or "permissions" and whichever is not specified is computed, and vice-versa. With this removal, it's sadly possible to specify multiple "permissions" blocks without an error (but there should be); this will result in a plan attempting to add a second set of permissions that results in a no-op (as only the first item in the permissions list is used). It's probably possible to munge further into the CustomizeDiff logic to just return an error ourselves at plan time should there be data at "permissions.1.*", but I'm not going to touch that right now.
The output in V2 of the SDK must have changed slightly, as the whitespacing looks ever so different and the messages aren't anchored to the beginning of the line as expected here, so the tests fail. The regexs here don't need to be this strict. Search for the substring and that's a-ok.
In V2 of the SDK, acceptance tests are done using a real Terraform binary and not via the inner workings of Terraform itself. By default, the latest version of Terraform is installed and used (unless specified via options to use a path or version) In upgrading to the V2 SDK, it seems that we actually have some test configurations that are not compatible with 0.13 (the current version, as of this writing), and cause tests to fail: === FAIL: tfe TestAccTFEOrganizationMembershipDataSource_basic (1.60s) data_source_organization_membership_****.go:16: Step 1/1 error: Error running pre-apply plan: Error: Error retrieving organization memberships: resource not found === FAIL: tfe TestAccTFEWorkspaceIDsDataSource_basic (1.56s) data_source_workspace_ids_****.go:16: Step 1/1 error: Error running pre-apply plan: Error: Error retrieving workspaces: resource not found This issue is due to a known issue with 0.13, issue number 26074 on hashicorp/terraform, and I confirmed that even using SDKv1 these tests fail if you use Terraform 0.13. Because of this, let's just force usage of 0.12 (which is how things are run now) and fix these configurations separately.
Now that the upgrade is complete, bump from 2.0 to 2.3
chrisarcand
requested review from
koikonom,
mikenomitch,
lafentres and
radditude
November 23, 2020 05:03
radditude
approved these changes
Dec 2, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, and local testing was all green!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR upgrades the provider to use the v2.x of the Terraform SDK. This allows for a number of benefits for provider development; the V2 upgrade guide is a great overview of some of the initial changes.
As a result of this major SDK upgrade, only Terraform CLI 0.12 and later can be supported past the current release (0.23.0). Users who wish to continue using Terraform 0.11 may continue to use version 0.23.x or earlier. This move will also consolidate all example code to use Terraform 0.12 syntax. Examples using the older syntax style can still be viewed by browsing older versions of the provider in the Terraform Registry.
The announcement that official HashiCorp-maintained providers would be dropping support for Terraform 0.11 was made in November 2019, over a year ago.
In Detail
CreateFunc
, etc).Upgrading
Upgrade details will be found in the release notes, but in case you've found your way here, instead:
No configuration changes should be necessary in using this provider (changes might be necessary in upgrading to Terraform 0.12+, though). As mentioned in this provider's documentation, it is considered best practice to pin a provider version to avoid bringing in potentially breaking changes automatically. To remain on previous versions of the provider until such time that you are able to accommodate upgrading to Terraform 0.12+, pin the installed version. Remember that as this provider is pre-1.0, 'minor' changes may signal breaking changes. In this example, we pin our configuration to only use patch versions of 0.23.x:
Terraform 0.13+
Terraform 0.12
Full documentation on how to pin a version of a provider can be found on the Terraform Website.
Testing plan
All resources and APIs should be thoroughly tested to ensure no regressions with the major SDK upgrade.
Closes #108