terraform {
  required_providers {
    zitadel = {
      source  = "zitadel/zitadel"
      version = "2.0.2"
    }
  }
}

resource "zitadel_machine_user" "default" {
  depends_on = [var.wait_on]

  org_id            = var.org_id
  user_name         = var.user_name
  name              = var.name
  description       = var.description
  with_secret       = var.with_secret
  access_token_type = var.access_token_type
}

output "installed" {
  value = true
  depends_on = [zitadel_machine_user.default]
}

output "user_id" {
  value = zitadel_machine_user.default.id
}

output "client_id" {
  value     = zitadel_machine_user.default.client_id
  sensitive = true
}

output "client_secret" {
  value     = zitadel_machine_user.default.client_secret
  sensitive = true
}
