provdoc

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 16 Imported by: 0

README

provdoc

build

Terraform provider documentation in the terminal.

Installation

go install github.com/jar-b/provdoc@latest

Requirements

  • Terraform
  • An initialized Terraform project OR exported JSON schema file.

Usage

$ provdoc -h
Usage: provdoc [flags]

Flags:
  -schemafile string
        JSON file storing provider schema data
# Load live from the `terraform providers schema -json` command
provdoc

# Load from an exported JSON file
provdoc -schemafile schema.json

provdoc should be executed in a directory with an initialized Terraform project. On startup, the program executes terraform providers schema -json (or reads in exported data if the -schemafile argument is provided), gathering up the schema documentation for all providers currently configured in the project. If providers are added or removed, the schema data can be reloaded with Ctrl+R.

Once the schema is loaded two search modes are available.

  • Schema mode expects an exact resource or data source name as the search term, and will render the resulting schema documentation to the viewport. Example search terms are be random_string or aws_instance.

  • Resource mode accepts any search term, and will list all resources or data sources containing the term to the viewport. Example search terms are random_ (ie. list all resources in the random provider) or aws_ec2.

The active search mode is displayed in lower left corner, and can be toggled with Tab/Shift+Tab.

Motivation

Writing Terraform can require frequent context switching between the editor and Terraform Registry, especially when adopting a new, unfamiliar provider. provdoc utilizes the existing documentation available from provider schemas to supply searchable documentation directly in the terminal.

Prior art

This project relies heavily on the following:

Future enhancements

At this phase the project is mostly a proof of concept. Some initial ideas for future enhancements include:

  • Display loaded providers at startup
  • Fuzzy search for resource names
  • Live reloading
  • Paged results (resources and data sources of the same name)
  • Alternate full screen display
  • Example configuration generation

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL