Dagger
Search

terragrunt

A powerful Dagger module for managing Terragrunt, Terraform, and OpenTofu in a containerized environment.

This module provides a comprehensive set of features for Infrastructure as Code, including:
- Flexible base image built using APKO for a secure and optimized container environment.
- Multi-tool support for Terragrunt, Terraform, and OpenTofu.
- Customizable configurations for Terragrunt and Terraform settings.
- Caching mechanisms for improved performance.
- Optional AWS CLI integration.
- Fine-grained control over directory permissions.
- Easy management of environment variables.
- Secure handling of sensitive information like Terraform tokens.
- Execution flexibility to run Terragrunt, Terraform, or shell commands within the container.

The module is designed to be highly configurable and extesible.
Example (OpenTerminal)
no available example in current language
// Terragrunt_OpenTerminal demonstrates how to open an interactive terminal session
// within a Terragrunt module container.
//
// This function showcases the initialization and configuration of a
// Terragrunt module container using various options like enabling Cgo,
// utilizing build cache, and including a GCC compiler.
//
// Parameters:
//   - None
//
// Returns:
//   - *dagger.Container: A configured Dagger container with an open terminal.
//
// Usage:
//
//	This function can be used to interactively debug or inspect the
//	container environment during test execution.
func (m *Go) Terragrunt_OpenTerminal() *dagger.Container {
	// Configure the Terragrunt module container with necessary options
	targetModule := dag.Terragrunt()

	// Retrieve and discard standard output
	_, _ = targetModule.Ctr().
		Stdout(context.Background())

	// Open and return the terminal session in the configured container
	return targetModule.Ctr().
		Terminal()
}
no available example in current language
no available example in current language
Example (PassedEnvVars)
no available example in current language
// Terragrunt_PassedEnvVars demonstrates how to pass environment variables to the Terragrunt module.
//
// This method configures a Terragrunt module to use specific environment variables from the host.
func (m *Go) Terragrunt_PassedEnvVars(ctx context.Context) error {
	targetModule := dag.Terragrunt(dagger.TerragruntOpts{
		EnvVarsFromHost: []string{"SOMETHING=SOMETHING,SOMETHING=SOMETHING"},
	})

	out, err := targetModule.Ctr().
		WithExec([]string{"printenv"}).
		Stdout(ctx)

	if err != nil {
		return fmt.Errorf("failed when executing printenv: %w", err)
	}

	if out == "" {
		return errEnvVarsEmpty
	}

	if !strings.Contains(out, "SOMETHING") {
		return errEnvVarsDontMatch
	}

	return nil
}
no available example in current language
no available example in current language
Example (ExecPlanCommand)
no available example in current language
// Terragrunt_ExecPlanCommand executes the 'terragrunt plan' command with specific configurations.
//
// This function demonstrates how to:
// - Set up environment variables for Terragrunt execution
// - Initialize the Terragrunt module with advanced logging and token options
// - Execute the 'plan' command
// - Validate the command output and environment variable setup
//
// It uses the Dagger Terragrunt module to perform these operations within a container.
//
// Parameters:
// - ctx: context.Context for controlling the function's lifetime
//
// Returns:
//   - error: If any step in the process fails, including command execution,
//     output validation, or environment variable checks
func (m *Go) Terragrunt_ExecPlanCommand(ctx context.Context) error {
	testEnvVars := []string{
		"OTHER_ENV_VAR=test",
		"AWS_ACCESS_KEY_ID=test",
		"AWS_SECRET_ACCESS_KEY=test",
		"AWS_SESSION_TOKEN=test",
		"TF_VAR_test=test",
	}

	tfTokenAsSecret := dag.SetSecret("TF_TOKEN_gitlab", "mysupertoken")

	// Initialize the Terragrunt module with some advance options.
	tgModule := dag.
		Terragrunt(dagger.TerragruntOpts{
			EnvVarsFromHost: testEnvVars,
			TgVersion:       "v0.52.1",
		}).
		WithTerraformToken(tfTokenAsSecret).
		WithTerragruntLogOptions(dagger.TerragruntWithTerragruntLogOptionsOpts{
			TgLogLevel:             "debug",
			TgLogDisableColor:      true,
			TgForwardTfStdout:      true,
			TgLogDisableFormatting: true,
		}).
		WithTerraformLogOptions(dagger.TerragruntWithTerraformLogOptionsOpts{
			TfLog:     "debug",
			TfLogPath: "/mnt/tflogs", // it's a directory that the terragrunt user owns.
		})

	// Container configured with all the options.
	tgCtrConfigured := tgModule.
		Exec("plan", dagger.TerragruntExecOpts{
			Source: m.
				getTestDir().
				Directory("terragrunt"),
		})

	tgPlanCmdOut, tgPlanCmdErr := tgCtrConfigured.
		Stdout(ctx)

	if tgPlanCmdErr != nil {
		return fmt.Errorf("failed to execute terragrunt plan command: %w", tgPlanCmdErr)
	}

	if tgPlanCmdOut == "" {
		return errTerragruntPlanEmpty
	}

	return nil
}
no available example in current language
no available example in current language
Example (RunArbitraryCommand)
no available example in current language
// Terragrunt_RunArbitraryCommand runs an arbitrary shell command in the test container.
//
// This function demonstrates how to execute a shell command within the container
// using the Terragrunt module.
//
// Parameters:
//
//	ctx - context for controlling the function lifetime.
//
// Returns:
//
//	A string containing the output of the executed command, or an error if the command fails or if the output is empty.
func (m *Go) Terragrunt_RunArbitraryCommand(ctx context.Context) (string, error) {
	targetModule := dag.Terragrunt().WithSource(m.TestDir)

	// Execute the 'ls -l' command
	out, err := targetModule.
		Ctr().
		WithExec([]string{"ls", "-l"}).
		Stdout(ctx)

	if err != nil {
		return "", fmt.Errorf("failed to run shell command: %w", err)
	}

	if out == "" {
		return "", errExpectedFoldersNotFound
	}

	return out, nil
}
no available example in current language
no available example in current language
Example (ExecLifecycleCommands)
no available example in current language
// Terragrunt_ExecLifecycleCommands executes Terragrunt lifecycle commands.
//
// This function sets up the necessary environment variables and secrets, configures the Terragrunt module,
// and executes a series of Terragrunt commands ("init", "plan", "apply", "destroy"). It validates the output
// of each command and ensures that the commands are executed successfully.
//
// Parameters:
// - ctx: The context for controlling the execution.
//
// Returns:
// - error: If any command execution fails or if the command output is empty.
func (m *Go) Terragrunt_ExecLifecycleCommands(ctx context.Context) error {
	testEnvVars := []string{
		"TF_VAR_test=test",
		"TF_VAR_another_test=test",
		"TF_VAR_region=westus",
		"TF_VAR_resource_group=myResourceGroup",
		"TF_VAR_storage_account=myStorageAccount",
		"AZURE_SUBSCRIPTION_ID=your_subscription_id",
		"AZURE_CLIENT_ID=your_client_id",
		"AZURE_CLIENT_SECRET=your_client_secret",
		"AZURE_TENANT_ID=your_tenant_id",
	}

	awsSecret := dag.SetSecret("AWS_SECRET_ACCESS_KEY", "awssecretkey")
	gcpSecret := dag.SetSecret("GCP_SERVICE_ACCOUNT_KEY", "gcpserviceaccountkey")
	azureSecret := dag.SetSecret("AZURE_CLIENT_SECRET", "azureclientsecret")

	// github tf token
	tfTokenGitHub := dag.SetSecret("TF_TOKEN_github", "mygithubtoken")

	// main module configuration.
	tgModule := dag.
		Terragrunt(dagger.TerragruntOpts{
			EnvVarsFromHost: testEnvVars,
		}).
		WithTerragruntPermissionsOnDirsDefault().
		WithTerraformToken(tfTokenGitHub).
		WithTerragruntLogOptions(dagger.TerragruntWithTerragruntLogOptionsOpts{
			TgLogLevel:             "debug",
			TgLogDisableColor:      true,
			TgForwardTfStdout:      true,
			TgLogDisableFormatting: true,
		}).
		WithTerraformLogOptions(dagger.TerragruntWithTerraformLogOptionsOpts{
			TfLog:     "debug",
			TfLogPath: "/mnt/tflogs", // it's a directory that the terragrunt user owns.
		})

	// run init command
	cmdInitOut, cmdInitErr := tgModule.ExecCmd(ctx, "init", dagger.TerragruntExecCmdOpts{
		Source: m.
			getTestDir().
			Directory("terragrunt"),
		Secrets: []*dagger.Secret{
			awsSecret,
			gcpSecret,
			azureSecret,
		},
	})

	if cmdInitErr != nil {
		return fmt.Errorf("failed to execute command init: %w", cmdInitErr)
	}

	if cmdInitOut == "" {
		return errCommandInitEmpty
	}

	// run plan command with arguments
	cmdPlanOut, cmdPlanErr := tgModule.ExecCmd(ctx, "plan", dagger.TerragruntExecCmdOpts{
		Source: m.
			getTestDir().
			Directory("terragrunt"),
		Secrets: []*dagger.Secret{
			awsSecret,
			gcpSecret,
			azureSecret,
		},
		Args: []string{
			"-out=plan.tfplan",
			"-refresh=true",
		},
	})

	if cmdPlanErr != nil {
		return fmt.Errorf("failed to execute command plan: %w", cmdPlanErr)
	}

	if cmdPlanOut == "" {
		return errCommandPlanEmpty
	}

	// run apply command with the auto-approve flag as an argument
	cmdApplyOut, cmdApplyErr := tgModule.ExecCmd(ctx, "apply", dagger.TerragruntExecCmdOpts{
		Source: m.
			getTestDir().
			Directory("terragrunt"),
		Args: []string{
			"-auto-approve",
		},
	})

	if cmdApplyErr != nil {
		return fmt.Errorf("failed to execute command apply: %w", cmdApplyErr)
	}

	if cmdApplyOut == "" {
		return errCommandApplyEmpty
	}

	// run destroy command with the auto-approve built-in option.
	cmdDestroyOut, cmdDestroyErr := tgModule.ExecCmd(ctx, "destroy", dagger.TerragruntExecCmdOpts{
		Source: m.
			getTestDir().
			Directory("terragrunt"),
		AutoApprove: true,
	})

	if cmdDestroyErr != nil {
		return fmt.Errorf("failed to execute command destroy: %w", cmdDestroyErr)
	}

	if cmdDestroyOut == "" {
		return errCommandDestroyEmpty
	}

	return nil
}
no available example in current language
no available example in current language

