forked from pierront/but3-iac
feat: iam module
This commit is contained in:
22
terraform/modules/iam/main.tf
Normal file
22
terraform/modules/iam/main.tf
Normal file
@@ -0,0 +1,22 @@
|
||||
resource "google_service_account" "terraform" {
|
||||
account_id = "terraform"
|
||||
display_name = "Service Account for Terraform"
|
||||
}
|
||||
|
||||
resource "google_service_account_key" "terraform_key" {
|
||||
service_account_id = google_service_account.terraform.name
|
||||
public_key_type = "TYPE_X509_PEM_FILE"
|
||||
}
|
||||
|
||||
resource "google_project_iam_binding" "terraform_viewer" {
|
||||
project = var.project_id
|
||||
role = "roles/viewer"
|
||||
members = ["serviceAccount:${google_service_account.terraform.email}"]
|
||||
}
|
||||
|
||||
data "google_client_openid_userinfo" "me" {}
|
||||
|
||||
resource "google_os_login_ssh_public_key" "default" {
|
||||
user = data.google_client_openid_userinfo.me.email
|
||||
key = file("~/.ssh/id_ed25519.pub")
|
||||
}
|
||||
Reference in New Issue
Block a user