Class SecretIamBinding
Three different resources help you manage your IAM policy for Secret Manager Secret. Each of these resources serves a different use case:
gcp.secretmanager.SecretIamPolicy: Authoritative. Sets the IAM policy for the secret and replaces any existing policy already attached.gcp.secretmanager.SecretIamBinding: 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 secret are preserved.gcp.secretmanager.SecretIamMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the secret are preserved.
Note:
gcp.secretmanager.SecretIamPolicycannot be used in conjunction withgcp.secretmanager.SecretIamBindingandgcp.secretmanager.SecretIamMemberor they will fight over what your policy should be.
Note:
gcp.secretmanager.SecretIamBindingresources can be used in conjunction withgcp.secretmanager.SecretIamMemberresources only if they do not grant privilege to the same role.
google_secret_manager_secret_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.SecretManager.SecretIamPolicy("policy", new Gcp.SecretManager.SecretIamPolicyArgs
{
Project = google_secret_manager_secret.Secret_basic.Project,
SecretId = google_secret_manager_secret.Secret_basic.Secret_id,
PolicyData = admin.Apply(admin => admin.PolicyData),
});
}
}
google_secret_manager_secret_iam_binding
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var binding = new Gcp.SecretManager.SecretIamBinding("binding", new Gcp.SecretManager.SecretIamBindingArgs
{
Project = google_secret_manager_secret.Secret_basic.Project,
SecretId = google_secret_manager_secret.Secret_basic.Secret_id,
Role = "roles/viewer",
Members =
{
"user:jane@example.com",
},
});
}
}
google_secret_manager_secret_iam_member
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var member = new Gcp.SecretManager.SecretIamMember("member", new Gcp.SecretManager.SecretIamMemberArgs
{
Project = google_secret_manager_secret.Secret_basic.Project,
SecretId = google_secret_manager_secret.Secret_basic.Secret_id,
Role = "roles/viewer",
Member = "user:jane@example.com",
});
}
}
Inherited Members
Namespace: Pulumi.Gcp.SecretManager
Assembly: Pulumi.Gcp.dll
Syntax
public class SecretIamBinding : CustomResource
Constructors
View SourceSecretIamBinding(String, SecretIamBindingArgs, CustomResourceOptions)
Create a SecretIamBinding resource with the given unique name, arguments, and options.
Declaration
public SecretIamBinding(string name, SecretIamBindingArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| SecretIamBindingArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceCondition
Declaration
public Output<SecretIamBindingCondition> Condition { get; }
Property Value
| Type | Description |
|---|---|
| Output<SecretIamBindingCondition> |
Etag
(Computed) The etag of the IAM policy.
Declaration
public Output<string> Etag { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Members
Declaration
public Output<ImmutableArray<string>> Members { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
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> |
Role
The role that should be applied. Only one
gcp.secretmanager.SecretIamBinding 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> |
SecretId
Declaration
public Output<string> SecretId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, SecretIamBindingState, CustomResourceOptions)
Get an existing SecretIamBinding resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static SecretIamBinding Get(string name, Input<string> id, SecretIamBindingState 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. |
| SecretIamBindingState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| SecretIamBinding |