https://github.com/tsubasaogawa/tfmodblock
tfmodblock generates Terraform module block from variable blocks.
https://github.com/tsubasaogawa/tfmodblock
terraform
Last synced: 2 months ago
JSON representation
tfmodblock generates Terraform module block from variable blocks.
- Host: GitHub
- URL: https://github.com/tsubasaogawa/tfmodblock
- Owner: tsubasaogawa
- License: mit
- Created: 2022-05-21T11:17:50.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-12T00:06:22.000Z (almost 2 years ago)
- Last Synced: 2025-03-02T22:02:18.967Z (3 months ago)
- Topics: terraform
- Language: Go
- Homepage:
- Size: 63.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tfmodblock
## Overview
tfmodblock generates Terraform module block HCL using variables from tf files.
## Features
- Auto generate module block
- Specify `source` by relative path
- Insert a value using `default` attribute
- Insert a description## Install & Update
### a. Use install script
```bash
curl -H 'Accept: application/vnd.github.VERSION.raw' 'https://api.github.com/repos/tsubasaogawa/tfmodblock/contents/install.sh?ref=main' | bash
```### b. Download an archive manually
Download an archive from [Releases](https://github.com/tsubasaogawa/tfmodblock/releases/latest) page.
Extract it and copy the binary to your PATH.## Example
```hcl
$ 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" }
}
``````hcl
$ tfmodblock --sort=false .
module "tfmodblock" {
source = "."
foo = ""
// this is bar
bar = 0
baz = {}
lorem = ["lorem1","lorem2"]
ipsum = {"a":"ipsum1"}
}
```## Help
[Run tfmodblock with `--help` option.](./command_help.md)
## Future works
- TBA
## Links
-