Review the New Project
Let’s review some of the generated project files:
Pulumi.yamldefines the project.Pulumi.dev.yamlcontains configuration values for the stack we initialized.
Program.cswith a simple entry point.
is the Pulumi program that defines our stack resources. Let’s examine it.index.jsindex.ts__main__.pymain.goMyStack.csProgram.fsMyStack.vb
"use strict";
const pulumi = require("@pulumi/pulumi");
const gcp = require("@pulumi/gcp");
// Create a GCP resource (Storage Bucket)
const bucket = new gcp.storage.Bucket("my-bucket");
// Export the DNS name of the bucket
exports.bucketName = bucket.url;
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
// Create a GCP resource (Storage Bucket)
const bucket = new gcp.storage.Bucket("my-bucket");
// Export the DNS name of the bucket
export const bucketName = bucket.url;import pulumi
from pulumi_gcp import storage
# Create a GCP resource (Storage Bucket)
bucket = storage.Bucket('my-bucket')
# Export the DNS name of the bucket
pulumi.export('bucket_name', bucket.url)package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v3/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create a GCP resource (Storage Bucket)
bucket, err := storage.NewBucket(ctx, "my-bucket", nil)
if err != nil {
return err
}
// Export the DNS name of the bucket
ctx.Export("bucketName", bucket.Url)
return nil
})
}using Pulumi;
using Pulumi.Gcp.Storage;
class MyStack : Stack
{
public MyStack()
{
// Create a GCP resource (Storage Bucket)
var bucket = new Bucket("my-bucket");
// Export the DNS name of the bucket
this.BucketName = bucket.Url;
}
[Output]
public Output<string> BucketName { get; set; }
}
This Pulumi program creates a storage bucket and exports the bucket URL.
Next, we’ll deploy the stack.