Installation

dagger install github.com/Excoriate/daggerverse/terragrunt@v0.14.0

Entrypoint

Return Type
Terragrunt !
Arguments
NameTypeDescription
ctrContainer ctr is the container to use as a base container.
imageUrlString imageURL is the URL of the image to use as the base container. It should includes tags. E.g. "ghcr.io/devops-infra/docker-terragrunt:tf-1.9.5-ot-1.8.2-tg-0.67.4"
tgVersionString tgVersion is the Terragrunt version to use. Default is "0.68.1".
tfVersionString tfVersion is the Terraform version to use. Default is "1.9.1".
openTofuVersionString openTofuVersion is the OpenTofu version to use. Default is "1.8.0".
envVarsFromHost[String ! ] envVarsFromHost is a list of environment variables to pass from the host to the container in a slice of strings.
enableAwscliBoolean enableAWSCLI is a boolean to enable or disable the installation of the AWS CLI.
awscliVersionString awscliVersion is the version of the AWS CLI to install. Ensure the version is listed in the Alpine packages.
extraPackages[String ! ] extraPackages is a list of extra packages to install with APKO, from the Alpine packages repository.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
}

Types

Terragrunt 🔗

Terragrunt is a Dagger module. This module is used to create and manage containers.

ctr() 🔗

Ctr is the container to use as a base container.

Return Type
Container !
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 ctr
func (m *myModule) example() *Container  {
	return dag.
			Terragrunt().
			Ctr()
}
@function
def example() -> dagger.Container:
	return (
		dag.terragrunt()
		.ctr()
	)
