All Projects → minamijoyo → Tfschema

minamijoyo / Tfschema

Licence: mit
A schema inspector for Terraform providers

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Tfschema

Awesome Terraform
Curated list of resources on HashiCorp's Terraform
Stars: ✭ 2,618 (+1196.04%)
Mutual labels:  terraform
Infra
Infrastructure to set up the public Compiler Explorer instances and compilers
Stars: ✭ 184 (-8.91%)
Mutual labels:  terraform
Go Lambda Ping
Deploy a Lambda to Ping a Site in 20 Seconds!
Stars: ✭ 195 (-3.47%)
Mutual labels:  terraform
Tf aws bastion s3 keys
A Terraform module for creating bastion host on AWS EC2 and populate its ~/.ssh/authorized_keys with public keys from bucket
Stars: ✭ 178 (-11.88%)
Mutual labels:  terraform
Terraform Provider Sentry
Terraform provider for Sentry
Stars: ✭ 183 (-9.41%)
Mutual labels:  terraform
Laravel Deployment
📗[WIP] 追求质量的 Laravel 应用部署上线课程。
Stars: ✭ 190 (-5.94%)
Mutual labels:  terraform
Homebrew Terraforms
Homebrew repository for a Terraform version switcher and all Terraform versions
Stars: ✭ 174 (-13.86%)
Mutual labels:  terraform
Serverless.tf
serverless.tf is an opinionated open-source framework for developing, building, deploying, and securing serverless applications and infrastructures on AWS using Terraform.
Stars: ✭ 198 (-1.98%)
Mutual labels:  terraform
Stubbornjava
Unconventional Java code for building web servers / services without a framework. Think dropwizard but as a seed project instead of a framework. If this project had a theme it would be break the rules but be mindful of your decisions.
Stars: ✭ 184 (-8.91%)
Mutual labels:  terraform
Tfmigrate
A Terraform state migration tool for GitOps
Stars: ✭ 192 (-4.95%)
Mutual labels:  terraform
Terraform Provider Azuread
Terraform provider for Azure Active Directory
Stars: ✭ 178 (-11.88%)
Mutual labels:  terraform
Fogg
Manage Infrastructure as Code with less pain.
Stars: ✭ 181 (-10.4%)
Mutual labels:  terraform
Tflint
A Pluggable Terraform Linter
Stars: ✭ 2,756 (+1264.36%)
Mutual labels:  terraform
Terraform Provider Kubectl
Terraform provider to handle raw kubernetes manifest yaml files
Stars: ✭ 174 (-13.86%)
Mutual labels:  terraform
Checkov
Prevent cloud misconfigurations during build-time for Terraform, Cloudformation, Kubernetes, Serverless framework and other infrastructure-as-code-languages with Checkov by Bridgecrew.
Stars: ✭ 3,572 (+1668.32%)
Mutual labels:  terraform
K8s Scw Baremetal
Kubernetes installer for Scaleway bare-metal AMD64 and ARMv7
Stars: ✭ 176 (-12.87%)
Mutual labels:  terraform
Terraform Visual
Terraform Visual is an interactive way of visualizing your Terraform plan
Stars: ✭ 190 (-5.94%)
Mutual labels:  terraform
Terraform Plugin Sdk
Terraform Plugin SDK enables building plugins (providers) to manage any service providers or custom in-house solutions
Stars: ✭ 201 (-0.5%)
Mutual labels:  terraform
Terraform Aws Jenkins
Terraform module to build Docker image with Jenkins, save it to an ECR repo, and deploy to Elastic Beanstalk running Docker stack
Stars: ✭ 197 (-2.48%)
Mutual labels:  terraform
Terraform Provider Hcloud
Terraform provider for Hetzner Cloud
Stars: ✭ 138 (-31.68%)
Mutual labels:  terraform

tfschema

License: MIT GitHub release GoDoc

A schema inspector for Terraform providers.

Features

  • Get resource type definitions dynamically from Terraform providers via go-plugin protocol.
  • List available resource types.
  • Autocomplete resource types in bash/zsh.
  • Open official provider documents quickly by your system web browser.
  • Terraform v0.14 support (minimum requirements: Terraform >= v0.11)

demo

Getting Started

$ brew install minamijoyo/tfschema/tfschema

