From 37b92806bff008dce8a3e93f7a6f29694c2ab03f Mon Sep 17 00:00:00 2001 From: Naoto Yokoyama Date: Fri, 1 Feb 2019 05:12:25 +0900 Subject: [PATCH] :pencil: use terraform-docs to generate module IO docs --- Dockerfile.golang | 23 +++++++++++++++++++++++ README.md | 17 ++++++++++++++++- build.sh | 1 + clean.sh | 1 + docker-compose.yml | 7 +++++++ docs.sh | 17 +++++++++++++++++ 6 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.golang create mode 100755 docs.sh diff --git a/Dockerfile.golang b/Dockerfile.golang new file mode 100644 index 0000000..b892985 --- /dev/null +++ b/Dockerfile.golang @@ -0,0 +1,23 @@ +FROM golang:1.11 + +### +# Set up the working directory +# +ENV CODES_DIR /codes +RUN mkdir -p "${CODES_DIR}" +WORKDIR "${CODES_DIR}" + +### +# Install utilities +# +RUN go get github.com/segmentio/terraform-docs + +### +# Install codes +# +COPY . . + +### +# What we need is.. bash! +# +CMD [ "bash" ] diff --git a/README.md b/README.md index a91e16a..1805310 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,22 @@ resource "aws_cloudfront_distribution" "your_distribution" { } ``` -## License +## Arguments and Outputs + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|:----:|:-----:|:-----:| +| basic\_auth\_credentials | Credentials for Basic Authentication. Pass a map composed of 'user' and 'password'. | map | n/a | yes | +| function\_name | Lambda function name | string | `"basicAuth"` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| lambda\_arn | Lambda function ARN with version | + +# License Copyright © 2019 Naoto Yokoyama diff --git a/build.sh b/build.sh index 23e169d..f5b5d18 100755 --- a/build.sh +++ b/build.sh @@ -13,4 +13,5 @@ set -o xtrace __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +docker-compose build dev docker-compose run --rm dev npm run build diff --git a/clean.sh b/clean.sh index 1f1b267..beaea28 100755 --- a/clean.sh +++ b/clean.sh @@ -13,4 +13,5 @@ set -o xtrace __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +docker-compose build dev docker-compose run --rm dev npm run clean diff --git a/docker-compose.yml b/docker-compose.yml index ecb74dd..dc8ed84 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,3 +5,10 @@ services: volumes: - .:/codes/ - /codes/node_modules + docs: + build: + context: . + dockerfile: Dockerfile.golang + command: terraform-docs markdown table ./module + volumes: + - .:/codes/ diff --git a/docs.sh b/docs.sh new file mode 100755 index 0000000..aeb0434 --- /dev/null +++ b/docs.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# +# Generates the module markdown documents by terraform-docs. +# +# Usage: +# ./docs.sh +# + +set -o errexit +set -o nounset +set -o pipefail +#set -o xtrace + +__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +docker-compose build docs 2>/dev/null 1>/dev/null +docker-compose run --rm docs