Show / Hide Table of Contents

Namespace Pulumi.Gcp.PubSub

Classes

Subscription

A named resource representing the stream of messages from a single, specific topic, to be delivered to the subscribing application.

To get more information about Subscription, see:

  • API documentation
  • How-to Guides
  • Managing Subscriptions

Example Usage - Pubsub Subscription Different Project

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var exampleTopic = new Gcp.PubSub.Topic("exampleTopic", new Gcp.PubSub.TopicArgs
    {
        Project = "topic-project",
    });
    var exampleSubscription = new Gcp.PubSub.Subscription("exampleSubscription", new Gcp.PubSub.SubscriptionArgs
    {
        Project = "subscription-project",
        Topic = exampleTopic.Name,
    });
}

}

SubscriptionArgs

SubscriptionIAMBinding

Three different resources help you manage your IAM policy for pubsub subscription. Each of these resources serves a different use case:

  • gcp.pubsub.SubscriptionIAMPolicy: Authoritative. Sets the IAM policy for the subscription and replaces any existing policy already attached.
  • gcp.pubsub.SubscriptionIAMBinding: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the subscription are preserved.
  • gcp.pubsub.SubscriptionIAMMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the subscription are preserved.

Note: gcp.pubsub.SubscriptionIAMPolicy cannot be used in conjunction with gcp.pubsub.SubscriptionIAMBinding and gcp.pubsub.SubscriptionIAMMember or they will fight over what your policy should be.

Note: gcp.pubsub.SubscriptionIAMBinding resources can be used in conjunction with gcp.pubsub.SubscriptionIAMMember resources only if they do not grant privilege to the same role.

google_pubsub_subscription_iam_policy

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var admin = Output.Create(Gcp.Organizations.GetIAMPolicy.InvokeAsync(new Gcp.Organizations.GetIAMPolicyArgs
    {
        Binding = 
        {

            {
                { "role", "roles/editor" },
                { "members", 
                {
                    "user:jane@example.com",
                } },
            },
        },
    }));
    var editor = new Gcp.PubSub.SubscriptionIAMPolicy("editor", new Gcp.PubSub.SubscriptionIAMPolicyArgs
    {
        Subscription = "your-subscription-name",
        PolicyData = admin.Apply(admin => admin.PolicyData),
    });
}

}

google_pubsub_subscription_iam_binding

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var editor = new Gcp.PubSub.SubscriptionIAMBinding("editor", new Gcp.PubSub.SubscriptionIAMBindingArgs
    {
        Members = 
        {
            "user:jane@example.com",
        },
        Role = "roles/editor",
        Subscription = "your-subscription-name",
    });
}

}

google_pubsub_subscription_iam_member

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var editor = new Gcp.PubSub.SubscriptionIAMMember("editor", new Gcp.PubSub.SubscriptionIAMMemberArgs
    {
        Member = "user:jane@example.com",
        Role = "roles/editor",
        Subscription = "your-subscription-name",
    });
}

}

SubscriptionIAMBindingArgs

SubscriptionIAMBindingState

SubscriptionIAMMember

Three different resources help you manage your IAM policy for pubsub subscription. Each of these resources serves a different use case:

  • gcp.pubsub.SubscriptionIAMPolicy: Authoritative. Sets the IAM policy for the subscription and replaces any existing policy already attached.
  • gcp.pubsub.SubscriptionIAMBinding: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the subscription are preserved.
  • gcp.pubsub.SubscriptionIAMMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the subscription are preserved.

Note: gcp.pubsub.SubscriptionIAMPolicy cannot be used in conjunction with gcp.pubsub.SubscriptionIAMBinding and gcp.pubsub.SubscriptionIAMMember or they will fight over what your policy should be.

Note: gcp.pubsub.SubscriptionIAMBinding resources can be used in conjunction with gcp.pubsub.SubscriptionIAMMember resources only if they do not grant privilege to the same role.

