Closed FakeEmperor closed 3 weeks ago
Indeed I can reproduce. your analysis is quite correct, any field that would be reused to generate the id of the resource will generate a conflict if it contains '/' I'll work on a fix, hopefully not restricting the name.
@FakeEmperor will you be available to test for non-regressions when it is ready?
FYI: User groups and Host groups are not affected by this bug. However these type of resources are affected:
@FakeEmperor would you be kind to test this branch before I make the PR?
Sure! I will test it and get back to you. Thank you for the quick reply!
SUDO rules with slashes in their names result in errors when managing them through the provider: adding any memberships (
allowcmd
,user
,host
, etc.) results in an error:For now I've made a note for our team to not use slashes (
/
) in any rules and made assertions in our modules, but the error is not intuitive and may lead some other provider users to spend time debugging.Taking
freeipa_sudo_rule_allowcmd_membership
as an example, my understanding is that the ID for this resource (and similarly for others) is being set as such:Which is parsed incorrectly later here if the
/
is present ind.Get("name")
:I might be wrong, but this is my best guess.
I think there are a few options to handle it:
%2F
) or perform another replacement. Probably the best solution, since existing users do not have this issue.I presume same issue affects other resources with memberships:
But let me thank you for the amazing work you've done! ❤
Terraform Version, Provider Version and FreeIPA version
Affected Resource(s)
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this. -->
Terraform Configuration Files
The following code fails:
If you remove
/
infreeipa_sudo_rule.test_rule.name
, it works. Notice that the name of the sudocmd does not matter.Steps to Reproduce
terraform plan
to see the changes.terraform apply
to observe the attempt to create memberships and failing with the aforementioned error.Expected Behavior
Membership resources would be created normally.
Actual Behavior
Resources failed to be created if the rule name contains slashes with the following error:
Community Note