Documentation ¶
Overview ¶
Package files allows to interact with files on a file system.
Index ¶
- func CopyFile(source string, destination string) error
- func CopyFolderContents(source string, destination string) error
- func CopyFolderContentsWithFilter(source string, destination string, filter func(path string) bool) error
- func CopyFolderToTemp(folderPath string, tempFolderPrefix string, filter func(path string) bool) (string, error)
- func CopyTerraformFolderToTemp(folderPath string, tempFolderPrefix string) (string, error)
- func CopyTerragruntFolderToTemp(folderPath string, tempFolderPrefix string) (string, error)
- func FileExists(path string) bool
- func PathContainsHiddenFileOrFolder(path string) bool
- func PathContainsTerraformState(path string) bool
- func PathContainsTerraformStateOrVars(path string) bool
- func WriteFileWithSamePermissions(source string, destination string, contents []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFolderContents ¶
CopyFolderContents copies all the files and folders within the given source folder to the destination folder.
func CopyFolderContentsWithFilter ¶
func CopyFolderContentsWithFilter(source string, destination string, filter func(path string) bool) error
CopyFolderContentsWithFilter copies the files and folders within the given source folder that pass the given filter (return true) to the destination folder.
func CopyFolderToTemp ¶
func CopyFolderToTemp(folderPath string, tempFolderPrefix string, filter func(path string) bool) (string, error)
CopyFolderToTemp creates a copy of the given folder and all its filtered contents in a temp folder with a unique name and the given prefix.
func CopyTerraformFolderToTemp ¶
CopyTerraformFolderToTemp creates a copy of the given folder and all its contents in a temp folder with a unique name and the given prefix. This is useful when running multiple tests in parallel against the same set of Terraform files to ensure the tests don't overwrite each other's .terraform working directory and terraform.tfstate files. This method returns the path to the temp folder with the copied contents. Hidden files and folders, Terraform state files, and terraform.tfvars files are not copied to this temp folder, as you typically don't want them interfering with your tests.
func CopyTerragruntFolderToTemp ¶
CopyTerragruntFolderToTemp creates a copy of the given folder and all its contents in a temp folder with a unique name and the given prefix. Since terragrunt uses tfvars files to specify modules, they are copied to the temporary directory as well. Terraform state files are excluded as well as .terragrunt-cache to avoid overwriting contents.
func FileExists ¶
FileExists returns true if the given file exists.
func PathContainsHiddenFileOrFolder ¶
PathContainsHiddenFileOrFolder returns true if the given path contains a hidden file or folder.
func PathContainsTerraformState ¶
PathContainsTerraformState returns true if the path corresponds to a Terraform state file.
func PathContainsTerraformStateOrVars ¶
PathContainsTerraformStateOrVars returns true if the path corresponds to a Terraform state file or .tfvars file.
Types ¶
This section is empty.