gitlab.ProjectContainerRepositoryProtection
Explore with Pulumi AI
The gitlab.ProjectContainerRepositoryProtection
resource allows managing the lifecycle of a container repository protection rule.
You can use a wildcard (*) to protect multiple container repositories with the same container protection rule. You can apply several protection rules to the same container repository. A container repository is protected if at least one protection rule matches.
Upstream API: GitLab API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const _this = new gitlab.ProjectContainerRepositoryProtection("this", {
project: "123",
repositoryPathPattern: "my_namespace/project*",
minimumAccessLevelForPush: "owner",
minimumAccessLevelForDelete: "admin",
});
import pulumi
import pulumi_gitlab as gitlab
this = gitlab.ProjectContainerRepositoryProtection("this",
project="123",
repository_path_pattern="my_namespace/project*",
minimum_access_level_for_push="owner",
minimum_access_level_for_delete="admin")
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v9/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := gitlab.NewProjectContainerRepositoryProtection(ctx, "this", &gitlab.ProjectContainerRepositoryProtectionArgs{
Project: pulumi.String("123"),
RepositoryPathPattern: pulumi.String("my_namespace/project*"),
MinimumAccessLevelForPush: pulumi.String("owner"),
MinimumAccessLevelForDelete: pulumi.String("admin"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
var @this = new GitLab.ProjectContainerRepositoryProtection("this", new()
{
Project = "123",
RepositoryPathPattern = "my_namespace/project*",
MinimumAccessLevelForPush = "owner",
MinimumAccessLevelForDelete = "admin",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.ProjectContainerRepositoryProtection;
import com.pulumi.gitlab.ProjectContainerRepositoryProtectionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var this_ = new ProjectContainerRepositoryProtection("this", ProjectContainerRepositoryProtectionArgs.builder()
.project("123")
.repositoryPathPattern("my_namespace/project*")
.minimumAccessLevelForPush("owner")
.minimumAccessLevelForDelete("admin")
.build());
}
}
resources:
this:
type: gitlab:ProjectContainerRepositoryProtection
properties:
project: 123
repositoryPathPattern: my_namespace/project*
minimumAccessLevelForPush: owner
minimumAccessLevelForDelete: admin
Create ProjectContainerRepositoryProtection Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ProjectContainerRepositoryProtection(name: string, args: ProjectContainerRepositoryProtectionArgs, opts?: CustomResourceOptions);
@overload
def ProjectContainerRepositoryProtection(resource_name: str,
args: ProjectContainerRepositoryProtectionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ProjectContainerRepositoryProtection(resource_name: str,
opts: Optional[ResourceOptions] = None,
project: Optional[str] = None,
repository_path_pattern: Optional[str] = None,
minimum_access_level_for_delete: Optional[str] = None,
minimum_access_level_for_push: Optional[str] = None)
func NewProjectContainerRepositoryProtection(ctx *Context, name string, args ProjectContainerRepositoryProtectionArgs, opts ...ResourceOption) (*ProjectContainerRepositoryProtection, error)
public ProjectContainerRepositoryProtection(string name, ProjectContainerRepositoryProtectionArgs args, CustomResourceOptions? opts = null)
public ProjectContainerRepositoryProtection(String name, ProjectContainerRepositoryProtectionArgs args)
public ProjectContainerRepositoryProtection(String name, ProjectContainerRepositoryProtectionArgs args, CustomResourceOptions options)
type: gitlab:ProjectContainerRepositoryProtection
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ProjectContainerRepositoryProtectionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ProjectContainerRepositoryProtectionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ProjectContainerRepositoryProtectionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ProjectContainerRepositoryProtectionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ProjectContainerRepositoryProtectionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var projectContainerRepositoryProtectionResource = new GitLab.ProjectContainerRepositoryProtection("projectContainerRepositoryProtectionResource", new()
{
Project = "string",
RepositoryPathPattern = "string",
MinimumAccessLevelForDelete = "string",
MinimumAccessLevelForPush = "string",
});
example, err := gitlab.NewProjectContainerRepositoryProtection(ctx, "projectContainerRepositoryProtectionResource", &gitlab.ProjectContainerRepositoryProtectionArgs{
Project: pulumi.String("string"),
RepositoryPathPattern: pulumi.String("string"),
MinimumAccessLevelForDelete: pulumi.String("string"),
MinimumAccessLevelForPush: pulumi.String("string"),
})
var projectContainerRepositoryProtectionResource = new ProjectContainerRepositoryProtection("projectContainerRepositoryProtectionResource", ProjectContainerRepositoryProtectionArgs.builder()
.project("string")
.repositoryPathPattern("string")
.minimumAccessLevelForDelete("string")
.minimumAccessLevelForPush("string")
.build());
project_container_repository_protection_resource = gitlab.ProjectContainerRepositoryProtection("projectContainerRepositoryProtectionResource",
project="string",
repository_path_pattern="string",
minimum_access_level_for_delete="string",
minimum_access_level_for_push="string")
const projectContainerRepositoryProtectionResource = new gitlab.ProjectContainerRepositoryProtection("projectContainerRepositoryProtectionResource", {
project: "string",
repositoryPathPattern: "string",
minimumAccessLevelForDelete: "string",
minimumAccessLevelForPush: "string",
});
type: gitlab:ProjectContainerRepositoryProtection
properties:
minimumAccessLevelForDelete: string
minimumAccessLevelForPush: string
project: string
repositoryPathPattern: string
ProjectContainerRepositoryProtection Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ProjectContainerRepositoryProtection resource accepts the following input properties:
- Project string
- ID or URL-encoded path of the project.
- Repository
Path stringPattern - Container repository path pattern protected by the protection rule. Wildcard character * allowed. Repository path pattern should start with the project's full path
- Minimum
Access stringLevel For Delete - Minimum GitLab access level required to delete container images in the container registry. For example maintainer, owner, admin. Must be provided when
minimum_access_level_for_push
is not set. - Minimum
Access stringLevel For Push - Minimum GitLab access level required to push container images to the container registry. For example maintainer, owner or admin. Must be provided when
minimum_access_level_for_delete
is not set.
- Project string
- ID or URL-encoded path of the project.
- Repository
Path stringPattern - Container repository path pattern protected by the protection rule. Wildcard character * allowed. Repository path pattern should start with the project's full path
- Minimum
Access stringLevel For Delete - Minimum GitLab access level required to delete container images in the container registry. For example maintainer, owner, admin. Must be provided when
minimum_access_level_for_push
is not set. - Minimum
Access stringLevel For Push - Minimum GitLab access level required to push container images to the container registry. For example maintainer, owner or admin. Must be provided when
minimum_access_level_for_delete
is not set.
- project String
- ID or URL-encoded path of the project.
- repository
Path StringPattern - Container repository path pattern protected by the protection rule. Wildcard character * allowed. Repository path pattern should start with the project's full path
- minimum
Access StringLevel For Delete - Minimum GitLab access level required to delete container images in the container registry. For example maintainer, owner, admin. Must be provided when
minimum_access_level_for_push
is not set. - minimum
Access StringLevel For Push - Minimum GitLab access level required to push container images to the container registry. For example maintainer, owner or admin. Must be provided when
minimum_access_level_for_delete
is not set.
- project string
- ID or URL-encoded path of the project.
- repository
Path stringPattern - Container repository path pattern protected by the protection rule. Wildcard character * allowed. Repository path pattern should start with the project's full path
- minimum
Access stringLevel For Delete - Minimum GitLab access level required to delete container images in the container registry. For example maintainer, owner, admin. Must be provided when
minimum_access_level_for_push
is not set. - minimum
Access stringLevel For Push - Minimum GitLab access level required to push container images to the container registry. For example maintainer, owner or admin. Must be provided when
minimum_access_level_for_delete
is not set.
- project str
- ID or URL-encoded path of the project.
- repository_
path_ strpattern - Container repository path pattern protected by the protection rule. Wildcard character * allowed. Repository path pattern should start with the project's full path
- minimum_
access_ strlevel_ for_ delete - Minimum GitLab access level required to delete container images in the container registry. For example maintainer, owner, admin. Must be provided when
minimum_access_level_for_push
is not set. - minimum_
access_ strlevel_ for_ push - Minimum GitLab access level required to push container images to the container registry. For example maintainer, owner or admin. Must be provided when
minimum_access_level_for_delete
is not set.
- project String
- ID or URL-encoded path of the project.
- repository
Path StringPattern - Container repository path pattern protected by the protection rule. Wildcard character * allowed. Repository path pattern should start with the project's full path
- minimum
Access StringLevel For Delete - Minimum GitLab access level required to delete container images in the container registry. For example maintainer, owner, admin. Must be provided when
minimum_access_level_for_push
is not set. - minimum
Access StringLevel For Push - Minimum GitLab access level required to push container images to the container registry. For example maintainer, owner or admin. Must be provided when
minimum_access_level_for_delete
is not set.
Outputs
All input properties are implicitly available as output properties. Additionally, the ProjectContainerRepositoryProtection resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Protection
Rule intId - Unique ID of the protection rule.
- Id string
- The provider-assigned unique ID for this managed resource.
- Protection
Rule intId - Unique ID of the protection rule.
- id String
- The provider-assigned unique ID for this managed resource.
- protection
Rule IntegerId - Unique ID of the protection rule.
- id string
- The provider-assigned unique ID for this managed resource.
- protection
Rule numberId - Unique ID of the protection rule.
- id str
- The provider-assigned unique ID for this managed resource.
- protection_
rule_ intid - Unique ID of the protection rule.
- id String
- The provider-assigned unique ID for this managed resource.
- protection
Rule NumberId - Unique ID of the protection rule.
Look up Existing ProjectContainerRepositoryProtection Resource
Get an existing ProjectContainerRepositoryProtection resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ProjectContainerRepositoryProtectionState, opts?: CustomResourceOptions): ProjectContainerRepositoryProtection
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
minimum_access_level_for_delete: Optional[str] = None,
minimum_access_level_for_push: Optional[str] = None,
project: Optional[str] = None,
protection_rule_id: Optional[int] = None,
repository_path_pattern: Optional[str] = None) -> ProjectContainerRepositoryProtection
func GetProjectContainerRepositoryProtection(ctx *Context, name string, id IDInput, state *ProjectContainerRepositoryProtectionState, opts ...ResourceOption) (*ProjectContainerRepositoryProtection, error)
public static ProjectContainerRepositoryProtection Get(string name, Input<string> id, ProjectContainerRepositoryProtectionState? state, CustomResourceOptions? opts = null)
public static ProjectContainerRepositoryProtection get(String name, Output<String> id, ProjectContainerRepositoryProtectionState state, CustomResourceOptions options)
resources: _: type: gitlab:ProjectContainerRepositoryProtection get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Minimum
Access stringLevel For Delete - Minimum GitLab access level required to delete container images in the container registry. For example maintainer, owner, admin. Must be provided when
minimum_access_level_for_push
is not set. - Minimum
Access stringLevel For Push - Minimum GitLab access level required to push container images to the container registry. For example maintainer, owner or admin. Must be provided when
minimum_access_level_for_delete
is not set. - Project string
- ID or URL-encoded path of the project.
- Protection
Rule intId - Unique ID of the protection rule.
- Repository
Path stringPattern - Container repository path pattern protected by the protection rule. Wildcard character * allowed. Repository path pattern should start with the project's full path
- Minimum
Access stringLevel For Delete - Minimum GitLab access level required to delete container images in the container registry. For example maintainer, owner, admin. Must be provided when
minimum_access_level_for_push
is not set. - Minimum
Access stringLevel For Push - Minimum GitLab access level required to push container images to the container registry. For example maintainer, owner or admin. Must be provided when
minimum_access_level_for_delete
is not set. - Project string
- ID or URL-encoded path of the project.
- Protection
Rule intId - Unique ID of the protection rule.
- Repository
Path stringPattern - Container repository path pattern protected by the protection rule. Wildcard character * allowed. Repository path pattern should start with the project's full path
- minimum
Access StringLevel For Delete - Minimum GitLab access level required to delete container images in the container registry. For example maintainer, owner, admin. Must be provided when
minimum_access_level_for_push
is not set. - minimum
Access StringLevel For Push - Minimum GitLab access level required to push container images to the container registry. For example maintainer, owner or admin. Must be provided when
minimum_access_level_for_delete
is not set. - project String
- ID or URL-encoded path of the project.
- protection
Rule IntegerId - Unique ID of the protection rule.
- repository
Path StringPattern - Container repository path pattern protected by the protection rule. Wildcard character * allowed. Repository path pattern should start with the project's full path
- minimum
Access stringLevel For Delete - Minimum GitLab access level required to delete container images in the container registry. For example maintainer, owner, admin. Must be provided when
minimum_access_level_for_push
is not set. - minimum
Access stringLevel For Push - Minimum GitLab access level required to push container images to the container registry. For example maintainer, owner or admin. Must be provided when
minimum_access_level_for_delete
is not set. - project string
- ID or URL-encoded path of the project.
- protection
Rule numberId - Unique ID of the protection rule.
- repository
Path stringPattern - Container repository path pattern protected by the protection rule. Wildcard character * allowed. Repository path pattern should start with the project's full path
- minimum_
access_ strlevel_ for_ delete - Minimum GitLab access level required to delete container images in the container registry. For example maintainer, owner, admin. Must be provided when
minimum_access_level_for_push
is not set. - minimum_
access_ strlevel_ for_ push - Minimum GitLab access level required to push container images to the container registry. For example maintainer, owner or admin. Must be provided when
minimum_access_level_for_delete
is not set. - project str
- ID or URL-encoded path of the project.
- protection_
rule_ intid - Unique ID of the protection rule.
- repository_
path_ strpattern - Container repository path pattern protected by the protection rule. Wildcard character * allowed. Repository path pattern should start with the project's full path
- minimum
Access StringLevel For Delete - Minimum GitLab access level required to delete container images in the container registry. For example maintainer, owner, admin. Must be provided when
minimum_access_level_for_push
is not set. - minimum
Access StringLevel For Push - Minimum GitLab access level required to push container images to the container registry. For example maintainer, owner or admin. Must be provided when
minimum_access_level_for_delete
is not set. - project String
- ID or URL-encoded path of the project.
- protection
Rule NumberId - Unique ID of the protection rule.
- repository
Path StringPattern - Container repository path pattern protected by the protection rule. Wildcard character * allowed. Repository path pattern should start with the project's full path
Import
Starting in Terraform v1.5.0, you can use an import block to import gitlab_project_container_repository_protection
. For example:
terraform
import {
to = gitlab_project_container_repository_protection.example
id = “see CLI command below for ID”
}
Importing using the CLI is supported with the following syntax:
GitLab project container repository protection rules can be imported using an id made up of <project_id>:<protection_rule_id>
, e.g.
$ pulumi import gitlab:index/projectContainerRepositoryProtection:ProjectContainerRepositoryProtection this 123:321
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- GitLab pulumi/pulumi-gitlab
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
gitlab
Terraform Provider.