Project Args
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.Project;
import com.pulumi.gitlab.ProjectArgs;
import com.pulumi.gitlab.inputs.ProjectPushRulesArgs;
import com.pulumi.gitlab.GitlabFunctions;
import com.pulumi.gitlab.inputs.GetUserArgs;
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 example = new Project("example", ProjectArgs.builder()
.description("My awesome codebase")
.visibilityLevel("public")
.build());
var example_two = new Project("example-two", ProjectArgs.builder()
.pushRules(ProjectPushRulesArgs.builder()
.authorEmailRegex("@example\\.com$")
.commitCommitterCheck(true)
.memberCheck(true)
.preventSecrets(true)
.build())
.build());
final var peterParker = GitlabFunctions.getUser(GetUserArgs.builder()
.username("peter_parker")
.build());
var petersRepo = new Project("petersRepo", ProjectArgs.builder()
.description("This is a description")
.namespaceId(peterParker.applyValue(getUserResult -> getUserResult.namespaceId()))
.build());
var forkProject = new Project("forkProject", ProjectArgs.builder()
.description("This is a fork")
.forkedFromProjectId(example.id())
.build());
var forkIndex_projectProject = new Project("forkIndex/projectProject", ProjectArgs.builder()
.description("This is a fork")
.forkedFromProjectId(example.id())
.importUrl(example.httpUrlToRepo())
.mirror(true)
.build());
var importPublic = new Project("importPublic", ProjectArgs.builder()
.importUrl("https://gitlab.example.com/repo.git")
.build());
var importPublicWithMirror = new Project("importPublicWithMirror", ProjectArgs.builder()
.importUrl("https://gitlab.example.com/repo.git")
.mirror(true)
.build());
var importPrivateProject = new Project("importPrivateProject", ProjectArgs.builder()
.importUrl("https://gitlab.example.com/repo.git")
.importUrlUsername("user")
.importUrlPassword("pass")
.build());
var importPrivateWithMirror = new Project("importPrivateWithMirror", ProjectArgs.builder()
.importUrl("https://gitlab.example.com/repo.git")
.importUrlUsername("user")
.importUrlPassword("pass")
.mirror(true)
.build());
var importPrivateIndex_projectProject = new Project("importPrivateIndex/projectProject", ProjectArgs.builder()
.importUrl("https://user:pass@gitlab.example.com/repo.git")
.build());
}
}
Import
$ pulumi import gitlab:index/project:Project You can import a project state using `<resource> <id>`. The
id
can be whatever the get_single_project takes for its :id
value, so for example
$ pulumi import gitlab:index/project:Project example richardc/example
NOTEthe import_url_username
and import_url_password
cannot be imported.
Constructors
Functions
Properties
Number of merge request approvals required for merging. Default is 0. This field does not work well in combination with the gitlab.ProjectApprovalRule
resource and is most likely gonna be deprecated in a future GitLab version (see this upstream epic). In the meantime we recommend against using this attribute and use gitlab.ProjectApprovalRule
instead.
Git URL to a repository to be imported. Together with mirror = true
it will setup a Pull Mirror. This can also be used together with forked_from_project_id
to setup a Pull Mirror for a fork. The fork takes precedence over the import. Make sure to provide the credentials in import_url_username
and import_url_password
. GitLab never returns the credentials, thus the provider cannot detect configuration drift in the credentials. They can also not be imported using terraform import
. See the examples section for how to properly use it.
If true
, the default behavior to wait for the default branch protection to be created is skipped. This is necessary if the current user is not an admin and the default branch protection is disabled on an instance-level. There is currently no known way to determine if the default branch protection is disabled on an instance-level for non-admin users. This attribute is only used during resource creation, thus changes are suppressed and the attribute cannot be imported.
When used with usecustomtemplate, project ID of a custom project template. This is preferable to using templatename since templatename may be ambiguous (enterprise edition). This option is mutually exclusive with template_name
. See gitlab.GroupProjectFileTemplate
to set a project as a template project. If a project has not been set as a template, using it here will result in an error.