-
Notifications
You must be signed in to change notification settings - Fork 47
[FeatureRequest: Issue #268] Major upgrade to Terraform SDK 2.0 #274
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
Merged
Conversation
This file contains hidden or 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
b238ee2 to
ed73607
Compare
- Terraform Plugin SDK v2 Upgrade Guide: https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#version-2-of-the-module - Updated readme to include compatible GO version for SDK 2.0 https://github.com/hashicorp/terraform-plugin-sdk#go-compatibility
…/hashcode Terraform Plugin SDK v2 Upgrade Guide: https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#removal-of-helper-hashcode-package
…deprecation notice // Providers is the ResourceProvider that will be under test. // Deprecated: Providers is deprecated, please use ProviderFactories
…delines - Terraform Plugin SDK v2 Upgrade Guide: Removal of the terraform.ResourceProvider Interface https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#removal-of-the-terraform-resourceprovider-interface
As per Terraform notes: It is recommended, but not required, that providers that have not already dropped support for 0.11 issue a major version bump when upgrading to version 2 of the SDK, to indicate this dropped support. https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#dropped-support-for-terraform-0-11-and-below https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#version-2-of-the-module
6b129c8 to
eff1b13
Compare
Codecov Report
@@ Coverage Diff @@
## master #274 +/- ##
==========================================
+ Coverage 90.97% 92.00% +1.03%
==========================================
Files 61 60 -1
Lines 3091 3041 -50
==========================================
- Hits 2812 2798 -14
+ Misses 184 164 -20
+ Partials 95 79 -16
Continue to review full report at Codecov.
|
28be277 to
3d2b872
Compare
52 tasks
31c866c to
cc3f054
Compare
…' Module As per Terraform notes: It is recommended, but not required, that providers that have not already dropped support for 0.11 issue a major version bump when upgrading to version 2 of the SDK, to indicate this dropped support. https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#dropped-support-for-terraform-0-11-and-below https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#version-2-of-the-module
- Terraform Plugin SDK v2 Upgrade Guide: Using a *helper/schema.Resource
as the value of the Elem property for a *helper/schema.Schema previously
yielded unspecified and likely confusing behavior, and was unsupported. It now returns an error.
https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#more-robust-validation-of-helper-schema-typemap-elems
Internal notes:
- This commit introduces breaking changes and OpenAPI property of type object will now be translated into a Terraform
schema of TypeList with Elem *Resource and MaxItems 1 (read more in the openapi_terraform_provider_v1.0.0.md)
- Deprecated the extension `x-terraform-complex-object-legacy-config` since object type now follow the extension's behaviour
by default (read more in the how_to.md)
- Removed from SpecSchemaDefinitionProperty the field EnableLegacyComplexObjectBlockConfiguration that mapped to the x-terraform-complex-object-legacy-config extension
- convertPayloadToLocalStateDataValue no longer accepts `useString bool` as that was introduced as a workaround to be
able to support helper/schema.TypeMap with *helper/schema.Resource as the value of the Elem property which expected data stored
in the state as string no matter what type the actual what type the key property of the hashmap was. This eliminates the undefined behaviour not supported with using helper/schema.TypeMap with *helper/schema.Resource as the value of the Elem property.
- populatePayload no longer expects string types to not match the actual proeprty type, which was the case when processing hashmaps properties due to how Terraform
stores the data as string.
- Fixed unit tests and integration tests
- updated release notes with deprecated support for OpenAPI property type object with internal Terraform schema representation
of TypeMap with Elem *Resource
…ud functions
- Terraform Plugin SDK v2 Upgrade Guide: A number of new functions have been added that return a diag.Diagnostics type. This type can be used to return multiple errors and warnings to Terraform, and to associate those errors or warnings with specific fields. The functions supporting diagnostics are: helper/schema.CreateContextFunc, helper/schema.ReadContextFunc, helper/schema.UpdateContextFunc and helper/schema.DeleteContextFunc.
https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#support-for-diagnostics
- Terraform Plugin SDK v2 Upgrade Guide: The helper/schema.Resource and helper/schema.Schema types both now have Description properties that accept strings. These properties are laying the groundwork for future improvements to Terraform, and will have no visible effect to the Terraform CLI at the moment. If you’d like to build in support for your provider starting now, it’s recommended that you set these properties to whatever you’d document the resource or field as in your terraform.io docs for the resource. You can globally set the format of the text in these fields by setting the global variable helper/schema.DescriptionKind. Its acceptable values are helper/schema.StringPlain (plain text, the default) or helper/schema.StringMarkdown (markdown formatting).
https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#support-for-resource-level-and-field-level-descriptions
- Terraform Plugin SDK v2 Upgrade Guide: The helper/schema.SchemaValidateFunc type and the properties that use it, including helper/schema.Schema.ValidateFunc, are now deprecated in favor of helper/schema.SchemaValidateDiagFunc, which gains awareness for diagnostics, allowing more accurate errors to be returned. The helper/validation helper functions will have helper/schema.SchemaValidateDiagFunc equivalents of the validation functions added in a future release to ease the transition. Until that point, a wrapper can be used that wraps the warnings and errors returned from helper/schema.SchemaValidateFunc in a diag.Diagnostics. https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#deprecation-of-helper-schema-schemavalidatefunc
Terraform SDK requires Go 1.14 or later when compiling the provider.
… make the plugin fail upon startup - the regex now matches only against the last match and grabs the last name found
- It is now possible to publish providers that can have debuggers like delve attached to them. To debug these providers, three things must be done. First, Terraform 0.12.26 or higher must be used when debugging. Second, the provider must modify its main function to optionally start a debuggable server. We recommend the following approach: https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#deprecation-of-helper-schema-schemavalidatefunc Link: https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#support-for-debuggable-provider-binaries This commit includes the following changes: - If the plugin is called with the debuggable flag, the plugin will be initialized using the debug functionality. The env variable can also be provided optionality to set the providers address accordingly. - The installation script has been updated to support only Terraform 0.12 and greater versions of installation modes. - The example service providers (swaggercodegen and goa) have been updated accordingly to specify the required_providers as well as the source address. - Updates in the installation documentation to reflect new changes
cc3f054 to
a74b7f3
Compare
6e406ab to
284e93b
Compare
284e93b to
adee174
Compare
74b14be to
b5d3f84
Compare
- Use OpenAPI instead of Swagger
…napi' Module As per Terraform notes: It is recommended, but not required, that providers that have not already dropped support for 0.11 issue a major version bump when upgrading to version 2 of the SDK, to indicate this dropped support. - https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#dropped-support-for-terraform-0-11-and-below - https://www.terraform.io/docs/extend/guides/v2-upgrade-guide.html#version-2-of-the-module
…ud functions for data sources - Moved crudWithContext from resourceFactory to common so the same logic can be reused by the resource factory and data factories
b5d3f84 to
003cd05
Compare
- Fix import issues
- This latest version seems to fix some issues with the SDK and integration tests - Updated documentation to make it clear Terraform v0.12.26 or later is needed when running the integration tests
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.
What problem does this Pull Request solve?
Please link to the issue number here (issue will be closed when PR is merged): Closes #268
Terraform Plugin SDK v2 Upgrade checklist:
Type of change
What type of change does your code introduce to the provider? Please put an
x(w/o heading/trailing white spaces) in the boxes that apply:Checklist
Please put an
x(w/o heading/trailing white spaces) in the boxes that apply:make test-all[FeatureRequest: Issue #X] <PR Title>[BugFix: Issue #X] <PR Title>[TechDebt: Issue #X] <PR Title>[NewRelease] vX.Y.ZChecklist for Admins