Dagger
Search

pre-commit-tf

It uses the official pre-commit-terraform Docker image to run the checks
The module supports specifying the version of pre-commit-terraform to run, the directory to run it in, and the Terraform/Opentofu binary to use
It also supports caching Terraform plugins to speed up the execution
The module returns the output of pre-commit-terraform as a string

Installation

dagger install github.com/Smana/daggerverse/pre-commit-tf@v0.0.1

Entrypoint

Return Type
PreCommitTf
Example
dagger -m github.com/Smana/daggerverse/pre-commit-tf@ea4a006643646184bbb497d7bc8d128c4aba5acf call \
func (m *myModule) example() *PreCommitTf  {
	return dag.
			PreCommitTf()
}
@function
def example() -> dag.PreCommitTf:
	return (
		dag.pre_commit_tf()
	)
@func()
example(): PreCommitTf {
	return dag
		.preCommitTf()
}

Types

PreCommitTf 🔗

run() 🔗

Run runs pre-commit-terraform on the given directory

Return Type
String !
Arguments
NameTypeDefault ValueDescription
versionString "v1.92.0"Version of pre-commit-terraform to run
dirDirectory !-Directory to run pre-commit-terraform in
tfBinaryString "terraform"Choose between "terraform" or "tofu"
cacheDirDirectory -cache is a directory to use as a cache for Terraform plugins
Example
dagger -m github.com/Smana/daggerverse/pre-commit-tf@ea4a006643646184bbb497d7bc8d128c4aba5acf call \
 run --dir DIR_PATH
func (m *myModule) example(ctx context.Context, dir *Directory) string  {
	return dag.
			PreCommitTf().
			Run(ctxdir)
}
@function
async def example(dir: dagger.Directory) -> str:
	return await (
		dag.pre_commit_tf()
		.run(dir)
	)
@func()
async example(dir: Directory): Promise<string> {
	return dag
		.preCommitTf()
		.run(dir)
}