# Service Account Terraform
resource "google_service_account" "terraform_sa" {
  account_id   = "terraform-admin"
  display_name = "Terraform Admin"
}

# Key
resource "google_service_account_key" "terraform_sa_key" {
  service_account_id = google_service_account.terraform_sa.name
}

# IAM roles nécessaires
resource "google_project_iam_member" "terraform_roles" {
  project = var.project_id
  role    = "roles/owner"
  member  = "serviceAccount:${google_service_account.terraform_sa.email}"
}

# Activation OS Login pour SSH
resource "google_os_login_ssh_public_key" "ssh_key" {
  user            = "raphael.hochlaf@gmail.com"
  key             = file("~/.ssh/id_rsa.pub")
  project         = var.project_id
}
