-
Notifications
You must be signed in to change notification settings - Fork 89
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
Remove immutable fields from initProvider #384
Comments
Consensus from discussion at the Upjet SIG meeting was to consider this in tandem with larger changes to the |
Can you help me understand why this would be very strange? To me, it's almost more intuitive to use |
Cem and Alper were confused about this too. I explained at the SIG meeting. Basically my mental model as a user of crossplane is that It sounds like this is not quite the same mental model of this feature that some of the crossplane developers have, which is a valid point of view that I just wasn't aware of. It seems like a "typical" crossplane user could potentially be thinking about the feature either way. My recollection/restating of what @mergenci said was that the actual implementation of this feature in upjet works by always merging @mergenci @ulucinar Does my summary of our conversation look right to you? |
I wonder if this boils down to whether or not you're starting from Terraform's FWIW, I was the one who pushed for |
What problem are you facing?
In provider-upjet-aws, there are many resources which use the
config.IdentifierFromProvider
external name config, which doesn't set any identifier fields. However, many of these resources do have fields which serve as an identifier, in that they are part of the terraform id. It would provide a better user experience to update the external name configuration to construct the terraform id from the parameters, so that users can specify the desiredspec
and not have to worry about whether crossplane is going to create or update it, as opposed to the current behavior where often (but not always) users have to set the external-name annotation to the right format for that resourceKind
, which is generally not documented anywhere.When opening PRs that make these sorts of improvements to an external name configuration, the result is technically a breaking schema change, because it removes fields from
spec.initProvider
, and there's (understandably!) resistance to releasing such changes in a normal minor release.While the terraform schema doesn't provide any specific indication that certain fields are part of the terraform id, it does indicate immutable fields with
ForceNew: true
(at least in the TF SDKv2 form of the schema), and identifier fields are almost always immutable.How could Upjet help solve your problem?
If we removed immutable fields from
initProvider
(based onForceNew: true
), then we would substantially reduce the size of our schemas, and allow external name config improvements to be non-breaking, at the cost of removing a feature it makes no sense to use.In provider-aws, the result of applying this change locally was a decrease of about 60,000 lines of generated code in the CRDs, and another 40,000 lines in the
apis
folder.How can we identify an immutable field?
For schemas defined using the TF SDKv2, there's a
ForceNew
parameter.For schemas deserialized to the TF SDKv2 format from terraform-json, as far as I can tell there is no indication of which fields are immutable.
For Terraform Plugin Framework schemas, there is a
RequiresReplace
plan modifier. See https://github.com/hashicorp/terraform-provider-aws/blob/898c9b5a1d8958366b293dad02daa44e24e360ef/internal/service/cognitoidp/user_pool_client.go#L237-L241 for an example.Breaking change
This would be a breaking change. I can think of two ways to release it.
v1beta1.initProvider
and missing fromv1beta2.initProvider
by setting the corresponding value inv1beta2.forProvider
I'd really prefer our conversion webhooks to be a bit more mature before we add one to nearly every resource, with issues like Code generation error: Import cycle not allowed #368 and Stability improvements to conversion webhooks #369 addressed.The text was updated successfully, but these errors were encountered: