Dagger
Search

terratest

No long description provided.

Installation

dagger install github.com/Excoriate/daggerverse/terratest@v1.15.4

Entrypoint

Return Type
Terratest !
Arguments
NameTypeDescription
versionString the Version of the Terraform to use, e.g., "0.12.24". by default, it uses the latest Version.
tfVersionString the Version of the Terraform to use, e.g., "0.12.24". by default, it uses the latest Version.
imageString Image of the container to use. by default, it uses the official HashiCorp Terraform Image hashicorp/terraform.
ctrContainer !ctr is the container to use as a base container. It's an optional parameter. If it's not set, it's going to create a new container.
envVarsString envVars is a string of environment variables in the form of "key1=value1,key2=value2"
Example
func (m *myModule) example(ctr *Container) *Terratest  {
	return dag.
			Terratest(ctr)
}
@function
def example(ctr: dagger.Container, ) -> dag.Terratest:
	return (
		dag.terratest(ctr)
	)
@func()
example(ctr: Container, ): Terratest {
	return dag
		.terratest(ctr)
}

Types

Terratest 🔗

version() 🔗

The Version of the Golang image that’ll host the ‘terratest’ test

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, ctr *Container) string  {
	return dag.
			Terratest(ctr).
			Version(ctx)
}
@function
async def example(ctr: dagger.Container, ) -> str:
	return await (
		dag.terratest(ctr)
		.version()
	)
@func()
async example(ctr: Container, ): Promise<string> {
	return dag
		.terratest(ctr)
		.version()
}

tfVersion() 🔗

TfVersion is the Version of the Terraform to use, e.g., “0.12.24”. by default, it uses the latest Version.

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, ctr *Container) string  {
	return dag.
			Terratest(ctr).
			TfVersion(ctx)
}
@function
async def example(ctr: dagger.Container, ) -> str:
	return await (
		dag.terratest(ctr)
		.tf_version()
	)
@func()
async example(ctr: Container, ): Promise<string> {
	return dag
		.terratest(ctr)
		.tfVersion()
}

image() 🔗

Image of the container to use.

Return Type
String !
Example
func (m *myModule) example(ctx context.Context, ctr *Container) string  {
	return dag.
			Terratest(ctr).
			Image(ctx)
}
@function
async def example(ctr: dagger.Container, ) -> str:
	return await (
		dag.terratest(ctr)
		.image()
	)
@func()
async example(ctr: Container, ): Promise<string> {
	return dag
		.terratest(ctr)
		.image()
}

ctr() 🔗

Ctr is the container to use as a base container.

Return Type
Container !
Example
func (m *myModule) example(ctr *Container) *Container  {
	return dag.
			Terratest(ctr).
			Ctr()
}
@function
def example(ctr: dagger.Container, ) -> dagger.Container:
	return (
		dag.terratest(ctr)
		.ctr()
	)
@func()
example(ctr: Container, ): Container {
	return dag
		.terratest(ctr)
		.ctr()
}

base() 🔗

Base sets up the Container with a golang image and cache volumes version string

Return Type
Terratest !
Arguments
NameTypeDefault ValueDescription
goVersionString !-No description provided
tfVersionString !-No description provided
Example
func (m *myModule) example(ctr *Container, goVersion string, tfVersion string) *Terratest  {
	return dag.
			Terratest(ctr).
			Base(goVersion, tfVersion)
}
@function
def example(ctr: dagger.Container, go_version: str, tf_version: str) -> dag.Terratest:
	return (
		dag.terratest(ctr)
		.base(go_version, tf_version)
	)
@func()
example(ctr: Container, goVersion: string, tfVersion: string): Terratest {
	return dag
		.terratest(ctr)
		.base(goVersion, tfVersion)
}

withContainer() 🔗

WithContainer specifies the container to use in the Terraform module.

Return Type
Terratest !
Arguments
NameTypeDefault ValueDescription
ctrContainer !-No description provided
Example
func (m *myModule) example(ctr *Container, ctr1 *Container) *Terratest  {
	return dag.
			Terratest(ctr).
			WithContainer(ctr1)
}
@function
def example(ctr: dagger.Container, ctr1: dagger.Container) -> dag.Terratest:
	return (
		dag.terratest(ctr)
		.with_container(ctr1)
	)
@func()
example(ctr: Container, ctr1: Container): Terratest {
	return dag
		.terratest(ctr)
		.withContainer(ctr1)
}

run() 🔗

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
testDirDirectory !-testDir is the directory that contains all the test code.
argsString -args is the arguments to pass to the 'go test' command.
Example
func (m *myModule) example(ctr *Container, testDir *Directory) *Container  {
	return dag.
			Terratest(ctr).
			Run(testDir)
}
@function
def example(ctr: dagger.Container, test_dir: dagger.Directory) -> dagger.Container:
	return (
		dag.terratest(ctr)
		.run(test_dir)
	)
@func()
example(ctr: Container, testDir: Directory): Container {
	return dag
		.terratest(ctr)
		.run(testDir)
}

withSource() 🔗

WithSource Set the source directory.

Return Type
Terratest !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-Src is the directory that contains all the source code, including the module directory.
workdirString -workdir is the working directory.
Example
func (m *myModule) example(ctr *Container, src *Directory) *Terratest  {
	return dag.
			Terratest(ctr).
			WithSource(src)
}
@function
def example(ctr: dagger.Container, src: dagger.Directory) -> dag.Terratest:
	return (
		dag.terratest(ctr)
		.with_source(src)
	)
@func()
example(ctr: Container, src: Directory): Terratest {
	return dag
		.terratest(ctr)
		.withSource(src)
}

withCgoDisabled() 🔗

WithCgoDisabled Set CGO_ENABLED environment variable to 0.

Return Type
Terratest !
Example
func (m *myModule) example(ctr *Container) *Terratest  {
	return dag.
			Terratest(ctr).
			WithCgoDisabled()
}
@function
def example(ctr: dagger.Container, ) -> dag.Terratest:
	return (
		dag.terratest(ctr)
		.with_cgo_disabled()
	)
@func()
example(ctr: Container, ): Terratest {
	return dag
		.terratest(ctr)
		.withCgoDisabled()
}

withEnvVar() 🔗

WithEnvVar Set an environment variable.

Return Type
Terratest !
Arguments
NameTypeDefault ValueDescription
nameString !-The name of the environment variable (e.g., "HOST").
valueString !-The value of the environment variable (e.g., "localhost").
expandBoolean -Replace `${VAR}` or $VAR in the value according to the current environment variables defined in the container (e.g., "/opt/bin:$PATH").
Example
func (m *myModule) example(ctr *Container, name string, value string) *Terratest  {
	return dag.
			Terratest(ctr).
			WithEnvVar(name, value)
}
@function
def example(ctr: dagger.Container, name: str, value: str) -> dag.Terratest:
	return (
		dag.terratest(ctr)
		.with_env_var(name, value)
	)
@func()
example(ctr: Container, name: string, value: string): Terratest {
	return dag
		.terratest(ctr)
		.withEnvVar(name, value)
}