-
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
Implement organization management (RBAC) #855
Implement organization management (RBAC) #855
Conversation
This resource allows managing the members of an organization: - Added members will be invited to the organization. The user will still have to accept the invitation before they have access to the organization. - Removed members will be removed from the organization - For each member their roles can be configured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we'd have a better UX restructuring this one a bit:
- An organisation data source. Like you've said there's no real configuration for an organisation, moving this to a data source would avoid the import requirement
- Having a resource per organisation member, rather than a single resource managing all members within an organisation.
The TF module could look something like:
data "ec_organization" "myorg" {}
resource "ec_organization_member" "tobio" {
organization_id = data.ec_organization.myorg.id
email = "[email protected]"
deployment_roles = [...]
...
}
Managing multiple members with the same permissions becomes simpler:
resource "ec_organization_member" "admins" {
for_each = ["[email protected]", "[email protected]"]
organization_id = ...
email = each.key
deployment_roles = [...]
I think both have their advantages. The main difference in my opinion is on the management of members:
In the end I decided to go with the first approach as it also makes it easier to add new members, and impossible to accidentally lose track of a member (e.g. the member exists but isn't tracked in terraform) |
The `Test_modelToState` had to be updated as it hashes the deployment response (and that response now has additional fields)
The PR is now updated to include the right cloud-sdk-go and should compile now. |
Small update to the PR, I reenamed the fields:
|
@gigerdo , does it make sense to add unit tests to cover negative use cases? |
@dimuon I refactored the testcases into separate tests, and added a failure case for each. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
This resource allows managing the members of an organization:
(
Currently all builds/tests for this PR are failing because we first need a new release of cloud-sdk-go to get the organization apis elastic/cloud-sdk-go#477)Now includes cloud-sdk-go 1.21.0
Description
terraform import
flow.terraform destroy
to remove the org from the state. However this is currently just to stop managing the resource in terraform, it won't actually be deleted.Related Issues
#629
How Has This Been Tested?
Types of Changes
Readiness Checklist