Skip to content

Commit

Permalink
Automate generating terraform configs README files (#2117)
Browse files Browse the repository at this point in the history
Bonus: verification of up to date of those READMEs
  • Loading branch information
kron4eg authored Jun 24, 2022
1 parent 632c854 commit f7070ab
Show file tree
Hide file tree
Showing 20 changed files with 204 additions and 3 deletions.
9 changes: 9 additions & 0 deletions examples/terraform/aws/README.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# AWS Quickstart Terraform configs

The AWS Quickstart Terraform configs can be used to create the needed
infrastructure for a Kubernetes HA cluster. Check out the
[Creating Infrastructure guide][docs-infrastructure] to learn more about how to
use the configs and how to provision a Kubernetes cluster using KubeOne.

[docs-infrastructure]: https://docs.kubermatic.com/kubeone/master/guides/using_terraform_configs/

4 changes: 2 additions & 2 deletions examples/terraform/azure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use the configs and how to provision a Kubernetes cluster using KubeOne.

| Name | Version |
|------|---------|
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | ~> 2.63.0 |
| <a name="provider_time"></a> [time](#provider\_time) | n/a |
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 3.10.0 |
| <a name="provider_time"></a> [time](#provider\_time) | 0.7.2 |

## Modules

Expand Down
9 changes: 9 additions & 0 deletions examples/terraform/azure/README.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Azure Quickstart Terraform configs

The Azure Quickstart Terraform configs can be used to create the needed
infrastructure for a Kubernetes HA cluster. Check out the
[Creating Infrastructure guide][docs-infrastructure] to learn more about how to
use the configs and how to provision a Kubernetes cluster using KubeOne.

[docs-infrastructure]: https://docs.kubermatic.com/kubeone/master/guides/using_terraform_configs/

1 change: 1 addition & 0 deletions examples/terraform/digitalocean/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ No modules.
| <a name="input_control_plane_droplet_image"></a> [control\_plane\_droplet\_image](#input\_control\_plane\_droplet\_image) | Image to use for provisioning control plane droplets | `string` | `"ubuntu-18-04-x64"` | no |
| <a name="input_control_plane_size"></a> [control\_plane\_size](#input\_control\_plane\_size) | Size of control plane nodes | `string` | `"s-2vcpu-4gb"` | no |
| <a name="input_initial_machinedeployment_operating_system_profile"></a> [initial\_machinedeployment\_operating\_system\_profile](#input\_initial\_machinedeployment\_operating\_system\_profile) | Name of operating system profile for MachineDeployments, only applicable if operatng-system-manager addon is enabled.<br>If not specified, the default value will be added by machine-controller addon. | `string` | `""` | no |
| <a name="input_initial_machinedeployment_replicas"></a> [initial\_machinedeployment\_replicas](#input\_initial\_machinedeployment\_replicas) | Number of replicas per MachineDeployment | `number` | `1` | no |
| <a name="input_region"></a> [region](#input\_region) | Region to speak to | `string` | `"fra1"` | no |
| <a name="input_ssh_agent_socket"></a> [ssh\_agent\_socket](#input\_ssh\_agent\_socket) | SSH Agent socket, default to grab from $SSH\_AUTH\_SOCK | `string` | `"env:SSH_AUTH_SOCK"` | no |
| <a name="input_ssh_port"></a> [ssh\_port](#input\_ssh\_port) | SSH port to be used to provision instances | `number` | `22` | no |
Expand Down
9 changes: 9 additions & 0 deletions examples/terraform/digitalocean/README.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# DigitalOcean Quickstart Terraform configs

The DigitalOcean Quickstart Terraform configs can be used to create the needed
infrastructure for a Kubernetes HA cluster. Check out the following
[Creating Infrastructure guide][docs-infrastructure] to learn more about how to
use the configs and how to provision a Kubernetes cluster using KubeOne.

[docs-infrastructure]: https://docs.kubermatic.com/kubeone/master/guides/using_terraform_configs/

1 change: 1 addition & 0 deletions examples/terraform/equinixmetal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ No modules.
| <a name="input_device_type"></a> [device\_type](#input\_device\_type) | type (size) of the device | `string` | `"c3.small.x86"` | no |
| <a name="input_facility"></a> [facility](#input\_facility) | Facility (datacenter) | `string` | `"ams1"` | no |
| <a name="input_initial_machinedeployment_operating_system_profile"></a> [initial\_machinedeployment\_operating\_system\_profile](#input\_initial\_machinedeployment\_operating\_system\_profile) | Name of operating system profile for MachineDeployments, only applicable if operatng-system-manager addon is enabled.<br>If not specified, the default value will be added by machine-controller addon. | `string` | `""` | no |
| <a name="input_initial_machinedeployment_replicas"></a> [initial\_machinedeployment\_replicas](#input\_initial\_machinedeployment\_replicas) | Number of replicas per MachineDeployment | `number` | `1` | no |
| <a name="input_lb_device_type"></a> [lb\_device\_type](#input\_lb\_device\_type) | type (size) of the load balancer device | `string` | `"c3.small.x86"` | no |
| <a name="input_lb_operating_system"></a> [lb\_operating\_system](#input\_lb\_operating\_system) | Image to use for loadbalancer provisioning | `string` | `"ubuntu_18_04"` | no |
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | project ID | `string` | n/a | yes |
Expand Down
14 changes: 14 additions & 0 deletions examples/terraform/equinixmetal/README.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Equinix Metal Quickstart Terraform configs

The Equinix Metal Quickstart Terraform configs can be used to create the needed
infrastructure for a Kubernetes HA cluster. Check out the following
[Creating Infrastructure guide][docs-infrastructure] to learn more about how to
use the configs and how to provision a Kubernetes cluster using KubeOne.

## Kubernetes API Server Load Balancing

See the [Terraform loadbalancers in examples document][docs-tf-loadbalancer].

[docs-infrastructure]: https://docs.kubermatic.com/kubeone/master/guides/using_terraform_configs/
[docs-tf-loadbalancer]: https://docs.kubermatic.com/kubeone/master/examples/ha_load_balancing/

1 change: 1 addition & 0 deletions examples/terraform/gce/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ No modules.
| <a name="input_control_plane_type"></a> [control\_plane\_type](#input\_control\_plane\_type) | GCE instance type | `string` | `"n1-standard-2"` | no |
| <a name="input_control_plane_volume_size"></a> [control\_plane\_volume\_size](#input\_control\_plane\_volume\_size) | Size of the boot volume, in GB | `number` | `100` | no |
| <a name="input_initial_machinedeployment_operating_system_profile"></a> [initial\_machinedeployment\_operating\_system\_profile](#input\_initial\_machinedeployment\_operating\_system\_profile) | Name of operating system profile for MachineDeployments, only applicable if operatng-system-manager addon is enabled.<br>If not specified, the default value will be added by machine-controller addon. | `string` | `""` | no |
| <a name="input_initial_machinedeployment_replicas"></a> [initial\_machinedeployment\_replicas](#input\_initial\_machinedeployment\_replicas) | Number of replicas per MachineDeployment | `number` | `1` | no |
| <a name="input_project"></a> [project](#input\_project) | Project to be used for all resources | `string` | n/a | yes |
| <a name="input_region"></a> [region](#input\_region) | GCP region to speak to | `string` | `"europe-west3"` | no |
| <a name="input_ssh_agent_socket"></a> [ssh\_agent\_socket](#input\_ssh\_agent\_socket) | SSH Agent socket, default to grab from $SSH\_AUTH\_SOCK | `string` | `"env:SSH_AUTH_SOCK"` | no |
Expand Down
20 changes: 20 additions & 0 deletions examples/terraform/gce/README.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# GCE Quickstart Terraform configs

The GCE Quickstart Terraform configs can be used to create the needed
infrastructure for a Kubernetes HA cluster. Check out the following
[Creating Infrastructure guide][docs-infrastructure] to learn more about how to
use the configs and how to provision a Kubernetes cluster using KubeOne.

[docs-infrastructure]: https://docs.kubermatic.com/kubeone/master/guides/using_terraform_configs/

## GCE Provider configuration

### Credentials

Per <https://www.terraform.io/docs/providers/google/provider_reference.html#configuration-reference>
either of the following ENV variables should be accessible:

* `GOOGLE_CREDENTIALS`
* `GOOGLE_CLOUD_KEYFILE_JSON`
* `GCLOUD_KEYFILE_JSON`

2 changes: 1 addition & 1 deletion examples/terraform/hetzner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ No modules.
| <a name="input_datacenter"></a> [datacenter](#input\_datacenter) | n/a | `string` | `"nbg1"` | no |
| <a name="input_image"></a> [image](#input\_image) | n/a | `string` | `"ubuntu-20.04"` | no |
| <a name="input_initial_machinedeployment_operating_system_profile"></a> [initial\_machinedeployment\_operating\_system\_profile](#input\_initial\_machinedeployment\_operating\_system\_profile) | Name of operating system profile for MachineDeployments, only applicable if operatng-system-manager addon is enabled.<br>If not specified, the default value will be added by machine-controller addon. | `string` | `""` | no |
| <a name="input_initial_machinedeployment_replicas"></a> [initial\_machinedeployment\_replicas](#input\_initial\_machinedeployment\_replicas) | Number of replicas per MachineDeployment | `number` | `1` | no |
| <a name="input_ip_range"></a> [ip\_range](#input\_ip\_range) | ip range to use for private network | `string` | `"192.168.0.0/16"` | no |
| <a name="input_lb_type"></a> [lb\_type](#input\_lb\_type) | n/a | `string` | `"lb11"` | no |
| <a name="input_network_zone"></a> [network\_zone](#input\_network\_zone) | network zone to use for private network | `string` | `"eu-central"` | no |
Expand All @@ -66,7 +67,6 @@ No modules.
| <a name="input_ssh_username"></a> [ssh\_username](#input\_ssh\_username) | SSH user, used only in output | `string` | `"root"` | no |
| <a name="input_worker_os"></a> [worker\_os](#input\_worker\_os) | OS to run on worker machines | `string` | `"ubuntu"` | no |
| <a name="input_worker_type"></a> [worker\_type](#input\_worker\_type) | n/a | `string` | `"cx21"` | no |
| <a name="input_workers_replicas"></a> [workers\_replicas](#input\_workers\_replicas) | n/a | `number` | `1` | no |

## Outputs

Expand Down
14 changes: 14 additions & 0 deletions examples/terraform/hetzner/README.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Hetzner Quickstart Terraform configs

The Hetzner Quickstart Terraform configs can be used to create the needed
infrastructure for a Kubernetes HA cluster. Check out the following
[Creating Infrastructure guide][docs-infrastructure] to learn more about how to
use the configs and how to provision a Kubernetes cluster using KubeOne.

## Kubernetes API Server Load Balancing

See the [Terraform loadbalancers in examples document][docs-tf-loadbalancer].

[docs-infrastructure]: https://docs.kubermatic.com/kubeone/master/guides/using_terraform_configs/
[docs-tf-loadbalancer]: https://docs.kubermatic.com/kubeone/master/examples/ha_load_balancing/

14 changes: 14 additions & 0 deletions examples/terraform/nutanix/README.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Nutanix Quickstart Terraform configs

The Nutanix Quickstart Terraform configs can be used to create the needed
infrastructure for a Kubernetes HA cluster. Check out the following
[Creating Infrastructure guide][docs-infrastructure] to learn more about how to
use the configs and how to provision a Kubernetes cluster using KubeOne.

## Kubernetes API Server Load Balancing

See the [Terraform loadbalancers in examples document][docs-tf-loadbalancer].

[docs-infrastructure]: https://docs.kubermatic.com/kubeone/master/guides/using_terraform_configs/
[docs-tf-loadbalancer]: https://docs.kubermatic.com/kubeone/master/examples/ha_load_balancing/

1 change: 1 addition & 0 deletions examples/terraform/openstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ No modules.
| <a name="input_image"></a> [image](#input\_image) | image name to use | `string` | `""` | no |
| <a name="input_image_properties_query"></a> [image\_properties\_query](#input\_image\_properties\_query) | in absense of var.image, this will be used to query API for the image | `map(any)` | <pre>{<br> "os_distro": "ubuntu",<br> "os_version": "20.04"<br>}</pre> | no |
| <a name="input_initial_machinedeployment_operating_system_profile"></a> [initial\_machinedeployment\_operating\_system\_profile](#input\_initial\_machinedeployment\_operating\_system\_profile) | Name of operating system profile for MachineDeployments, only applicable if operatng-system-manager addon is enabled.<br>If not specified, the default value will be added by machine-controller addon. | `string` | `""` | no |
| <a name="input_initial_machinedeployment_replicas"></a> [initial\_machinedeployment\_replicas](#input\_initial\_machinedeployment\_replicas) | Number of replicas per MachineDeployment | `number` | `1` | no |
| <a name="input_lb_flavor"></a> [lb\_flavor](#input\_lb\_flavor) | OpenStack instance flavor for the LoadBalancer node | `string` | `"m1.tiny"` | no |
| <a name="input_ssh_agent_socket"></a> [ssh\_agent\_socket](#input\_ssh\_agent\_socket) | SSH Agent socket, default to grab from $SSH\_AUTH\_SOCK | `string` | `"env:SSH_AUTH_SOCK"` | no |
| <a name="input_ssh_port"></a> [ssh\_port](#input\_ssh\_port) | SSH port to be used to provision instances | `number` | `22` | no |
Expand Down
14 changes: 14 additions & 0 deletions examples/terraform/openstack/README.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# OpenStack Quickstart Terraform configs

The OpenStack Quickstart Terraform configs can be used to create the needed
infrastructure for a Kubernetes HA cluster. Check out the following
[Creating Infrastructure guide][docs-infrastructure] to learn more about how to
use the configs and how to provision a Kubernetes cluster using KubeOne.

## Kubernetes API Server Load Balancing

See the [Terraform loadbalancers in examples document][docs-tf-loadbalancer].

[docs-infrastructure]: https://docs.kubermatic.com/kubeone/master/guides/using_terraform_configs/
[docs-tf-loadbalancer]: https://docs.kubermatic.com/kubeone/master/examples/ha_load_balancing/

31 changes: 31 additions & 0 deletions examples/terraform/vmware-cloud-director/README.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# VMware Cloud Director Quickstart Terraform Configs

The VMware Cloud Director Quickstart Terraform configs can be used to create the needed
infrastructure for a Kubernetes HA cluster. Check out the following
[Creating Infrastructure guide][docs-infrastructure] to learn more about how to
use the configs and how to provision a Kubernetes cluster using KubeOne.

[docs-infrastructure]: https://docs.kubermatic.com/kubeone/master/guides/using_terraform_configs/

## Setup

In this setup, we assume that a dedicated org VDC has been created. It's connected to an external network using an edge gateway. NSX-V is enabled in the infrastructure since the sample configs only support NSX-V, for now.

The kube-apiserver will be assigned the private IP address of the first control plane VM.

### Credentials

Following environment variables or terraform variables can be used to authenticate with the provider:

| Environment Variable | Terraform Variable |
|------|---------|
| VCD_USER | vcd.user |
| VCD_PASSWORD | vcd.user |
| VCD_ORG | vcd.org |
| VCD_URL | vcd.url |

#### References

- <https://registry.terraform.io/providers/vmware/vcd/latest/docs#connecting-as-sys-admin-with-default-org-and-vdc>
- <https://registry.terraform.io/providers/vmware/vcd/latest/docs#argument-reference>

1 change: 1 addition & 0 deletions examples/terraform/vsphere/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ No modules.
| <a name="input_disk_size"></a> [disk\_size](#input\_disk\_size) | disk size | `number` | `50` | no |
| <a name="input_folder_name"></a> [folder\_name](#input\_folder\_name) | folder name | `string` | `"kubeone"` | no |
| <a name="input_initial_machinedeployment_operating_system_profile"></a> [initial\_machinedeployment\_operating\_system\_profile](#input\_initial\_machinedeployment\_operating\_system\_profile) | Name of operating system profile for MachineDeployments, only applicable if operatng-system-manager addon is enabled.<br>If not specified, the default value will be added by machine-controller addon. | `string` | `""` | no |
| <a name="input_initial_machinedeployment_replicas"></a> [initial\_machinedeployment\_replicas](#input\_initial\_machinedeployment\_replicas) | Number of replicas per MachineDeployment | `number` | `1` | no |
| <a name="input_network_name"></a> [network\_name](#input\_network\_name) | network name | `string` | `"public"` | no |
| <a name="input_resource_pool_name"></a> [resource\_pool\_name](#input\_resource\_pool\_name) | cluster resource pool name | `string` | `""` | no |
| <a name="input_ssh_agent_socket"></a> [ssh\_agent\_socket](#input\_ssh\_agent\_socket) | SSH Agent socket, default to grab from $SSH\_AUTH\_SOCK | `string` | `"env:SSH_AUTH_SOCK"` | no |
Expand Down
25 changes: 25 additions & 0 deletions examples/terraform/vsphere/README.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# vSphere Quickstart Terraform configs

The vSphere Quickstart Terraform configs can be used to create the needed
infrastructure for a Kubernetes HA cluster. Check out the following
[Creating Infrastructure guide][docs-infrastructure] to learn more about how to
use the configs and how to provision a Kubernetes cluster using KubeOne.

## Required environment variables

* `VSPHERE_USER`
* `VSPHERE_PASSWORD`
* `VSPHERE_SERVER`
* `VSPHERE_ALLOW_UNVERIFIED_SSL`

## How to prepare a template

See <https://github.com/kubermatic/machine-controller/blob/master/docs/vsphere.md>

## Kubernetes API Server Load Balancing

See the [Terraform loadbalancers in examples document][docs-tf-loadbalancer].

[docs-infrastructure]: https://docs.kubermatic.com/kubeone/master/guides/using_terraform_configs/
[docs-tf-loadbalancer]: https://docs.kubermatic.com/kubeone/master/examples/ha_load_balancing/

1 change: 1 addition & 0 deletions examples/terraform/vsphere_flatcar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ No modules.
| <a name="input_disk_size"></a> [disk\_size](#input\_disk\_size) | disk size | `number` | `50` | no |
| <a name="input_folder_name"></a> [folder\_name](#input\_folder\_name) | folder name | `string` | `"kubeone"` | no |
| <a name="input_initial_machinedeployment_operating_system_profile"></a> [initial\_machinedeployment\_operating\_system\_profile](#input\_initial\_machinedeployment\_operating\_system\_profile) | Name of operating system profile for MachineDeployments, only applicable if operatng-system-manager addon is enabled.<br>If not specified, the default value will be added by machine-controller addon. | `string` | `""` | no |
| <a name="input_initial_machinedeployment_replicas"></a> [initial\_machinedeployment\_replicas](#input\_initial\_machinedeployment\_replicas) | Number of replicas per MachineDeployment | `number` | `1` | no |
| <a name="input_network_name"></a> [network\_name](#input\_network\_name) | network name | `string` | `"public"` | no |
| <a name="input_resource_pool_name"></a> [resource\_pool\_name](#input\_resource\_pool\_name) | cluster resource pool name | `string` | `""` | no |
| <a name="input_ssh_agent_socket"></a> [ssh\_agent\_socket](#input\_ssh\_agent\_socket) | SSH Agent socket, default to grab from $SSH\_AUTH\_SOCK | `string` | `"env:SSH_AUTH_SOCK"` | no |
Expand Down
25 changes: 25 additions & 0 deletions examples/terraform/vsphere_flatcar/README.md.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# vSphere Quickstart Terraform configs

The vSphere Quickstart Terraform configs can be used to create the needed
infrastructure for a Kubernetes HA cluster. Check out the following
[Creating Infrastructure guide][docs-infrastructure] to learn more about how to
use the configs and how to provision a Kubernetes cluster using KubeOne.

## Required environment variables

* `VSPHERE_USER`
* `VSPHERE_PASSWORD`
* `VSPHERE_SERVER`
* `VSPHERE_ALLOW_UNVERIFIED_SSL`

## How to prepare a template

See <https://github.com/kubermatic/machine-controller/blob/master/docs/vsphere.md>

## Kubernetes API Server Load Balancing

See the [Terraform loadbalancers in examples document][docs-tf-loadbalancer].

[docs-infrastructure]: https://docs.kubermatic.com/kubeone/master/guides/using_terraform_configs/
[docs-tf-loadbalancer]: https://docs.kubermatic.com/kubeone/master/examples/ha_load_balancing/

11 changes: 11 additions & 0 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@

set -eu -o pipefail

TERRAFORM_DOCS="go run github.com/terraform-docs/terraform-docs@v0.16.0"

for input in examples/terraform/*/README.md.in; do
dir=$(dirname "$input")
target=$(basename "$input" .in)
full_target="$dir/$target"
echo "$full_target"
cat "$input" > "$dir/$target"
$TERRAFORM_DOCS md "$dir" >> "$dir/$target"
done

export GOFLAGS=-mod=vendor

# The code generation script takes the following arguments:
Expand Down

0 comments on commit f7070ab

Please sign in to comment.