joshdk / tfbundle

📦 Bundle a single artifact as a Terraform module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CircleCI Go Report Card License Godoc CodeCov Releases

TFBundle

📦 Bundle a single artifact as a Terraform module

Installing

From source

You can install a development version of this tool by running:

$ go get -u github.com/joshdk/tfbundle

Precompiled binary

Alternatively, you can download a precompiled release binary by running:

$ wget -q https://github.com/joshdk/tfbundle/releases/download/0.1.0/tfbundle_linux_amd64
$ sudo install tfbundle_linux_amd64 /usr/bin/tfbundle

Usage

As a command line tool

The tfbundle tool can be used to consume a given file (lambda.zip in this example), and generate a fully contained Terraform module (module.tgz).

$ ls
lambda.zip

$ tfbundle -artifact lambda.zip -module module.tgz

$ ls
lambda.zip module.tgz

$ tar -tf module.tgz
main.tf
artifact
artifact/lambda.zip

As the resulting Terraform module

Configuration

The resulting module takes no inputs, just a source.

module "artifact" {
  source = "module.tgz"
}

Outputs

The etag output contains an entity tag for the bundled file. Used as a pass-through when configuring aws.s3_bucket_object.etag.

output "etag" {
  value = "${module.artifact.etag}"
}

The filename output contains the absolute path to the bundled file.

output "filename" {
  value = "${module.artifact.filename}"
}

The size output contains the size in bytes of the bundled file.

output "size" {
  value = "${module.artifact.size}"
}

The source_code_hash output contains a content hash for the bundled file. Used as a pass-through when configuring aws.lambda_function.source_code_hash.

output "source_code_hash" {
  value = "${module.artifact.source_code_hash}"
}

License

This library is distributed under the MIT License, see LICENSE.txt for more information.

About

📦 Bundle a single artifact as a Terraform module

License:MIT License


Languages

Language:Go 96.1%Language:Shell 3.9%