Compare commits

..

2 Commits

Author SHA1 Message Date
d5e9fe017f docs: generated module docs 2022-05-26 22:07:16 +02:00
4be687de81 doc: Add empty readme with build badge 2022-05-26 20:56:42 +02:00
9 changed files with 845 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
## Requirements
The following requirements are needed by this module:
- <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) (~> 2.11)
## Providers
The following providers are used by this module:
- <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) (~> 2.11)
## Modules
No modules.
## Resources
The following resources are used by this module:
- [kubernetes_persistent_volume.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/persistent_volume) (resource)
- [kubernetes_persistent_volume_claim.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/persistent_volume_claim) (resource)
## Required Inputs
The following input variables are required:
### <a name="input_name"></a> [name](#input\_name)
Description: The name of the volume
Type: `string`
### <a name="input_namespace"></a> [namespace](#input\_namespace)
Description: The namespace for the persistent volume claim
Type: `string`
## Optional Inputs
The following input variables are optional (have default values):
### <a name="input_volume_storage_capacity"></a> [volume\_storage\_capacity](#input\_volume\_storage\_capacity)
Description: Size of the persistent volume reported to Kubernetes
Type: `string`
Default: `"1Gi"`
## Outputs
The following outputs are exported:
### <a name="output_host_path"></a> [host\_path](#output\_host\_path)
Description: n/a
### <a name="output_namespace"></a> [namespace](#output\_namespace)
Description: n/a
### <a name="output_persistent_volume"></a> [persistent\_volume](#output\_persistent\_volume)
Description: n/a
### <a name="output_persistent_volume_claim"></a> [persistent\_volume\_claim](#output\_persistent\_volume\_claim)
Description: n/a
### <a name="output_pv_name"></a> [pv\_name](#output\_pv\_name)
Description: n/a
### <a name="output_pvc_name"></a> [pvc\_name](#output\_pvc\_name)
Description: n/a

5
README.md Normal file
View File

@@ -0,0 +1,5 @@
## Terraform modules
[![Build Status](https://drone.thomasklein.me/api/badges/thomasklein/terraform-modules/status.svg)](https://drone.thomasklein.me/thomasklein/terraform-modules)
Here is a collection of various terraform modules I use to keep my homelab dry and tidy.

View File

@@ -0,0 +1,142 @@
## Requirements
The following requirements are needed by this module:
- <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) (~> 2.11)
## Providers
The following providers are used by this module:
- <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) (~> 2.11)
## Modules
No modules.
## Resources
The following resources are used by this module:
- [kubernetes_cluster_role.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/cluster_role) (resource)
- [kubernetes_cluster_role_binding.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/cluster_role_binding) (resource)
- [kubernetes_config_map.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/config_map) (resource)
- [kubernetes_daemonset.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/daemonset) (resource)
- [kubernetes_pod_security_policy.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/pod_security_policy) (resource)
- [kubernetes_service_account.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service_account) (resource)
## Required Inputs
The following input variables are required:
### <a name="input_cluster_cidr"></a> [cluster\_cidr](#input\_cluster\_cidr)
Description: ClusterCIDR
Type: `string`
### <a name="input_vxlan_id"></a> [vxlan\_id](#input\_vxlan\_id)
Description: VXLAN ID (VNI)
Type: `number`
### <a name="input_vxlan_port"></a> [vxlan\_port](#input\_vxlan\_port)
Description: UDP port to use for sending encapsulated packets
Type: `number`
## Optional Inputs
The following input variables are optional (have default values):
### <a name="input_cluster_role_name"></a> [cluster\_role\_name](#input\_cluster\_role\_name)
Description: Name of the cluster role flannel will use
Type: `string`
Default: `"flannel"`
### <a name="input_create_cluster_role"></a> [create\_cluster\_role](#input\_create\_cluster\_role)
Description: Weather or not to create a suitable cluster role or use an already exisiting specified by cluster\_role\_name variable
Type: `bool`
Default: `true`
### <a name="input_daemonset_name"></a> [daemonset\_name](#input\_daemonset\_name)
Description: Name of the daeomonset
Type: `string`
Default: `"flannel"`
### <a name="input_flannel_cni_plugin_image"></a> [flannel\_cni\_plugin\_image](#input\_flannel\_cni\_plugin\_image)
Description: n/a
Type: `string`
Default: `"rancher/mirrored-flannelcni-flannel-cni-plugin:v1.0.1"`
### <a name="input_flannel_image"></a> [flannel\_image](#input\_flannel\_image)
Description: n/a
Type: `string`
Default: `"rancher/mirrored-flannelcni-flannel:v0.17.0"`
### <a name="input_namespace"></a> [namespace](#input\_namespace)
Description: namespace for resources
Type: `string`
Default: `"kube-system"`
### <a name="input_node_selector_os"></a> [node\_selector\_os](#input\_node\_selector\_os)
Description: Which kubernetes.io/os node-label to match for execution
Type: `list(string)`
Default:
```json
[
"linux"
]
```
## Outputs
The following outputs are exported:
### <a name="output_cluster_role"></a> [cluster\_role](#output\_cluster\_role)
Description: n/a
### <a name="output_cluster_role_binding"></a> [cluster\_role\_binding](#output\_cluster\_role\_binding)
Description: n/a
### <a name="output_configmap"></a> [configmap](#output\_configmap)
Description: n/a
### <a name="output_daemonset"></a> [daemonset](#output\_daemonset)
Description: n/a
### <a name="output_pod_security_policy"></a> [pod\_security\_policy](#output\_pod\_security\_policy)
Description: n/a
### <a name="output_service_account"></a> [service\_account](#output\_service\_account)
Description: n/a