google_pubsub_subscription_iam_policy

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var admin = Output.Create(Gcp.Organizations.GetIAMPolicy.InvokeAsync(new Gcp.Organizations.GetIAMPolicyArgs
    {
        Binding = 
        {

            {
                { "role", "roles/editor" },
                { "members", 
                {
                    "user:jane@example.com",
                } },
            },
        },
    }));
    var editor = new Gcp.PubSub.SubscriptionIAMPolicy("editor", new Gcp.PubSub.SubscriptionIAMPolicyArgs
    {
        Subscription = "your-subscription-name",
        PolicyData = admin.Apply(admin => admin.PolicyData),
    });
}

}

google_pubsub_subscription_iam_binding

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var editor = new Gcp.PubSub.SubscriptionIAMBinding("editor", new Gcp.PubSub.SubscriptionIAMBindingArgs
    {
        Members = 
        {
            "user:jane@example.com",
        },
        Role = "roles/editor",
        Subscription = "your-subscription-name",
    });
}

}

google_pubsub_subscription_iam_member

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var editor = new Gcp.PubSub.SubscriptionIAMMember("editor", new Gcp.PubSub.SubscriptionIAMMemberArgs
    {
        Member = "user:jane@example.com",
        Role = "roles/editor",
        Subscription = "your-subscription-name",
    });
}

}

SubscriptionIAMMemberArgs

SubscriptionIAMMemberState

SubscriptionIAMPolicy

Three different resources help you manage your IAM policy for pubsub subscription. Each of these resources serves a different use case:

  • gcp.pubsub.SubscriptionIAMPolicy: Authoritative. Sets the IAM policy for the subscription and replaces any existing policy already attached.
  • gcp.pubsub.SubscriptionIAMBinding: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the subscription are preserved.
  • gcp.pubsub.SubscriptionIAMMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the subscription are preserved.

Note: gcp.pubsub.SubscriptionIAMPolicy cannot be used in conjunction with gcp.pubsub.SubscriptionIAMBinding and gcp.pubsub.SubscriptionIAMMember or they will fight over what your policy should be.

Note: gcp.pubsub.SubscriptionIAMBinding resources can be used in conjunction with gcp.pubsub.SubscriptionIAMMember resources only if they do not grant privilege to the same role.

google_pubsub_subscription_iam_policy

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var admin = Output.Create(Gcp.Organizations.GetIAMPolicy.InvokeAsync(new Gcp.Organizations.GetIAMPolicyArgs
    {
        Binding = 
        {

            {
                { "role", "roles/editor" },
                { "members", 
                {
                    "user:jane@example.com",
                } },
            },
        },
    }));
    var editor = new Gcp.PubSub.SubscriptionIAMPolicy("editor", new Gcp.PubSub.SubscriptionIAMPolicyArgs
    {
        Subscription = "your-subscription-name",
        PolicyData = admin.Apply(admin => admin.PolicyData),
    });
}

}

google_pubsub_subscription_iam_binding

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var editor = new Gcp.PubSub.SubscriptionIAMBinding("editor", new Gcp.PubSub.SubscriptionIAMBindingArgs
    {
        Members = 
        {
            "user:jane@example.com",
        },
        Role = "roles/editor",
        Subscription = "your-subscription-name",
    });
}

}

google_pubsub_subscription_iam_member

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var editor = new Gcp.PubSub.SubscriptionIAMMember("editor", new Gcp.PubSub.SubscriptionIAMMemberArgs
    {
        Member = "user:jane@example.com",
        Role = "roles/editor",
        Subscription = "your-subscription-name",
    });
}

}

SubscriptionIAMPolicyArgs

SubscriptionIAMPolicyState

SubscriptionState

Topic

A named resource to which messages are sent by publishers.

To get more information about Topic, see:

  • API documentation
  • How-to Guides
  • Managing Topics

Example Usage - Pubsub Topic Basic

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var example = new Gcp.PubSub.Topic("example", new Gcp.PubSub.TopicArgs
    {
        Labels = 
        {
            { "foo", "bar" },
        },
    });
}

}