@func()
example(): Container {
	return dag
		.terragrunt()
		.ctr()
}

withTerragruntInstalled() 🔗

WithTerragruntInstalled installs the specified version of Terragrunt. If no version is specified, it defaults to the version defined in defaultTerragruntVersion. The function returns a pointer to the updated Terragrunt instance.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
versionString -version is the version of Terragrunt to install.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terragrunt-installed
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerragruntInstalled()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terragrunt_installed()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
		.withTerragruntInstalled()
}

withTerraformInstalled() 🔗

WithTerraformInstalled installs the specified version of Terraform. If no version is specified, it defaults to the version defined in defaultTerraformVersion. The function returns a pointer to the updated Terragrunt instance.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
versionString -version is the version of Terraform to install.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terraform-installed
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerraformInstalled()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terraform_installed()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
		.withTerraformInstalled()
}

withOpenTofuInstalled() 🔗

WithOpenTofuInstalled installs the specified version of OpenTofu. If no version is specified, it defaults to the version defined in defaultOpenTofuVersion. The function returns a pointer to the updated Terragrunt instance.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
versionString -version is the version of OpenTofu to install.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-open-tofu-installed
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt().
			WithOpenTofuInstalled()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_open_tofu_installed()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
		.withOpenTofuInstalled()
}

withAwsclipackage() 🔗

WithAWSCLIPackage adds the AWS CLI package to the APKO packages list. If a specific version is provided, it adds the package with the specified version. If no version is provided, it adds the package without specifying a version.

Parameters:

version - the version of the AWS CLI package to add. If empty, the package is added without a version.

Returns:

A pointer to the updated Terragrunt instance.
Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
versionString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-awsclipackage --version string
func (m *myModule) example(version string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithAwsclipackage(version)
}
@function
def example(version: str) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_awsclipackage(version)
	)
@func()
example(version: string): Terragrunt {
	return dag
		.terragrunt()
		.withAwsclipackage(version)
}

withExtraPackages() 🔗

WithExtraPackages adds extra packages to the APKO packages list. This function allows adding multiple packages at once.

Parameters:

packages - a variadic parameter representing the list of packages to add.

Returns:

A pointer to the updated Terragrunt instance.
Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
packages[String ! ] !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-extra-packages --packages string1 --packages string2
func (m *myModule) example(packages []string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithExtraPackages(packages)
}
@function
def example(packages: List[str]) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_extra_packages(packages)
	)
@func()
example(packages: string[]): Terragrunt {
	return dag
		.terragrunt()
		.withExtraPackages(packages)
}

openTerminal() 🔗

OpenTerminal returns a terminal

It returns a terminal for the container. Arguments: - None. Returns: - *Terminal: The terminal for the container.

Return Type
Container !
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 open-terminal
func (m *myModule) example() *Container  {
	return dag.
			Terragrunt().
			OpenTerminal()
}
@function
def example() -> dagger.Container:
	return (
		dag.terragrunt()
		.open_terminal()
	)
@func()
example(): Container {
	return dag
		.terragrunt()
		.openTerminal()
}

runShell() 🔗

RunShell runs a shell command in the container.

It runs a shell command in the container and returns the output. Arguments: - cmd: The command to run in the container. Returns: - string: The output of the command. - error: An error if the command fails.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
cmdString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 run-shell --cmd string
func (m *myModule) example(ctx context.Context, cmd string) string  {
	return dag.
			Terragrunt().
			RunShell(ctx, cmd)
}
@function
async def example(cmd: str) -> str:
	return await (
		dag.terragrunt()
		.run_shell(cmd)
	)
@func()
async example(cmd: string): Promise<string> {
	return dag
		.terragrunt()
		.runShell(cmd)
}

base() 🔗

Base sets the base image and version, and creates the base container.

The default image is “alpine/latest” and the default version is “latest”.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
imageUrlString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 base --image-url string
func (m *myModule) example(imageUrl string) *Terragrunt  {
	return dag.
			Terragrunt().
			Base(imageUrl)
}
@function
def example(image_url: str) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.base(image_url)
	)
@func()
example(imageUrl: string): Terragrunt {
	return dag
		.terragrunt()
		.base(imageUrl)
}

baseApko() 🔗

BaseApko sets up a base container using an APKO preset configuration.

This function performs the following steps: 1. Retrieves keyring information for the given preset. 2. Obtains the APKO configuration file path. 3. Sets up the APKO cache directory. 4. Retrieves the Alpine key to be mounted into the container. 5. Builds the APKO command with the specified parameters. 6. Creates and decorates the container with APKO-related mounts and executes the APKO build command.

Parameters: - preset: A string representing the APKO preset to be used.

Returns: - *dagger.Container: A pointer to the created and configured container. - error: An error object if any step fails, otherwise nil. See: https://github.com/Excoriate/daggerx/tree/main/pkg/builderx

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
extraPackages[String ! ] !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 base-apko --extra-packages string1 --extra-packages string2
func (m *myModule) example(extraPackages []string) *Container  {
	return dag.
			Terragrunt().
			BaseApko(extraPackages)
}
@function
def example(extra_packages: List[str]) -> dagger.Container:
	return (
		dag.terragrunt()
		.base_apko(extra_packages)
	)
@func()
example(extraPackages: string[]): Container {
	return dag
		.terragrunt()
		.baseApko(extraPackages)
}

withTerragruntPermissionsOnDirsDefault() 🔗

WithTerragruntPermissionsOnDirsDefault sets the default permissions for the Terragrunt directories. It ensures that the specified user and group own the directories and sets the appropriate permissions. The default directories include: - /home/terragrunt - /home/.terraform.d - /home - /var/log - fixtures.MntPrefix Additionally, it sets the permissions to 0777 for the following directories: - /home - /var/log - fixtures.MntPrefix

Returns: - *Terragrunt: Updated instance with the default permissions set.

Return Type
Terragrunt !
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terragrunt-permissions-on-dirs-default
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerragruntPermissionsOnDirsDefault()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terragrunt_permissions_on_dirs_default()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
		.withTerragruntPermissionsOnDirsDefault()
}

withTerragruntPermissionsOnDirs() 🔗

