forked from pierront/but3-iac
correction arborescence
This commit is contained in:
26
terraform/modules/iam/main.tf
Normal file
26
terraform/modules/iam/main.tf
Normal file
@@ -0,0 +1,26 @@
|
||||
resource "google_service_account" "terraform_sa" {
|
||||
account_id = "terraform"
|
||||
display_name = "Service Account pour Terraform Automation"
|
||||
}
|
||||
|
||||
resource "google_service_account_key" "terraform_sa_key" {
|
||||
service_account_id = google_service_account.terraform_sa.name
|
||||
public_key_type = "TYPE_X509_PEM_FILE"
|
||||
}
|
||||
|
||||
resource "google_project_iam_binding" "terraform_viewer" {
|
||||
project = var.projet_name
|
||||
role = "roles/viewer"
|
||||
|
||||
members = [
|
||||
"serviceAccount:${google_service_account.terraform_sa.email}",
|
||||
]
|
||||
}
|
||||
|
||||
data "google_client_openid_userinfo" "me" {}
|
||||
|
||||
resource "google_os_login_ssh_public_key" "my_ssh_key" {
|
||||
user = data.google_client_openid_userinfo.me.email
|
||||
key = file("~/.ssh/id_ed25519.pub")
|
||||
project = var.projet_name
|
||||
}
|
||||
9
terraform/modules/iam/outputs.tf
Normal file
9
terraform/modules/iam/outputs.tf
Normal file
@@ -0,0 +1,9 @@
|
||||
output "service_account_email" {
|
||||
value = google_service_account.terraform_sa.email
|
||||
}
|
||||
|
||||
output "service_account_key" {
|
||||
value = google_service_account_key.terraform_sa_key.private_key
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
4
terraform/modules/iam/variables.tf
Normal file
4
terraform/modules/iam/variables.tf
Normal file
@@ -0,0 +1,4 @@
|
||||
variable "projet_name" {
|
||||
type = string
|
||||
default = "projet-hugo-478713"
|
||||
}
|
||||
Reference in New Issue
Block a user