Example Usage - Pubsub Topic Cmek

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var keyRing = new Gcp.Kms.KeyRing("keyRing", new Gcp.Kms.KeyRingArgs
    {
        Location = "global",
    });
    var cryptoKey = new Gcp.Kms.CryptoKey("cryptoKey", new Gcp.Kms.CryptoKeyArgs
    {
        KeyRing = keyRing.Id,
    });
    var example = new Gcp.PubSub.Topic("example", new Gcp.PubSub.TopicArgs
    {
        KmsKeyName = cryptoKey.Id,
    });
}

}

Example Usage - Pubsub Topic Geo Restricted

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var example = new Gcp.PubSub.Topic("example", new Gcp.PubSub.TopicArgs
    {
        MessageStoragePolicy = new Gcp.PubSub.Inputs.TopicMessageStoragePolicyArgs
        {
            AllowedPersistenceRegions = 
            {
                "europe-west3",
            },
        },
    });
}

}

TopicArgs

TopicIAMBinding

Three different resources help you manage your IAM policy for Cloud Pub/Sub Topic. Each of these resources serves a different use case:

  • gcp.pubsub.TopicIAMPolicy: Authoritative. Sets the IAM policy for the topic and replaces any existing policy already attached.
  • gcp.pubsub.TopicIAMBinding: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the topic are preserved.
  • gcp.pubsub.TopicIAMMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the topic are preserved.

Note: gcp.pubsub.TopicIAMPolicy cannot be used in conjunction with gcp.pubsub.TopicIAMBinding and gcp.pubsub.TopicIAMMember or they will fight over what your policy should be.

Note: gcp.pubsub.TopicIAMBinding resources can be used in conjunction with gcp.pubsub.TopicIAMMember resources only if they do not grant privilege to the same role.

google_pubsub_topic_iam_policy

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var admin = Output.Create(Gcp.Organizations.GetIAMPolicy.InvokeAsync(new Gcp.Organizations.GetIAMPolicyArgs
    {
        Binding = 
        {

            {
                { "role", "roles/viewer" },
                { "members", 
                {
                    "user:jane@example.com",
                } },
            },
        },
    }));
    var policy = new Gcp.PubSub.TopicIAMPolicy("policy", new Gcp.PubSub.TopicIAMPolicyArgs
    {
        Project = google_pubsub_topic.Example.Project,
        Topic = google_pubsub_topic.Example.Name,
        PolicyData = admin.Apply(admin => admin.PolicyData),
    });
}

}

google_pubsub_topic_iam_binding

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var binding = new Gcp.PubSub.TopicIAMBinding("binding", new Gcp.PubSub.TopicIAMBindingArgs
    {
        Project = google_pubsub_topic.Example.Project,
        Topic = google_pubsub_topic.Example.Name,
        Role = "roles/viewer",
        Members = 
        {
            "user:jane@example.com",
        },
    });
}

}

google_pubsub_topic_iam_member

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var member = new Gcp.PubSub.TopicIAMMember("member", new Gcp.PubSub.TopicIAMMemberArgs
    {
        Project = google_pubsub_topic.Example.Project,
        Topic = google_pubsub_topic.Example.Name,
        Role = "roles/viewer",
        Member = "user:jane@example.com",
    });
}

}

TopicIAMBindingArgs

TopicIAMBindingState

TopicIAMMember

Three different resources help you manage your IAM policy for Cloud Pub/Sub Topic. Each of these resources serves a different use case:

  • gcp.pubsub.TopicIAMPolicy: Authoritative. Sets the IAM policy for the topic and replaces any existing policy already attached.
  • gcp.pubsub.TopicIAMBinding: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the topic are preserved.
  • gcp.pubsub.TopicIAMMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the topic are preserved.

Note: gcp.pubsub.TopicIAMPolicy cannot be used in conjunction with gcp.pubsub.TopicIAMBinding and gcp.pubsub.TopicIAMMember or they will fight over what your policy should be.

Note: gcp.pubsub.TopicIAMBinding resources can be used in conjunction with gcp.pubsub.TopicIAMMember resources only if they do not grant privilege to the same role.

