1. Packages
  2. Gitlab Provider
  3. API Docs
  4. RepositoryFile
GitLab v8.10.0 published on Friday, Mar 21, 2025 by Pulumi

gitlab.RepositoryFile

Explore with Pulumi AI

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
import * as std from "@pulumi/std";

const _this = new gitlab.Group("this", {
    name: "example",
    path: "example",
    description: "An example group",
});
const thisProject = new gitlab.Project("this", {
    name: "example",
    namespaceId: _this.id,
    initializeWithReadme: true,
});
const thisRepositoryFile = new gitlab.RepositoryFile("this", {
    project: thisProject.id,
    filePath: "meow.txt",
    branch: "main",
    content: std.base64encode({
        input: "Meow goes the cat",
    }).then(invoke => invoke.result),
    authorEmail: "terraform@example.com",
    authorName: "Terraform",
    commitMessage: "feature: add meow file",
});
const readme = new gitlab.RepositoryFile("readme", {
    project: thisProject.id,
    filePath: "readme.txt",
    branch: "main",
    content: "Meow goes the cat",
    authorEmail: "terraform@example.com",
    authorName: "Terraform",
    commitMessage: "feature: add readme file",
});
const readmeForDogs = new gitlab.RepositoryFile("readme_for_dogs", {
    project: thisProject.id,
    filePath: "readme.txt",
    branch: "main",
    content: "Bark goes the dog",
    authorEmail: "terraform@example.com",
    authorName: "Terraform",
    commitMessage: "feature: update readme file",
    overwriteOnCreate: true,
});
Copy
import pulumi
import pulumi_gitlab as gitlab
import pulumi_std as std

this = gitlab.Group("this",
    name="example",
    path="example",
    description="An example group")
this_project = gitlab.Project("this",
    name="example",
    namespace_id=this.id,
    initialize_with_readme=True)
this_repository_file = gitlab.RepositoryFile("this",
    project=this_project.id,
    file_path="meow.txt",
    branch="main",
    content=std.base64encode(input="Meow goes the cat").result,
    author_email="terraform@example.com",
    author_name="Terraform",
    commit_message="feature: add meow file")
readme = gitlab.RepositoryFile("readme",
    project=this_project.id,
    file_path="readme.txt",
    branch="main",
    content="Meow goes the cat",
    author_email="terraform@example.com",
    author_name="Terraform",
    commit_message="feature: add readme file")
readme_for_dogs = gitlab.RepositoryFile("readme_for_dogs",
    project=this_project.id,
    file_path="readme.txt",
    branch="main",
    content="Bark goes the dog",
    author_email="terraform@example.com",
    author_name="Terraform",
    commit_message="feature: update readme file",
    overwrite_on_create=True)
Copy
package main

