hirosassa / terraform-provider-looker

Terraform Provider for managing Looker
https://registry.terraform.io/providers/hirosassa/looker/latest
MIT License
20 stars 13 forks source link

Looking for support! #26

Open kylasam opened 2 years ago

kylasam commented 2 years ago

Hello , I'm using 0.8.5( Latest ) version of Looker TF module and not sure how to approach with my use case.

My use case: I have a CSV file as like, #email,first_name.last_name,role_ids,group_ids abcd@test.com,foo,bar,['1','2'],['2','5','7']

NOTE: The above mentioned CSV would be created as one time from API. Once the roles/groups are in-synch with our existing Looker infrastructure and code, users just create a new entry in csv by copy pasting sample user cred's and make change in their email. Once they update a new entry in CSV( basically they copy the roles and groups from their team mates ) pipeline starts and tries to create user and apply roles and groups as per the csv entry. Can you please help me out in applying the above with your repo modules? In this case, how can I create user and attach roles and group to the user? I got stuck at the below, ` locals { looker_user_details = { for user in yamldecode(file("looker_users.yml"))["users"] : user.email => { email = user.email first_name = try(user.first_name, title(split(".", split("@", user.email)[0])[0]), null) last_name = try(user.last_name, title(split(".", split("@", user.email)[0])[1]), null) group_ids = [for group_id in lookup(user, "group_ids", []) : group_id] role_ids = [for role_id in lookup(user, "role_ids", []) : role_id] } } }

resource "looker_user" "provision_looker_user" { for_each = local.looker_user_details email = each.value.email first_name = each.value.first_name last_name = each.value.last_name }

#### I wanted to use the block "looker_user_roles" dynamically for each "looker_user" block's id.######## resource "looker_user_roles" "LOOKER_SET_USER_ROLE" { for_each = local.looker_user_details user_id = looker_user.provision_looker_user.id role_ids = each.value.role_ids }

REALLY NOT SURE HOW TO APPLY ROLE[GROUPS] for each user resource "looker_role_groups" "role_groups" { role_id = looker_role.role.id group_ids = [looker_group.group.id] }`

Could you please help me out here? Thanks a lot in advance!

Thanks and your module is of great help! A Big kudo's!