This repository has been archived by the owner on Aug 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Refactor for terraform-plugin-go SDK and introduce OpenAPI planner #151
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
* Adapt usage of AttributePath to newest interface. * Fix some unit tests
…xtensions.v1beta1.JSONSchemaProps
Refurbish logging to use go-hclog to be Terraform friendly and respect log levels
apiextensions.v1beta1.CustomResourceSubresourceStatus to the OpenAPI type generator.
Don't return error when setting diagnostics on the response
…tics * Relax resource validation since not all have 'spec' and some have other ot top-level attributes
…improve unit tests
* Reformat actions yaml manifests * Only run on pushes to master and main, or pull-requests
* Reformat github action mainfest with YAML formatter (VSCode YAML by RedHat)
aareet
approved these changes
Mar 8, 2021
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.
🚢
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
ghost
locked as resolved and limited conversation to collaborators
Apr 8, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 change reflects a major refactoring of the provider, primarily to transition to using the new Terraform low-level SDK
In addition to that, the following important changes are included in this PR:
Planning using type information from
OpenAPI
The provider no longer supports
server_side_planning
as an option.Instead, we introduce so called local-planing as the single method of planning. This means the provider now queries the cluster for the OpenAPI spec document and uses the OpenAPI type information for expanding the resource during plan. This has the fundamental advantage that it allows Terraform to understand and record the entire set of attributes of a resource after the first plan, even if not all actually have values configured by the user.
This is crucial for ensuring a reliable resource life-cycle as Terraform does not accept modifications to a resources type structure (adding or removing attributes) after it was first recorded in the state file. Note that this does not refer to attribute values which can be freely set and changed, but rather to the type structure (available set of attributes in a resource).
Previously, the provider implemented two alternatives for producing a plan.
By selected by setting
server_side_planning = true
, the provider would make a dry-run "Patch" call to the cluster during the plan phase and use the response to populate the plan. This ensured that any "computed" values from the API would be included in the plan and the plan would not produce cyclic diffs. However, this method could not guarantee that the plan structure included all possible attributes of the resource and could potentially lead to apply failures when additional attributes would be added later on.By selected by setting
server_side_planning = false
the provider would simply just use the configuration supplied by the user inmanifest
as the plan and added no other attribute information to it. This had roughly the same disadvantages as the first method, most importantly not capturing the entire structure of the resource type during plan and leading to the same class of issues later on.Note:
The acceptance tests are using deprecated packages and need to be re-written for the test helpers in the new SDK
These changes have been however extensively tested with real-world manifests from well known Kubernetes applications, among which: Flux v2, ArgoCD, Jetstack CertManager, Thanos, Prometheus Operator, Terraform Cloud Operator, Vault and others.
Some reference modules based on this provider release are available in the Terraform Registry.
Release Note
Release note for CHANGELOG:
References
Fixes #3
Fixes #21
Fixes #33
Fixes #34
Fixes #35
Fixes #43
Fixes #48
Fixes #57
Fixes #59
Fixes #69
Fixes #72
Fixes #76
Fixes #88
Fixes #110
Fixes #135
Fixes #143
Fixes #144
Fixes #149
Community Note