1. Packages
  2. Gitlab Provider
  3. API Docs
  4. ProjectSecureFile
GitLab v9.8.0 published on Friday, Jan 16, 2026 by Pulumi
gitlab logo
GitLab v9.8.0 published on Friday, Jan 16, 2026 by Pulumi

    The gitlab.ProjectSecureFile resource allows users to manage the lifecycle of a secure file in gitlab.

    Upstream API: GitLab REST API docs

    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 thisProjectSecureFile = new gitlab.ProjectSecureFile("this", {
        name: "my-secure-file",
        project: thisProject.id,
        content: std.file({
            input: "example.txt",
        }).then(invoke => invoke.result),
    });
    const disablePollForMetadata = new gitlab.ProjectSecureFile("disable_poll_for_metadata", {
        name: "my-secure-file",
        project: thisProject.id,
        content: std.file({
            input: "example.txt",
        }).then(invoke => invoke.result),
        pollForMetadataDurationInSeconds: 0,
    });
    
    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_project_secure_file = gitlab.ProjectSecureFile("this",
        name="my-secure-file",
        project=this_project.id,
        content=std.file(input="example.txt").result)
    disable_poll_for_metadata = gitlab.ProjectSecureFile("disable_poll_for_metadata",
        name="my-secure-file",
        project=this_project.id,
        content=std.file(input="example.txt").result,
        poll_for_metadata_duration_in_seconds=0)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gitlab/sdk/v9/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
    		}
    		invokeFile, err := std.File(ctx, &std.FileArgs{
    			Input: "example.txt",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = gitlab.NewProjectSecureFile(ctx, "this", &gitlab.ProjectSecureFileArgs{
    			Name:    pulumi.String("my-secure-file"),
    			Project: thisProject.ID(),
    			Content: pulumi.String(invokeFile.Result),
    		})
    		if err != nil {
    			return err
    		}
    		invokeFile1, err := std.File(ctx, &std.FileArgs{
    			Input: "example.txt",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = gitlab.NewProjectSecureFile(ctx, "disable_poll_for_metadata", &gitlab.ProjectSecureFileArgs{
    			Name:                             pulumi.String("my-secure-file"),
    			Project:                          thisProject.ID(),
    			Content:                          pulumi.String(invokeFile1.Result),
    			PollForMetadataDurationInSeconds: 0,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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 thisProjectSecureFile = new GitLab.ProjectSecureFile("this", new()
        {
            Name = "my-secure-file",
            Project = thisProject.Id,
            Content = Std.File.Invoke(new()
            {
                Input = "example.txt",
            }).Apply(invoke => invoke.Result),
        });
    
        var disablePollForMetadata = new GitLab.ProjectSecureFile("disable_poll_for_metadata", new()
        {
            Name = "my-secure-file",
            Project = thisProject.Id,
            Content = Std.File.Invoke(new()
            {
                Input = "example.txt",
            }).Apply(invoke => invoke.Result),
            PollForMetadataDurationInSeconds = 0,
        });
    
    });
    
    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.ProjectSecureFile;
    import com.pulumi.gitlab.ProjectSecureFileArgs;
    import com.pulumi.std.StdFunctions;
    import com.pulumi.std.inputs.FileArgs;
    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 thisProjectSecureFile = new ProjectSecureFile("thisProjectSecureFile", ProjectSecureFileArgs.builder()
                .name("my-secure-file")
                .project(thisProject.id())
                .content(StdFunctions.file(FileArgs.builder()
                    .input("example.txt")
                    .build()).result())
                .build());
    
            var disablePollForMetadata = new ProjectSecureFile("disablePollForMetadata", ProjectSecureFileArgs.builder()
                .name("my-secure-file")
                .project(thisProject.id())
                .content(StdFunctions.file(FileArgs.builder()
                    .input("example.txt")
                    .build()).result())
                .pollForMetadataDurationInSeconds(0)
                .build());
    
        }
    }
    
    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
      thisProjectSecureFile:
        type: gitlab:ProjectSecureFile
        name: this
        properties:
          name: my-secure-file
          project: ${thisProject.id}
          content:
            fn::invoke:
              function: std:file
              arguments:
                input: example.txt
              return: result
      disablePollForMetadata:
        type: gitlab:ProjectSecureFile
        name: disable_poll_for_metadata
        properties:
          name: my-secure-file
          project: ${thisProject.id}
          content:
            fn::invoke:
              function: std:file
              arguments:
                input: example.txt
              return: result
          pollForMetadataDurationInSeconds: 0
    

    Create ProjectSecureFile Resource

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

    Constructor syntax

    new ProjectSecureFile(name: string, args: ProjectSecureFileArgs, opts?: CustomResourceOptions);
    @overload
    def ProjectSecureFile(resource_name: str,
                          args: ProjectSecureFileArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def ProjectSecureFile(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          content: Optional[str] = None,
                          project: Optional[str] = None,
                          name: Optional[str] = None)
    func NewProjectSecureFile(ctx *Context, name string, args ProjectSecureFileArgs, opts ...ResourceOption) (*ProjectSecureFile, error)
    public ProjectSecureFile(string name, ProjectSecureFileArgs args, CustomResourceOptions? opts = null)
    public ProjectSecureFile(String name, ProjectSecureFileArgs args)
    public ProjectSecureFile(String name, ProjectSecureFileArgs args, CustomResourceOptions options)
    
    type: gitlab:ProjectSecureFile
    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 ProjectSecureFileArgs
    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 ProjectSecureFileArgs
    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 ProjectSecureFileArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ProjectSecureFileArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ProjectSecureFileArgs
    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 projectSecureFileResource = new GitLab.ProjectSecureFile("projectSecureFileResource", new()
    {
        Content = "string",
        Project = "string",
        Name = "string",
    });
    
    example, err := gitlab.NewProjectSecureFile(ctx, "projectSecureFileResource", &gitlab.ProjectSecureFileArgs{
    	Content: pulumi.String("string"),
    	Project: pulumi.String("string"),
    	Name:    pulumi.String("string"),
    })
    
    var projectSecureFileResource = new ProjectSecureFile("projectSecureFileResource", ProjectSecureFileArgs.builder()
        .content("string")
        .project("string")
        .name("string")
        .build());
    
    project_secure_file_resource = gitlab.ProjectSecureFile("projectSecureFileResource",
        content="string",
        project="string",
        name="string")
    
    const projectSecureFileResource = new gitlab.ProjectSecureFile("projectSecureFileResource", {
        content: "string",
        project: "string",
        name: "string",
    });
    
    type: gitlab:ProjectSecureFile
    properties:
        content: string
        name: string
        project: string
    

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

    Content string
    The contents of the secure file
    Project string
    The ID or full path of the project to environment is created for.
    Name string
    The name for the secure file, unique per project
    Content string
    The contents of the secure file
    Project string
    The ID or full path of the project to environment is created for.
    Name string
    The name for the secure file, unique per project
    content String
    The contents of the secure file
    project String
    The ID or full path of the project to environment is created for.
    name String
    The name for the secure file, unique per project
    content string
    The contents of the secure file
    project string
    The ID or full path of the project to environment is created for.
    name string
    The name for the secure file, unique per project
    content str
    The contents of the secure file
    project str
    The ID or full path of the project to environment is created for.
    name str
    The name for the secure file, unique per project
    content String
    The contents of the secure file
    project String
    The ID or full path of the project to environment is created for.
    name String
    The name for the secure file, unique per project

    Outputs

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

    Checksum string
    The checksum of the file
    ChecksumAlgorithm string
    The checksum algorithm used
    CreatedAt string
    The time the secure file was uploaded
    ExpiresAt string
    The time the secure file will expire
    Id string
    The provider-assigned unique ID for this managed resource.
    SecureFileId int
    The id of the secure file in gitlab
    Checksum string
    The checksum of the file
    ChecksumAlgorithm string
    The checksum algorithm used
    CreatedAt string
    The time the secure file was uploaded
    ExpiresAt string
    The time the secure file will expire
    Id string
    The provider-assigned unique ID for this managed resource.
    SecureFileId int
    The id of the secure file in gitlab
    checksum String
    The checksum of the file
    checksumAlgorithm String
    The checksum algorithm used
    createdAt String
    The time the secure file was uploaded
    expiresAt String
    The time the secure file will expire
    id String
    The provider-assigned unique ID for this managed resource.
    secureFileId Integer
    The id of the secure file in gitlab
    checksum string
    The checksum of the file
    checksumAlgorithm string
    The checksum algorithm used
    createdAt string
    The time the secure file was uploaded
    expiresAt string
    The time the secure file will expire
    id string
    The provider-assigned unique ID for this managed resource.
    secureFileId number
    The id of the secure file in gitlab
    checksum str
    The checksum of the file
    checksum_algorithm str
    The checksum algorithm used
    created_at str
    The time the secure file was uploaded
    expires_at str
    The time the secure file will expire
    id str
    The provider-assigned unique ID for this managed resource.
    secure_file_id int
    The id of the secure file in gitlab
    checksum String
    The checksum of the file
    checksumAlgorithm String
    The checksum algorithm used
    createdAt String
    The time the secure file was uploaded
    expiresAt String
    The time the secure file will expire
    id String
    The provider-assigned unique ID for this managed resource.
    secureFileId Number
    The id of the secure file in gitlab

    Look up Existing ProjectSecureFile Resource

    Get an existing ProjectSecureFile 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?: ProjectSecureFileState, opts?: CustomResourceOptions): ProjectSecureFile
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            checksum: Optional[str] = None,
            checksum_algorithm: Optional[str] = None,
            content: Optional[str] = None,
            created_at: Optional[str] = None,
            expires_at: Optional[str] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            secure_file_id: Optional[int] = None) -> ProjectSecureFile
    func GetProjectSecureFile(ctx *Context, name string, id IDInput, state *ProjectSecureFileState, opts ...ResourceOption) (*ProjectSecureFile, error)
    public static ProjectSecureFile Get(string name, Input<string> id, ProjectSecureFileState? state, CustomResourceOptions? opts = null)
    public static ProjectSecureFile get(String name, Output<String> id, ProjectSecureFileState state, CustomResourceOptions options)
    resources:  _:    type: gitlab:ProjectSecureFile    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.
    The following state arguments are supported:
    Checksum string
    The checksum of the file
    ChecksumAlgorithm string
    The checksum algorithm used
    Content string
    The contents of the secure file
    CreatedAt string
    The time the secure file was uploaded
    ExpiresAt string
    The time the secure file will expire
    Name string
    The name for the secure file, unique per project
    Project string
    The ID or full path of the project to environment is created for.
    SecureFileId int
    The id of the secure file in gitlab
    Checksum string
    The checksum of the file
    ChecksumAlgorithm string
    The checksum algorithm used
    Content string
    The contents of the secure file
    CreatedAt string
    The time the secure file was uploaded
    ExpiresAt string
    The time the secure file will expire
    Name string
    The name for the secure file, unique per project
    Project string
    The ID or full path of the project to environment is created for.
    SecureFileId int
    The id of the secure file in gitlab
    checksum String
    The checksum of the file
    checksumAlgorithm String
    The checksum algorithm used
    content String
    The contents of the secure file
    createdAt String
    The time the secure file was uploaded
    expiresAt String
    The time the secure file will expire
    name String
    The name for the secure file, unique per project
    project String
    The ID or full path of the project to environment is created for.
    secureFileId Integer
    The id of the secure file in gitlab
    checksum string
    The checksum of the file
    checksumAlgorithm string
    The checksum algorithm used
    content string
    The contents of the secure file
    createdAt string
    The time the secure file was uploaded
    expiresAt string
    The time the secure file will expire
    name string
    The name for the secure file, unique per project
    project string
    The ID or full path of the project to environment is created for.
    secureFileId number
    The id of the secure file in gitlab
    checksum str
    The checksum of the file
    checksum_algorithm str
    The checksum algorithm used
    content str
    The contents of the secure file
    created_at str
    The time the secure file was uploaded
    expires_at str
    The time the secure file will expire
    name str
    The name for the secure file, unique per project
    project str
    The ID or full path of the project to environment is created for.
    secure_file_id int
    The id of the secure file in gitlab
    checksum String
    The checksum of the file
    checksumAlgorithm String
    The checksum algorithm used
    content String
    The contents of the secure file
    createdAt String
    The time the secure file was uploaded
    expiresAt String
    The time the secure file will expire
    name String
    The name for the secure file, unique per project
    project String
    The ID or full path of the project to environment is created for.
    secureFileId Number
    The id of the secure file in gitlab

    Import

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

    terraform

    import {

    to = gitlab_project_secure_file.example

    id = “see CLI command below for ID”

    }

    Importing using the CLI is supported with the following syntax:

    GitLab secure files can be imported using an id made up of projectId:secureFileId, e.g.

    $ pulumi import gitlab:index/projectSecureFile:ProjectSecureFile bar 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.
    gitlab logo
    GitLab v9.8.0 published on Friday, Jan 16, 2026 by Pulumi
      Meet Neo: Your AI Platform Teammate