How do I create a GCP organization folder with Pulumi?
In this guide, we will create a Google Cloud Platform (GCP) organization folder using Pulumi in TypeScript. This is useful for organizing your GCP resources within your organization. We will define and deploy a folder under a specified parent resource (which can be an organization or another folder).
Key Points:
- We will use the
gcp.organizations.Folder
resource to create the folder. - The
parent
property specifies the parent resource under which the folder will be created. - The
displayName
property sets the name of the folder.
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
// Define the parent resource (organization or folder ID)
const parentResource = "organizations/1234567890"; // Replace with your organization ID
// Create a new GCP organization folder
const myFolder = new gcp.organizations.Folder("myFolder", {
parent: parentResource,
displayName: "My New Folder",
});
// Export the name and parent of the created folder
export const folderName = myFolder.displayName;
export const folderParent = myFolder.parent;
Summary:
In this program, we created a GCP organization folder under a specified parent resource using Pulumi. We defined the folder’s parent
and displayName
properties and exported the folder’s name and parent for reference. This setup helps in organizing and managing GCP resources efficiently within an organization.
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.