Skip to content

Commit

Permalink
Merge pull request #36081 from bschaatsbergen/b/tbz2-getter
Browse files Browse the repository at this point in the history
getmodules: support `tbz2` module archives
  • Loading branch information
DanielMSchmidt authored Nov 26, 2024
2 parents e82c8e0 + 1060b07 commit 1221f33
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
32 changes: 22 additions & 10 deletions internal/getmodules/getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,41 @@ import (
var goGetterNoDetectors = []getter.Detector{}

var goGetterDecompressors = map[string]getter.Decompressor{
"bz2": new(getter.Bzip2Decompressor),
"gz": new(getter.GzipDecompressor),
"xz": new(getter.XzDecompressor),
"zip": new(getter.ZipDecompressor),

// Bzip2
"bz2": new(getter.Bzip2Decompressor),
"tbz2": new(getter.TarBzip2Decompressor),
"tar.bz2": new(getter.TarBzip2Decompressor),
"tar.tbz2": new(getter.TarBzip2Decompressor),

// Gzip
"gz": new(getter.GzipDecompressor),
"tar.gz": new(getter.TarGzipDecompressor),
"tgz": new(getter.TarGzipDecompressor),

// Xz
"xz": new(getter.XzDecompressor),
"tar.xz": new(getter.TarXzDecompressor),
"txz": new(getter.TarXzDecompressor),

// Zip
"zip": new(getter.ZipDecompressor),
}

var goGetterGetters = map[string]getter.Getter{
"file": new(getter.FileGetter),
"gcs": new(getter.GCSGetter),
"git": new(getter.GitGetter),
"hg": new(getter.HgGetter),
"s3": new(getter.S3Getter),
// Protocol-based getters
"http": getterHTTPGetter,
"https": getterHTTPGetter,

// Cloud storage getters
"gcs": new(getter.GCSGetter),
"s3": new(getter.S3Getter),

// Version control getters
"git": new(getter.GitGetter),
"hg": new(getter.HgGetter),

// Local and file-based getters
"file": new(getter.FileGetter),
}

var getterHTTPClient = cleanhttp.DefaultClient()
Expand Down
6 changes: 3 additions & 3 deletions website/docs/language/modules/sources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ module "vpc" {
The extensions that Terraform recognizes for this special behavior are:

- `zip`
- `tar.bz2` and `tbz2`
- `tar.gz` and `tgz`
- `tar.xz` and `txz`
- `bz2`, `tar.bz2`, `tar.tbz2`, and `tbz2`
- `gz`, `tar.gz`, and `tgz`
- `xz`, `tar.xz`, and `txz`

If your URL _doesn't_ have one of these extensions but refers to an archive
anyway, use the `archive` argument to force this interpretation:
Expand Down

0 comments on commit 1221f33

Please sign in to comment.