Manage GCP BigQuery Connection IAM Permissions

The gcp:bigquery/connectionIamMember:ConnectionIamMember resource, part of the Pulumi GCP provider, grants IAM permissions on BigQuery connections by adding individual members to roles. This guide focuses on three approaches: adding single members, managing complete member lists per role, and replacing entire policies.

Three related resources manage connection permissions with different levels of control. ConnectionIamMember adds one member non-authoritatively, ConnectionIamBinding manages all members for one role, and ConnectionIamPolicy replaces the entire policy. ConnectionIamPolicy cannot be used with the other two resources; ConnectionIamBinding and ConnectionIamMember can coexist if they manage different roles. The examples are intentionally small. Combine them with your own connection resources and organizational IAM structure.

Grant a single user access to a connection

Most IAM configurations add individual users or service accounts to roles without disrupting existing permissions.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const member = new gcp.bigquery.ConnectionIamMember("member", {
    project: connection.project,
    location: connection.location,
    connectionId: connection.connectionId,
    role: "roles/viewer",
    member: "user:jane@example.com",
});
import pulumi
import pulumi_gcp as gcp

member = gcp.bigquery.ConnectionIamMember("member",
    project=connection["project"],
    location=connection["location"],
    connection_id=connection["connectionId"],
    role="roles/viewer",
    member="user:jane@example.com")
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/bigquery"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := bigquery.NewConnectionIamMember(ctx, "member", &bigquery.ConnectionIamMemberArgs{
			Project:      pulumi.Any(connection.Project),
			Location:     pulumi.Any(connection.Location),
			ConnectionId: pulumi.Any(connection.ConnectionId),
			Role:         pulumi.String("roles/viewer"),
			Member:       pulumi.String("user:jane@example.com"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var member = new Gcp.BigQuery.ConnectionIamMember("member", new()
    {
        Project = connection.Project,
        Location = connection.Location,
        ConnectionId = connection.ConnectionId,
        Role = "roles/viewer",
        Member = "user:jane@example.com",
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.bigquery.ConnectionIamMember;
import com.pulumi.gcp.bigquery.ConnectionIamMemberArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var member = new ConnectionIamMember("member", ConnectionIamMemberArgs.builder()
            .project(connection.project())
            .location(connection.location())
            .connectionId(connection.connectionId())
            .role("roles/viewer")
            .member("user:jane@example.com")
            .build());

    }
}
resources:
  member:
    type: gcp:bigquery:ConnectionIamMember
    properties:
      project: ${connection.project}
      location: ${connection.location}
      connectionId: ${connection.connectionId}
      role: roles/viewer
      member: user:jane@example.com

The member property specifies one identity (user, service account, group, or domain). The role property defines what that member can do. ConnectionIamMember is non-authoritative: it adds this member to the role without removing other members or affecting other roles on the connection.

Manage all members for a single role

When you need to control exactly who has a specific role, ConnectionIamBinding replaces all members for that role.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const binding = new gcp.bigquery.ConnectionIamBinding("binding", {
    project: connection.project,
    location: connection.location,
    connectionId: connection.connectionId,
    role: "roles/viewer",
    members: ["user:jane@example.com"],
});
import pulumi
import pulumi_gcp as gcp

binding = gcp.bigquery.ConnectionIamBinding("binding",
    project=connection["project"],
    location=connection["location"],
    connection_id=connection["connectionId"],
    role="roles/viewer",
    members=["user:jane@example.com"])
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/bigquery"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := bigquery.NewConnectionIamBinding(ctx, "binding", &bigquery.ConnectionIamBindingArgs{
			Project:      pulumi.Any(connection.Project),
			Location:     pulumi.Any(connection.Location),
			ConnectionId: pulumi.Any(connection.ConnectionId),
			Role:         pulumi.String("roles/viewer"),
			Members: pulumi.StringArray{
				pulumi.String("user:jane@example.com"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var binding = new Gcp.BigQuery.ConnectionIamBinding("binding", new()
    {
        Project = connection.Project,
        Location = connection.Location,
        ConnectionId = connection.ConnectionId,
        Role = "roles/viewer",
        Members = new[]
        {
            "user:jane@example.com",
        },
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.bigquery.ConnectionIamBinding;
import com.pulumi.gcp.bigquery.ConnectionIamBindingArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var binding = new ConnectionIamBinding("binding", ConnectionIamBindingArgs.builder()
            .project(connection.project())
            .location(connection.location())
            .connectionId(connection.connectionId())
            .role("roles/viewer")
            .members("user:jane@example.com")
            .build());

    }
}
resources:
  binding:
    type: gcp:bigquery:ConnectionIamBinding
    properties:
      project: ${connection.project}
      location: ${connection.location}
      connectionId: ${connection.connectionId}
      role: roles/viewer
      members:
        - user:jane@example.com

The members property (plural) lists all identities that should have this role. ConnectionIamBinding is authoritative for this role: it replaces the member list, removing anyone not in the array. Other roles on the connection remain unchanged.

Replace the entire IAM policy for a connection

Some deployments require complete control over all roles and members, replacing any existing policy.

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const admin = gcp.organizations.getIAMPolicy({
    bindings: [{
        role: "roles/viewer",
        members: ["user:jane@example.com"],
    }],
});
const policy = new gcp.bigquery.ConnectionIamPolicy("policy", {
    project: connection.project,
    location: connection.location,
    connectionId: connection.connectionId,
    policyData: admin.then(admin => admin.policyData),
});
import pulumi
import pulumi_gcp as gcp

admin = gcp.organizations.get_iam_policy(bindings=[{
    "role": "roles/viewer",
    "members": ["user:jane@example.com"],
}])
policy = gcp.bigquery.ConnectionIamPolicy("policy",
    project=connection["project"],
    location=connection["location"],
    connection_id=connection["connectionId"],
    policy_data=admin.policy_data)
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/bigquery"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		admin, err := organizations.LookupIAMPolicy(ctx, &organizations.LookupIAMPolicyArgs{
			Bindings: []organizations.GetIAMPolicyBinding{
				{
					Role: "roles/viewer",
					Members: []string{
						"user:jane@example.com",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		_, err = bigquery.NewConnectionIamPolicy(ctx, "policy", &bigquery.ConnectionIamPolicyArgs{
			Project:      pulumi.Any(connection.Project),
			Location:     pulumi.Any(connection.Location),
			ConnectionId: pulumi.Any(connection.ConnectionId),
			PolicyData:   pulumi.String(admin.PolicyData),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var admin = Gcp.Organizations.GetIAMPolicy.Invoke(new()
    {
        Bindings = new[]
        {
            new Gcp.Organizations.Inputs.GetIAMPolicyBindingInputArgs
            {
                Role = "roles/viewer",
                Members = new[]
                {
                    "user:jane@example.com",
                },
            },
        },
    });

    var policy = new Gcp.BigQuery.ConnectionIamPolicy("policy", new()
    {
        Project = connection.Project,
        Location = connection.Location,
        ConnectionId = connection.ConnectionId,
        PolicyData = admin.Apply(getIAMPolicyResult => getIAMPolicyResult.PolicyData),
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetIAMPolicyArgs;
import com.pulumi.gcp.bigquery.ConnectionIamPolicy;
import com.pulumi.gcp.bigquery.ConnectionIamPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var admin = OrganizationsFunctions.getIAMPolicy(GetIAMPolicyArgs.builder()
            .bindings(GetIAMPolicyBindingArgs.builder()
                .role("roles/viewer")
                .members("user:jane@example.com")
                .build())
            .build());

        var policy = new ConnectionIamPolicy("policy", ConnectionIamPolicyArgs.builder()
            .project(connection.project())
            .location(connection.location())
            .connectionId(connection.connectionId())
            .policyData(admin.policyData())
            .build());

    }
}
resources:
  policy:
    type: gcp:bigquery:ConnectionIamPolicy
    properties:
      project: ${connection.project}
      location: ${connection.location}
      connectionId: ${connection.connectionId}
      policyData: ${admin.policyData}
variables:
  admin:
    fn::invoke:
      function: gcp:organizations:getIAMPolicy
      arguments:
        bindings:
          - role: roles/viewer
            members:
              - user:jane@example.com

The policyData property accepts a complete IAM policy document, typically from getIAMPolicy. The bindings array defines all role-to-members mappings. ConnectionIamPolicy is fully authoritative: it replaces the entire policy, removing any roles or members not in the document. This resource cannot coexist with ConnectionIamBinding or ConnectionIamMember.

Beyond these examples

These snippets focus on specific IAM management approaches: incremental member grants, role-level member management, and complete policy replacement. They’re intentionally minimal rather than full access control systems.

The examples reference pre-existing infrastructure such as BigQuery connections (via connectionId), and GCP projects and locations. They focus on permission configuration rather than provisioning the underlying connections.

To keep things focused, common IAM patterns are omitted, including:

  • Conditional IAM bindings (condition property)
  • Custom role definitions
  • Service account creation and management
  • Connection resource provisioning

These omissions are intentional: the goal is to illustrate how each IAM resource type is wired, not provide drop-in access control modules. See the BigQuery ConnectionIamMember resource reference for all available configuration options.

Let's manage GCP BigQuery Connection IAM Permissions

Get started with Pulumi Cloud, then follow our quick setup guide to deploy this infrastructure.

Try Pulumi Cloud for FREE

Frequently Asked Questions

Resource Selection & Conflicts
What's the difference between ConnectionIamPolicy, ConnectionIamBinding, and ConnectionIamMember?
ConnectionIamPolicy is authoritative and replaces the entire IAM policy. ConnectionIamBinding is authoritative for a specific role, preserving other roles. ConnectionIamMember is non-authoritative, adding a single member while preserving other members for that role.
Can I use ConnectionIamPolicy with ConnectionIamBinding or ConnectionIamMember?
No, ConnectionIamPolicy cannot be used with ConnectionIamBinding or ConnectionIamMember because they will conflict over the policy.
Can I use ConnectionIamBinding and ConnectionIamMember together?
Yes, but only if they grant different roles. Using both for the same role will cause conflicts.
Configuration & Formats
What member identity formats are supported?

Supported formats include:

  • allUsers or allAuthenticatedUsers for public/authenticated access
  • user:{email}, serviceAccount:{email}, group:{email} for specific identities
  • domain:{domain} for G Suite domains
  • projectOwner:{projectid}, projectEditor:{projectid}, projectViewer:{projectid} for project roles
  • principal://... for federated identities (workload/workforce pools, GKE workloads)
How do I specify a custom IAM role?
Custom roles must use the full format [projects|organizations]/{parent-name}/roles/{role-name}, for example projects/my-project/roles/my-custom-role.
What location should I use for my BigQuery connection?
Use the geographic location where the connection should reside. Note mappings: Cloud SQL us-central1 maps to BigQuery US, europe-west1 maps to EU. Spanner uses the same region. AWS supports aws-us-east-1, Azure supports azure-eastus2.
Import & Migration
What formats can I use when importing a BigQuery connection IAM resource?
Four formats are supported: projects/{{project}}/locations/{{location}}/connections/{{connection_id}}, {{project}}/{{location}}/{{connection_id}}, {{location}}/{{connection_id}}, or just {{connection_id}}. Missing variables are taken from the provider configuration.
How do I import a ConnectionIamMember with a custom role?
Use the full custom role name in the import command, for example: pulumi import gcp:bigquery/connectionIamMember:ConnectionIamMember editor "projects/{{project}}/locations/{{location}}/connections/{{connection_id}} projects/my-project/roles/my-custom-role user:jane@example.com".

Using a different cloud?

Explore security guides for other cloud providers: