diff --git a/CHANGELOG.md b/CHANGELOG.md index 8695273..d46e250 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - New flag `--description-file` to generate a description file of the Graph Nodes ([Issue #178](https://github.com/cycloidio/inframap/issues/178)) +- `graphviz` is now in the Docker image so no need of external tools to generate the graph by @agalazis + ([PR #221](https://github.com/cycloidio/inframap/pull/221)) ### Changed diff --git a/Dockerfile b/Dockerfile index 290d681..99fa34d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN apk -q --no-progress add git make \ FROM alpine -RUN apk -q --no-progress add graphviz ttf-dejavu\ +RUN apk -q --no-progress add graphviz ttf-dejavu \ && addgroup -g 1000 inframap \ && adduser -u 1000 -G inframap -s /bin/ash -D inframap @@ -22,4 +22,4 @@ WORKDIR /home/inframap COPY --from=builder /app/inframap /home/inframap -ENTRYPOINT ["inframap"] +ENTRYPOINT ["./inframap"] diff --git a/README.md b/README.md index 6ad136b..bee9958 100644 --- a/README.md +++ b/README.md @@ -81,33 +81,41 @@ The most important subcommands are: Visualizing with [dot](https://graphviz.org/download/) ```shell -$ inframap generate state.tfstate | dot -Tpng > graph.png +inframap generate state.tfstate | dot -Tpng > graph.png ``` or from the terminal itself with [graph-easy](https://github.com/ironcamel/Graph-Easy) ```shell -$ inframap generate state.tfstate | graph-easy +inframap generate state.tfstate | graph-easy ``` or from HCL ```shell -$ inframap generate config.tf | graph-easy +inframap generate config.tf | graph-easy ``` or HCL module ```shell -$ inframap generate ./my-module/ | graph-easy +inframap generate ./my-module/ | graph-easy ``` using docker image (assuming that your Terraform files are in the working directory) ```shell -$ docker run --rm -v ${PWD}:/opt cycloid/inframap generate /opt/terraform.tfstate +docker run --rm -v ${PWD}:/opt cycloid/inframap generate /opt/terraform.tfstate ``` +or if you use docker and want to have the images generated already, the docker image has the `graphviz` lib installed: + +```shell +docker run --rm -v ${PWD}:/opt --entrypoint "/bin/ash" inframap -c './inframap generate /opt/PATH_TO_HCL_STATE | dot -Tpng > /opt/graph.png' +``` + +and the generated image will be on `$PWD/graph.png` + **Note:** InfraMap will guess the type of the input (HCL or TFState) by validating if it's a JSON and if it fails then we fallback to HCL (except if you send a directory on args, the it'll use HCL directly), to force one specific type you can use `--hcl` or `--tfstate` flags.