WithTerragruntPermissionsOnDirs sets the necessary permissions for the Terragrunt directories. It ensures that the specified user and group own the directories and sets the appropriate permissions. The default directories include: - /home/terragrunt - /home/.terraform.d - /home - /var/log - fixtures.MntPrefix Additionally, it sets the permissions to 0777 for the following directories: - /home - /var/log - fixtures.MntPrefix If dirsToOwn and dirsToHaveWritePermissions are provided, they will be appended to the respective default lists.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
dirsToOwn[String ! ] -dirsToOwn are the directories to set the permissions to 0777.
dirsToHaveWritePermissions[String ! ] -dirsToHaveWritePermissions are the directories to have write permissions.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terragrunt-permissions-on-dirs
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerragruntPermissionsOnDirs()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terragrunt_permissions_on_dirs()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
		.withTerragruntPermissionsOnDirs()
}

withTerragruntCacheConfiguration() 🔗

WithTerragruntCacheConfiguration configures the cache directory for Terragrunt. It sets up the cache directory at /home/terragrunt/.terragrunt-providers-cache and assigns the environment variable TERRAGRUNT_PROVIDER_CACHE_DIR to this path.

Return Type
Terragrunt !
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terragrunt-cache-configuration
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerragruntCacheConfiguration()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terragrunt_cache_configuration()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
		.withTerragruntCacheConfiguration()
}

withTerraformCacheConfiguration() 🔗

WithTerraformCacheConfiguration configures the cache directories for Terraform. It sets up the following cache directories: - /home/.terraform.d/plugin-cache with the environment variable TF_PLUGIN_CACHE_DIR. - /home/.terraform.d/plugins without any specific environment variable.

Return Type
Terragrunt !
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terraform-cache-configuration
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerraformCacheConfiguration()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terraform_cache_configuration()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
		.withTerraformCacheConfiguration()
}

withIactoolsInstalled() 🔗

WithIACToolsInstalled ensures that the specified versions of Terragrunt, Terraform, and OpenTofu are installed. If any of the provided version strings are empty, it defaults to the predefined versions for each tool. The function performs the following steps: 1. Checks if the provided Terragrunt version is empty. If it is, it assigns the defaultTerragruntVersion. 2. Checks if the provided Terraform version is empty. If it is, it assigns the defaultTerraformVersion. 3. Checks if the provided OpenTofu version is empty. If it is, it assigns the defaultOpenTofuVersion. 4. Calls WithTerragruntInstalled with the determined Terragrunt version to ensure Terragrunt is installed. 5. Calls WithTerraformInstalled with the determined Terraform version to ensure Terraform is installed. 6. Calls WithOpenTofuInstalled with the determined OpenTofu version to ensure OpenTofu is installed. The function returns the modified Terragrunt instance with the specified tools installed.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
tgVersionString !-No description provided
tfVersionString !-No description provided
openTofuVersionString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-iactools-installed --tg-version string --tf-version string --open-tofu-version string
func (m *myModule) example(tgVersion string, tfVersion string, openTofuVersion string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithIactoolsInstalled(tgVersion, tfVersion, openTofuVersion)
}
@function
def example(tg_version: str, tf_version: str, open_tofu_version: str) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_iactools_installed(tg_version, tf_version, open_tofu_version)
	)
@func()
example(tgVersion: string, tfVersion: string, openTofuVersion: string): Terragrunt {
	return dag
		.terragrunt()
		.withIactoolsInstalled(tgVersion, tfVersion, openTofuVersion)
}

withSshauthForTerraformModules() 🔗

WithSSHAuthForTerraformModules configures SSH authentication for Terraform modules with Git SSH sources.

This function mounts an SSH authentication socket into the container, enabling Terraform to authenticate when fetching modules from Git repositories using SSH URLs (e.g., git@github.com:org/repo.git).

Parameters: - sshAuthSocket: The SSH authentication socket to mount in the container. - socketPath: The path where the SSH socket will be mounted in the container. - owner: Optional. The owner of the mounted socket in the container.

Returns: - *Terragrunt: The updated Terragrunt instance with SSH authentication configured for Terraform modules.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
sshAuthSocketSocket !-sshAuthSocket is the SSH socket to use for authentication.
socketPathString !-socketPath is the path where the SSH socket will be mounted in the container.
ownerString -owner is the owner of the mounted socket in the container. Optional parameter.
Example
echo 'Custom types are not supported in shell examples'
func (m *myModule) example(sshAuthSocket *Socket, socketPath string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithSshauthForTerraformModules(sshAuthSocket, socketPath)
}
@function
def example(ssh_auth_socket: dag.Socket, socket_path: str) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_sshauth_for_terraform_modules(ssh_auth_socket, socket_path)
	)
@func()
example(sshAuthSocket: Socket, socketPath: string): Terragrunt {
	return dag
		.terragrunt()
		.withSshauthForTerraformModules(sshAuthSocket, socketPath)
}

withTerragruntProviderCacheServerDisabled() 🔗

WithTerragruntProviderCacheServerDisabled disables the Terragrunt provider cache server. It sets the environment variable TERRAGRUNT_PROVIDER_CACHE to “0”. WithTerragruntProviderCacheServerDisabled disables the Terragrunt provider cache server.

By default, it’s enabled, but in some cases, you may want to disable it.

Returns: - *Terragrunt: The updated Terragrunt instance with the provider cache server disabled.

Return Type
Terragrunt !
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terragrunt-provider-cache-server-disabled
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerragruntProviderCacheServerDisabled()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terragrunt_provider_cache_server_disabled()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
		.withTerragruntProviderCacheServerDisabled()
}

withRegistriesToCacheProvidersFrom() 🔗

WithRegistriesToCacheProvidersFrom adds extra registries to cache providers from.

This function appends the provided registries to the default list of registries in the Terragrunt configuration. By default, the Terragrunt provider’s cache only caches registry.terraform.io and registry.opentofu.org.

Parameters: - registries: A slice of strings representing the registries to cache providers from.

