published on Thursday, May 7, 2026 by Pulumi
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
planandapply). For large files this can add significant time to each run. Useoverwrite = falseto skip the download when the local file already matches the remote — see theoverwriteargument 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 dictionarydata "gcp_artifactregistry_getfile" "name" {
# arguments
}The following arguments are supported:
- 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 atoutputPathis always downloaded and overwritten on every read. Iffalse, the download is skipped when the file already exists atoutputPathand the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on everyplan/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 atoutputPathis always downloaded and overwritten on every read. Iffalse, the download is skipped when the file already exists atoutputPathand the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on everyplan/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 atoutputPathis always downloaded and overwritten on every read. Iffalse, the download is skipped when the file already exists atoutputPathand the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on everyplan/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 Boolean
- If
true(default), the file atoutputPathis always downloaded and overwritten on every read. Iffalse, the download is skipped when the file already exists atoutputPathand the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on everyplan/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 boolean
- If
true(default), the file atoutputPathis always downloaded and overwritten on every read. Iffalse, the download is skipped when the file already exists atoutputPathand the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on everyplan/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 atoutputPathis always downloaded and overwritten on every read. Iffalse, the download is skipped when the file already exists atoutputPathand the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on everyplan/apply. - project str
- 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 Boolean
- If
true(default), the file atoutputPathis always downloaded and overwritten on every read. Iffalse, the download is skipped when the file already exists atoutputPathand the Artifact Registry-reported hash matches the hash from the previous read — useful for large files that rarely change, to avoid re-downloading on everyplan/apply. - project String
- The project in which the repository lives. Defaults to the provider project.
getFile Result
The following output properties are available:
- Create
Time string - Creation time (RFC 3339).
- File
Id 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/...). - 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 int - Size of the file in bytes, as reported by Artifact Registry.
- Update
Time string - Last update time (RFC 3339).
- Overwrite bool
- Create
Time string - Creation time (RFC 3339).
- File
Id 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/...). - 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 int - Size of the file in bytes, as reported by Artifact Registry.
- Update
Time 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
- create
Time String - Creation time (RFC 3339).
- file
Id 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/...). - 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 Integer - Size of the file in bytes, as reported by Artifact Registry.
- update
Time String - Last update time (RFC 3339).
- overwrite Boolean
- create
Time string - Creation time (RFC 3339).
- file
Id 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/...). - 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 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
- 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 Boolean
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-betaTerraform Provider.
published on Thursday, May 7, 2026 by Pulumi
