„This is my spot!“
TFLint ruleset plugin that will check your terraform formatting from sorting and spacing perspective.
- TFLint v0.41+
- Go v1.19
You can install the plugin with tflint --init
. Declare a config in
.tflint.hcl
as follows:
plugin "sheldon" {
enabled = true
version = "0.0.5"
source = "github.com/0x416e746f6e/tflint-ruleset-sheldon"
signing_key = <<-KEY
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGNC+x0BEAC5QCwqP3tO+WfClDkQwK0dGbtxUthsL1/p97q1ckt1Ko3NJzn7
2356psXbzikFnZ/UgwGyr4IcJsyFTRV2cteXWZLS5zoJFu8Vo5Tl8CmkLVRiIfJo
AfdvlcMQecJOzkSo8JMBchL/k5JxHJ73AQX0oJQXeaEv0LVeuOfLN7rtkNmkcz6d
hlQgy2JHDkpwGO1f5CbAC5bu3ummPqcPUpBxACbGDAv8k4G8838lCZse6WLAlNEz
9gih3aNMrjrvNCm4ojP68J4dnfSK0S21UBW6zqHeBqNQOx+dwio7WyU8J681d0lW
SQT0QQJwW5MV9ksnzzFj/aPQz0Fcq87xZZ3sw/zykhGnZCbC8DBRLJ7Q+HdyXcDz
VQnPHddZtvJo0pRiKL27e8UCjx5B4Ho9McHTRuIxG+k4CStuIifOxh8q5CRuwVlg
0FbQFePKwvpnvaAtCmKe//tc/WLLRy+rpEzVqCMah5YrydAYalf0H5HNvADeKQQ4
WnRkJae9tAApcu098fiPThPGufLdYJq1CSC1JFB29g0MRKW5qwbb6z/MeejGgi9v
U9pQ544O7UNbwDNB4ExorqXgBV7ceEHQ3RSEtgYLT6nVDfPFLkkiUNPSR0Z8jbcE
SDpJXTQ6SXVsVSgh5DTHHagJZsBsflNleZ0yfcOtAzMkHoK2PqlU7lmd4QARAQAB
tClBbnRvbiBCcm9ubmlrb3YgPGFudG9uQG5vcnRoZXJuZm9yZXN0Lm5sPokCTgQT
AQgAOBYhBBgwXxgsmIosL/brx+TX84nWLliyBQJjQvsdAhsDBQsJCAcCBhUKCQgL
AgQWAgMBAh4BAheAAAoJEOTX84n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YDcnLkLOYftFGV9rHkCKqesenfkuPtR7DGT9w0k5dNrCN
SgvumlA=
=ys3x
-----END PGP PUBLIC KEY BLOCK-----
KEY
}
Clone the repository locally and run the following command:
make
You can easily install the built plugin with the following:
make install
You can run the built plugin like the following:
cat << EOF > .tflint.hcl
config {
plugin_dir = "~/.tflint.d/plugins"
}
plugin "sheldon" {
enabled = true
}
EOF
tflint
Some of the resources come with their key-attributes pre-defined. However,
their set is far from being exhaustive (and will never be). To define the
key-attributes for a resource/data blocks (so that key_attributes
rule picks them up) add them to in .tflint.hcl
like follows:
plugin "sheldon" {
enabled = true
resource "kubernetes_deployment" {
key_attributes = ["metadata.namespace", "metadata.name"]
}
}