-
Notifications
You must be signed in to change notification settings - Fork 91
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
Some optional blocks in auth0_connection
behave differently from each other
#308
Comments
Hmm, could be related to this issue: #14 |
Kinda sorta related to #314 too |
So just focusing just on the password_history {
enable = null
size = null
} This fails because the Management API does not allow the
Your expectation may be that the Terraform provider will magically omit the Admittedly, there are some minor DX enhancements that could be applied to validate and smooth-out what you're describing, but when it comes to sub-properties of blocks it becomes a bit more tricky. There are several different types of connection with their own bespoke options, some of which get minor changes and additions over time. We have intentionally erred on the side of maintaining flexibility and reducing false-negatives. As for a solution, I recommend defining all possible values in your YAML and nix the |
Hey, thanks for the reply! Yes, I don't dispute your main point: "there is no way to distinguish between intentionally null and intentionally omitted." - this is what the dynamic block workaround... works around I guess 😅 As you have laid it out, it does seem to be a relatively impossible request to fix (sorry about that ;)) - though my sticking point has been the In saying that, I do appreciate it's unclear how those But it does make me curious: why is the |
I don't mean to re-open an older issue, but I came back to this just now, because the It is relevant because you can specify optional fields to a variable, and I wondered how they handled the issue of addressing an optional entity within a variable when it was not provided - and it turns out it just sets the value to be From this discussion, I had thought: "how do you specify omitted vs intentionally null" - but looking here: https://www.terraform.io/language/expressions/types#null
Anyway - while that is interesting, this particular issue was about optionally specifying blocks - and it still appears that Terraform as a language does not support the same sort of idea as an optional block :( Closing this off for now! |
Checklist
Description
Hello, and thanks again for the provider!
I'm trying to pass config values into an
auth0_connection
, so a lot of the variables are optional. Hopefully this gets the idea across:You can see above that almost all variables are either taken from config, or filled with
null
, to indicate that we'll just use whatever the provider sets as the default.The issue comes in with the blocks within the
options
block. Some of them, like themfa
block, work just fine with the above code; while the rest of them, including thepassword_history
one, won't work with this setup. Onterraform apply
, it throws this error:I go into more detail in the reproduction section, but this seems to be because the
password_history
block is being sent as an empty{}
map, which fails the payload validation.Expectation
My expectation is that I should be able to pass any of the objects below to my
auth0_connection
code, and it to behave "as expected" - that is: if I don't specify a block in the object, it's as if the block was not set in theauth0_connection
:(I know these objects are YAML, but the structure is the same 😅 ):
At the moment, only
no_mfa
andwith_password_history_with_mfa
will work. The reproduction section (hopefully) explains why.Reproduction
Commenting out both the
mfa
andpassword_history
blocks in myauth0_connection
, and creating a brand new DB with this object:gives
and it is applied successfully
Making a single change: add the
mfa
block back into theauth0_connection
:the plan looks like:
applying that also works fine.
Now, deleting the whole connection and this same process again, but instead of the
mfa
block, I'll add in thepassword_history
block:but when I apply it, I get the error:
I think the key is this difference:
vs
the
mfa
block already exists on a brand new connection, whereas thepassword_history
is a new thing - but since it contains 'nothing', the payload is wrong.The work around I have at the moment is:
which is relatively compact, but quite ugly 😅, and it seems that the
mfa
block is the only that doesn't need it.Auth0 Terraform Provider version
v0.35.0
Terraform version
Terraform v1.2.7
The text was updated successfully, but these errors were encountered: