Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…8mm#71: work around pyhcl

virtuald/pyhcl#55: pyhcl doesn't support terraform v0.12

Resolve this temporarily by using the go library `hcl2json` which allows
colorization and rendering to still work.  JSON references don't appear
to work, but the package is still usable.

Add pipenv support and update documentation and Makefile to support the
external go package.
  • Loading branch information
dustinlharrison committed Nov 21, 2019
1 parent 37f65b8 commit f70391b
Show file tree
Hide file tree
Showing 7 changed files with 343 additions and 8 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ __pycache__/
# C extensions
*.so

# dot files
.history/
.vscode/

# Build Dependencies
blastradius/bin/
blastradius/src/

# Distribution / packaging
.Python
build/
Expand Down Expand Up @@ -102,3 +110,4 @@ venv.bak/

# mypy
.mypy_cache/

1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ include blastradius/server/example/demo-3/*
include blastradius/server/templates/*
include blastradius/doc/*
include blastradius/utilities/providers/*
include blastradius/bin/*
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,25 @@

CATEGORIES_JSON = ./blastradius/server/static/js/categories.json
CATEGORIES_JS = ./blastradius/server/static/js/categories.js
GOPATH = $(CURDIR)/blastradius
export GOPATH

.PHONY: clean
clean:
-find . -type d -name __pycache__ -exec rm -r {} \+
-rm $(CATEGORIES_JSON)
-rm $(CATEGORIES_JS)
-rm -rf hcl2json

# install
.PHONY: install
install: hcl2json
pipenv install

# build hcl2json binary
.PHONY: hcl2json
hcl2json:
-go get github.com/tmccombs/hcl2json

# build pypi package
.PHONY: dist
Expand Down Expand Up @@ -42,4 +55,4 @@ $(CATEGORIES_JS): $(CATEGORIES_JSON)
-sed -e '1s/{/resource_groups \= {/' $(CATEGORIES_JSON) > $(CATEGORIES_JS).new && mv $(CATEGORIES_JS).new $(CATEGORIES_JS)

# probably best to clean 1st
all: categories dist docker
all: categories dist docker
18 changes: 18 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
pylint = "*"
mypy = "*"

[packages]
requests = "==2.22.0"
beautifulsoup4 = "==4.7.1"
ply = ">=3.11"
pyhcl = "==0.3.12"
Jinja2 = "==2.10.1"
Flask = "==1.0.3"

[requires]
286 changes: 286 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,19 @@ Use _Blast Radius_ to:
## Quickstart

The fastest way to get up and running with *Blast Radius* is to install it with
`pip` to your pre-existing environment:
NOTE: This version has been hacked to use a Go package `hcl2json` to replace
pyhcl until it can be fixed. Before continuing, make sure Go is installed in your system.
You will also need to install `pipenv`.

```sh
pip install blastradius
make install
```

Once installed just point *Blast Radius* at any initialized *Terraform*
directory:

```sh
blast-radius --serve /path/to/terraform/directory
pipenv run blast-radius --serve /path/to/terraform/directory
```

And you will shortly be rewarded with a browser link http://127.0.0.1:5000/.
Expand Down
Loading

0 comments on commit f70391b

Please sign in to comment.