Returns: - *Terragrunt: The updated Terragrunt instance with the extra registries to cache providers from.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
registries[String ! ] !-registries is a slice of strings representing the registries to cache providers from.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-registries-to-cache-providers-from --registries string1 --registries string2
func (m *myModule) example(registries []string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithRegistriesToCacheProvidersFrom(registries)
}
@function
def example(registries: List[str]) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_registries_to_cache_providers_from(registries)
	)
@func()
example(registries: string[]): Terragrunt {
	return dag
		.terragrunt()
		.withRegistriesToCacheProvidersFrom(registries)
}

exec() 🔗

Exec executes a given command within a dagger container. It returns the output of the command or an error if the command is invalid or fails to execute.

Return Type
Container !
Arguments
NameTypeDefault ValueDescription
commandString !-command is the terragrunt command to execute. It's the actual command that comes after 'terragrunt'
args[String ! ] -args are the arguments to pass to the command.
autoApproveBoolean -autoApprove is the flag to auto approve the command.
sourceDirectory -source is the source directory that includes the source code.
moduleString -module is the module to execute or the terragrunt configuration where the terragrunt.hcl file is located.
envVars[String ! ] -envVars is the environment variables to pass to the container.
secrets[Secret ! ] -secrets is the secrets to pass to the container.
toolString -tool is the tool to use for executing the command.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 exec --command string
func (m *myModule) example(command string) *Container  {
	return dag.
			Terragrunt().
			Exec(command)
}
@function
def example(command: str) -> dagger.Container:
	return (
		dag.terragrunt()
		.exec(command)
	)
@func()
example(command: string): Container {
	return dag
		.terragrunt()
		.exec(command)
}

execCmd() 🔗

ExecCmd executes a given command within a dagger container. It returns the output of the command or an error if the command is invalid or fails to execute.

Return Type
String !
Arguments
NameTypeDefault ValueDescription
commandString !-command is the terragrunt command to execute. It's the actual command that comes after 'terragrunt'
args[String ! ] -args are the arguments to pass to the command.
autoApproveBoolean -autoApprove is the flag to auto approve the command.
sourceDirectory -source is the source directory that includes the source code.
moduleString -module is the module to execute or the terragrunt configuration where the terragrunt.hcl file is located.
envVars[String ! ] -envVars is the environment variables to pass to the container.
secrets[Secret ! ] -secrets is the secrets to pass to the container.
toolString -tool is the tool to use for executing the command.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 exec-cmd --command string
func (m *myModule) example(ctx context.Context, command string) string  {
	return dag.
			Terragrunt().
			ExecCmd(ctx, command)
}
@function
async def example(command: str) -> str:
	return await (
		dag.terragrunt()
		.exec_cmd(command)
	)
@func()
async example(command: string): Promise<string> {
	return dag
		.terragrunt()
		.execCmd(command)
}

getTerragruntCacheDir() 🔗

GetTerragruntCacheDir returns the terragrunt cache directory. It returns a pointer to the directory containing the terragrunt cache.

Return Type
Directory !
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 get-terragrunt-cache-dir
func (m *myModule) example() *Directory  {
	return dag.
			Terragrunt().
			GetTerragruntCacheDir()
}
@function
def example() -> dagger.Directory:
	return (
		dag.terragrunt()
		.get_terragrunt_cache_dir()
	)
@func()
example(): Directory {
	return dag
		.terragrunt()
		.getTerragruntCacheDir()
}

getTerraformCacheDir() 🔗

GetTerraformCacheDir returns the terraform cache directory. It returns a pointer to the directory containing the terraform cache.

Return Type
Directory !
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 get-terraform-cache-dir
func (m *myModule) example() *Directory  {
	return dag.
			Terragrunt().
			GetTerraformCacheDir()
}
@function
def example() -> dagger.Directory:
	return (
		dag.terragrunt()
		.get_terraform_cache_dir()
	)
@func()
example(): Directory {
	return dag
		.terragrunt()
		.getTerraformCacheDir()
}

withTerraformLogOptions() 🔗

WithTerraformLogOptions sets the Terraform log options in the Terragrunt container.

This function allows you to configure the logging behavior of Terraform when executing commands through Terragrunt. The parameters specify the log modes and the log file path.

Parameters: - tfLog: The Terraform log mode to use when executing the Terragrunt command. // +optional - tfLogCore: The Terraform log core mode to use when executing the Terragrunt command. // +optional - tfLogProvider: The Terraform log provider mode to use when executing the Terragrunt command. // +optional - tfLogPath: The path to the Terraform log file to use when executing the Terragrunt command. // +optional

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
tfLogString -tfLog is the terraform log mode to use when executing the terragrunt command.
tfLogCoreString -tfLogCore is the terraform log core mode to use when executing the terragrunt command.
tfLogProviderString -tfLogProvider is the terraform log provider mode to use when executing the terragrunt command.
tfLogPathString -tfLogPath is the path to the terraform log file to use when executing the terragrunt command.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terraform-log-options
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerraformLogOptions()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terraform_log_options()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
		.withTerraformLogOptions()
}

withTerragruntLogOptions() 🔗

WithTerragruntLogOptions sets the terragrunt log options in the container.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
tgLogLevelString -tgLogLevel is the terragrunt log level to use when executing the terragrunt command.
tgLogDisableColorBoolean -tgLogDisableColor is the flag to disable color in terragrunt logs.
tgLogShowAbsPathsBoolean -tgLogShowAbsPaths is the flag to show absolute paths in terragrunt logs.
tgLogDisableFormattingBoolean -tgLogDisableFormatting is the flag to disable formatting in terragrunt logs.
tgForwardTfStdoutBoolean -tgForwardTfStdout is the flag to forward terraform stdout to terragrunt stdout.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terragrunt-log-options
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerragruntLogOptions()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terragrunt_log_options()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
		.withTerragruntLogOptions()
}

withTerragruntOptions() 🔗

