1. Packages
  2. Packages
  3. Google Cloud (GCP) Classic
  4. API Docs
  5. artifactregistry
  6. getFile
Viewing docs for Google Cloud v9.23.0
published on Thursday, May 7, 2026 by Pulumi
gcp logo
Viewing docs for Google Cloud v9.23.0
published on Thursday, May 7, 2026 by Pulumi

    Downloads a single file from a Google Artifact Registry repository to a local path and exposes its metadata and content hashes. Applies to file-based Artifact Registry formats (Generic, Maven, npm, Python, Apt, Yum, Go). For Docker/OCI images, use gcp.artifactregistry.getDockerImage.

    Note: This data source downloads the file on every Terraform read (i.e. every plan and apply). For large files this can add significant time to each run. Use overwrite = false to skip the download when the local file already matches the remote — see the overwrite argument below.

    To get more information about Artifact Registry files, see:

    Example Usage

    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(file_id: Optional[str] = None,
                 location: Optional[str] = None,
                 output_path: Optional[str] = None,
                 overwrite: Optional[bool] = None,
                 project: Optional[str] = None,
                 repository_id: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetFileResult
    def get_file_output(file_id: pulumi.Input[Optional[str]] = None,
                 location: pulumi.Input[Optional[str]] = None,
                 output_path: pulumi.Input[Optional[str]] = None,
                 overwrite: pulumi.Input[Optional[bool]] = None,
                 project: pulumi.Input[Optional[str]] = None,
                 repository_id: pulumi.Input[Optional[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: gcp:artifactregistry/getFile:getFile
      arguments:
        # arguments dictionary
    data "gcp_artifactregistry_getfile" "name" {
        # arguments
    }

    The following arguments are supported:

    FileId string
    The Artifact Registry file ID. For Generic repositories this is <package>:<version>:<filename>; for other formats refer to the file listing in the API. Slashes and other reserved characters are URL-encoded by the provider.
    Location string
    The location of the repository.
    OutputPath string
    Local filesystem path where the downloaded bytes are written. Parent directories are created if missing.
    RepositoryId string
    The ID of the repository.
    Overwrite bool
    If true (default), the file at outputPath is always downloaded and overwritten on every read. If false, the download is skipped when the file already exists at outputPath and the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on every plan/apply.
    Project string
    The project in which the repository lives. Defaults to the provider project.
    FileId string
    The Artifact Registry file ID. For Generic repositories this is <package>:<version>:<filename>; for other formats refer to the file listing in the API. Slashes and other reserved characters are URL-encoded by the provider.
    Location string
    The location of the repository.
    OutputPath string
    Local filesystem path where the downloaded bytes are written. Parent directories are created if missing.
    RepositoryId string
    The ID of the repository.
    Overwrite bool
    If true (default), the file at outputPath is always downloaded and overwritten on every read. If false, the download is skipped when the file already exists at outputPath and the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on every plan/apply.
    Project string
    The project in which the repository lives. Defaults to the provider project.
    file_id string
    The Artifact Registry file ID. For Generic repositories this is <package>:<version>:<filename>; for other formats refer to the file listing in the API. Slashes and other reserved characters are URL-encoded by the provider.
    location string
    The location of the repository.
    output_path string
    Local filesystem path where the downloaded bytes are written. Parent directories are created if missing.
    repository_id string
    The ID of the repository.
    overwrite bool
    If true (default), the file at outputPath is always downloaded and overwritten on every read. If false, the download is skipped when the file already exists at outputPath and the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on every plan/apply.
    project string
    The project in which the repository lives. Defaults to the provider project.
    fileId String
    The Artifact Registry file ID. For Generic repositories this is <package>:<version>:<filename>; for other formats refer to the file listing in the API. Slashes and other reserved characters are URL-encoded by the provider.
    location String
    The location of the repository.
    outputPath String
    Local filesystem path where the downloaded bytes are written. Parent directories are created if missing.
    repositoryId String
    The ID of the repository.
    overwrite Boolean
    If true (default), the file at outputPath is always downloaded and overwritten on every read. If false, the download is skipped when the file already exists at outputPath and the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on every plan/apply.
    project String
    The project in which the repository lives. Defaults to the provider project.
    fileId string
    The Artifact Registry file ID. For Generic repositories this is <package>:<version>:<filename>; for other formats refer to the file listing in the API. Slashes and other reserved characters are URL-encoded by the provider.
    location string
    The location of the repository.
    outputPath string
    Local filesystem path where the downloaded bytes are written. Parent directories are created if missing.
    repositoryId string
    The ID of the repository.
    overwrite boolean
    If true (default), the file at outputPath is always downloaded and overwritten on every read. If false, the download is skipped when the file already exists at outputPath and the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on every plan/apply.
    project string
    The project in which the repository lives. Defaults to the provider project.
    file_id str
    The Artifact Registry file ID. For Generic repositories this is <package>:<version>:<filename>; for other formats refer to the file listing in the API. Slashes and other reserved characters are URL-encoded by the provider.
    location str
    The location of the repository.
    output_path str
    Local filesystem path where the downloaded bytes are written. Parent directories are created if missing.
    repository_id str
    The ID of the repository.
    overwrite bool
    If true (default), the file at outputPath is always downloaded and overwritten on every read. If false, the download is skipped when the file already exists at outputPath and the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on every plan/apply.
    project str
    The project in which the repository lives. Defaults to the provider project.
    fileId String
    The Artifact Registry file ID. For Generic repositories this is <package>:<version>:<filename>; for other formats refer to the file listing in the API. Slashes and other reserved characters are URL-encoded by the provider.
    location String
    The location of the repository.
    outputPath String
    Local filesystem path where the downloaded bytes are written. Parent directories are created if missing.
    repositoryId String
    The ID of the repository.
    overwrite Boolean
    If true (default), the file at outputPath is always downloaded and overwritten on every read. If false, the download is skipped when the file already exists at outputPath and the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on every plan/apply.
    project String
    The project in which the repository lives. Defaults to the provider project.

    getFile Result

    The following output properties are available:

    CreateTime string
    Creation time (RFC 3339).
    FileId string
    Hashes Dictionary<string, string>
    Map of hash type (e.g. SHA256, MD5) to the corresponding hash value reported by Artifact Registry.
    Id string
    The provider-assigned unique ID for this managed resource.
    Location string
    Name string
    The fully-qualified file resource name (projects/.../files/...).
    OutputBase64sha256 string
    Base64-encoded SHA-256 of the downloaded file contents.
    OutputPath string
    OutputSha256 string
    Hex-encoded SHA-256 of the downloaded file contents.
    Project string
    RepositoryId string
    SizeBytes int
    Size of the file in bytes, as reported by Artifact Registry.
    UpdateTime string
    Last update time (RFC 3339).
    Overwrite bool
    CreateTime string
    Creation time (RFC 3339).
    FileId string
    Hashes map[string]string
    Map of hash type (e.g. SHA256, MD5) to the corresponding hash value reported by Artifact Registry.
    Id string
    The provider-assigned unique ID for this managed resource.
    Location string
    Name string
    The fully-qualified file resource name (projects/.../files/...).
    OutputBase64sha256 string
    Base64-encoded SHA-256 of the downloaded file contents.
    OutputPath string
    OutputSha256 string
    Hex-encoded SHA-256 of the downloaded file contents.
    Project string
    RepositoryId string
    SizeBytes int
    Size of the file in bytes, as reported by Artifact Registry.
    UpdateTime string
    Last update time (RFC 3339).
    Overwrite bool
    create_time string
    Creation time (RFC 3339).
    file_id string
    hashes map(string)
    Map of hash type (e.g. SHA256, MD5) to the corresponding hash value reported by Artifact Registry.
    id string
    The provider-assigned unique ID for this managed resource.
    location string
    name string
    The fully-qualified file resource name (projects/.../files/...).
    output_base64sha256 string
    Base64-encoded SHA-256 of the downloaded file contents.
    output_path string
    output_sha256 string
    Hex-encoded SHA-256 of the downloaded file contents.
    project string
    repository_id string
    size_bytes number
    Size of the file in bytes, as reported by Artifact Registry.
    update_time string
    Last update time (RFC 3339).
    overwrite bool
    createTime String
    Creation time (RFC 3339).
    fileId String
    hashes Map<String,String>
    Map of hash type (e.g. SHA256, MD5) to the corresponding hash value reported by Artifact Registry.
    id String
    The provider-assigned unique ID for this managed resource.
    location String
    name String
    The fully-qualified file resource name (projects/.../files/...).
    outputBase64sha256 String
    Base64-encoded SHA-256 of the downloaded file contents.
    outputPath String
    outputSha256 String
    Hex-encoded SHA-256 of the downloaded file contents.
    project String
    repositoryId String
    sizeBytes Integer
    Size of the file in bytes, as reported by Artifact Registry.
    updateTime String
    Last update time (RFC 3339).
    overwrite Boolean
    createTime string
    Creation time (RFC 3339).
    fileId string
    hashes {[key: string]: string}
    Map of hash type (e.g. SHA256, MD5) to the corresponding hash value reported by Artifact Registry.
    id string
    The provider-assigned unique ID for this managed resource.
    location string
    name string
    The fully-qualified file resource name (projects/.../files/...).
    outputBase64sha256 string
    Base64-encoded SHA-256 of the downloaded file contents.
    outputPath string
    outputSha256 string
    Hex-encoded SHA-256 of the downloaded file contents.
    project string
    repositoryId string
    sizeBytes number
    Size of the file in bytes, as reported by Artifact Registry.
    updateTime string
    Last update time (RFC 3339).
    overwrite boolean
    create_time str
    Creation time (RFC 3339).
    file_id str
    hashes Mapping[str, str]
    Map of hash type (e.g. SHA256, MD5) to the corresponding hash value reported by Artifact Registry.
    id str
    The provider-assigned unique ID for this managed resource.
    location str
    name str
    The fully-qualified file resource name (projects/.../files/...).
    output_base64sha256 str
    Base64-encoded SHA-256 of the downloaded file contents.
    output_path str
    output_sha256 str
    Hex-encoded SHA-256 of the downloaded file contents.
    project str
    repository_id str
    size_bytes int
    Size of the file in bytes, as reported by Artifact Registry.
    update_time str
    Last update time (RFC 3339).
    overwrite bool
    createTime String
    Creation time (RFC 3339).
    fileId String
    hashes Map<String>
    Map of hash type (e.g. SHA256, MD5) to the corresponding hash value reported by Artifact Registry.
    id String
    The provider-assigned unique ID for this managed resource.
    location String
    name String
    The fully-qualified file resource name (projects/.../files/...).
    outputBase64sha256 String
    Base64-encoded SHA-256 of the downloaded file contents.
    outputPath String
    outputSha256 String
    Hex-encoded SHA-256 of the downloaded file contents.
    project String
    repositoryId String
    sizeBytes Number
    Size of the file in bytes, as reported by Artifact Registry.
    updateTime String
    Last update time (RFC 3339).
    overwrite Boolean

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Viewing docs for Google Cloud v9.23.0
    published on Thursday, May 7, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.