1. Packages
  2. Vercel Provider
  3. API Docs
  4. getFile
Vercel v3.15.1 published on Monday, Sep 8, 2025 by Pulumiverse

vercel.getFile

Start a Neo task
Explain and create a vercel.getFile resource
vercel logo
Vercel v3.15.1 published on Monday, Sep 8, 2025 by Pulumiverse

    Provides information about a file on disk.

    This will read a single file, providing metadata for use with a vercel.Deployment.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as vercel from "@pulumi/vercel";
    import * as vercel from "@pulumiverse/vercel";
    
    // In this example, we are assuming that a single index.html file
    // is being deployed. This file lives directly next to the terraform file.
    const example = vercel.getFile({
        path: "index.html",
    });
    const exampleGetProject = vercel.getProject({
        name: "my-project",
    });
    const exampleDeployment = new vercel.Deployment("example", {
        projectId: exampleGetProject.then(exampleGetProject => exampleGetProject.id),
        files: example.then(example => example.file),
    });
    
    import pulumi
    import pulumi_vercel as vercel
    import pulumiverse_vercel as vercel
    
    # In this example, we are assuming that a single index.html file
    # is being deployed. This file lives directly next to the terraform file.
    example = vercel.get_file(path="index.html")
    example_get_project = vercel.get_project(name="my-project")
    example_deployment = vercel.Deployment("example",
        project_id=example_get_project.id,
        files=example.file)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-vercel/sdk/v3/go/vercel"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// In this example, we are assuming that a single index.html file
    		// is being deployed. This file lives directly next to the terraform file.
    		example, err := vercel.GetFile(ctx, &vercel.GetFileArgs{
    			Path: "index.html",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleGetProject, err := vercel.LookupProject(ctx, &vercel.LookupProjectArgs{
    			Name: "my-project",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = vercel.NewDeployment(ctx, "example", &vercel.DeploymentArgs{
    			ProjectId: pulumi.String(exampleGetProject.Id),
    			Files:     pulumi.StringMap(example.File),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vercel = Pulumi.Vercel;
    using Vercel = Pulumiverse.Vercel;
    
    return await Deployment.RunAsync(() => 
    {
        // In this example, we are assuming that a single index.html file
        // is being deployed. This file lives directly next to the terraform file.
        var example = Vercel.GetFile.Invoke(new()
        {
            Path = "index.html",
        });
    
        var exampleGetProject = Vercel.GetProject.Invoke(new()
        {
            Name = "my-project",
        });
    
        var exampleDeployment = new Vercel.Deployment("example", new()
        {
            ProjectId = exampleGetProject.Apply(getProjectResult => getProjectResult.Id),
            Files = example.Apply(getFileResult => getFileResult.File),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vercel.VercelFunctions;
    import com.pulumi.vercel.inputs.GetFileArgs;
    import com.pulumi.vercel.inputs.GetProjectArgs;
    import com.pulumi.vercel.Deployment;
    import com.pulumi.vercel.DeploymentArgs;
    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) {
            // In this example, we are assuming that a single index.html file
            // is being deployed. This file lives directly next to the terraform file.
            final var example = VercelFunctions.getFile(GetFileArgs.builder()
                .path("index.html")
                .build());
    
            final var exampleGetProject = VercelFunctions.getProject(GetProjectArgs.builder()
                .name("my-project")
                .build());
    
            var exampleDeployment = new Deployment("exampleDeployment", DeploymentArgs.builder()
                .projectId(exampleGetProject.applyValue(getProjectResult -> getProjectResult.id()))
                .files(example.applyValue(getFileResult -> getFileResult.file()))
                .build());
    
        }
    }
    
    resources:
      exampleDeployment:
        type: vercel:Deployment
        name: example
        properties:
          projectId: ${exampleGetProject.id}
          files: ${example.file}
    variables:
      # In this example, we are assuming that a single index.html file
      # is being deployed. This file lives directly next to the terraform file.
      example:
        fn::invoke:
          Function: vercel:getFile
          Arguments:
            path: index.html
      exampleGetProject:
        fn::invoke:
          Function: vercel:getProject
          Arguments:
            name: my-project
    

    Using getFile

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getFile(args: GetFileArgs, opts?: InvokeOptions): Promise<GetFileResult>
    function getFileOutput(args: GetFileOutputArgs, opts?: InvokeOptions): Output<GetFileResult>
    def get_file(path: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetFileResult
    def get_file_output(path: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetFileResult]
    func GetFile(ctx *Context, args *GetFileArgs, opts ...InvokeOption) (*GetFileResult, error)
    func GetFileOutput(ctx *Context, args *GetFileOutputArgs, opts ...InvokeOption) GetFileResultOutput

    > Note: This function is named GetFile in the Go SDK.

    public static class GetFile 
    {
        public static Task<GetFileResult> InvokeAsync(GetFileArgs args, InvokeOptions? opts = null)
        public static Output<GetFileResult> Invoke(GetFileInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetFileResult> getFile(GetFileArgs args, InvokeOptions options)
    public static Output<GetFileResult> getFile(GetFileArgs args, InvokeOptions options)
    
    fn::invoke:
      function: vercel:index/getFile:getFile
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Path string
    Path string
    path String
    path string
    path str
    path String

    getFile Result

    The following output properties are available:

    File Dictionary<string, string>
    A map of filename to metadata about the file. The metadata contains the file size and hash, and allows a deployment to be created if the file changes.
    Id string
    The ID of this resource.
    Path string
    File map[string]string
    A map of filename to metadata about the file. The metadata contains the file size and hash, and allows a deployment to be created if the file changes.
    Id string
    The ID of this resource.
    Path string
    file Map<String,String>
    A map of filename to metadata about the file. The metadata contains the file size and hash, and allows a deployment to be created if the file changes.
    id String
    The ID of this resource.
    path String
    file {[key: string]: string}
    A map of filename to metadata about the file. The metadata contains the file size and hash, and allows a deployment to be created if the file changes.
    id string
    The ID of this resource.
    path string
    file Mapping[str, str]
    A map of filename to metadata about the file. The metadata contains the file size and hash, and allows a deployment to be created if the file changes.
    id str
    The ID of this resource.
    path str
    file Map<String>
    A map of filename to metadata about the file. The metadata contains the file size and hash, and allows a deployment to be created if the file changes.
    id String
    The ID of this resource.
    path String

    Package Details

    Repository
    vercel pulumiverse/pulumi-vercel
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vercel Terraform Provider.
    vercel logo
    Vercel v3.15.1 published on Monday, Sep 8, 2025 by Pulumiverse
      Meet Neo: Your AI Platform Teammate