ForHost (cliconfig/credentials.go)

terragrunt · internal/tf/cliconfig/credentials.go · go · MIT
infra

Resolves host credentials from environment variables or CLI config for Terraform/OpenTofu authentication.

// Source: https://github.com/gruntwork-io/terragrunt | License: MIT | Copyright 2016 Gruntwork, LLC
// Provided via justclaw.it.com; keep this notice with the code.
package cliconfig

import (
	"maps"
	"slices"
	"strings"

	svchost "github.com/hashicorp/terraform-svchost"
	svcauth "github.com/hashicorp/terraform-svchost/auth"
)

type CredentialsSource struct {
	// configured describes the credentials explicitly configured in the CLI config via "credentials" blocks.
	configured map[svchost.Hostname]string
	// env is the run's environment, held by reference so credentials an auth
	// provider contributes part-way through a run are still found here.
	env map[string]string
}

func (s *CredentialsSource) ForHost(host svchost.Hostname) svcauth.HostCredentials {
	// The first order of precedence

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key