Skip to content

Commit

Permalink
Merge pull request #13 from scrhicks/feature/update-file-name
Browse files Browse the repository at this point in the history
Changed lock file name to .terraform.module.lock.hcl
  • Loading branch information
ned1313 authored Jun 12, 2024
2 parents 17d80d5 + 8daff4d commit b11fca3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ This is still in the very early stages of development and is likely full of bugs

## What is it?

TerraHash is a command-line tool which will evaluate your Terraform configuration after it has been initialized and generate hashes of the modules used by the configuration. The hash and version constraints will be stored in a file called `.terraform.module.hcl` similar to how the providers used are stored in `.terraform.lock.hcl`.
TerraHash is a command-line tool which will evaluate your Terraform configuration after it has been initialized and generate hashes of the modules used by the configuration. The hash and version constraints will be stored in a file called `.terraform.module.lock.hcl` similar to how the providers used are stored in `.terraform.lock.hcl`.

The hashes generated by `terrahash` will be compared against the contents of the `.terraform.module.hcl` file (if found) and will flag if any of the module hashes or versions have been changed. This can ensure that only approved and vetted modules are used during deployment.
The hashes generated by `terrahash` will be compared against the contents of the `.terraform.module.lock.hcl` file (if found) and will flag if any of the module hashes or versions have been changed. This can ensure that only approved and vetted modules are used during deployment.

If a user wishes to upgrade the versions of a module, they can do so with the command `upgrade`.

Expand All @@ -20,6 +20,6 @@ TerraHash is meant to be integrated into a CI process. It may be extended to pro

There are three essential commands for `terrahash`:

* `terrahash init` - evaluates the current configuration and generates a `.terraform.module.hcl` file. It will error out if the Terraform configuration has not yet been initialized or the `.terraform.module.hcl` file already exists.
* `terrahash check` - evaluates the current configuration against the `.terraform.module.hcl` file and reports on any changes for each module: mismatched hash, changed version, or not present. It will error out if the `.terraform.module.hcl` file is not found.
* `terrahash upgrade` - updates the `.terraform.module.hcl` file based on the contents of the configuration. This command will prompt you to accept the changes, or you can use the `-auto-approve` flag to skip.
* `terrahash init` - evaluates the current configuration and generates a `.terraform.module.lock.hcl` file. It will error out if the Terraform configuration has not yet been initialized or the `.terraform.module.lock.hcl` file already exists.
* `terrahash check` - evaluates the current configuration against the `.terraform.module.lock.hcl` file and reports on any changes for each module: mismatched hash, changed version, or not present. It will error out if the `.terraform.module.lock.hcl` file is not found.
* `terrahash upgrade` - updates the `.terraform.module.lock.hcl` file based on the contents of the configuration. This command will prompt you to accept the changes, or you can use the `-auto-approve` flag to skip.
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type modulesFile struct {
Modules []moduleEntry `json:"Modules"`
}

const modFileName = ".terraform.module.hcl"
const modFileName = ".terraform.module.lock.hcl"

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
Expand Down Expand Up @@ -186,4 +186,4 @@ func setPath(path string) (string, error) {
}
slog.Debug("no trailing slash found in " + setPath)
return (setPath + "/"), nil
}
}

0 comments on commit b11fca3

Please sign in to comment.