Class 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.SubscriptionIAMPolicycannot be used in conjunction withgcp.pubsub.SubscriptionIAMBindingandgcp.pubsub.SubscriptionIAMMemberor they will fight over what your policy should be.
Note:
gcp.pubsub.SubscriptionIAMBindingresources can be used in conjunction withgcp.pubsub.SubscriptionIAMMemberresources 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",
});
}
}
Inherited Members
Namespace: Pulumi.Gcp.PubSub
Assembly: Pulumi.Gcp.dll
Syntax
public class SubscriptionIAMPolicy : CustomResource
Constructors
View SourceSubscriptionIAMPolicy(String, SubscriptionIAMPolicyArgs, CustomResourceOptions)
Create a SubscriptionIAMPolicy resource with the given unique name, arguments, and options.
Declaration
public SubscriptionIAMPolicy(string name, SubscriptionIAMPolicyArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| SubscriptionIAMPolicyArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceEtag
(Computed) The etag of the subscription's IAM policy.
Declaration
public Output<string> Etag { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PolicyData
The policy data generated by
a gcp.organizations.getIAMPolicy data source.
Declaration
public Output<string> PolicyData { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Project
The project in which the resource belongs. If it is not provided, the provider project is used.
Declaration
public Output<string> Project { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Subscription
The subscription name or id to bind to attach IAM policy to.
Declaration
public Output<string> Subscription { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, SubscriptionIAMPolicyState, CustomResourceOptions)
Get an existing SubscriptionIAMPolicy resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static SubscriptionIAMPolicy Get(string name, Input<string> id, SubscriptionIAMPolicyState 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. |
| SubscriptionIAMPolicyState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| SubscriptionIAMPolicy |