tfdir

package
v0.0.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRelativePathFromGitRepo

func GetRelativePathFromGitRepo(tfDir string, t *testing.T) (relativePath, repoRoot string, err error)

GetRelativePathFromGitRepo returns the relative path to the Git repository root for the specified Terraform directory. If the Terraform directory is an absolute path, it returns the relative path to the Git repository root. If the Terraform directory is a relative path, it returns the relative path to the Git repository root.

Parameters:

  • tfDir: The path to the Terraform directory. This parameter is required.
  • t: The testing instance.

Returns:

  • relativePath: The relative path to the Git repository root from the Terraform directory.
  • repoRoot: The root directory of the Git repository.
  • err: An error if the relative path to the Git repository root could not be determined.

Example:

relativePath, repoRoot, err := GetRelativePathFromGitRepo("/path/to/terraform/dir", t)
if err != nil {
    t.Fatalf("Error getting relative path from Git repo: %v", err)
}
fmt.Printf("Relative Path: %s, Repo Root: %s\n", relativePath, repoRoot)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL