Show / Hide Table of Contents

Class 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",
    });
}

}
Inheritance
System.Object
Resource
CustomResource
TopicIAMBinding
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Gcp.PubSub
Assembly: Pulumi.Gcp.dll
Syntax
public class TopicIAMBinding : CustomResource

Constructors

View Source

TopicIAMBinding(String, TopicIAMBindingArgs, CustomResourceOptions)

Create a TopicIAMBinding resource with the given unique name, arguments, and options.

Declaration
public TopicIAMBinding(string name, TopicIAMBindingArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

TopicIAMBindingArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

Condition

Declaration
public Output<TopicIAMBindingCondition> Condition { get; }
Property Value
Type Description
Output<TopicIAMBindingCondition>
View Source

Etag

(Computed) The etag of the IAM policy.

Declaration
public Output<string> Etag { get; }
Property Value
Type Description
Output<System.String>
View Source

Members

Declaration
public Output<ImmutableArray<string>> Members { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

Project

The ID of the project in which the resource belongs. If it is not provided, the project will be parsed from the identifier of the parent resource. If no project is provided in the parent identifier and no project is specified, the provider project is used.

Declaration
public Output<string> Project { get; }
Property Value
Type Description
Output<System.String>
View Source

Role

The role that should be applied. Only one gcp.pubsub.TopicIAMBinding can be used per role. Note that custom roles must be of the format [projects|organizations]/{parent-name}/roles/{role-name}.

Declaration
public Output<string> Role { get; }
Property Value
Type Description
Output<System.String>
View Source

Topic

Used to find the parent resource to bind the IAM policy to

Declaration
public Output<string> Topic { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, TopicIAMBindingState, CustomResourceOptions)

Get an existing TopicIAMBinding resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static TopicIAMBinding Get(string name, Input<string> id, TopicIAMBindingState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

TopicIAMBindingState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
TopicIAMBinding
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.