-
Notifications
You must be signed in to change notification settings - Fork 230
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
Using ConflictsWith in a TypeSet not possible #1001
Comments
Hi @Junkern 👋 Thank you for raising this and sorry you ran into this potentially frustrating situation.
To answer your question there directly, yes. I'll explain below. Sets are conceptually an interesting implementation detail within the Terraform type system as each element is "indexed" by its entire value, rather than something that can be indexed by an ordering of the elements like a list. Values of every type in Terraform, in terms of set "indexing", can be either null, unknown, or a unique known value. Effectively in real world usage, Terraform opts to say that "indexing" into sets is generally not supported because of the inherent complexity of this implementation detail. As a set value becomes more complex in schema details, there are exponentially growing cases to account for that are non-intuitive to implement the set value for "indexing" purposes. In the case of set blocks in the SDK, that Terraform type is a set of objects with further attributes/blocks. Every attribute's null/unknown/known value would need to be accounted for if "indexing" was supported. Additionally, the syntax provided to The SDK could potentially try to paper over this implementation detail (or limitation, if you will), however, ensuring the validity of a proper set element match would likely be jeopardized since each of those underlying details is important. I also personally think the syntax discussion is a non-starter. There are however, other possible approaches to this problem that can avoid this set "indexing" issue. For example, supporting relative attribute paths in SDK functionality would allow provider developers to start within an attribute in an already calculated set object path, step backwards once to the parent (the set object), then step forwards into different attribute within the same set object. The discussions surrounding this are captured in #71, which is considered a feature request to this project. Because there is already an existing feature request for this type of functionality and the answer to your question seems to be a binary yes/no that I hopefully covered for you, I'm going to close this issue in preference of the existing one to consolidate any discussions or efforts. Aside: The team that maintains this SDK has been mainly focusing development efforts on |
Thanks a lot for your thorough response, I really appreciate that! |
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. |
SDK version
Relevant provider source code
(Taken from here) kreuzwerker/terraform-provider-docker#400
Terraform Configuration Files
not applicable
Debug Output
Expected Behavior
I expect that I can have a Set and every item of the set can only have non-conflicting elements.
E.g. the first item of the
registry_auth
set hasusername
&&password
. The second item hasconfig_file
.I assume that this is not possible at the moment and I have to do the conflicts validation manually in the code?
Actual Behavior
Error message is seen in Debug Output secetion
References
The text was updated successfully, but these errors were encountered: