Class RepositoryIamPolicy
Three different resources help you manage your IAM policy for Artifact Registry Repository. Each of these resources serves a different use case:
gcp.artifactregistry.RepositoryIamPolicy: Authoritative. Sets the IAM policy for the repository and replaces any existing policy already attached.gcp.artifactregistry.RepositoryIamBinding: 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 repository are preserved.gcp.artifactregistry.RepositoryIamMember: Non-authoritative. Updates the IAM policy to grant a role to a new member. Other members for the role for the repository are preserved.
Note:
gcp.artifactregistry.RepositoryIamPolicycannot be used in conjunction withgcp.artifactregistry.RepositoryIamBindingandgcp.artifactregistry.RepositoryIamMemberor they will fight over what your policy should be.
Note:
gcp.artifactregistry.RepositoryIamBindingresources can be used in conjunction withgcp.artifactregistry.RepositoryIamMemberresources only if they do not grant privilege to the same role.
google_artifact_registry_repository_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.ArtifactRegistry.RepositoryIamPolicy("policy", new Gcp.ArtifactRegistry.RepositoryIamPolicyArgs
{
Project = google_artifact_registry_repository.My_repo.Project,
Location = google_artifact_registry_repository.My_repo.Location,
Repository = google_artifact_registry_repository.My_repo.Name,
PolicyData = admin.Apply(admin => admin.PolicyData),
});
}
}
google_artifact_registry_repository_iam_binding
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var binding = new Gcp.ArtifactRegistry.RepositoryIamBinding("binding", new Gcp.ArtifactRegistry.RepositoryIamBindingArgs
{
Project = google_artifact_registry_repository.My_repo.Project,
Location = google_artifact_registry_repository.My_repo.Location,
Repository = google_artifact_registry_repository.My_repo.Name,
Role = "roles/viewer",
Members =
{
"user:jane@example.com",
},
});
}
}
google_artifact_registry_repository_iam_member
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var member = new Gcp.ArtifactRegistry.RepositoryIamMember("member", new Gcp.ArtifactRegistry.RepositoryIamMemberArgs
{
Project = google_artifact_registry_repository.My_repo.Project,
Location = google_artifact_registry_repository.My_repo.Location,
Repository = google_artifact_registry_repository.My_repo.Name,
Role = "roles/viewer",
Member = "user:jane@example.com",
});
}
}
Inherited Members
Namespace: Pulumi.Gcp.ArtifactRegistry
Assembly: Pulumi.Gcp.dll
Syntax
public class RepositoryIamPolicy : CustomResource
Constructors
View SourceRepositoryIamPolicy(String, RepositoryIamPolicyArgs, CustomResourceOptions)
Create a RepositoryIamPolicy resource with the given unique name, arguments, and options.
Declaration
public RepositoryIamPolicy(string name, RepositoryIamPolicyArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| RepositoryIamPolicyArgs | 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> |
Location
The name of the location this repository is located in. Used to find the parent resource to bind the IAM policy to
Declaration
public Output<string> Location { 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 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> |
Repository
Used to find the parent resource to bind the IAM policy to
Declaration
public Output<string> Repository { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, RepositoryIamPolicyState, CustomResourceOptions)
Get an existing RepositoryIamPolicy resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static RepositoryIamPolicy Get(string name, Input<string> id, RepositoryIamPolicyState 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. |
| RepositoryIamPolicyState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| RepositoryIamPolicy |