View File

@@ -0,0 +1,103 @@
## Requirements
The following requirements are needed by this module:
- <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) (~> 2.11)
## Providers
The following providers are used by this module:
- <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) (~> 2.11)
## Modules
No modules.
## Resources
The following resources are used by this module:
- [kubernetes_cluster_role_binding.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/cluster_role_binding) (resource)
- [kubernetes_config_map.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/config_map) (resource)
- [kubernetes_daemonset.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/daemonset) (resource)
- [kubernetes_service.prometheus](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service) (resource)
- [kubernetes_service_account.this](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/service_account) (resource)
## Required Inputs
The following input variables are required:
### <a name="input_cluster_cidr"></a> [cluster\_cidr](#input\_cluster\_cidr)
Description: Kubernetes cluster CIDR
Type: `string`
### <a name="input_kubernetes_server"></a> [kubernetes\_server](#input\_kubernetes\_server)
Description: Kubernetes (master) server address (eg: https://k8s.my.domain:6443/)
Type: `string`
### <a name="input_kubernetes_version"></a> [kubernetes\_version](#input\_kubernetes\_version)
Description: Kubernetes cluster version (eg: 1.23.5)
Type: `string`
## Optional Inputs
The following input variables are optional (have default values):
### <a name="input_additional_config"></a> [additional\_config](#input\_additional\_config)
Description: n/a
Type: `map(any)`
Default: `{}`
### <a name="input_daemonset_name"></a> [daemonset\_name](#input\_daemonset\_name)
Description: n/a
Type: `string`
Default: `"kube-proxy"`
### <a name="input_mode"></a> [mode](#input\_mode)
Description: n/a
Type: `string`
Default: `"iptables"`
### <a name="input_namespace"></a> [namespace](#input\_namespace)
Description: n/a
Type: `string`
Default: `"kube-system"`
## Outputs
The following outputs are exported:
### <a name="output_cluster_role_binding"></a> [cluster\_role\_binding](#output\_cluster\_role\_binding)
Description: n/a
### <a name="output_configmap"></a> [configmap](#output\_configmap)
Description: n/a
### <a name="output_daemonset"></a> [daemonset](#output\_daemonset)
Description: n/a
### <a name="output_service_account"></a> [service\_account](#output\_service\_account)
Description: n/a

View File

@@ -0,0 +1,96 @@
## Requirements
The following requirements are needed by this module:
- <a name="requirement_dns"></a> [dns](#requirement\_dns) (~> 3.2)
## Providers
The following providers are used by this module:
- <a name="provider_dns"></a> [dns](#provider\_dns) (~> 3.2)
## Modules
No modules.
## Resources
The following resources are used by this module:
- [dns_a_record_set.this](https://registry.terraform.io/providers/hashicorp/dns/latest/docs/resources/a_record_set) (resource)
- [dns_ptr_record.this](https://registry.terraform.io/providers/hashicorp/dns/latest/docs/resources/ptr_record) (resource)
## Required Inputs
The following input variables are required:
### <a name="input_id"></a> [id](#input\_id)
Description: The ID for the VM that will be transposed into an IP address
Type: `number`
### <a name="input_interface"></a> [interface](#input\_interface)
Description: Which interface should be used. Can be either nat or internal
Type: `string`
### <a name="input_name"></a> [name](#input\_name)
Description: The domain name for the vm
Type: `string`
## Optional Inputs
The following input variables are optional (have default values):
### <a name="input_ttl"></a> [ttl](#input\_ttl)
Description: TTL value for the new records
Type: `number`
Default: `300`
## Outputs
The following outputs are exported:
### <a name="output_cidr"></a> [cidr](#output\_cidr)
Description: n/a
### <a name="output_fqdn"></a> [fqdn](#output\_fqdn)
Description: n/a
### <a name="output_gateway"></a> [gateway](#output\_gateway)
Description: n/a
### <a name="output_interface"></a> [interface](#output\_interface)
Description: n/a
### <a name="output_ip_address"></a> [ip\_address](#output\_ip\_address)
Description: n/a
### <a name="output_lawndale_interface"></a> [lawndale\_interface](#output\_lawndale\_interface)
Description: n/a
### <a name="output_name"></a> [name](#output\_name)
Description: n/a
### <a name="output_nameserver"></a> [nameserver](#output\_nameserver)
Description: n/a
### <a name="output_search_domains"></a> [search\_domains](#output\_search\_domains)
Description: n/a

182
lawndale-vm/README.md Normal file
View File

@@ -0,0 +1,182 @@
## Requirements
The following requirements are needed by this module:
- <a name="requirement_libvirt"></a> [libvirt](#requirement\_libvirt) (~> 0.6.14)
- <a name="requirement_macaddress"></a> [macaddress](#requirement\_macaddress) (~> 0.3.0)
## Providers
The following providers are used by this module:
- <a name="provider_libvirt"></a> [libvirt](#provider\_libvirt) (~> 0.6.14)
- <a name="provider_macaddress"></a> [macaddress](#provider\_macaddress) (~> 0.3.0)
## Modules
The following Modules are called:
### <a name="module_ipam"></a> [ipam](#module\_ipam)
Source: ../../modules/lawndale-vm-ipam
Version:
## Resources
The following resources are used by this module:
- [libvirt_cloudinit_disk.this](https://registry.terraform.io/providers/dmacvicar/libvirt/latest/docs/resources/cloudinit_disk) (resource)
- [libvirt_domain.this](https://registry.terraform.io/providers/dmacvicar/libvirt/latest/docs/resources/domain) (resource)
- [libvirt_pool.this](https://registry.terraform.io/providers/dmacvicar/libvirt/latest/docs/resources/pool) (resource)
- [libvirt_volume.this](https://registry.terraform.io/providers/dmacvicar/libvirt/latest/docs/resources/volume) (resource)
- [macaddress_macaddress.this](https://registry.terraform.io/providers/ivoronin/macaddress/latest/docs/resources/macaddress) (resource)
## Required Inputs
The following input variables are required:
### <a name="input_base_image_pool"></a> [base\_image\_pool](#input\_base\_image\_pool)
Description: Base image storage pool
Type: `string`
### <a name="input_base_image_volume"></a> [base\_image\_volume](#input\_base\_image\_volume)
Description: Base image storage pool
Type: `string`
### <a name="input_description"></a> [description](#input\_description)
Description: (Short) Description for the virtual machine
Type: `string`
### <a name="input_id"></a> [id](#input\_id)
Description: The lawndale id of the virtual machine
Type: `number`
### <a name="input_interface"></a> [interface](#input\_interface)
Description: Network interface to attach the vm on
Type: `string`
### <a name="input_memory_mb"></a> [memory\_mb](#input\_memory\_mb)
Description: VM memory allocation in megabytes
Type: `number`
### <a name="input_name"></a> [name](#input\_name)
Description: The name of the virtual machine (must be a [-\_a-z0-9])
Type: `string`
### <a name="input_root_storage_volume_size_gb"></a> [root\_storage\_volume\_size\_gb](#input\_root\_storage\_volume\_size\_gb)
Description: The size of the storage volume (in gigabytes)
Type: `number`
### <a name="input_user_data"></a> [user\_data](#input\_user\_data)
Description: Cloud-init userdata script to run
Type: `string`
## Optional Inputs
The following input variables are optional (have default values):
### <a name="input_autostart"></a> [autostart](#input\_autostart)
Description: Start the VM at host start?
Type: `bool`
Default: `true`
### <a name="input_create_root_storage_pool"></a> [create\_root\_storage\_pool](#input\_create\_root\_storage\_pool)
Description: Create the storage pool as part of the module
Type: `bool`
Default: `true`
### <a name="input_filesystems"></a> [filesystems](#input\_filesystems)
Description: 9p shared filesystem devices
Type:
```hcl
list(object({
source = string
target = string
accessmode = string
readonly = bool
}))
```
Default: `[]`
### <a name="input_meta_data"></a> [meta\_data](#input\_meta\_data)
Description: Cloud-init meta-data
Type: `string`
Default: `null`
### <a name="input_network_config"></a> [network\_config](#input\_network\_config)
Description: Cloud-init network config
Type: `string`
Default: `null`
### <a name="input_root_storage_pool"></a> [root\_storage\_pool](#input\_root\_storage\_pool)
Description: The name of the storage pool. It will default to the VM name
Type: `string`
Default: `""`
### <a name="input_root_storage_volume_name"></a> [root\_storage\_volume\_name](#input\_root\_storage\_volume\_name)
Description: the name of the storage volume (must be unique in the pool)
Type: `string`
Default: `""`
### <a name="input_vcpu"></a> [vcpu](#input\_vcpu)
Description: CPU count
Type: `number`
Default: `1`
### <a name="input_xslt"></a> [xslt](#input\_xslt)
Description: XSLT applied to the domain before sent to libvirt
Type: `string`
Default: `null`
## Outputs
No outputs.

View File

@@ -0,0 +1,101 @@
## Requirements
The following requirements are needed by this module:
- <a name="requirement_aws"></a> [aws](#requirement\_aws) (~> 4.9)
## Providers
The following providers are used by this module:
- <a name="provider_aws"></a> [aws](#provider\_aws) (~> 4.9)
## Modules
No modules.
## Resources
The following resources are used by this module:
- [aws_iam_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) (resource)
- [aws_iam_role.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) (resource)
- [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) (data source)
## Required Inputs
The following input variables are required:
### <a name="input_bucket_name"></a> [bucket\_name](#input\_bucket\_name)
Description: n/a
Type: `string`
### <a name="input_dynamo_table"></a> [dynamo\_table](#input\_dynamo\_table)
Description: n/a
Type: `string`
### <a name="input_prefixes"></a> [prefixes](#input\_prefixes)
Description: n/a
Type: `list(string)`
## Optional Inputs
The following input variables are optional (have default values):
### <a name="input_create_policy"></a> [create\_policy](#input\_create\_policy)
Description: n/a
Type: `bool`
Default: `false`
### <a name="input_create_role"></a> [create\_role](#input\_create\_role)
Description: n/a
Type: `bool`
Default: `false`
### <a name="input_policy_name"></a> [policy\_name](#input\_policy\_name)
Description: n/a
Type: `string`
Default: `null`
### <a name="input_policy_path"></a> [policy\_path](#input\_policy\_path)
Description: n/a
Type: `string`
Default: `"/"`
### <a name="input_role_name"></a> [role\_name](#input\_role\_name)
Description: n/a
Type: `string`
Default: `null`
## Outputs
The following outputs are exported:
### <a name="output_policy_arn"></a> [policy\_arn](#output\_policy\_arn)
Description: n/a
### <a name="output_role_arn"></a> [role\_arn](#output\_role\_arn)
Description: n/a

120
remote-state/README.md Normal file
View File

@@ -0,0 +1,120 @@
## Requirements
The following requirements are needed by this module:
- <a name="requirement_aws"></a> [aws](#requirement\_aws) (~> 4.9)
## Providers
The following providers are used by this module:
- <a name="provider_aws"></a> [aws](#provider\_aws) (~> 4.9)
## Modules
The following Modules are called:
### <a name="module_states_bucket"></a> [states\_bucket](#module\_states\_bucket)
Source: terraform-aws-modules/s3-bucket/aws
Version:
## Resources
The following resources are used by this module:
- [aws_dynamodb_table.lock](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/dynamodb_table) (resource)
- [aws_iam_policy.terraform](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) (resource)
- [aws_kms_key.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) (resource)
- [aws_iam_policy_document.access_state](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) (data source)
- [aws_iam_policy_document.force_secure_transport](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) (data source)
- [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) (data source)
## Required Inputs
No required inputs.
## Optional Inputs
The following input variables are optional (have default values):
### <a name="input_bucket_name_override"></a> [bucket\_name\_override](#input\_bucket\_name\_override)
Description: Explicit name for the remote state bucket. If not specified, the bucket will be named as {name\_prefix}-{region\_name}-states
Type: `string`
Default: `null`
### <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix)
Description: Resource names prefixed by this string.
Type: `string`
Default: `null`
### <a name="input_table_billing_mode"></a> [table\_billing\_mode](#input\_table\_billing\_mode)
Description: Table billing mode. Can be PAY\_PER\_REQUEST or PROVISIONED
Type: `string`
Default: `"PAY_PER_REQUEST"`
### <a name="input_table_encryption_at_rest"></a> [table\_encryption\_at\_rest](#input\_table\_encryption\_at\_rest)
Description: Wheather or not apply encryption at rest for the DynamoDB.
Type: `bool`
Default: `false`
### <a name="input_table_name_override"></a> [table\_name\_override](#input\_table\_name\_override)
Description: Explicit name for the remote state lock DynamoDB table. If not specified, the table will be named as {name\_prefix}-{region\_name}-tf-state-locks
Type: `string`
Default: `null`
### <a name="input_table_read_capacity"></a> [table\_read\_capacity](#input\_table\_read\_capacity)
Description: (Optional) The number of read units for this table. If the billing\_mode is PROVISIONED, this field is required
Type: `number`
Default: `0`
### <a name="input_table_write_capacity"></a> [table\_write\_capacity](#input\_table\_write\_capacity)
Description: (Optional) The number of write units for the lock table. If the billing\_mode is PROVISIONED, this field is required
Type: `number`
Default: `0`
## Outputs
The following outputs are exported:
### <a name="output_bucket_name"></a> [bucket\_name](#output\_bucket\_name)
Description: n/a
### <a name="output_kms_key"></a> [kms\_key](#output\_kms\_key)
Description: n/a
### <a name="output_lock_table"></a> [lock\_table](#output\_lock\_table)
Description: n/a
### <a name="output_lock_table_name"></a> [lock\_table\_name](#output\_lock\_table\_name)
Description: n/a
### <a name="output_terraform_policy"></a> [terraform\_policy](#output\_terraform\_policy)
Description: n/a

18
scripts/generate-docs.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
for DIR in $(find . -type d); do
if [[ "${DIR}" = "." ]] || [[ $(echo ${DIR} | cut -c1-5) = ".git/" ]]; then
continue;
fi
pushd $DIR
terraform_files=$(find . -maxdepth 1 -type f -iname '*.tf')
if [[ ${#terraform_files} -eq 0 ]]; then
popd
continue
fi
terraform-docs markdown document . > README.md
popd
done