TfUtility provides different tools for Terraform Developers
Project description
TfUtility
Documentation:
tfutility allows performing commands on terraform/tofu files. This commands can be different things. Currently, there are possibilities to check if a module block has remote sources. Or import or moved blocks have creation dates on them.
It also allows TF-Stack Developers to swap the sources of marked modules.
For all of these Functions, show the Samples Below or read the Documentation
Setup
Install via PIP
Install tfutility via pip
$ pip install tfutility
Run tfutility in command line
$ tfutility
for detailed Examples visit the Documentation
Use with Docker
docker run -it --rm -v $(pwd):/workspace ghcr.io/eieste/tfutility:1.0.9 forcedremotesource /workspace
Use with pre-commit
Quick-Reference
The following Options are currently available
@importdate
The importdate decorator should help you to keep your code clean. You should be able to delete imports after the stack has been successfully rolled out. this decorator is useful to avoid removing import blocks too early or forgetting them
Example:
# @importdate(create="01-12-1970", expire="05-01-1971)
import {
...
}
Execute the following command to check if the import was "expired"
tfutility importdate /workspace
you can also overwrite the expire date with your own duration like:
tfutility importdate --expire-after 60 /workspace
The --expire-after
value is in Days.
If --allow-failure is not set the Application wil exit with exitcode
1
and without --silent it logs all expired imports
@moveddate
This has the same Reason like @importdate
Decorator in Terraform
# @moveddate(create="01-12-1970", expire="05-01-1971)
moved {
...
}
Execute the following command to check if the moved was "expired"
tfutility moveddate /workspace
@sourceswap
This command allows to swap between remote and local sources.
# @sourceswap(remote_version="0.0.1", remote_source="example.com/examplemodule/local", source="../../examplemodule")
module {
source = "../../examplemodule"
}
To Swap all Sources in your workspace you can execute the following command
tfutility sourceswap --swap-to local /workspace
tfutility sourceswap --swap-to remote /workspace
@forcedremotesource
Decorator in Terraform
# @forceremotecheck
module {
source = "../
}
Execute the following command to check if all module blocks has an remote source.
tfutility forcedremotesource /workspace
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tfutility-1.1.0.tar.gz
.
File metadata
- Download URL: tfutility-1.1.0.tar.gz
- Upload date:
- Size: 49.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d748949dfaa95f11f3e86f41fdf9198c2c2b79a02ecb71311b6b5ff578ecab8 |
|
MD5 | bc42f608865caf93c400ff0983ab8390 |
|
BLAKE2b-256 | 45b9226c096fe8aca1ab0ee61f43741a6c2c74b80ae1a9308d657bfedd46bae9 |
Provenance
The following attestation bundles were made for tfutility-1.1.0.tar.gz
:
Publisher:
pypi.yml
on eieste/tfutility
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
tfutility-1.1.0.tar.gz
- Subject digest:
3d748949dfaa95f11f3e86f41fdf9198c2c2b79a02ecb71311b6b5ff578ecab8
- Sigstore transparency entry: 149169600
- Sigstore integration time:
- Predicate type:
File details
Details for the file tfutility-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: tfutility-1.1.0-py3-none-any.whl
- Upload date:
- Size: 37.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce6901f66ab3f1e4a226222e23fe2f2d41d27b5ac0439dade1da87d8529d5b87 |
|
MD5 | 84711b16b73d82d938163507708d8bb6 |
|
BLAKE2b-256 | 40c8181ba3cb1052f53d27556e014cc050a837cda5d419372d4090e51f358af6 |
Provenance
The following attestation bundles were made for tfutility-1.1.0-py3-none-any.whl
:
Publisher:
pypi.yml
on eieste/tfutility
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
tfutility-1.1.0-py3-none-any.whl
- Subject digest:
ce6901f66ab3f1e4a226222e23fe2f2d41d27b5ac0439dade1da87d8529d5b87
- Sigstore transparency entry: 149169601
- Sigstore integration time:
- Predicate type: