mirror of
https://github.com/ryboe/private-ip-cloud-sql-db.git
synced 2025-12-19 18:14:59 -05:00
* terraform v1.0.0 -> v1.1.5 * hashicorp/google 3.80.0 -> 4.9.0 * hashicorp/tfe 0.25.3 -> 0.28.1 * postgres 13 -> 14
18 lines
517 B
HCL
18 lines
517 B
HCL
// serviceaccount module
|
|
data "google_project" "provider" {}
|
|
|
|
resource "google_service_account" "account" {
|
|
account_id = var.name
|
|
description = "The service account used by Cloud SQL Proxy to connect to the db"
|
|
}
|
|
|
|
resource "google_project_iam_member" "role" {
|
|
project = data.google_project.provider.project_id
|
|
role = var.role
|
|
member = "serviceAccount:${google_service_account.account.email}"
|
|
}
|
|
|
|
resource "google_service_account_key" "key" {
|
|
service_account_id = google_service_account.account.name
|
|
}
|