Skip to content

milliHQ/terraform-npm-download

Repository files navigation

NPM Download Terraform module

CI

A simple Terraform module to download files distributed via npm.

Usage

The module requires that bash and curl are installed on the system where Terraform is executed.

module "npm_download" {
  source = "milliHQ/download/npm"

  module_name    = "@millihq/tf-next-image-optimization"
  module_version = "11.1.2"
  path_to_file   = "dist.zip"
}

output "file_path" {
  value = module.npm_download.abs_path
}

Requirements

Name Version
terraform >= 0.13
external >= 1.2.0

Providers

Name Version
external >= 1.2.0

Inputs

Name Description Type Default Required
cdn_provider_url The service that should be used for unpacking. jsdelivr or unpkg should work. string "https://cdn.jsdelivr.net/npm/" no
local_cwd Root path where node.resolve should start looking for the local module. string null no
module_name The name of the npm module. string n/a yes
module_version If you want a specific version (or semver range) of the module define it here. string "" no
path_to_file The path inside of the npm module to the file you want to download. string n/a yes
use_local Fallback for using node.resolve for getting the module locally. Usually used for debug. bool false no

Outputs

Name Description
abs_path The absolute path to the downloaded file on the local file system.
rel_path The cwd based relative path to the downloaded file on the local file system.

License

Apache-2.0 - see LICENSE for details.