tfmodblock generates Terraform module block HCL using variables from tf files.
- Auto generate module block
- Specify
sourceby relative path - Insert a value using
defaultattribute - Insert a description
curl -H 'Accept: application/vnd.github.VERSION.raw' 'https://api.github.com/repos/tsubasaogawa/tfmodblock/contents/install.sh?ref=main' | bashDownload an archive from Releases page. Extract it and copy the binary to your PATH.
$ cat example.tf
variable "foo" {
type = string
}
variable "bar" {
type = number
description = "this is bar"
}
variable "baz" {
type = map(number)
}
variable "lorem" {
type = list(string)
default = ["lorem1", "lorem2"]
}
variable "ipsum" {
type = object({ a = string })
default = { a = "ipsum1" }
}$ tfmodblock --sort=false .
module "tfmodblock" {
source = "."
foo = ""
// this is bar
bar = 0
baz = {}
lorem = ["lorem1","lorem2"]
ipsum = {"a":"ipsum1"}
}Run tfmodblock with --help option.
- TBA