-
Notifications
You must be signed in to change notification settings - Fork 458
Added databricks_permission resource *DRAFT* #4609
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
base: main
Are you sure you want to change the base?
Conversation
Please ensure that the NEXT_CHANGELOG.md file is updated with any relevant changes. |
} | ||
|
||
var provider | ||
//TODO CHECK IF ACCOUNTID ATTRIBUTE IS SET IN PROVIDER CONFIG STRUCT, |
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.
permission is a workspace-level resource, so we should not worry about account-level
I'm getting a weird error with both the PUT and PATCH methods on the access control request API call,
I have the error out to make sure that they're the current strings I'm passing in for fields RequestObjectId and RequestObjectType respectively. I'm not sure if this needs to be a special value for the JSON request to format properly, or it just needs to be a normal string, but it looks like it's populating the API path properly |
I got it, this one just didn't like the extra strings that were getting passed in... |
@nkvuong how do we want to deal with existing objects when we do a state refresh? Do we want to pull all of those into state for the particular object? or just the ones that are made by terraform? The second one presents a bit of a challenge because it means we'd have to do some weird comparisons and decisions for what is considered "changed" for individual permissions. |
@Tanchwa we should make this similar to basically resource "databricks_permission" "cluster_data_eng_permission" {
cluster_id = databricks_cluster.shared_autoscaling.id
group_name = databricks_group.data_eng.display_name
permission_level = "CAN_ATTACH_TO"
} will not touch permissions of other groups/users, but will always overwrite permissions for so in the read method, we should call GET, and filter for just the permissions of the right identity @mgyucht what do you think, as you did some refactoring for |
@nkvuong func toSecurableId(d *schema.ResourceData) string {
principal := d.Get("principal").(string)
return fmt.Sprintf("%s/%s", permissions.Mappings.Id(d), principal)
} and are you talking about the key for the mapping in Go or in the state file? |
Also, I'm having trouble figuring out how to have all the different field options for each type of permission. Would it just be an optional attribute for each one in the schema? |
@Tanchwa In order to add all the different field options, most of the helper functions are in https://github.com/databricks/terraform-provider-databricks/blob/main/permissions/permission_definitions.go. The tf schema is defined as
|
…or account clients in Configure method
… issues with databricks API calls
….String instead of (types.String).ValueString
788f0c4
to
8c77103
Compare
If integration tests don't run automatically, an authorized user can run them manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
@nkvuong sorry I'm just getting back into this... we're in the middle of migrating our Azure DevOps agents to Openshift at work and I didn't have the time to give this attention... so Ngl I found it easier to figure out how to build the schema myself from Terraform's developer documentation than it was to use your guys' struct to schema function. because I'm trying to use the new plugin framework, I used the tfsdk tags to create the resource model structs type permissionResourceModel struct {
ObjectID types.String `tfsdk:"object_id"`
ObjectType types.String `tfsdk:"object_type"`
AccessControlList permissionAccessControlModel `tfsdk:"access_control"`
LastUpdated types.String `tfsdk:"last_updated"`
}
// accessControlListModel is the same as iam.AccessControlRequest
// was originally just called this way in entity.go
type permissionAccessControlModel struct {
ServicePrincipalId types.String `tfsdk:"service_principal_id"`
GroupName types.String `tfsdk:"group_name"`
UserName types.String `tfsdk:"user_name"`
PermissionLevel types.String `tfsdk:"permission_level"`
} |
Changes
Tests
make test
run locallydocs/
folderinternal/acceptance