WithTerragruntOptions sets various Terragrunt options in the container. This function allows you to configure the Terragrunt environment by setting multiple parameters such as the configuration file path, Terraform binary path, working directory, log level, IAM role details, download directory, source URL, source map, and a flag to update the source before running Terragrunt. Each parameter corresponds to a specific Terragrunt environment variable.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
configPathString -configPath is the path to the terragrunt configuration file. corresponds to the TERRAGRUNT_CONFIG environment variable.
terraformPathString -terraformPath is the path to the terraform binary. corresponds to the TERRAGRUNT_TFPATH environment variable.
workingDirString -workingDir is the working directory for terragrunt. corresponds to the TERRAGRUNT_WORKING_DIR environment variable.
logLevelString -logLevel is the log level for terragrunt. corresponds to the TERRAGRUNT_LOG_LEVEL environment variable.
iamRoleString -iamRole is the iam role to assume before running terragrunt. corresponds to the TERRAGRUNT_IAM_ROLE environment variable.
iamRoleSessionNameString -iamRoleSessionName is the iam role session name to use when assuming the iam role. corresponds to the TERRAGRUNT_IAM_ROLE_SESSION_NAME environment variable.
iamRoleDurationInteger -iamRoleDuration is the iam role duration to use when assuming the iam role. corresponds to the TERRAGRUNT_IAM_ROLE_DURATION environment variable.
iamRoleExternalIdString -iamRoleExternalID is the iam role external id to use when assuming the iam role. corresponds to the TERRAGRUNT_IAM_ROLE_EXTERNAL_ID environment variable.
iamRolePolicyString -iamRolePolicy is the iam role policy to use when assuming the iam role. corresponds to the TERRAGRUNT_IAM_ROLE_POLICY environment variable.
iamRolePolicyArnsString -iamRolePolicyArns is the iam role policy arns to use when assuming the iam role. corresponds to the TERRAGRUNT_IAM_ROLE_POLICY_ARNS environment variable.
iamRoleTagsString -iamRoleTags is the iam role tags to use when assuming the iam role. corresponds to the TERRAGRUNT_IAM_ROLE_TAGS environment variable.
iamRoleTransitiveTagKeysString -iamRoleTransitiveTagKeys is the iam role transitive tag keys to use when assuming the iam role. corresponds to the TERRAGRUNT_IAM_ROLE_TRANSITIVE_TAG_KEYS environment variable.
iamRoleSourceIdentityString -iamRoleSourceIdentity is the iam role source identity to use when assuming the iam role. corresponds to the TERRAGRUNT_IAM_ROLE_SOURCE_IDENTITY environment variable.
downloadDirString -downloadDir is the directory to download terragrunt dependencies. corresponds to the TERRAGRUNT_DOWNLOAD_DIR environment variable.
sourceString -source is the source url for terragrunt. corresponds to the TERRAGRUNT_SOURCE environment variable.
sourceMapString -sourceMap is the source map for terragrunt. corresponds to the TERRAGRUNT_SOURCE_MAP environment variable.
sourceUpdateBoolean -sourceUpdate is the flag to update the source before running terragrunt. corresponds to the TERRAGRUNT_SOURCE_UPDATE environment variable.
ignoreDependencyErrorsBoolean -ignoreDependencyErrors is the flag to ignore dependency errors. corresponds to the TERRAGRUNT_IGNORE_DEPENDENCY_ERRORS environment variable.
ignoreExternalDependenciesBoolean -ignoreExternalDependencies is the flag to ignore external dependencies. corresponds to the TERRAGRUNT_IGNORE_EXTERNAL_DEPENDENCIES environment variable.
includeExternalDependenciesBoolean -includeExternalDependencies is the flag to include external dependencies. corresponds to the TERRAGRUNT_INCLUDE_EXTERNAL_DEPENDENCIES environment variable.
parallelismInteger -parallelism is the parallelism level for terragrunt. corresponds to the TERRAGRUNT_PARALLELISM environment variable.
debugBoolean -debug is the flag to enable debug mode. corresponds to the TERRAGRUNT_DEBUG environment variable.
noColorBoolean -noColor is the flag to disable color in logs. corresponds to the TERRAGRUNT_NO_COLOR environment variable.
checkBoolean -check is the flag to check the configuration. corresponds to the TERRAGRUNT_CHECK environment variable.
diffBoolean -diff is the flag to enable diff mode. corresponds to the TERRAGRUNT_DIFF environment variable.
hclfmtFileString -hclfmtFile is the file for hcl formatting. corresponds to the TERRAGRUNT_HCLFMT_FILE environment variable.
hclValidateJsonBoolean -hclValidateJSON is the flag to validate hcl in json format. corresponds to the TERRAGRUNT_HCLVALIDATE_JSON environment variable.
hclValidateShowConfigPathBoolean -hclValidateShowConfigPath is the flag to show the config path in hcl validation. corresponds to the TERRAGRUNT_HCLVALIDATE_SHOW_CONFIG_PATH environment variable.
overrideAttrString -overrideAttr is the attribute to override. corresponds to the TERRAGRUNT_OVERRIDE_ATTR environment variable.
jsonOutDirString -jsonOutDir is the directory for json output. corresponds to the TERRAGRUNT_JSON_OUT_DIR environment variable.
disableLogFormattingBoolean -disableLogFormatting is the flag to disable log formatting. corresponds to the TERRAGRUNT_DISABLE_LOG_FORMATTING environment variable.
forwardTfStdoutBoolean -forwardTfStdout is the flag to forward terraform stdout. corresponds to the TERRAGRUNT_FORWARD_TF_STDOUT environment variable.
noAutoInitBoolean -noAutoInit is the flag to disable auto init. corresponds to the TERRAGRUNT_NO_AUTO_INIT environment variable.
noAutoRetryBoolean -noAutoRetry is the flag to disable auto retry. corresponds to the TERRAGRUNT_NO_AUTO_RETRY environment variable.
nonInteractiveBoolean -nonInteractive is the flag to disable interactive mode. corresponds to the TERRAGRUNT_NON_INTERACTIVE environment variable.
excludeDirString -excludeDir is the flag to exclude directories. corresponds to the TERRAGRUNT_EXCLUDE_DIR environment variable.
includeDirString -includeDir is the flag to include directories. corresponds to the TERRAGRUNT_INCLUDE_DIR environment variable.
strictIncludeBoolean -strictInclude is the flag to enable strict include. corresponds to the TERRAGRUNT_STRICT_INCLUDE environment variable.
strictValidateBoolean -strictValidate is the flag to enable strict validate. corresponds to the TERRAGRUNT_STRICT_VALIDATE environment variable.
ignoreDependencyOrderBoolean -ignoreDependencyOrder is the flag to ignore dependency order. corresponds to the TERRAGRUNT_IGNORE_DEPENDENCY_ORDER environment variable.
usePartialParseConfigCacheBoolean -usePartialParseConfigCache is the flag to use partial parse config cache. corresponds to the TERRAGRUNT_USE_PARTIAL_PARSE_CONFIG_CACHE environment variable.
failOnStateBucketCreationBoolean -failOnStateBucketCreation is the flag to fail on state bucket creation. corresponds to the TERRAGRUNT_FAIL_ON_STATE_BUCKET_CREATION environment variable.
disableBucketUpdateBoolean -disableBucketUpdate is the flag to disable bucket update. corresponds to the TERRAGRUNT_DISABLE_BUCKET_UPDATE environment variable.
disableCommandValidationBoolean -disableCommandValidation is the flag to disable command validation. corresponds to the TERRAGRUNT_DISABLE_COMMAND_VALIDATION environment variable.
iamAssumeRoleDurationInteger -iamAssumeRoleDuration is the duration for IAM role assumption. corresponds to the TERRAGRUNT_IAM_ASSUME_ROLE_DURATION environment variable.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terragrunt-options
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerragruntOptions()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terragrunt_options()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
		.withTerragruntOptions()
}

