This message was deleted.
# google-cloud
s
This message was deleted.
d
You need to do this using Project IAM policies and conditions. There's a Terraform example in the docs: https://cloud.google.com/sql/docs/postgres/iam-conditions#terraform The example can be used as reference for how to use the pulumi IAMMember resource: https://www.pulumi.com/registry/packages/gcp/api-docs/projects/iammember/
b
Ah thank you!
g
If you do end up creating a Pulumi sample for this, could you post it here? My team might be interested in it in a couple of weeks.
b
I haven't tested it yet, but it should look roughly like this:
Copy code
new gcp.projects.IAMBinding("...", {
    members: [...],
    role: "roles/cloudsql.client",
    condition: {
        expression: pulumi.interpolate`resource.name == 'projects/${gcp.config.project}/instances/${instance.name}' && resource.type == 'sqladmin.googleapis.com/Instance'`,
        title: "...",
        description: "...",
    }
});