Class NamespaceIamPolicy
Three different resources help you manage your IAM policy for Service Directory Namespace. Each of these resources serves a different use case:
gcp.servicedirectory.NamespaceIamPolicy: Authoritative. Sets the IAM policy for the namespace and replaces any existing policy already attached.gcp.servicedirectory.NamespaceIamBinding: 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 namespace are preserved.gcp.servicedirectory.NamespaceIamMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the namespace are preserved.
Note:
gcp.servicedirectory.NamespaceIamPolicycannot be used in conjunction withgcp.servicedirectory.NamespaceIamBindingandgcp.servicedirectory.NamespaceIamMemberor they will fight over what your policy should be.
Note:
gcp.servicedirectory.NamespaceIamBindingresources can be used in conjunction withgcp.servicedirectory.NamespaceIamMemberresources only if they do not grant privilege to the same role.
google_service_directory_namespace_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.ServiceDirectory.NamespaceIamPolicy("policy", new Gcp.ServiceDirectory.NamespaceIamPolicyArgs
{
PolicyData = admin.Apply(admin => admin.PolicyData),
});
}
}
google_service_directory_namespace_iam_binding
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var binding = new Gcp.ServiceDirectory.NamespaceIamBinding("binding", new Gcp.ServiceDirectory.NamespaceIamBindingArgs
{
Role = "roles/viewer",
Members =
{
"user:jane@example.com",
},
});
}
}
google_service_directory_namespace_iam_member
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var member = new Gcp.ServiceDirectory.NamespaceIamMember("member", new Gcp.ServiceDirectory.NamespaceIamMemberArgs
{
Role = "roles/viewer",
Member = "user:jane@example.com",
});
}
}
Inherited Members
Namespace: Pulumi.Gcp.ServiceDirectory
Assembly: Pulumi.Gcp.dll
Syntax
public class NamespaceIamPolicy : CustomResource
Constructors
View SourceNamespaceIamPolicy(String, NamespaceIamPolicyArgs, CustomResourceOptions)
Create a NamespaceIamPolicy resource with the given unique name, arguments, and options.
Declaration
public NamespaceIamPolicy(string name, NamespaceIamPolicyArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| NamespaceIamPolicyArgs | 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 IAM policy.
Declaration
public Output<string> Etag { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
Used to find the parent resource to bind the IAM policy to
Declaration
public Output<string> Name { 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> |
Methods
View SourceGet(String, Input<String>, NamespaceIamPolicyState, CustomResourceOptions)
Get an existing NamespaceIamPolicy resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static NamespaceIamPolicy Get(string name, Input<string> id, NamespaceIamPolicyState 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. |
| NamespaceIamPolicyState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| NamespaceIamPolicy |