-
Notifications
You must be signed in to change notification settings - Fork 19
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
Support app rule actions which shouldn't require 'expression' field #44
Conversation
at-k
commented
Apr 1, 2021
- a behavior of app rule api is different whether 'expression' field exists or not.
- e.g. AWS application
- 'Map from Onelogin' is selected, because 'expression' field is post as "" string
- after this pr merged, 'expression' is set to nil when it is empty - 'From Existing' is selected (expected)
- action spec
- https://developers.onelogin.com/api-docs/2/app-rules/create-rule
Hey @at-k this has been a notorious issue for a while #16 My concern with this approach is that setting If your change fixes the issue, Im inclined to merge it to satisfy the majority of use cases where expression is either null or something that is not an empty string. Do you have any thoughts around this? |
Hi @dcaponi , I added action type translation on provider to keep both action w / and w/o expression available. When action is 'set_role_from_existing', the provider set expression nil on Create/Update. In addition, when onelogin api return app rules with no expression field, the provider judges that the rule is 'set_role_from_existing' and translate it. I'm not familiar with onelogin api specification, so I'm not sure this provider behavior satisfy the specification of api. How do you think this approach? |
Hi @at-k unfortunately that would not satisfy the specification. You have I'm still trying to deep dive in here, but something is happening at the Terraform level I believe, where I'm getting I'm looking for a workaround for this, but it may need to be escalated to Hashicorp. Thank you for your continued patience with the matter. |
@dcaponi Thank you for your review. Yes I know the action is not exist actually. So I intend that the action 'set_role_from_existing' is translated into "set_role" before submitting to onelogin api. I checked provider behavior by following example code. resource "onelogin_app_rules" "rule" {
name = "Test Developer 10"
enabled = true
app_id = "698140"
match = "all"
conditions {
operator = "ri"
source = "has_role"
value = onelogin_roles.role.id
}
actions {
action = "set_role_from_existing"
//action = "set_role"
//expression = ".*"
value = [
"arn:aws:iam::057575985710:role/benefit-developer",
"arn:aws:iam::057575985710:role/benefit-admin",
]
}
}
the action is registered as 'set_role_from_existing' on terraform state, but actual action sent to onelogin api is 'set_role' without 'expression' field. The result is Please review again. |
@at-k I think I see where you're going with this. You want to add this "custom" action If my understanding is correct, would you please replace the
Please confirm and I'll merge. P.S. While this should solve the immediate problem, I think upon further analysis of the problem there will have to be some changes to the way the provider handles unpacking nested Terraform resources. In this case, it seems that when unpacking the app rule with a nested |
@dcaponi thank you for your review. As you say, this PR adds a custom action which is acceptable only on terraform code. I also think this solution is just a temporary work around, and should be replaced by other approach based on onelogin api specification. So the other approach to make this feature available is welcome to me. |
I'm going to merge this for now to unblock you. I have a suspicion that Hashicorp may need to change the way they handle Here's the issue I opened with them for reference hashicorp/terraform-plugin-sdk#741 Here's the PR I'm working on if you're interested #47 |
@dcaponi I found that the current available release version is still v0.1.12 published 24 days ago.
https://registry.terraform.io/providers/onelogin/onelogin/latest I don't know how to register the release of provider to terraform official registry, but can you update them to make it available from terraform? |
@at-k sorry about that 😅 something was wrong with the publish action I set up. v0.1.14 should be up now. |