$ echo 'provider "aws" {}' > main.tf
$ terraform init
$ tfschema resource list aws | grep aws_iam_user
aws_iam_user
aws_iam_user_group_membership
aws_iam_user_login_profile
aws_iam_user_policy
aws_iam_user_policy_attachment
aws_iam_user_ssh_key
$ tfschema resource show aws_iam_user
+----------------------+-------------+----------+----------+----------+-----------+
| ATTRIBUTE            | TYPE        | REQUIRED | OPTIONAL | COMPUTED | SENSITIVE |
+----------------------+-------------+----------+----------+----------+-----------+
| arn                  | string      | false    | false    | true     | false     |
| force_destroy        | bool        | false    | true     | false    | false     |
| id                   | string      | false    | true     | true     | false     |
| name                 | string      | true     | false    | false    | false     |
| path                 | string      | false    | true     | false    | false     |
| permissions_boundary | string      | false    | true     | false    | false     |
| tags                 | map(string) | false    | true     | false    | false     |
| unique_id            | string      | false    | false    | true     | false     |
+----------------------+-------------+----------+----------+----------+-----------+

Install

If you are Mac OSX user:

$ brew install minamijoyo/tfschema/tfschema

or

If you have Go 1.15+ development environment:

$ git clone https://github.com/minamijoyo/tfschema
$ cd tfschema
$ go install

or

Download the latest compiled binaries and put it anywhere in your executable path.

https://github.com/minamijoyo/tfschema/releases

Requirements for Terraform providers

  • terraform-provider-aws >= v1.11.0
  • terraform-provider-google >= v1.5.0
  • terraform-provider-azurerm >= v1.3.0

Other providers

Your provider may or may not support a required API. If your provider support Terraform >= v0.11, it should work. Strictly speaking, the tfschema depends on the Terraform's GetSchema API.

The tfschema requires the provider's dependency library version to:

  • hashicorp/terraform >= v0.10.8
  • zclconf/go-cty >= 14e23b14828dd12cc7ae0956813c7e91a196e68f (2018/01/06)

Rules of finding provider's binary

When terraform init command is executed, provider's binary is installed under the auto installed directory ( .terraform/providers/<SOURCE ADDRESS>/<VERSION>/<OS>_<ARCH> ) by default. The tfschema can use the same provider's binary as terraform uses, so you can run tfschema command in the same directory where you run the terraform command Alternatively, you can set the environment variable $TFSCHEMA_ROOT_DIR to be this directory. If $TFSCHEMA_ROOT_DIR is not set, it will default to the current directory

The tfschema finds provider's binary under the following directories.

  1. $TFSCHEMA_ROOT_DIR
  2. same directory as tfschema executable
  3. user vendor directory ( $TFSCHEMA_ROOT_DIR/terraform.d/plugins/<OS>_<ARCH> )
  4. auto installed directory for Terraform v0.14+ ( $TFSCHEMA_ROOT_DIR/.terraform/providers/<SOURCE ADDRESS>/<VERSION>/<OS>_<ARCH> )
  5. auto installed directory for Terraform v0.13 ( $TFSCHEMA_ROOT_DIR/.terraform/plugins/<SOURCE ADDRESS>/<VERSION>/<OS>_<ARCH> )
  6. legacy auto installed directory for Terraform < v0.13 ( $TFSCHEMA_ROOT_DIR/.terraform/plugins/<OS>_<ARCH> )
  7. global plugin directory ( $HOME/.terraform.d/plugins )
  8. global plugin directory with os and arch ( $HOME/.terraform.d/plugins/<OS>_<ARCH> )
  9. gopath ( $GOPATH/bin )

If you are Mac OSX user, <OS>_<ARCH> is darwin_amd64. The <SOURCE ADDRESS> is a fully qualified provider name in Terraform 0.13+. (e.g. registry.terraform.io/hashicorp/aws)

Note that it doesn't have exactly the same behavior of Terraform because of some reasons:

  • Support multiple Terraform versions
  • Can't import internal packages of Terraform and it's too complicated to support
  • For debug

Autocomplete

To enable autocomplete, execute the following command:

$ tfschema -install-autocomplete

The above command adds the following line to your ~/.bashrc and ~/.zshrc:

.bashrc

complete -C </path/to/tfschema> tfschema

.zshrc

autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C </path/to/tfschema> tfschema

Check your .bashrc and/or .zshrc and reload it.

Usage

$ tfschema --help
Usage: tfschema [--version] [--help] <command> [<args>]

Available commands are:
    data
    provider
    resource
$ tfschema resource --help
This command is accessed by using one of the subcommands below.

Subcommands:
    browse    Browse a documentation of resource
    list      List resource types
    show      Show a type definition of resource
$ tfschema resource show --help
Usage: tfschema resource show [options] RESOURCE_TYPE

Options:

  -format=type    Set output format to table or json (default: table)

Contributions

Any feedback and contributions are welcome. Feel free to open an issue and submit a pull request.

Acknowledgments

The tfschema is built on Terraform and its providers. I'm sincerely grateful to those authors.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].