- 
                Notifications
    You must be signed in to change notification settings 
- Fork 24
          feat: add rbac_roles to coder_workspace_owner data source
          #330
        
          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
Conversation
| All contributors have signed the CLA  ✍️ ✅ | 
| I have read the CLA Document and I hereby sign the CLA | 
d784267    to
    7414a32      
    Compare
  
    | It does require some coder/coder updates. I have plans to pull in more user context such as  | 
0c3001a    to
    9bae197      
    Compare
  
    Part of coder/terraform-provider-coder#330 Adds support for the coder_workspace_owner.rbac_roles attribute
coder_workspace_owner data source
      coder_workspace_owner data sourcerbac_roles to coder_workspace_owner data source
              
          
                provider/workspace_owner.go
              
                Outdated
          
        
      | var rbacRoles []string | ||
| if rolesRaw, ok := os.LookupEnv("CODER_WORKSPACE_OWNER_RBAC_ROLES"); ok { | ||
| if err := json.NewDecoder(strings.NewReader(rolesRaw)).Decode(&rbacRoles); err != nil { | ||
| return diag.Errorf("invalid user rbac roles: %s", err.Error()) | ||
| } | ||
| } | ||
| _ = rd.Set("rbac_roles", rbacRoles) | 
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.
CODER_WORKSPACE_OWNER_RBAC_ROLES is now a data structure right?
So we need to json decode the env var, and correct the schema to be an object with 2 fields: name and org_id.
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.
Correct - I plan to revisit this today or tomorrow and make the updates based on the changes in the other PR
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.
@nxf5025 awesome, just keep pinging me 👍
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.
@Emyrk - Just pushed an update. Let me know if any changes are needed
9bae197    to
    8d20979      
    Compare
  
    | Hey @Emyrk - Anything else you need from my end? | 
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.
LG 👍
This PR updates the schema for the coder_workspace_owner data source to expose rbac_roles.
It's very similar to #287
Relevant
coder/coderPR - coder/coder#16407