withTerraformToken() 🔗

WithTerraformToken sets the terraform token in the container.

This method takes a terraform token as input, validates it, and sets it as an environment variable in the container. The terraform token is used when executing the terragrunt command.

Parameters: - tfToken: A string representing the terraform token to use.

Returns: - *Terragrunt: A pointer to the updated Terragrunt instance. - error: An error if the terraform token validation fails.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
tfTokenSecret !-tfToken is the value of the terraform token to use when executing the terragrunt command.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terraform-token --tf-token env:MYSECRET
func (m *myModule) example(tfToken *Secret) *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerraformToken(tfToken)
}
@function
def example(tf_token: dagger.Secret) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terraform_token(tf_token)
	)
@func()
example(tfToken: Secret): Terragrunt {
	return dag
		.terragrunt()
		.withTerraformToken(tfToken)
}

withTerraformCommand() 🔗

WithTerraformCommand executes a terraform command in the container.

This method takes a terraform command and its arguments as input, validates them, and executes the command in the container. The command is executed with the Terraform binary.

Parameters: - command: A string representing the terraform command to execute.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
commandString !-command is the terraform command to execute.
args[String ! ] -args are the arguments to pass to the terraform command.
autoApproveBoolean -autoApprove is the flag to approve the terraform command.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terraform-command --command string
func (m *myModule) example(command string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerraformCommand(command)
}
@function
def example(command: str) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terraform_command(command)
	)
@func()
example(command: string): Terragrunt {
	return dag
		.terragrunt()
		.withTerraformCommand(command)
}

withTerragruntCommand() 🔗

WithTerragruntCommand executes a terragrunt command in the container.

This method takes a terragrunt command and its arguments as input, validates them, and executes the command in the container. The command is executed with the Terragrunt binary.

Parameters: - command: A string representing the terragrunt command to execute.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
commandString !-command is the terragrunt command to execute.
args[String ! ] -args are the arguments to pass to the terragrunt command.
autoApproveBoolean -autoApprove is the flag to approve the terragrunt command.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-terragrunt-command --command string
func (m *myModule) example(command string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithTerragruntCommand(command)
}
@function
def example(command: str) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_terragrunt_command(command)
	)
@func()
example(command: string): Terragrunt {
	return dag
		.terragrunt()
		.withTerragruntCommand(command)
}

withEnvironmentVariable() 🔗

WithEnvironmentVariable sets an environment variable in the container.

Parameters: - name: The name of the environment variable (e.g., “HOST”). - value: The value of the environment variable (e.g., “localhost”). - expand: Whether to replace ${VAR} or \(VAR in the value according to the current environment variables defined in the container (e.g., "/opt/bin:\)PATH”). Optional parameter.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
nameString !-name is the name of the environment variable.
valueString !-value is the value of the environment variable.
expandBoolean -expand is whether to replace `${VAR}` or $VAR in the value according to the current
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-environment-variable --name string --value string
func (m *myModule) example(name string, value string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithEnvironmentVariable(name, value)
}
@function
def example(name: str, value: str) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_environment_variable(name, value)
	)
@func()
example(name: string, value: string): Terragrunt {
	return dag
		.terragrunt()
		.withEnvironmentVariable(name, value)
}

withSource() 🔗

WithSource sets the source directory for the container.

Parameters: - src: The directory that contains all the source code, including the module directory. - workdir: The working directory within the container. Optional parameter.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
srcDirectory !-src is the directory that contains all the source code, including the module directory.
workdirString -workdir is the working directory within the container. If not set it'll default to /mnt
ownerString -owner is the owner of the directory. If not set it'll default to terragrunt
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-source --src DIR_PATH
func (m *myModule) example(src *Directory) *Terragrunt  {
	return dag.
			Terragrunt().
			WithSource(src)
}
@function
def example(src: dagger.Directory) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_source(src)
	)
@func()
example(src: Directory): Terragrunt {
	return dag
		.terragrunt()
		.withSource(src)
}

withUserAsOwnerOfDirs() 🔗

WithUserAsOwnerOfDirs sets the specified user (and optionally group) as the owner of the given directories within the container.

This method iterates over the provided list of directories and executes the “chown” command within the container to change the ownership of each directory to the specified user (and optionally group).

Parameters: - user: The user to set as the owner of the directories. This should be a valid user within the container. - group: The group to set as the owner of the directories. This is an optional parameter. - dirs: A slice of strings representing the directories to set the owner of. Each directory path should be specified relative to the container’s filesystem.

