File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -42,12 +42,20 @@ resource "google_project_iam_member" "sql_backup_serviceaccount_sql_admin" {
4242 member = " serviceAccount:${ google_service_account . sql_backup_serviceaccount [0 ]. email } "
4343 role = local. role_name
4444 project = var. project_id
45- condition {
46- title = " Limit access to instance ${ var . sql_instance } "
47- expression = <<- EOT
48- (resource.type == "sqladmin.googleapis.com/Instance" &&
49- resource.name == "projects/${ var . project_id } /instances/${ var . sql_instance } ")
50- EOT
45+ # It is not possible to limit access to a specific instance when exports are enabled.
46+ # The export workflow needs to be able to list databases for the database instance.
47+ # It currently is not possible to define a condition that limits access to these
48+ # sub-resources/database resources. Only Instances and BackupRuns are supported:
49+ # https://cloud.google.com/iam/docs/conditions-resource-attributes#resource-type
50+ dynamic "condition" {
51+ for_each = var. enable_export_backup ? [] : [1 ]
52+ content {
53+ title = " Limit access to instance ${ var . sql_instance } "
54+ expression = <<- EOT
55+ (resource.type == "sqladmin.googleapis.com/Instance" &&
56+ resource.name == "projects/${ var . project_id } /instances/${ var . sql_instance } ")
57+ EOT
58+ }
5159 }
5260}
5361
You can’t perform that action at this time.
0 commit comments