https://github.com/managedkaos/tf-module-instance
A tool for creating an instance of a Terraform module from the variables.tf file.
https://github.com/managedkaos/tf-module-instance
Last synced: 9 months ago
JSON representation
A tool for creating an instance of a Terraform module from the variables.tf file.
- Host: GitHub
- URL: https://github.com/managedkaos/tf-module-instance
- Owner: managedkaos
- License: mit
- Created: 2025-03-30T21:43:27.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-31T22:25:58.000Z (about 1 year ago)
- Last Synced: 2025-09-11T08:45:55.093Z (10 months ago)
- Language: Python
- Size: 17.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TF Module Instance Generator
A tool for creating an instance of a Terraform module from the variables.tf file.
## Usage
```bash
docker run -v $(pwd):/data tf-module-instance:main /data/variables.tf MODULE_INSTANCE_NAME PATH_TO_MODULE_SOURCE
```
- `MODULE_INSTANCE_NAME` : The name of the module instance to be used in the output
- `PATH_TO_MODULE_SOURCE` : The path to the module source to be used in the output
## Example
**Input**: `variables.tf`
```js
variable "vpc_id" {
type = string
}
variable "public_subnet_tag" {
type = string
default = "Name"
}
variable "private_subnet_tag" {
type = string
default = "Name"
}
variable "public_subnet_regex" {
type = string
default = "Public"
}
variable "private_subnet_regex" {
type = string
default = "Private"
}
variable "tags" {
type = map(any)
default = {}
description = "A map of tags to assign"
}
variable "subnets_desired_count" {
type = number
default = 2
}
```
**Command**:
```bash
docker run -v $(pwd):/data ghcr.io/managedkaos/tf-module-instance:fe46190 /data/variables.tf vpc "./modules/vpc" | tee main.tf
```
**Output**: `main.tf`
```js
module "vpc" {
source = "./modules/vpc"
vpc_id = "" # Needs to be defined
public_subnet_tag = "Name"
private_subnet_tag = "Name"
public_subnet_regex = "Public"
private_subnet_regex = "Private"
tags = {}
subnets_desired_count = 2
}
```