Want to learn about running containers in Lambda? Join our free hands-on workshop. Register Now

Modify the Program

Now that we have an instance of our Pulumi program deployed, let’s add some labels to it.

Replace the entire contents of index.js index.ts __main__.py main.go MyStack.cs Program.fs MyStack.vb with the following:

"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", {
    labels: { "environment": "dev" }
});

// 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", {
    labels: { "environment": "dev" }
});

// 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',
    labels={'environment': "dev"})

# 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", &storage.BucketArgs{
            Labels: pulumi.StringMap{
                "environment": pulumi.String("dev"),
            },
        })
        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", new BucketArgs{
            Labels =
            {
                { "environment", "dev" }
            }
        });

        // Export the DNS name of the bucket
        this.BucketName = bucket.Url;
    }

    [Output]
    public Output<string> BucketName { get; set; }
}

Next, we’ll deploy the changes.