terraform-cmd-generator
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

terraform-cmd-generator

Generate commands based on Terraform Resources

oclif Version Downloads/week License Quality Gate Status Bugs Coverage

Usage

$ npm install -g terraform-cmd-generator
 
$ tfgenerate -f <yaml_file_with_resources>
running command...
$ tfgenerate --help
USAGE
Generate any commands, based on Terraform Resources
 
USAGE
  $ tfgenerate
 
OPTIONS
  -f, --resourcesFile=resourcesFile  (required) YAML File with all the Resources
  -h, --help                         show CLI help
  -v, --version                      show CLI version
...

Example

For example, let's say you need to generate terraform import commands, based on a list of resources. You can do something like this

existing-resources.yaml

command_line: "sh(script: \"terraform import ${TF_RESOURCE_TYPE}.${TF_RESOURCE_NAME} ${TF_RESOURCE_ID}\")"
resources:
    aws_sqs_queue:
          some_queue: "awsqueueid"
          some_other_queue: "someotherqueueid"
    aws_dynamodb_table:
          table1: "idoftable1"
          table2: "idoftable2"

When running

tfgenerate -f existing-resources.yaml

The output should be

sh(script: "terraform import aws_sqs_queue.some_queue awsqueueid")
sh(script: "terraform import aws_sqs_queue.some_other_queue someotherqueueid")
sh(script: "terraform import aws_dynamodb_table.table1 idoftable1")
sh(script: "terraform import aws_dynamodb_table.table2 idoftable2")

Readme

Keywords

Package Sidebar

Install

npm i terraform-cmd-generator

Weekly Downloads

2

Version

0.0.4

License

MIT

Unpacked Size

6.51 kB

Total Files

6

Last publish

Collaborators

  • jonathan.nagayoshi