validation

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: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasTFVarFiles added in v0.0.8

func HasTFVarFiles(path string) (bool, error)

HasTFVarFiles checks if the given directory has Terraform variable files with the .tfvars extension. If the directory does not have any Terraform variable files, it returns an error.

Parameters:

  • path: The path to the directory to check.

Returns:

  • bool: True if the directory has Terraform variable files, false otherwise.
  • error: An error if the directory does not have any Terraform variable files or if there is any other issue.

Example:

hasTFVars, err := HasTFVarFiles("/path/to/dir")
if err != nil {
    log.Fatalf("Error: %v", err)
}
if hasTFVars {
    fmt.Println("The directory has Terraform variable files.")
} else {
    fmt.Println("The directory does not have Terraform variable files.")

func HasTerraformFiles

func HasTerraformFiles(path string, extensions []string) error

HasTerraformFiles checks if the given directory has Terraform files with the given extensions. If the directory does not have any Terraform files with the given extensions, it returns an error.

Parameters:

  • path: The path to the directory to check.
  • extensions: A list of file extensions to look for.

Returns:

  • error: An error if the directory does not have any Terraform files with the given extensions.

Example:

err := HasTerraformFiles("/path/to/dir", []string{".tf"})
if err != nil {
    log.Fatalf("Error: %v", err)
} else {
    fmt.Println("The directory has Terraform files.")

func IsAHCLFile added in v0.0.17

func IsAHCLFile(path string) error

IsAHCLFile checks if the given path is a valid .hcl file. A valid .hcl file is a file with the .hcl extension that is not empty.

Parameters:

  • path: The path to the file to check.

Returns:

  • error: An error if the path is not a valid .hcl file.

Example:

err := IsAHCLFile("/path/to/config.hcl")
if err != nil {
    log.Fatalf("Error: %v", err)
} else {
    fmt.Println("The path is a valid .hcl file.")

func IsATerragruntModule added in v0.0.17

func IsATerragruntModule(path string) error

IsATerragruntModule checks if the given path is a valid Terragrunt module. A valid Terragrunt module is a directory that contains a terragrunt.hcl file.

Parameters:

  • path: The path to the directory to check.

Returns:

  • error: An error if the path is not a valid Terragrunt module.

Example:

err := IsATerragruntModule("/path/to/module")
if err != nil {
    log.Fatalf("Error: %v", err)
} else {
    fmt.Println("The path is a valid Terragrunt module.")

func IsValidTFDir

func IsValidTFDir(path string) error

IsValidTFDir checks if the given path is a valid Terraform directory. A valid Terraform directory is a directory that exists and is not empty.

Parameters:

  • path: The path to the directory to check.

Returns:

  • error: An error if the path is not a valid Terraform directory.

Example:

err := IsValidTFDir("/path/to/dir")
if err != nil {
    log.Fatalf("Error: %v", err)
} else {
    fmt.Println("The path is a valid Terraform directory.")

func IsValidTFModuleDir added in v0.0.7

func IsValidTFModuleDir(path string) error

IsValidTFModuleDir checks if the given path is a valid Terraform module directory. A valid Terraform module directory is a directory that contains at least one Terraform file with the .tf extension. The path must also be a valid directory.

Parameters:

  • path: The path to the directory to check.

Returns:

  • error: An error if the path is not a valid Terraform module directory.

Example:

err := IsValidTFModuleDir("/path/to/module")
if err != nil {
    log.Fatalf("Error: %v", err)
} else {
    fmt.Println("The path is a valid Terraform module directory.")

func IsValidTFVarFile

func IsValidTFVarFile(path string) error

IsValidTFVarFile checks if the given path is a valid Terraform variable file. A valid Terraform variable file is a file with the .tfvars extension that is not empty.

Parameters:

  • path: The path to the file to check.

Returns:

  • error: An error if the path is not a valid Terraform variable file.

Example:

err := IsValidTFVarFile("/path/to/variables.tfvars")
if err != nil {
    log.Fatalf("Error: %v", err)
} else {
    fmt.Println("The path is a valid Terraform variable file.")

Types

This section is empty.

Jump to

Keyboard shortcuts

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