Last active
March 30, 2019 16:08
-
-
Save rajtmana/0fec42adfbad402bc2dabbc5de11cdc0 to your computer and use it in GitHub Desktop.
Service Accounts and IAM Binding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "gcp_project" { | |
type = "string" | |
default = "proteen-12176181" | |
} | |
provider "google" { | |
project = "${var.gcp_project}" | |
} | |
resource "google_service_account" "mservice_svc_sa" { | |
account_id = "mservice-svc-service-account" | |
display_name = "Service Deployment Service Account" | |
} | |
resource "google_project_iam_custom_role" "mservice_svc_admin_role" { | |
role_id = "mservice_svc_admin_role" | |
title = "mservice_svc_admin_role" | |
description = "Service Deployment Custom Role" | |
permissions = [ | |
"container.apiServices.get", | |
"container.apiServices.list", | |
"container.clusters.get", | |
"container.clusters.getCredentials", | |
] | |
} | |
resource "google_project_iam_binding" "mservice_svc_binding" { | |
role = "projects/${var.gcp_project}/roles/${google_project_iam_custom_role.mservice_svc_admin_role.role_id}" | |
members = [ | |
"serviceAccount:${google_service_account.mservice_svc_sa.email}", | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment