BranchProtection

class BranchProtection : KotlinCustomResource

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.BranchProtection;
import com.pulumi.gitlab.BranchProtectionArgs;
import com.pulumi.gitlab.inputs.BranchProtectionAllowedToPushArgs;
import com.pulumi.gitlab.inputs.BranchProtectionAllowedToMergeArgs;
import com.pulumi.gitlab.inputs.BranchProtectionAllowedToUnprotectArgs;
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 branchProtect = new BranchProtection("branchProtect", BranchProtectionArgs.builder()
.project("12345")
.branch("BranchProtected")
.pushAccessLevel("developer")
.mergeAccessLevel("developer")
.unprotectAccessLevel("developer")
.allowForcePush(true)
.codeOwnerApprovalRequired(true)
.allowedToPushes(
BranchProtectionAllowedToPushArgs.builder()
.userId(5)
.build(),
BranchProtectionAllowedToPushArgs.builder()
.userId(521)
.build())
.allowedToMerges(
BranchProtectionAllowedToMergeArgs.builder()
.userId(15)
.build(),
BranchProtectionAllowedToMergeArgs.builder()
.userId(37)
.build())
.allowedToUnprotects(
BranchProtectionAllowedToUnprotectArgs.builder()
.userId(15)
.build(),
BranchProtectionAllowedToUnprotectArgs.builder()
.groupId(42)
.build())
.build());
var main = new BranchProtection("main", BranchProtectionArgs.builder()
.project("12345")
.branch("main")
.pushAccessLevel("maintainer")
.mergeAccessLevel("maintainer")
.unprotectAccessLevel("maintainer")
.dynamic(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
.build());
}
}

Import

Gitlab protected branches can be imported with a key composed of <project_id>:<branch>, e.g.

$ pulumi import gitlab:index/branchProtection:BranchProtection BranchProtect "12345:main"

Properties

Link copied to clipboard

Defines permissions for action.

Link copied to clipboard

Defines permissions for action.

Link copied to clipboard

Defines permissions for action.

Link copied to clipboard
val allowForcePush: Output<Boolean>?

Can be set to true to allow users with push access to force push.

Link copied to clipboard
val branch: Output<String>

Name of the branch.

Link copied to clipboard
val branchProtectionId: Output<Int>

The ID of the branch protection (not the branch name).

Link copied to clipboard

Can be set to true to require code owner approval before merging. Only available own Premium and Ultimate instances.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val mergeAccessLevel: Output<String>?

Access levels allowed to merge. Valid values are: no one, developer, maintainer.

Link copied to clipboard
val project: Output<String>

The id of the project.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val pushAccessLevel: Output<String>?

Access levels allowed to push. Valid values are: no one, developer, maintainer.

Link copied to clipboard

Access levels allowed to unprotect. Valid values are: no one, developer, maintainer.

Link copied to clipboard
val urn: Output<String>