google_pubsub_topic_iam_policy

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var admin = Output.Create(Gcp.Organizations.GetIAMPolicy.InvokeAsync(new Gcp.Organizations.GetIAMPolicyArgs
    {
        Binding = 
        {

            {
                { "role", "roles/viewer" },
                { "members", 
                {
                    "user:jane@example.com",
                } },
            },
        },
    }));
    var policy = new Gcp.PubSub.TopicIAMPolicy("policy", new Gcp.PubSub.TopicIAMPolicyArgs
    {
        Project = google_pubsub_topic.Example.Project,
        Topic = google_pubsub_topic.Example.Name,
        PolicyData = admin.Apply(admin => admin.PolicyData),
    });
}

}

google_pubsub_topic_iam_binding

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var binding = new Gcp.PubSub.TopicIAMBinding("binding", new Gcp.PubSub.TopicIAMBindingArgs
    {
        Project = google_pubsub_topic.Example.Project,
        Topic = google_pubsub_topic.Example.Name,
        Role = "roles/viewer",
        Members = 
        {
            "user:jane@example.com",
        },
    });
}

}

google_pubsub_topic_iam_member

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var member = new Gcp.PubSub.TopicIAMMember("member", new Gcp.PubSub.TopicIAMMemberArgs
    {
        Project = google_pubsub_topic.Example.Project,
        Topic = google_pubsub_topic.Example.Name,
        Role = "roles/viewer",
        Member = "user:jane@example.com",
    });
}

}

TopicIAMMemberArgs

TopicIAMMemberState

TopicIAMPolicy

Three different resources help you manage your IAM policy for Cloud Pub/Sub Topic. Each of these resources serves a different use case:

  • gcp.pubsub.TopicIAMPolicy: Authoritative. Sets the IAM policy for the topic and replaces any existing policy already attached.
  • gcp.pubsub.TopicIAMBinding: Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the topic are preserved.
  • gcp.pubsub.TopicIAMMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the topic are preserved.

Note: gcp.pubsub.TopicIAMPolicy cannot be used in conjunction with gcp.pubsub.TopicIAMBinding and gcp.pubsub.TopicIAMMember or they will fight over what your policy should be.

Note: gcp.pubsub.TopicIAMBinding resources can be used in conjunction with gcp.pubsub.TopicIAMMember resources only if they do not grant privilege to the same role.

google_pubsub_topic_iam_policy

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var admin = Output.Create(Gcp.Organizations.GetIAMPolicy.InvokeAsync(new Gcp.Organizations.GetIAMPolicyArgs
    {
        Binding = 
        {

            {
                { "role", "roles/viewer" },
                { "members", 
                {
                    "user:jane@example.com",
                } },
            },
        },
    }));
    var policy = new Gcp.PubSub.TopicIAMPolicy("policy", new Gcp.PubSub.TopicIAMPolicyArgs
    {
        Project = google_pubsub_topic.Example.Project,
        Topic = google_pubsub_topic.Example.Name,
        PolicyData = admin.Apply(admin => admin.PolicyData),
    });
}

}

google_pubsub_topic_iam_binding

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var binding = new Gcp.PubSub.TopicIAMBinding("binding", new Gcp.PubSub.TopicIAMBindingArgs
    {
        Project = google_pubsub_topic.Example.Project,
        Topic = google_pubsub_topic.Example.Name,
        Role = "roles/viewer",
        Members = 
        {
            "user:jane@example.com",
        },
    });
}

}

google_pubsub_topic_iam_member

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
public MyStack()
{
    var member = new Gcp.PubSub.TopicIAMMember("member", new Gcp.PubSub.TopicIAMMemberArgs
    {
        Project = google_pubsub_topic.Example.Project,
        Topic = google_pubsub_topic.Example.Name,
        Role = "roles/viewer",
        Member = "user:jane@example.com",
    });
}

}

TopicIAMPolicyArgs

TopicIAMPolicyState

TopicState

Back to top Copyright 2016-2020, Pulumi Corporation.