Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andreygubarev/terraform-external-self-extractable-archive
Terraform module that uses makeself to create a self-extractable archive from a directory
https://github.com/andreygubarev/terraform-external-self-extractable-archive
cloud-init makeself-archives self-extracting-script terraform terraform-module
Last synced: 15 days ago
JSON representation
Terraform module that uses makeself to create a self-extractable archive from a directory
- Host: GitHub
- URL: https://github.com/andreygubarev/terraform-external-self-extractable-archive
- Owner: andreygubarev
- Created: 2023-03-08T14:44:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-24T18:55:32.000Z (7 months ago)
- Last Synced: 2024-10-10T22:15:01.816Z (about 1 month ago)
- Topics: cloud-init, makeself-archives, self-extracting-script, terraform, terraform-module
- Language: Shell
- Homepage: https://registry.terraform.io/modules/andreygubarev/self-extractable-archive/external/latest
- Size: 89.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Terraform Module for Self-Extractable Archive
This module creates a self-extractable archive from a directory using [makeself](https://makeself.io/). The archive can be used to bootstrap a new instance using cloud-init.
Module uses `external` provider to run `makeself` command. It creates temporary directory, copies source directory to it, runs `makeself` and returns path to the archive.
Module targets to build hermetic self-extractable archives. It uses `--nomd5 --nocrc` options to disable checksums.
## Usage
Quick start:
```terraform
module "bootstrap" {
source = "andreygubarev/self-extractable-archive/external"
source_dir = "${path.module}/bootstrap"
}
```Advanced usage:
```terraform
module "userdata" {
source = "andreygubarev/self-extractable-archive/external"
version = "1.4.1"description = "User Data" # Description of the archive
filename = "userdata.run" # Name of self-extractable archive
source_dir = "${path.module}/userdata" # Directory to be archived
source_entrypoint = "entrypoint.sh" # Entrypoint script, relative to source_dir, defaults to "entrypoint.sh"
source_environment = {
FOO = "BAR" # Environment variables to be exported, defaults to {}
}
}data "cloudinit_config" "this" {
gzip = true
base64_encode = truepart {
filename = basename(module.userdata.path)
content_type = "text/x-shellscript"
content = file(module.userdata.path)
}
}output "userdata" {
value = data.cloudinit_config.this.rendered
}
```Example `entrypoint.sh`:
```bash
#!/bin/bash
set -euxo pipefail
source .env# ...
```## Prerequisite
For MacOS:
```bash
brew install gnu-tar
export PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH"
```# Reference
- https://makeself.io/
- https://registry.terraform.io/providers/hashicorp/external/latest