Returns: - *Terragrunt: The updated Terragrunt instance with the ownership of the specified directories changed.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
userString !-user is the user to set as the owner of the directories.
groupString -group is the group to set as the owner of the directories.
dirs[String ! ] !-dirs is the directories to set the owner of.
configureAsRootBoolean -configureAsRoot is whether to configure the directories as root, and then it'll use the given user.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-user-as-owner-of-dirs --user string --dirs string1 --dirs string2
func (m *myModule) example(user string, dirs []string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithUserAsOwnerOfDirs(user, dirs)
}
@function
def example(user: str, dirs: List[str]) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_user_as_owner_of_dirs(user, dirs)
	)
@func()
example(user: string, dirs: string[]): Terragrunt {
	return dag
		.terragrunt()
		.withUserAsOwnerOfDirs(user, dirs)
}

withUserWithPermissionsOnDirs() 🔗

WithUserWithPermissionsOnDirs sets the specified permissions on the given directories within the container.

This method iterates over the provided list of directories and executes the “chmod” command within the container to change the permissions of each directory to the specified mode.

Parameters: - user: The user to set as the owner of the directories. This should be a valid user within the container. - mode: The permissions to set on the directories. This should be a valid mode string (e.g., “0777”). - dirs: A slice of strings representing the directories to set the permissions of. Each directory path should be specified relative to the container’s filesystem. - configureAsRoot: Whether to configure the directories as root, and then it’ll use the given mode.

Returns: - *Terragrunt: The updated Terragrunt instance with the permissions of the specified directories changed.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
userString -user is the user to set as the owner of the directories.
modeString !-mode is the permissions to set on the directories.
dirs[String ! ] !-dirs is the directories to set the permissions of.
configureAsRootBoolean -configureAsRoot is whether to configure the directories as root, and then it'll use the given mode.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-user-with-permissions-on-dirs --mode string --dirs string1 --dirs string2
func (m *myModule) example(mode string, dirs []string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithUserWithPermissionsOnDirs(mode, dirs)
}
@function
def example(mode: str, dirs: List[str]) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_user_with_permissions_on_dirs(mode, dirs)
	)
@func()
example(mode: string, dirs: string[]): Terragrunt {
	return dag
		.terragrunt()
		.withUserWithPermissionsOnDirs(mode, dirs)
}

withContainer() 🔗

WithContainer sets the container to be used.

Parameters: - ctr: The container to run the command in. If passed, it will override the container set in the Dagger instance.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
ctrContainer !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-container --ctr IMAGE:TAG
func (m *myModule) example(ctr *Container) *Terragrunt  {
	return dag.
			Terragrunt().
			WithContainer(ctr)
}
@function
def example(ctr: dagger.Container) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_container(ctr)
	)
@func()
example(ctr: Container): Terragrunt {
	return dag
		.terragrunt()
		.withContainer(ctr)
}

withFileMountedInContainer() 🔗

WithFileMountedInContainer adds a file to the container.

Parameters: - file: The file to add to the container. - dest: The destination path in the container. Optional parameter. - owner: The owner of the file. Optional parameter.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
fileFile !-No description provided
destString !-No description provided
ownerString !-No description provided
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-file-mounted-in-container --file file:path --dest string --owner string
func (m *myModule) example(file *File, dest string, owner string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithFileMountedInContainer(file, dest, owner)
}
@function
def example(file: dagger.File, dest: str, owner: str) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_file_mounted_in_container(file, dest, owner)
	)
@func()
example(file: File, dest: string, owner: string): Terragrunt {
	return dag
		.terragrunt()
		.withFileMountedInContainer(file, dest, owner)
}

withDownloadedFile() 🔗

WithDownloadedFile downloads a file from the specified URL and mounts it in the container.

Parameters: - url: The URL of the file to download. - destDir: The directory within the container where the file will be downloaded. Optional parameter. If not provided, it defaults to the predefined mount prefix.

Returns: - *Terragrunt: The updated Terragrunt with the downloaded file mounted in the container.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
urlString !-url is the URL of the file to download.
destFileNameString -destFileName is the name of the file to download. If not set, it'll default to the basename of the URL.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-downloaded-file --url string
func (m *myModule) example(url string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithDownloadedFile(url)
}
@function
def example(url: str) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_downloaded_file(url)
	)
@func()
example(url: string): Terragrunt {
	return dag
		.terragrunt()
		.withDownloadedFile(url)
}

withCacheBuster() 🔗

WithCacheBuster sets a cache-busting environment variable in the container.

This method sets an environment variable “CACHE_BUSTER” with a timestamp value in RFC3339Nano format. This can be useful for invalidating caches by providing a unique value.

Returns: - *Terragrunt: The updated Terragrunt with the cache-busting environment variable set.

Return Type
Terragrunt !
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-cache-buster
func (m *myModule) example() *Terragrunt  {
	return dag.
			Terragrunt().
			WithCacheBuster()
}
@function
def example() -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_cache_buster()
	)
@func()
example(): Terragrunt {
	return dag
		.terragrunt()
		.withCacheBuster()
}

withCachedDirectory() 🔗

WithCachedDirectory mounts a cache volume in the container.

Parameters: - path: The path in the container where the cache volume will be mounted. - cacheVolume: The cache volume to mount.

Return Type
Terragrunt !
Arguments
NameTypeDefault ValueDescription
pathString !-path is the path in the container where the cache volume will be mounted.
enablePrefixWithMountPathBoolean -enablePrefixWithMountPath is whether to enable the prefix with the mount path.
setEnvVarWithCacheDirValueString -setEnvVarWithCacheDirValue is the value to set the cache directory in the container.
cacheSharingModeEnum -cacheSharingMode is the sharing mode of the cache volume.
cacheVolumeRootDirDirectory -cacheVolumeRootDir is the root directory of the cache volume.
cacheVolumeOwnerString -cacheVolumeOwner is the owner of the cache volume.
Example
dagger -m github.com/Excoriate/daggerverse/terragrunt@ff2e4f0fbe48f2790685e7feaa01b19caab9b48b call \
 with-cached-directory --path string
func (m *myModule) example(path string) *Terragrunt  {
	return dag.
			Terragrunt().
			WithCachedDirectory(path)
}
@function
def example(path: str) -> dag.Terragrunt:
	return (
		dag.terragrunt()
		.with_cached_directory(path)
	)
@func()
example(path: string): Terragrunt {
	return dag
		.terragrunt()
		.withCachedDirectory(path)
}