Documentation
¶
Index ¶
- func HasTFVarFiles(path string) (bool, error)
- func HasTerraformFiles(path string, extensions []string) error
- func IsAHCLFile(path string) error
- func IsATerragruntModule(path string) error
- func IsValidTFDir(path string) error
- func IsValidTFModuleDir(path string) error
- func IsValidTFVarFile(path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasTFVarFiles ¶ added in v0.0.8
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 ¶
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
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
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 ¶
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
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 ¶
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.