Skip to main content

Module: module-artifact

Terraform Module to fetch remote build artifacts via http(s) using curl.

Introduction

This terraform module uses the external data provider to execute curl, which downloads the file locally to the modules cache folder.

It's ideally suited for downloading public build artifacts (e.g. for use with Lambdas) associated with terraform modules. We recommend using this pattern to avoid adding binary artifacts like .zip files to Git repositories.

NOTE: The term external refers to the primary Terraform provider used in this module.

Dependencies

First make sure you have curl installed and that it exists in your PATH (E.g. /usr/bin).

Usage

For a complete example, see examples/complete.

For automated tests of the complete example using bats and Terratest (which tests and deploys the example on AWS), see test.

module "external_module_artifact" {
source = "cloudposse/module-artifact/external"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
filename = "test.zip"
git_ref = "example"
module_name = "terraform-external-module-artifact"
module_path = path.module
}

NOTE: Leave git_ref blank and it will be automatically computed from the module_path NOTE: We've published an artifact for purpose of testing this module