inframap

command module
Version: v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: MIT Imports: 2 Imported by: 0

README

InfraMap

Read your tfstate or HCL to generate a graph specific for each provider, showing only the resources that are most important/relevant.

Cloud Providers

We support certain providers. This allows us to better represent information that comes from these providers.

If your state file or HCL is from a provider we do not support, the resulting representation will simply be all resources present without any simplification or refinement.

We use Terraform: 0.12.28

Provider State HCL
AWS Yes Yes
FlexibleEngine Yes Yes
OpenStack Yes Yes
Google WIP WIP
AzureRM WIP WIP

Installation

Development

You can build and install with the latest sources, you will enjoy the new features and bug fixes. It uses Go Modules (1.13+)

$ git clone https://github.com/cycloidio/inframap
$ cd inframap
$ go mod download
$ make build

Usage

The inframap --help will show you the basics.

asciicast

The most important subcommands are:

  • generate: generates the graph from STDIN or file.
  • prune: removes all unnecessary information from the state or HCL (not supported yet) so it can be shared without any security concerns
Example

Visualizing with dot

$ inframap generate --tfstate state.tfstate | dot -Tsvg > graph.svg

or from the terminal itself

$ inframap generate --tfstate state.tfstate | graph-easy

or from HCL

$ inframap generate --hcl config.tf | graph-easy

or HCL module

$ inframap generate --hcl ./my-module/ | graph-easy

using docker image (assuming that your Terraform files are in the working directory)

$ docker run --rm -v ${PWD}:/opt inframap generate --tfstate /opt/terraform.tfstate

What is the difference with terraform graph

Terraform Graph outputs a dependency graph of all the resources on the tfstate/HCL. We try to go one step forward, by trying to make it human readable

If the provider is not supported, the output will be closer to the Terraform one (without displaying provider / variable nodes)

Taking https://github.com/cycloid-community-catalog/stack-magento/ as reference this is the different output:

With terraform graph:

With inframap generate --hcl ./terraform/module-magento/ | dot -Tsvg > inframap.svg:

With inframap generate --hcl ./terraform/module-magento/ --raw | dot -Tsvg > inframap.svg:

How does it work?

For each provider, we support specific types of connections; we have a static list of resources that can be nodes or edges. Once we identify the edges, we try to create one unique edge from the resources they connect.

For a state file, we rely on the depends_on key and, for HCL we rely on interpolation to create the base graph one which we then apply specific provider logic if supported. If not supported, then basic graph is returned.

AWS

Note: We are currently investigating/trying to implement the grouping (https://github.com/cycloidio/inframap/issues/6) and connections based on iam resources (https://github.com/cycloidio/inframap/issues/11).

  • aws_security_group
  • aws_security_group_rule
FlexibleEngine
  • flexibleengine_compute_interface_attach_v2
  • flexibleengine_networking_port_v2
  • flexibleengine_networking_secgroup_rule_v2
  • flexibleengine_networking_secgroup_v2
  • flexibleengine_lb_listener_v2
  • flexibleengine_lb_pool_v2
  • flexibleengine_lb_member_v2
OpenStack
  • openstack_compute_interface_attach_v2
  • openstack_networking_port_v2
  • openstack_networking_secgroup_rule_v2
  • openstack_networking_secgroup_v2
  • openstack_lb_listener_v2
  • openstack_lb_pool_v2
  • openstack_lb_member_v2

License

Please see the MIT LICENSE file.

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

About Cycloid

Cycloid is a European fully-remote company, building a product to simplify, accelerate and optimize your DevOps and Cloud adoption.

We built Cycloid, your DevOps framework to encourage Developers and Ops to work together with the respect of best practices. We want to provide a tool that eliminates the silo effect in a company and allows to share the same level of informations within all professions.

Cycloid supports you to factorize your application in a reproducible way, to deploy a new environment in one click. This is what we call a stack.

A stack is composed of 3 pillars:

  1. the pipeline (Concourse)
  2. infrastructure layer (Terraform)
  3. applicative layer (Ansible)

Thanks to the flexible pipeline, all the steps and technologies are configurable.

To make it easier to create a stack, we build an Infrastructure designer named StackCraft that allows you to drag & drop Terraform resources and generate your Terraform files for you.

InfraMap is a brick that will help us to visualize running infrastructures.

The product comes also with an Open Source service catalog (all our public stacks are on Github) to deploy applications seamlessly. To manage the whole life cycle of an application, it also integrates the diagram of the infrastructure and the application, a cost management control to centralize Cloud billing, the monitoring, logs and events centralized with Prometheus, Grafana, ELK.

Don't hesitate to contact us, we'll be happy to meet you !

Documentation

The Go Gopher

There is no documentation for this package.

Source Files

Jump to

Keyboard shortcuts

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