How do I define a GCP BigQuery dataset IAM member with Pulumi?
In this guide, we will define a Google Cloud Platform (GCP) BigQuery dataset IAM member using Pulumi in TypeScript. This will allow us to manage access control for a specific BigQuery dataset by assigning IAM roles to users or service accounts.
Steps:
- Create a BigQuery Dataset.
- Define an IAM member for the dataset.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
// Create a BigQuery Dataset
const dataset = new gcp.bigquery.Dataset("myDataset", {
datasetId: "my_dataset_id",
friendlyName: "My Dataset",
description: "A sample dataset for demonstration purposes",
});
// Define an IAM member for the dataset
const datasetIamMember = new gcp.bigquery.DatasetIamMember("datasetIamMember", {
datasetId: dataset.datasetId,
role: "roles/bigquery.dataViewer",
member: "user:example-user@example.com",
});
export const datasetId = dataset.datasetId;
export const datasetIamMemberRole = datasetIamMember.role;
export const datasetIamMemberMember = datasetIamMember.member;
Key Points:
- BigQuery Dataset: We create a BigQuery dataset named
myDataset
with a uniquedatasetId
, a friendly name, and a description. - IAM Member: We assign the
roles/bigquery.dataViewer
role to a specific user (example-user@example.com
) for the created dataset.
Summary:
In this guide, we defined a GCP BigQuery dataset and assigned an IAM member to it using Pulumi in TypeScript. This allows us to manage access control for the dataset by specifying IAM roles for users or service accounts.
Deploy this code
Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.
Sign upNew to Pulumi?
Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.
Sign upThank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.