Skip to content

Instantly share code, notes, and snippets.

@monde
Created December 13, 2023 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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 sam@example.com sam@example.com
id02 Sue Bravo sue@example.com sue@example.com
id03 Sonny Charlie sonny@example.com sonny@example.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment