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.1.1

Entrypoint

Return Type
PreCommitTf
Example
dagger -m github.com/Smana/daggerverse/pre-commit-tf@2c1f1545e1c9824beafae766eb382b300816dcef 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.94.1"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@2c1f1545e1c9824beafae766eb382b300816dcef 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)
}