Skip to content

Instantly share code, notes, and snippets.

@monde
Created December 13, 2023 15:58
Show Gist options
  • Save monde/be30ad4c3a873d8e8c9ea2c7d7288c62 to your computer and use it in GitHub Desktop.
Save monde/be30ad4c3a873d8e8c9ea2c7d7288c62 to your computer and use it in GitHub Desktop.
example of Okta Terraform bulk user import from CSV
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
}
local_id first_name last_name login email
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