Created
          December 13, 2023 15:58 
        
      - 
      
 - 
        
Save monde/be30ad4c3a873d8e8c9ea2c7d7288c62 to your computer and use it in GitHub Desktop.  
    example of Okta Terraform bulk user import from CSV
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | terraform { | |
| required_providers { | |
| okta = { | |
| source = "okta/okta" | |
| } | |
| } | |
| } | |
| locals { | |
| users = csvdecode(file("./users.csv")) | |
| } | |
| resource "okta_user" "test" { | |
| for_each = { for user in local.users : user.local_id => user } | |
| # all of this arguments are required but there are other optional arguments to be made | |
| # see https://registry.terraform.io/providers/okta/okta/latest/docs/resources/user | |
| first_name = each.value.first_name | |
| last_name = each.value.last_name | |
| login = each.value.login | |
| email = each.value.email | |
| } | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    | local_id | first_name | last_name | login | ||
|---|---|---|---|---|---|
| id01 | Sam | Alpha | [email protected] | [email protected] | |
| id02 | Sue | Bravo | [email protected] | [email protected] | |
| id03 | Sonny | Charlie | [email protected] | [email protected] | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment