#build-harness (2019-12)
Help with the Cloud Posse build-harness https://github.com/cloudposse/build-harness
2019-12-17
@Erik Osterman (Cloud Posse) has joined the channel
set the channel description: Help with the Cloud Posse build-harness https://github.com/cloudposse/build-harness
@Andriy Knysh (Cloud Posse) has joined the channel
@Igor just created this channel
@Igor has joined the channel
@Andriy Knysh (Cloud Posse) said you have some problems with the build-harness
when running make readme
I’d like to help triage
Yes, thank you. The readme is generated but without terraform output. ie docs/terraform.md is empty.
I had similar issue (variables/outputs not generated). It was an old version of gomplate
in PATH
removed it, and then make readme/deps
installed the new version, which worked
I have no gomplate in PATH
but that was on Mac
ok, so docs/terraform.md
does not have anything to do with gomplate
so we can rule that out
That’s terraform-docs, right?
docs/terraform.md
is generated using the “terraform-docs
” or more accurately a shell script that wraps it and munges the terraform code (HCL2) so that it works with terraform-docs
i suspect there’s something we are using in that script that doesn’t work on your ubuntu distro (perhaps missing package)
one sec
Collection of Makefiles to facilitate building Golang projects, Dockerfiles, Helm charts, and more - cloudposse/build-harness
this is the script we run
can you test if that script works for you?
e.g. ./build-harness/bin/terraform-docs.sh md .
i think
I don’t have terraform-docs in my PATH either
but it seems to be in the /vendor/ folder of the build-harness
Collection of Makefiles to facilitate building Golang projects, Dockerfiles, Helm charts, and more - cloudposse/build-harness
the Makefile
sets the search PATH
to include the build-harness/vendor
folder
Do I need to run make within build-harness itself?
(hides behind the tree)
not technically, you just need those things in your path
so try this:
(for debugging)
export PATH="./build-harness/vendor:$PATH"
then if you run terraform-docs
it should find it
test that that works first..
then we’ll proceed to debug
@Jeff Young has joined the channel
cannot open /bin/terraform-docs.awk
aha sec
set export BUILD_HARNESS_PATH=./build-harness
(again, just for debugging right now - none of this stuff needs to be set otherwise)
no output from terraform-docs.sh now
ok, run the script this way:
bash -x ./build-harness/bin/terraform-docs.sh md .
then we should see where it gets
+ which awk
+ which terraform
+ which terraform-docs
++ head -1
++ terraform version
+ [[ Terraform v0.12.18 =~ 0\.12 ]]
++ mktemp /tmp/terraform-docs-XXXXXXXXXX
+ TMP_FILE=/tmp/terraform-docs-JhZVXiFB8g
+ awk -f ./build-harness/bin/terraform-docs.awk ./main.tf ./outputs.tf ./variables.tf ./versions.tf
+ terraform-docs md /tmp/terraform-docs-JhZVXiFB8g
+ rm -f /tmp/terraform-docs-JhZVXiFB8g
Ok, so it’s working, but appears then to be something wrong either with the awk
or the output from the awk
can you run awk -f ./build-harness/bin/terraform-docs.awk ./main.tf ./outputs.tf ./variables.tf ./versions.tf
@roth.andy has joined the channel
we also have a couple open PRs
i haven’t had a chance to test the work yet by @cytopia
As stated in the PR description, I’ve added regression tests for every issue on GitHub, so it should not be too time-consuming to validate it.
@cytopia has joined the channel
do any of those issues sound like they could be related to your problem?
if so, we can test that
I messed something up in my environment and now curl to get gomplate fails for me
on make readme/deps
what’s the error?
curl: (23) Failed writing body (0 != 16360)
oh, that just means the gomplate
binary is not writable
probably b/c sudo
check fs permissions
all good now
trying the awk cmd, one sec
no output
@tamsky has joined the channel
@krueger.andre has joined the channel
@cbravo has joined the channel
@daveyu has joined the channel
@oscar has joined the channel
<https://raw.githubusercontent.com/cloudposse/build-harness/b65f55ec83c4c63d6aff1dfa2201547ffc676262/bin/terraform-docs.awk>
can you download that file
then replace the awk script with that one
re-run see if it works?
if so, I’ll merge this PR
(also, i assume you can read all the *.tf
files? no perms issues, right?)
btw, @Igor which repo?
terraform-aws-ecs-container-definition
What should the expected output be for terraform-docs.awk?
the terraform variables and outputs formatted in a an old HCLv1 format
that can be read by terraform-docs
Here’s the issue: https://github.com/segmentio/terraform-docs/issues/62
Prerequisites Put an x into the box that applies: This issue describes a bug. This issue describes a feature request. For more information, see the Contributing Guidelines. Description With the upc…
basically we wrote an awk script to munge the HCL2 code so it could be parsed by terraform-docs
(sufficient for automatic documentation)
If I run terraform-docs directly
I get 2019/12/17 15:58:45 At 3:26: Unknown token: 3:26 IDENT var.environment
yup
(due to HCl2)
@Andriy Knysh (Cloud Posse) I don’t have access to my terminal ATM
can you check if you can run readme
on that project right now?
terraform-aws-ecs-container-definition
will check (but I ran it about two weeks ago)
runs ok
README and terraform.md generated
@Igor IDENT
error usually happens when you mix different TF versions of TF binary and the module version
This is always going to be the case with terraform-docs
There is no 0.12 support
That is why the wrapper exists
e.g. try to use TF 0.12 version of the module with TF 0.11 binary
or other way around
Looks like terraform-docs doesn’t support HCL2
I don’t know enough about awk to troubleshoot why it’s failing, but it’d be great to figure it out so others don’t get stuck with the same problem
@Andriy Knysh (Cloud Posse) can you confirm that you can reproduce?
runs ok
I think it’s just me
I’ll try to find time to debug it on my own
Weird! Something else though I was thinking is we should just run build harness inside of Docker
And eliminate these issues
We already have the container
And already do this in our other pipelines
I am guessing if I run geodesic, it would be more likely to work as well, right?
yes try in geodesic
and yes, I tried it many times, works (with TF 0.12 binary and 0.12 version of the module, master
branch)
@Taylor has joined the channel
2019-12-18
@Roderik van der Veer has joined the channel
@Taras has joined the channel
@Kostis (Codefresh) has joined the channel
@Eugene has joined the channel
@osirisx.tls_cloudposs has joined the channel
@curious deviant has joined the channel
2019-12-19
@Can Kutlu Kinay has joined the channel
2019-12-28
@deftunix has joined the channel
Hi all, do you have in build-harness any switch to deploy helm charts?
No, or at least not maintained. We use #helmfile for deploying charts