merci gpt XD

This commit is contained in:
2025-12-03 16:15:42 +01:00
parent f2eef8ed81
commit 91d297cb21
9 changed files with 266 additions and 12 deletions

View File

@@ -0,0 +1,24 @@
# 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
}

View File

@@ -0,0 +1,8 @@
output "service_account_email" {
value = google_service_account.terraform_sa.email
}
output "service_account_private_key" {
value = google_service_account_key.terraform_sa_key.private_key
sensitive = true
}

View File

@@ -0,0 +1,4 @@
variable "project_id" {
description = "project_id"
type = string
}