From 8c7bbd38fd2935c07c9696763f883ccf87342069 Mon Sep 17 00:00:00 2001 From: Erin Atkinson <20285458+erindatkinson@users.noreply.github.com> Date: Wed, 30 Oct 2019 11:27:47 -0600 Subject: [PATCH 1/2] Add DocGen and Gen'd Docs (#23) * add docgen scripts * docgen * update readme to point at docs --- .gitignore | 1 + .scripts/doc-gen.sh | 71 +++++++++++++++++++++++ Makefile | 3 + README.md | 63 +++++--------------- docs/inputs.md | 44 ++++++++++++++ docs/outputs.md | 12 ++++ modules/instance-template/docs/inputs.md | 21 +++++++ modules/instance-template/docs/outputs.md | 8 +++ modules/lb/docs/inputs.md | 15 +++++ modules/lb/docs/outputs.md | 8 +++ 10 files changed, 196 insertions(+), 50 deletions(-) create mode 100644 .gitignore create mode 100755 .scripts/doc-gen.sh create mode 100644 Makefile create mode 100644 docs/inputs.md create mode 100644 docs/outputs.md create mode 100644 modules/instance-template/docs/inputs.md create mode 100644 modules/instance-template/docs/outputs.md create mode 100644 modules/lb/docs/inputs.md create mode 100644 modules/lb/docs/outputs.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..a340c103 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +work \ No newline at end of file diff --git a/.scripts/doc-gen.sh b/.scripts/doc-gen.sh new file mode 100755 index 00000000..38b6158d --- /dev/null +++ b/.scripts/doc-gen.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +set -e + +BINARY_DIR=./work +BINARY_FILE="${BINARY_DIR}/terraform-docs" +BINARY_VERSION=0.6.0 +BINARY_URL_PREFIX="https://github.com/segmentio/terraform-docs/releases/download/v${BINARY_VERSION}/terraform-docs-v${BINARY_VERSION}" + +DOCS_CMDS="--sort-inputs-by-required --with-aggregate-type-defaults markdown table" +DOCS_DIR=docs + +VARS_TF=variables.tf +OUTS_TF=outputs.tf + +INS_MD=inputs.md +OUTS_MD=outputs.md + + +function setup { + mkdir -p ${BINARY_DIR} + if [[ ! -e "${BINARY_FILE}" ]]; then + if [[ "$OSTYPE" == "linux-gnu" ]]; then + BINARY_URL="${BINARY_URL_PREFIX}-linux-amd64" + elif [[ "$OSTYPE" == "darwin"* ]]; then + BINARY_URL="${BINARY_URL_PREFIX}-darwin-amd64" + else + echo "Please run this in either a Linux or Mac environment." + exit 1 + fi + echo "Downloading ${BINARY_URL}" + curl -L -o "${BINARY_FILE}" "${BINARY_URL}" + chmod +x "${BINARY_FILE}" + fi +} + +function main_docs { + if test ! -d "${DOCS_DIR}"; then + mkdir "${DOCS_DIR}" + fi + + echo -e "# Terraform Enterprise: Clustering\n" | tee "${DOCS_DIR}/${INS_MD}" "${DOCS_DIR}/${OUTS_MD}" &> /dev/null + + eval "${BINARY_FILE} ${DOCS_CMDS} ${VARS_TF}" >> "${DOCS_DIR}/${INS_MD}" + eval "${BINARY_FILE} ${DOCS_CMDS} ${OUTS_TF}" >> "${DOCS_DIR}/${OUTS_MD}" + +} + + +function module_docs { + if test -d ./modules; then + for dir in ./modules/*; do + mkdir -p "${dir}/${DOCS_DIR}" + + echo -e "# Terraform Enterprise: Clustering\n" | tee "${dir}/${DOCS_DIR}/${INS_MD}" "${dir}/${DOCS_DIR}/${OUTS_MD}" &> /dev/null + + eval "${BINARY_FILE} ${DOCS_CMDS} ${dir}/${VARS_TF}" >> "${dir}/${DOCS_DIR}/${INS_MD}" + eval "${BINARY_FILE} ${DOCS_CMDS} ${dir}/${OUTS_TF}" >> "${dir}/${DOCS_DIR}/${OUTS_MD}" + done + else + echo "No modules directory, skipping." + fi +} + + +setup +main_docs +module_docs + + + diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..a2ac87ef --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +.PHONY: docs +docs: + .scripts/doc-gen.sh diff --git a/README.md b/README.md index 57eb84b5..9266812e 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,32 @@ -# Terraform Enterprise: High Availability for Google (BETA) +# Terraform Enterprise: Clustering for Google ![Terraform Logo](https://github.com/hashicorp/terraform-google-terraform-enterprise/blob/master/assets/TerraformLogo.png?raw=true) ## Description -This module installs Terraform Enterprise HA BETA onto 1 or more gcp instances in DEMO mode. All data is stored on the instance(s) and is not preserved. +This module installs Terraform Enterprise Clustering onto one or more gcp instances. An Ubuntu Bionic (18.04 LTS) image is chosen by default, but this config supports previous version of Ubuntu as well as Red Hat Enterprise Linux 7.2-7.7 (v8 is not supported.) ## Architecture -![basic diagram](https://github.com/hashicorp/terraform-google-terraform-enterprise/blob/v0.0.1-beta/assets/gcp_diagram.jpg?raw=true) +![basic diagram](https://github.com/hashicorp/terraform-google-terraform-enterprise/blob/master/assets/gcp_diagram.jpg?raw=true) _example architecture_ Please contact your Technical Account Manager for more information, and support for any issues you have. +## Examples + +Please see the [examples directory](https://github.com/hashicorp/terraform-google-terraform-enterprise/tree/master/examples/) for more extensive examples. + ## Inputs -| Name | Description | Type | Default | Required | -|------|-------------|:----:|:-----:|:-----:| -| certificate | Path to Certificate file or GCP certificate link | string | n/a | yes | -| credentials\_file | Path to credential file | string | n/a | yes | -| dns\_zone | Managed DNS Zone name | string | n/a | yes | -| domain | domain name | string | n/a | yes | -| frontend\_dns | DNS name for load balancer | string | n/a | yes | -| license\_file | License file | string | n/a | yes | -| project | Name of the project to deploy into | string | n/a | yes | -| public\_ip | the public IP for the load balancer to use | string | n/a | yes | -| ssl\_policy | SSL policy for the cert | string | n/a | yes | -| subnet | name of the subnet to install into | string | n/a | yes | -| airgap\_installer\_url | URL to replicated's airgap installer package | string | `"https://install.terraform.io/installer/replicated-v5.tar.gz"` | no | -| airgap\_package\_url | airgap url | string | `"none"` | no | -| boot\_disk\_size | The size of the boot disk to use for the instances | string | `"40"` | no | -| ca\_bundle\_url | URL to Custom CA bundle used for outgoing connections | string | `"none"` | no | -| dns\_project | Name of project where the DNS zone resides | string | `""` | no | -| encryption\_password | encryption password for the vault unseal key. save this! | string | `""` | no | -| gcs\_bucket | Name of the gcp storage bucket | string | `""` | no | -| gcs\_credentials | Base64 encoded credentials json to access your gcp storage bucket. Run base64 -i -o and then copy the contents of the file into the variable | string | `""` | no | -| gcs\_project | Project name where the bucket resides, if left blank will use project provided above | string | `""` | no | -| http\_proxy\_url | HTTP(S) proxy url | string | `"none"` | no | -| image\_family | The image family, choose from ubuntu-1604-lts, ubuntu-1804-lts, or rhel-7 | string | `"ubuntu-1804-lts"` | no | -| jq\_url | Location of the jq package | string | `"https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64"` | no | -| postgresql\_address | Database connection url | string | `""` | no | -| postgresql\_database | Database name | string | `""` | no | -| postgresql\_extra\_params | Extra connection parameters such as ssl=true | string | `""` | no | -| postgresql\_password | Base64 encoded database password | string | `""` | no | -| postgresql\_user | Database username | string | `"none"` | no | -| prefix | Resource and instance prefix | string | `"tfe"` | no | -| primary\_count | Number of primary nodes to run, must be odd number - 3 or 5 recommended. | string | `"3"` | no | -| primary\_machine\_type | Type of machine to use | string | `"n1-standard-4"` | no | -| ptfe\_install\_url | Location of the ptfe install tool zip file | string | `"https://install.terraform.io/installer/ptfe.zip"` | no | -| region | The region to install into. | string | `"us-central1"` | no | -| release\_sequence | Replicated release sequence | string | `"latest"` | no | -| repl\_cidr | Specify a non-standard CIDR range for the replicated services. The default is 10.96.0.0/12 | string | `""` | no | -| secondary\_count | Number of secondary nodes to run | string | `"0"` | no | -| secondary\_machine\_type | Type of machine to use for secondary nodes, if unset, will default to primary_machine_type | string | `"n1-standard-4"` | no | -| weave\_cidr | Specify a non-standard CIDR range for weave. The default is 10.32.0.0/12 | string | `""` | no | -| zone | Preferred zone | string | `"us-central1-a"` | no | +Please see the [inputs documentation](https://registry.terraform.io/modules/hashicorp/terraform-enterprise/google/?tab=inputs) + +Repository versions of the inputs documentation can be found in [docs/inputs.md](docs/inputs.md) ## Outputs -| Name | Description | -|------|-------------| -| application\_endpoint | The URI to access the Terraform Enterprise Application. | -| application\_health\_check | The URI for the Terraform Enterprise Application health check. | -| installer\_dashboard\_password | The password to access the installer dashboard. | -| installer\_dashboard\_url | The URL to access the installer dashboard. | -| primary\_public\_ip | The Public IP for the load balancer to use. | +Please see the [outputs documentation](https://registry.terraform.io/modules/hashicorp/terraform-enterprise/google/?tab=outputs) + +Repository versions of the outputs documentation can be found in [docs/outputs.md](docs/outputs.md) diff --git a/docs/inputs.md b/docs/inputs.md new file mode 100644 index 00000000..72458815 --- /dev/null +++ b/docs/inputs.md @@ -0,0 +1,44 @@ +# Terraform Enterprise: Clustering + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|:----:|:-----:|:-----:| +| certificate | Path to Certificate file or GCP certificate link | string | n/a | yes | +| credentials\_file | Path to credential file | string | n/a | yes | +| dns\_zone | Managed DNS Zone name | string | n/a | yes | +| domain | domain name | string | n/a | yes | +| frontend\_dns | DNS name for load balancer | string | n/a | yes | +| license\_file | License file | string | n/a | yes | +| project | Name of the project to deploy into | string | n/a | yes | +| public\_ip | the public IP for the load balancer to use | string | n/a | yes | +| ssl\_policy | SSL policy for the cert | string | n/a | yes | +| subnet | name of the subnet to install into | string | n/a | yes | +| airgap\_installer\_url | URL to replicated's airgap installer package | string | `"https://install.terraform.io/installer/replicated-v5.tar.gz"` | no | +| airgap\_package\_url | airgap url | string | `"none"` | no | +| boot\_disk\_size | The size of the boot disk to use for the instances | string | `"40"` | no | +| ca\_bundle\_url | URL to Custom CA bundle used for outgoing connections | string | `"none"` | no | +| dns\_project | Name of project where the DNS zone resides | string | `""` | no | +| encryption\_password | encryption password for the vault unseal key. save this! | string | `""` | no | +| external\_services | object store provider for external services. Allowed values: gcs | string | `""` | no | +| gcs\_bucket | Name of the gcp storage bucket | string | `""` | no | +| gcs\_credentials | Base64 encoded credentials json to access your gcp storage bucket. Run base64 -i -o and then copy the contents of the file into the variable | string | `""` | no | +| gcs\_project | Project name where the bucket resides, if left blank will use project provided above | string | `""` | no | +| image\_family | The image family, choose from ubuntu-1604-lts, ubuntu-1804-lts, or rhel-7 | string | `"ubuntu-1804-lts"` | no | +| install\_type | Installation type, options are (poc or production). Switch to production for external services. | string | `"poc"` | no | +| postgresql\_address | Database connection url | string | `""` | no | +| postgresql\_database | Database name | string | `""` | no | +| postgresql\_extra\_params | Extra connection parameters such as ssl=true | string | `""` | no | +| postgresql\_password | Base64 encoded database password | string | `""` | no | +| postgresql\_user | Database username | string | `""` | no | +| prefix | Resource and instance prefix | string | `"tfe"` | no | +| primary\_count | Number of primary nodes to run, must be odd number - 3 or 5 recommended. | string | `"3"` | no | +| primary\_machine\_type | Type of machine to use | string | `"n1-standard-4"` | no | +| region | The region to install into. | string | `"us-central1"` | no | +| release\_sequence | Replicated release sequence | string | `"latest"` | no | +| repl\_cidr | Specify a non-standard CIDR range for the replicated services. The default is 10.96.0.0/12 | string | `""` | no | +| secondary\_count | Number of secondary nodes to run | string | `"0"` | no | +| secondary\_machine\_type | Type of machine to use for secondary nodes, if unset, will default to primary_machine_type | string | `"n1-standard-4"` | no | +| weave\_cidr | Specify a non-standard CIDR range for weave. The default is 10.32.0.0/12 | string | `""` | no | +| zone | Preferred zone | string | `"us-central1-a"` | no | + diff --git a/docs/outputs.md b/docs/outputs.md new file mode 100644 index 00000000..5481b9d5 --- /dev/null +++ b/docs/outputs.md @@ -0,0 +1,12 @@ +# Terraform Enterprise: Clustering + +## Outputs + +| Name | Description | +|------|-------------| +| application\_endpoint | The URI to access the Terraform Enterprise Application. | +| application\_health\_check | The URI for the Terraform Enterprise Application health check. | +| installer\_dashboard\_password | The password to access the installer dashboard. | +| installer\_dashboard\_url | The URL to access the installer dashboard. | +| primary\_public\_ip | The Public IP for the load balancer to use. | + diff --git a/modules/instance-template/docs/inputs.md b/modules/instance-template/docs/inputs.md new file mode 100644 index 00000000..8c7aa4e5 --- /dev/null +++ b/modules/instance-template/docs/inputs.md @@ -0,0 +1,21 @@ +# Terraform Enterprise: Clustering + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|:----:|:-----:|:-----:| +| bootstrap\_token\_id | bootstrap token id | string | n/a | yes | +| bootstrap\_token\_suffix | bootstrap token suffix | string | n/a | yes | +| cluster\_endpoint | the cluster endpoint | string | n/a | yes | +| image\_family | image family | string | n/a | yes | +| install\_type | type of install - poc or production | string | n/a | yes | +| prefix | Prefix for resource names | string | n/a | yes | +| ptfe\_subnet | subnet to deploy into | string | n/a | yes | +| region | The region to install into. | string | n/a | yes | +| release\_sequence | Replicated release sequence | string | n/a | yes | +| repl\_data | console | string | n/a | yes | +| secondary\_machine\_type | Type of machine to use | string | n/a | yes | +| setup\_token | setup token | string | n/a | yes | +| boot\_disk\_size | The size of the boot disk to use for the instances | string | `"40"` | no | +| ca\_bundle\_url | URL to CA certificate file used for the internal `ptfe-proxy` used for outgoing connections | string | `"none"` | no | + diff --git a/modules/instance-template/docs/outputs.md b/modules/instance-template/docs/outputs.md new file mode 100644 index 00000000..2db846b8 --- /dev/null +++ b/modules/instance-template/docs/outputs.md @@ -0,0 +1,8 @@ +# Terraform Enterprise: Clustering + +## Outputs + +| Name | Description | +|------|-------------| +| secondary\_template | | + diff --git a/modules/lb/docs/inputs.md b/modules/lb/docs/inputs.md new file mode 100644 index 00000000..d45972eb --- /dev/null +++ b/modules/lb/docs/inputs.md @@ -0,0 +1,15 @@ +# Terraform Enterprise: Clustering + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|:----:|:-----:|:-----:| +| cert | certificate for the load balancer | string | n/a | yes | +| domain | domain | string | n/a | yes | +| frontenddns | front end url name | string | n/a | yes | +| instance\_group | primary instance group | string | n/a | yes | +| prefix | Prefix for resource names | string | n/a | yes | +| primary\_instances | primary instances | list | n/a | yes | +| publicIP | External-facing IP address for PTFE application | string | n/a | yes | +| sslpolicy | SSL policy for the cert | string | n/a | yes | + diff --git a/modules/lb/docs/outputs.md b/modules/lb/docs/outputs.md new file mode 100644 index 00000000..50f3caa7 --- /dev/null +++ b/modules/lb/docs/outputs.md @@ -0,0 +1,8 @@ +# Terraform Enterprise: Clustering + +## Outputs + +| Name | Description | +|------|-------------| +| cluster\_endpoint | | + From 681be27dc294fb8163533279b3e7ca04325b04cb Mon Sep 17 00:00:00 2001 From: Erin Atkinson <20285458+erindatkinson@users.noreply.github.com> Date: Wed, 30 Oct 2019 11:43:09 -0600 Subject: [PATCH 2/2] Update README.md (#24) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9266812e..faa85b21 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This module installs Terraform Enterprise Clustering onto one or more gcp instances. -An Ubuntu Bionic (18.04 LTS) image is chosen by default, but this config supports previous version of Ubuntu as well as Red Hat Enterprise Linux 7.2-7.7 (v8 is not supported.) +An Ubuntu Bionic (18.04 LTS) image is chosen by default, but this config supports previous version of Ubuntu as well as Red Hat Enterprise Linux 7.2-7.6 (v8 are not supported.) ## Architecture