How do I build a GCP organizations folder with Pulumi?
In this guide, we will set up a GCP organizations folder using Pulumi. This will help you organize your Google Cloud resources into a hierarchical structure. We will use the gcp.organizations.Folder
resource to create the folder.
Key Points
- We will create a folder within a GCP organization.
- The folder will have a specified parent and display name.
Step-by-Step
- Import the necessary Pulumi and GCP packages.
- Create the folder resource with the required properties.
Below is the complete Pulumi program to achieve this:
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
// Create a GCP folder within an organization
const myFolder = new gcp.organizations.Folder("myFolder", {
parent: "organizations/123456789", // Replace with your organization ID
displayName: "My Folder"
});
// Export the folder name and ID
export const folderName = myFolder.displayName;
export const folderId = myFolder.id;
Summary
In this guide, we created a GCP organizations folder using Pulumi. We imported the necessary Pulumi and GCP packages, defined the folder resource, and exported the folder name and ID for reference. This setup helps in organizing your Google Cloud resources efficiently.
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.