@@ -59,16 +59,18 @@ func New(scope constructs.Construct, id resourceid.ID, config Config) (*Output,
59
59
// Operator access: grant restricted read-only permissions, based on
60
60
// https://github.com/sourcegraph/deploy-sourcegraph-managed/blob/ded74a806bb6d1925cb894a8755ed52db7585a4f/modules/terraform-managed-instance-new/sql.tf#L153-L179
61
61
for _ , db := range config .Databases {
62
- _ = grant .NewGrant (scope , id .Group (db ).TerraformID ("operator_access_service_account_connect_grant" ), & grant.GrantConfig {
62
+ id := id .Group (db )
63
+ _ = grant .NewGrant (scope , id .TerraformID ("operator_access_service_account_connect_grant" ), & grant.GrantConfig {
63
64
Provider : pgProvider ,
64
65
Database : & db ,
65
66
Role : config .CloudSQL .OperatorAccessUser .Name (),
66
67
ObjectType : pointers .Ptr ("database" ),
67
68
Privileges : pointers .Ptr (pointers .Slice ([]string {
68
69
"CONNECT" ,
69
70
})),
71
+ DependsOn : & config .CloudSQL .Databases ,
70
72
})
71
- _ = grant .NewGrant (scope , id .Group ( db ). TerraformID ("operator_access_service_account_table_grant" ), & grant.GrantConfig {
73
+ _ = grant .NewGrant (scope , id .TerraformID ("operator_access_service_account_table_grant" ), & grant.GrantConfig {
72
74
Provider : pgProvider ,
73
75
Database : & db ,
74
76
Role : config .CloudSQL .OperatorAccessUser .Name (),
@@ -80,6 +82,7 @@ func New(scope constructs.Construct, id resourceid.ID, config Config) (*Output,
80
82
Privileges : pointers .Ptr (pointers .Slice ([]string {
81
83
"SELECT" ,
82
84
})),
85
+ DependsOn : & config .CloudSQL .Databases ,
83
86
})
84
87
}
85
88
0 commit comments