Merge pull request #612 from GoogleCloudPlatform/jccb/pf-sa-prefix
Add prefix to project factory SA bindings
This commit is contained in:
commit
2c175f8565
|
@ -24,10 +24,11 @@ locals {
|
|||
}
|
||||
_group_iam_bindings = distinct(flatten(values(var.group_iam)))
|
||||
# internal structures for project service accounts IAM bindings
|
||||
_project_id = var.prefix == null || var.prefix == "" ? var.project_id : "${var.prefix}-${var.project_id}"
|
||||
_service_accounts_iam = {
|
||||
for r in local._service_accounts_iam_bindings : r => [
|
||||
for k, v in var.service_accounts :
|
||||
"serviceAccount:${k}@${var.project_id}.iam.gserviceaccount.com"
|
||||
"serviceAccount:${k}@${local._project_id}.iam.gserviceaccount.com"
|
||||
if try(index(v, r), null) != null
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
Loading…
Reference in New Issue