import (
	"github.com/pulumi/pulumi-gitlab/sdk/v8/go/gitlab"
	"github.com/pulumi/pulumi-std/sdk/go/std"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		this, err := gitlab.NewGroup(ctx, "this", &gitlab.GroupArgs{
			Name:        pulumi.String("example"),
			Path:        pulumi.String("example"),
			Description: pulumi.String("An example group"),
		})
		if err != nil {
			return err
		}
		thisProject, err := gitlab.NewProject(ctx, "this", &gitlab.ProjectArgs{
			Name:                 pulumi.String("example"),
			NamespaceId:          this.ID(),
			InitializeWithReadme: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		invokeBase64encode, err := std.Base64encode(ctx, &std.Base64encodeArgs{
			Input: "Meow goes the cat",
		}, nil)
		if err != nil {
			return err
		}
		_, err = gitlab.NewRepositoryFile(ctx, "this", &gitlab.RepositoryFileArgs{
			Project:       thisProject.ID(),
			FilePath:      pulumi.String("meow.txt"),
			Branch:        pulumi.String("main"),
			Content:       pulumi.String(invokeBase64encode.Result),
			AuthorEmail:   pulumi.String("terraform@example.com"),
			AuthorName:    pulumi.String("Terraform"),
			CommitMessage: pulumi.String("feature: add meow file"),
		})
		if err != nil {
			return err
		}
		_, err = gitlab.NewRepositoryFile(ctx, "readme", &gitlab.RepositoryFileArgs{
			Project:       thisProject.ID(),
			FilePath:      pulumi.String("readme.txt"),
			Branch:        pulumi.String("main"),
			Content:       pulumi.String("Meow goes the cat"),
			AuthorEmail:   pulumi.String("terraform@example.com"),
			AuthorName:    pulumi.String("Terraform"),
			CommitMessage: pulumi.String("feature: add readme file"),
		})
		if err != nil {
			return err
		}
		_, err = gitlab.NewRepositoryFile(ctx, "readme_for_dogs", &gitlab.RepositoryFileArgs{
			Project:           thisProject.ID(),
			FilePath:          pulumi.String("readme.txt"),
			Branch:            pulumi.String("main"),
			Content:           pulumi.String("Bark goes the dog"),
			AuthorEmail:       pulumi.String("terraform@example.com"),
			AuthorName:        pulumi.String("Terraform"),
			CommitMessage:     pulumi.String("feature: update readme file"),
			OverwriteOnCreate: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
using Std = Pulumi.Std;

return await Deployment.RunAsync(() => 
{
    var @this = new GitLab.Group("this", new()
    {
        Name = "example",
        Path = "example",
        Description = "An example group",
    });

    var thisProject = new GitLab.Project("this", new()
    {
        Name = "example",
        NamespaceId = @this.Id,
        InitializeWithReadme = true,
    });

    var thisRepositoryFile = new GitLab.RepositoryFile("this", new()
    {
        Project = thisProject.Id,
        FilePath = "meow.txt",
        Branch = "main",
        Content = Std.Base64encode.Invoke(new()
        {
            Input = "Meow goes the cat",
        }).Apply(invoke => invoke.Result),
        AuthorEmail = "terraform@example.com",
        AuthorName = "Terraform",
        CommitMessage = "feature: add meow file",
    });

    var readme = new GitLab.RepositoryFile("readme", new()
    {
        Project = thisProject.Id,
        FilePath = "readme.txt",
        Branch = "main",
        Content = "Meow goes the cat",
        AuthorEmail = "terraform@example.com",
        AuthorName = "Terraform",
        CommitMessage = "feature: add readme file",
    });

    var readmeForDogs = new GitLab.RepositoryFile("readme_for_dogs", new()
    {
        Project = thisProject.Id,
        FilePath = "readme.txt",
        Branch = "main",
        Content = "Bark goes the dog",
        AuthorEmail = "terraform@example.com",
        AuthorName = "Terraform",
        CommitMessage = "feature: update readme file",
        OverwriteOnCreate = true,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.Group;
import com.pulumi.gitlab.GroupArgs;
import com.pulumi.gitlab.Project;
import com.pulumi.gitlab.ProjectArgs;
import com.pulumi.gitlab.RepositoryFile;
import com.pulumi.gitlab.RepositoryFileArgs;
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 Group("this", GroupArgs.builder()
            .name("example")
            .path("example")
            .description("An example group")
            .build());

        var thisProject = new Project("thisProject", ProjectArgs.builder()
            .name("example")
            .namespaceId(this_.id())
            .initializeWithReadme(true)
            .build());

        var thisRepositoryFile = new RepositoryFile("thisRepositoryFile", RepositoryFileArgs.builder()
            .project(thisProject.id())
            .filePath("meow.txt")
            .branch("main")
            .content(StdFunctions.base64encode(Base64encodeArgs.builder()
                .input("Meow goes the cat")
                .build()).result())
            .authorEmail("terraform@example.com")
            .authorName("Terraform")
            .commitMessage("feature: add meow file")
            .build());

        var readme = new RepositoryFile("readme", RepositoryFileArgs.builder()
            .project(thisProject.id())
            .filePath("readme.txt")
            .branch("main")
            .content("Meow goes the cat")
            .authorEmail("terraform@example.com")
            .authorName("Terraform")
            .commitMessage("feature: add readme file")
            .build());

        var readmeForDogs = new RepositoryFile("readmeForDogs", RepositoryFileArgs.builder()
            .project(thisProject.id())
            .filePath("readme.txt")
            .branch("main")
            .content("Bark goes the dog")
            .authorEmail("terraform@example.com")
            .authorName("Terraform")
            .commitMessage("feature: update readme file")
            .overwriteOnCreate(true)
            .build());

    }
}
Copy
resources:
  this:
    type: gitlab:Group
    properties:
      name: example
      path: example
      description: An example group
  thisProject:
    type: gitlab:Project
    name: this
    properties:
      name: example
      namespaceId: ${this.id}
      initializeWithReadme: true
  thisRepositoryFile:
    type: gitlab:RepositoryFile
    name: this
    properties:
      project: ${thisProject.id}
      filePath: meow.txt
      branch: main
      content:
        fn::invoke:
          function: std:base64encode
          arguments:
            input: Meow goes the cat
          return: result
      authorEmail: terraform@example.com
      authorName: Terraform
      commitMessage: 'feature: add meow file'
  readme:
    type: gitlab:RepositoryFile
    properties:
      project: ${thisProject.id}
      filePath: readme.txt
      branch: main
      content: Meow goes the cat
      authorEmail: terraform@example.com
      authorName: Terraform
      commitMessage: 'feature: add readme file'
  readmeForDogs:
    type: gitlab:RepositoryFile
    name: readme_for_dogs
    properties:
      project: ${thisProject.id}
      filePath: readme.txt
      branch: main
      content: Bark goes the dog
      authorEmail: terraform@example.com
      authorName: Terraform
      commitMessage: 'feature: update readme file'
      overwriteOnCreate: true
Copy

Create RepositoryFile Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new RepositoryFile(name: string, args: RepositoryFileArgs, opts?: CustomResourceOptions);
@overload
def RepositoryFile(resource_name: str,
                   args: RepositoryFileArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def RepositoryFile(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   content: Optional[str] = None,
                   project: Optional[str] = None,
                   branch: Optional[str] = None,
                   file_path: Optional[str] = None,
                   commit_message: Optional[str] = None,
                   create_commit_message: Optional[str] = None,
                   delete_commit_message: Optional[str] = None,
                   encoding: Optional[str] = None,
                   execute_filemode: Optional[bool] = None,
                   author_email: Optional[str] = None,
                   overwrite_on_create: Optional[bool] = None,
                   author_name: Optional[str] = None,
                   start_branch: Optional[str] = None,
                   update_commit_message: Optional[str] = None)
func NewRepositoryFile(ctx *Context, name string, args RepositoryFileArgs, opts ...ResourceOption) (*RepositoryFile, error)
public RepositoryFile(string name, RepositoryFileArgs args, CustomResourceOptions? opts = null)
public RepositoryFile(String name, RepositoryFileArgs args)
public RepositoryFile(String name, RepositoryFileArgs args, CustomResourceOptions options)
type: gitlab:RepositoryFile
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. RepositoryFileArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. RepositoryFileArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. RepositoryFileArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. RepositoryFileArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. RepositoryFileArgs
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 repositoryFileResource = new GitLab.RepositoryFile("repositoryFileResource", new()
{
    Content = "string",
    Project = "string",
    Branch = "string",
    FilePath = "string",
    CommitMessage = "string",
    CreateCommitMessage = "string",
    DeleteCommitMessage = "string",
    Encoding = "string",
    ExecuteFilemode = false,
    AuthorEmail = "string",
    OverwriteOnCreate = false,
    AuthorName = "string",
    StartBranch = "string",
    UpdateCommitMessage = "string",
});
Copy
example, err := gitlab.NewRepositoryFile(ctx, "repositoryFileResource", &gitlab.RepositoryFileArgs{
	Content:             pulumi.String("string"),
	Project:             pulumi.String("string"),
	Branch:              pulumi.String("string"),
	FilePath:            pulumi.String("string"),
	CommitMessage:       pulumi.String("string"),
	CreateCommitMessage: pulumi.String("string"),
	DeleteCommitMessage: pulumi.String("string"),
	Encoding:            pulumi.String("string"),
	ExecuteFilemode:     pulumi.Bool(false),
	AuthorEmail:         pulumi.String("string"),
	OverwriteOnCreate:   pulumi.Bool(false),
	AuthorName:          pulumi.String("string"),
	StartBranch:         pulumi.String("string"),
	UpdateCommitMessage: pulumi.String("string"),
})
Copy
var repositoryFileResource = new RepositoryFile("repositoryFileResource", RepositoryFileArgs.builder()
    .content("string")
    .project("string")
    .branch("string")
    .filePath("string")
    .commitMessage("string")
    .createCommitMessage("string")
    .deleteCommitMessage("string")
    .encoding("string")
    .executeFilemode(false)
    .authorEmail("string")
    .overwriteOnCreate(false)
    .authorName("string")
    .startBranch("string")
    .updateCommitMessage("string")
    .build());
Copy
repository_file_resource = gitlab.RepositoryFile("repositoryFileResource",
    content="string",
    project="string",
    branch="string",
    file_path="string",
    commit_message="string",
    create_commit_message="string",
    delete_commit_message="string",
    encoding="string",
    execute_filemode=False,
    author_email="string",
    overwrite_on_create=False,
    author_name="string",
    start_branch="string",
    update_commit_message="string")
Copy
const repositoryFileResource = new gitlab.RepositoryFile("repositoryFileResource", {
    content: "string",
    project: "string",
    branch: "string",
    filePath: "string",
    commitMessage: "string",
    createCommitMessage: "string",
    deleteCommitMessage: "string",
    encoding: "string",
    executeFilemode: false,
    authorEmail: "string",
    overwriteOnCreate: false,
    authorName: "string",
    startBranch: "string",
    updateCommitMessage: "string",
});
Copy
type: gitlab:RepositoryFile
properties:
    authorEmail: string
    authorName: string
    branch: string
    commitMessage: string
    content: string
    createCommitMessage: string
    deleteCommitMessage: string
    encoding: string
    executeFilemode: false
    filePath: string
    overwriteOnCreate: false
    project: string
    startBranch: string
    updateCommitMessage: string
Copy

RepositoryFile 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 RepositoryFile resource accepts the following input properties:

Branch
This property is required.
Changes to this property will trigger replacement.
string
Name of the branch to which to commit to.
Content This property is required. string
File content.
FilePath
This property is required.
Changes to this property will trigger replacement.
string
The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
Project
This property is required.
Changes to this property will trigger replacement.
string
The name or ID of the project.
AuthorEmail string
Email of the commit author.
AuthorName string
Name of the commit author.
CommitMessage string
Commit message.
CreateCommitMessage string
Create commit message.
DeleteCommitMessage string
Delete Commit message.
Encoding string
The file content encoding. Default value is base64. Valid values are: base64, text.
ExecuteFilemode bool
Enables or disables the execute flag on the file.
OverwriteOnCreate bool
Enable overwriting existing files, defaults to false. This attribute is only used during create and must be use carefully. We suggest to use imports whenever possible and limit the use of this attribute for when the project was imported on the same apply. This attribute is not supported during a resource import.
StartBranch string
Name of the branch to start the new commit from.
UpdateCommitMessage string
Update commit message.
Branch
This property is required.
Changes to this property will trigger replacement.
string
Name of the branch to which to commit to.
Content This property is required. string
File content.
FilePath
This property is required.
Changes to this property will trigger replacement.
string
The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
Project
This property is required.
Changes to this property will trigger replacement.
string
The name or ID of the project.
AuthorEmail string
Email of the commit author.
AuthorName string
Name of the commit author.
CommitMessage string
Commit message.
CreateCommitMessage string
Create commit message.
DeleteCommitMessage string
Delete Commit message.
Encoding string
The file content encoding. Default value is base64. Valid values are: base64, text.
ExecuteFilemode bool
Enables or disables the execute flag on the file.
OverwriteOnCreate bool
Enable overwriting existing files, defaults to false. This attribute is only used during create and must be use carefully. We suggest to use imports whenever possible and limit the use of this attribute for when the project was imported on the same apply. This attribute is not supported during a resource import.
StartBranch string
Name of the branch to start the new commit from.
UpdateCommitMessage string
Update commit message.
branch
This property is required.
Changes to this property will trigger replacement.
String
Name of the branch to which to commit to.
content This property is required. String
File content.
filePath
This property is required.
Changes to this property will trigger replacement.
String
The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
project
This property is required.
Changes to this property will trigger replacement.
String
The name or ID of the project.
authorEmail String
Email of the commit author.
authorName String
Name of the commit author.
commitMessage String
Commit message.
createCommitMessage String
Create commit message.
deleteCommitMessage String
Delete Commit message.
encoding String
The file content encoding. Default value is base64. Valid values are: base64, text.
executeFilemode Boolean
Enables or disables the execute flag on the file.
overwriteOnCreate Boolean
Enable overwriting existing files, defaults to false. This attribute is only used during create and must be use carefully. We suggest to use imports whenever possible and limit the use of this attribute for when the project was imported on the same apply. This attribute is not supported during a resource import.
startBranch String
Name of the branch to start the new commit from.
updateCommitMessage String
Update commit message.
branch
This property is required.
Changes to this property will trigger replacement.
string
Name of the branch to which to commit to.
content This property is required. string
File content.
filePath
This property is required.
Changes to this property will trigger replacement.
string
The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
project
This property is required.
Changes to this property will trigger replacement.
string
The name or ID of the project.
authorEmail string
Email of the commit author.
authorName string
Name of the commit author.
commitMessage string
Commit message.
createCommitMessage string
Create commit message.
deleteCommitMessage string
Delete Commit message.
encoding string
The file content encoding. Default value is base64. Valid values are: base64, text.
executeFilemode boolean
Enables or disables the execute flag on the file.
overwriteOnCreate boolean
Enable overwriting existing files, defaults to false. This attribute is only used during create and must be use carefully. We suggest to use imports whenever possible and limit the use of this attribute for when the project was imported on the same apply. This attribute is not supported during a resource import.
startBranch string
Name of the branch to start the new commit from.
updateCommitMessage string
Update commit message.
branch
This property is required.
Changes to this property will trigger replacement.
str
Name of the branch to which to commit to.
content This property is required. str
File content.
file_path
This property is required.
Changes to this property will trigger replacement.
str
The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
project
This property is required.
Changes to this property will trigger replacement.
str
The name or ID of the project.
author_email str
Email of the commit author.
author_name str
Name of the commit author.
commit_message str
Commit message.
create_commit_message str
Create commit message.
delete_commit_message str
Delete Commit message.
encoding str
The file content encoding. Default value is base64. Valid values are: base64, text.
execute_filemode bool
Enables or disables the execute flag on the file.
overwrite_on_create bool
Enable overwriting existing files, defaults to false. This attribute is only used during create and must be use carefully. We suggest to use imports whenever possible and limit the use of this attribute for when the project was imported on the same apply. This attribute is not supported during a resource import.
start_branch str
Name of the branch to start the new commit from.
update_commit_message str
Update commit message.
branch
This property is required.
Changes to this property will trigger replacement.
String
Name of the branch to which to commit to.
content This property is required. String
File content.
filePath
This property is required.
Changes to this property will trigger replacement.
String
The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
project
This property is required.
Changes to this property will trigger replacement.
String
The name or ID of the project.
authorEmail String
Email of the commit author.
authorName String
Name of the commit author.
commitMessage String
Commit message.
createCommitMessage String
Create commit message.
deleteCommitMessage String
Delete Commit message.
encoding String
The file content encoding. Default value is base64. Valid values are: base64, text.
executeFilemode Boolean
Enables or disables the execute flag on the file.
overwriteOnCreate Boolean
Enable overwriting existing files, defaults to false. This attribute is only used during create and must be use carefully. We suggest to use imports whenever possible and limit the use of this attribute for when the project was imported on the same apply. This attribute is not supported during a resource import.
startBranch String
Name of the branch to start the new commit from.
updateCommitMessage String
Update commit message.

Outputs

All input properties are implicitly available as output properties. Additionally, the RepositoryFile resource produces the following output properties:

BlobId string
The blob id.
CommitId string
The commit id.
ContentSha256 string
File content sha256 digest.
FileName string
The filename.
Id string
The provider-assigned unique ID for this managed resource.
LastCommitId string
The last known commit id.
Ref string
The name of branch, tag or commit.
Size int
The file size.
BlobId string
The blob id.
CommitId string
The commit id.
ContentSha256 string
File content sha256 digest.
FileName string
The filename.
Id string
The provider-assigned unique ID for this managed resource.
LastCommitId string
The last known commit id.
Ref string
The name of branch, tag or commit.
Size int
The file size.
blobId String
The blob id.
commitId String
The commit id.
contentSha256 String
File content sha256 digest.
fileName String
The filename.
id String
The provider-assigned unique ID for this managed resource.
lastCommitId String
The last known commit id.
ref String
The name of branch, tag or commit.
size Integer
The file size.
blobId string
The blob id.
commitId string
The commit id.
contentSha256 string
File content sha256 digest.
fileName string
The filename.
id string
The provider-assigned unique ID for this managed resource.
lastCommitId string
The last known commit id.
ref string
The name of branch, tag or commit.
size number
The file size.
blob_id str
The blob id.
commit_id str
The commit id.
content_sha256 str
File content sha256 digest.
file_name str
The filename.
id str
The provider-assigned unique ID for this managed resource.
last_commit_id str
The last known commit id.
ref str
The name of branch, tag or commit.
size int
The file size.
blobId String
The blob id.
commitId String
The commit id.
contentSha256 String
File content sha256 digest.
fileName String
The filename.
id String
The provider-assigned unique ID for this managed resource.
lastCommitId String
The last known commit id.
ref String
The name of branch, tag or commit.
size Number
The file size.

Look up Existing RepositoryFile Resource

Get an existing RepositoryFile 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?: RepositoryFileState, opts?: CustomResourceOptions): RepositoryFile
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        author_email: Optional[str] = None,
        author_name: Optional[str] = None,
        blob_id: Optional[str] = None,
        branch: Optional[str] = None,
        commit_id: Optional[str] = None,
        commit_message: Optional[str] = None,
        content: Optional[str] = None,
        content_sha256: Optional[str] = None,
        create_commit_message: Optional[str] = None,
        delete_commit_message: Optional[str] = None,
        encoding: Optional[str] = None,
        execute_filemode: Optional[bool] = None,
        file_name: Optional[str] = None,
        file_path: Optional[str] = None,
        last_commit_id: Optional[str] = None,
        overwrite_on_create: Optional[bool] = None,
        project: Optional[str] = None,
        ref: Optional[str] = None,
        size: Optional[int] = None,
        start_branch: Optional[str] = None,
        update_commit_message: Optional[str] = None) -> RepositoryFile
func GetRepositoryFile(ctx *Context, name string, id IDInput, state *RepositoryFileState, opts ...ResourceOption) (*RepositoryFile, error)
public static RepositoryFile Get(string name, Input<string> id, RepositoryFileState? state, CustomResourceOptions? opts = null)
public static RepositoryFile get(String name, Output<String> id, RepositoryFileState state, CustomResourceOptions options)
resources:  _:    type: gitlab:RepositoryFile    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.
The following state arguments are supported:
AuthorEmail string
Email of the commit author.
AuthorName string
Name of the commit author.
BlobId string
The blob id.
Branch Changes to this property will trigger replacement. string
Name of the branch to which to commit to.
CommitId string
The commit id.
CommitMessage string
Commit message.
Content string
File content.
ContentSha256 string
File content sha256 digest.
CreateCommitMessage string
Create commit message.
DeleteCommitMessage string
Delete Commit message.
Encoding string
The file content encoding. Default value is base64. Valid values are: base64, text.
ExecuteFilemode bool
Enables or disables the execute flag on the file.
FileName string
The filename.
FilePath Changes to this property will trigger replacement. string
The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
LastCommitId string
The last known commit id.
OverwriteOnCreate bool
Enable overwriting existing files, defaults to false. This attribute is only used during create and must be use carefully. We suggest to use imports whenever possible and limit the use of this attribute for when the project was imported on the same apply. This attribute is not supported during a resource import.
Project Changes to this property will trigger replacement. string
The name or ID of the project.
Ref string
The name of branch, tag or commit.
Size int
The file size.
StartBranch string
Name of the branch to start the new commit from.
UpdateCommitMessage string
Update commit message.
AuthorEmail string
Email of the commit author.
AuthorName string
Name of the commit author.
BlobId string
The blob id.
Branch Changes to this property will trigger replacement. string
Name of the branch to which to commit to.
CommitId string
The commit id.
CommitMessage string
Commit message.
Content string
File content.
ContentSha256 string
File content sha256 digest.
CreateCommitMessage string
Create commit message.
DeleteCommitMessage string
Delete Commit message.
Encoding string
The file content encoding. Default value is base64. Valid values are: base64, text.
ExecuteFilemode bool
Enables or disables the execute flag on the file.
FileName string
The filename.
FilePath Changes to this property will trigger replacement. string
The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
LastCommitId string
The last known commit id.
OverwriteOnCreate bool
Enable overwriting existing files, defaults to false. This attribute is only used during create and must be use carefully. We suggest to use imports whenever possible and limit the use of this attribute for when the project was imported on the same apply. This attribute is not supported during a resource import.
Project Changes to this property will trigger replacement. string
The name or ID of the project.
Ref string
The name of branch, tag or commit.
Size int
The file size.
StartBranch string
Name of the branch to start the new commit from.
UpdateCommitMessage string
Update commit message.
authorEmail String
Email of the commit author.
authorName String
Name of the commit author.
blobId String
The blob id.
branch Changes to this property will trigger replacement. String
Name of the branch to which to commit to.
commitId String
The commit id.
commitMessage String
Commit message.
content String
File content.
contentSha256 String
File content sha256 digest.
createCommitMessage String
Create commit message.
deleteCommitMessage String
Delete Commit message.
encoding String
The file content encoding. Default value is base64. Valid values are: base64, text.
executeFilemode Boolean
Enables or disables the execute flag on the file.
fileName String
The filename.
filePath Changes to this property will trigger replacement. String
The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
lastCommitId String
The last known commit id.
overwriteOnCreate Boolean
Enable overwriting existing files, defaults to false. This attribute is only used during create and must be use carefully. We suggest to use imports whenever possible and limit the use of this attribute for when the project was imported on the same apply. This attribute is not supported during a resource import.
project Changes to this property will trigger replacement. String
The name or ID of the project.
ref String
The name of branch, tag or commit.
size Integer
The file size.
startBranch String
Name of the branch to start the new commit from.
updateCommitMessage String
Update commit message.
authorEmail string
Email of the commit author.
authorName string
Name of the commit author.
blobId string
The blob id.
branch Changes to this property will trigger replacement. string
Name of the branch to which to commit to.
commitId string
The commit id.
commitMessage string
Commit message.
content string
File content.
contentSha256 string
File content sha256 digest.
createCommitMessage string
Create commit message.
deleteCommitMessage string
Delete Commit message.
encoding string
The file content encoding. Default value is base64. Valid values are: base64, text.
executeFilemode boolean
Enables or disables the execute flag on the file.
fileName string
The filename.
filePath Changes to this property will trigger replacement. string
The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
lastCommitId string
The last known commit id.
overwriteOnCreate boolean
Enable overwriting existing files, defaults to false. This attribute is only used during create and must be use carefully. We suggest to use imports whenever possible and limit the use of this attribute for when the project was imported on the same apply. This attribute is not supported during a resource import.
project Changes to this property will trigger replacement. string
The name or ID of the project.
ref string
The name of branch, tag or commit.
size number
The file size.
startBranch string
Name of the branch to start the new commit from.
updateCommitMessage string
Update commit message.
author_email str
Email of the commit author.
author_name str
Name of the commit author.
blob_id str
The blob id.
branch Changes to this property will trigger replacement. str
Name of the branch to which to commit to.
commit_id str
The commit id.
commit_message str
Commit message.
content str
File content.
content_sha256 str
File content sha256 digest.
create_commit_message str
Create commit message.
delete_commit_message str
Delete Commit message.
encoding str
The file content encoding. Default value is base64. Valid values are: base64, text.
execute_filemode bool
Enables or disables the execute flag on the file.
file_name str
The filename.
file_path Changes to this property will trigger replacement. str
The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
last_commit_id str
The last known commit id.
overwrite_on_create bool
Enable overwriting existing files, defaults to false. This attribute is only used during create and must be use carefully. We suggest to use imports whenever possible and limit the use of this attribute for when the project was imported on the same apply. This attribute is not supported during a resource import.
project Changes to this property will trigger replacement. str
The name or ID of the project.
ref str
The name of branch, tag or commit.
size int
The file size.
start_branch str
Name of the branch to start the new commit from.
update_commit_message str
Update commit message.
authorEmail String
Email of the commit author.
authorName String
Name of the commit author.
blobId String
The blob id.
branch Changes to this property will trigger replacement. String
Name of the branch to which to commit to.
commitId String
The commit id.
commitMessage String
Commit message.
content String
File content.
contentSha256 String
File content sha256 digest.
createCommitMessage String
Create commit message.
deleteCommitMessage String
Delete Commit message.
encoding String
The file content encoding. Default value is base64. Valid values are: base64, text.
executeFilemode Boolean
Enables or disables the execute flag on the file.
fileName String
The filename.
filePath Changes to this property will trigger replacement. String
The full path of the file. It must be relative to the root of the project without a leading slash / or ./.
lastCommitId String
The last known commit id.
overwriteOnCreate Boolean
Enable overwriting existing files, defaults to false. This attribute is only used during create and must be use carefully. We suggest to use imports whenever possible and limit the use of this attribute for when the project was imported on the same apply. This attribute is not supported during a resource import.
project Changes to this property will trigger replacement. String
The name or ID of the project.
ref String
The name of branch, tag or commit.
size Number
The file size.
startBranch String
Name of the branch to start the new commit from.
updateCommitMessage String
Update commit message.

Import

Starting in Terraform v1.5.0 you can use an import block to import gitlab_repository_file. For example:

terraform

import {

to = gitlab_repository_file.example

id = “see CLI command below for ID”

}

Import using the CLI is supported using the following syntax:

A Repository File can be imported using an id made up of <project-id>:<branch-name>:<file-path>, e.g.

$ pulumi import gitlab:index/repositoryFile:RepositoryFile this 1:main:foo/bar.txt
Copy

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.