diff --git a/.drone.yaml b/.drone.yaml new file mode 100644 index 0000000..b375dab --- /dev/null +++ b/.drone.yaml @@ -0,0 +1,117 @@ +--- +kind: pipeline +name: default +type: kubernetes + +steps: + - name: tf-apply + image: autonomy/build-container:latest + pull: always + environment: + ARM_SUBSCRIPTION_ID: + from_secret: 'azure_subscription_id' + AZURE_STORAGE_ACCOUNT: + from_secret: 'az_storage_account' + ARM_CLIENT_ID: + from_secret: 'az_storage_user' + ARM_CLIENT_SECRET: + from_secret: 'az_storage_pass' + ARM_TENANT_ID: + from_secret: 'azure_tenant_id' + AWS_ACCESS_KEY_ID: + from_secret: 'aws_access_key_id' + AWS_SECRET_ACCESS_KEY: + from_secret: 'aws_secret_access_key' + commands: + - apk add --no-cache terraform + - mkdir -p _out + - cp hack/backend.tf examples/terraform/${TYPE}/backend.tf + - az login --service-principal -u "$${ARM_CLIENT_ID}" -p "$${ARM_CLIENT_SECRET}" --tenant "$${ARM_TENANT_ID}" + - az storage blob download-batch --overwrite -d _out --pattern "e2e-$${TYPE}-generated/*" -s ${BUCKET_PATH} + # copying the downloaded vars + - mv _out/e2e-${TYPE}-generated/* examples/terraform/${TYPE} + - terraform -chdir=examples/terraform/${TYPE} init -backend-config="resource_group_name=General" -backend-config="storage_account_name=$${AZURE_STORAGE_ACCOUNT}" -backend-config="container_name=${BUCKET_PATH}" -backend-config="key=${TYPE}-terraform.tfstate" + # - terraform -chdir=examples/terraform/${TYPE} plan -var-file="vars.json" + - terraform -chdir=examples/terraform/${TYPE} apply -auto-approve -var-file="vars.json" + - terraform -chdir=examples/terraform/${TYPE} output -raw talosconfig > talosconfig + - terraform -chdir=examples/terraform/${TYPE} output -raw kubeconfig > kubeconfig + - az storage blob upload --overwrite -f talosconfig -n e2e-${TYPE}-talosconfig -c ${BUCKET_PATH} + - az storage blob upload --overwrite -f kubeconfig -n e2e-${TYPE}-kubeconfig -c ${BUCKET_PATH} + when: + event: + - promote + target: + - e2e-talos-tf-apply + - name: tf-destroy + image: autonomy/build-container:latest + pull: always + environment: + ARM_SUBSCRIPTION_ID: + from_secret: 'azure_subscription_id' + AZURE_STORAGE_ACCOUNT: + from_secret: 'az_storage_account' + ARM_CLIENT_ID: + from_secret: 'az_storage_user' + ARM_CLIENT_SECRET: + from_secret: 'az_storage_pass' + ARM_TENANT_ID: + from_secret: 'azure_tenant_id' + AWS_ACCESS_KEY_ID: + from_secret: 'aws_access_key_id' + AWS_SECRET_ACCESS_KEY: + from_secret: 'aws_secret_access_key' + commands: + - apk add --no-cache terraform + - cp hack/backend.tf examples/terraform/${TYPE}/backend.tf + - terraform -chdir=examples/terraform/${TYPE} init -backend-config="resource_group_name=General" -backend-config="storage_account_name=$${AZURE_STORAGE_ACCOUNT}" -backend-config="container_name=${BUCKET_PATH}" -backend-config="key=${TYPE}-terraform.tfstate" + # lets remove the talosconfig/kubeconfig data source so destroy is not blocked + - terraform -chdir=examples/terraform/${TYPE} state rm data.talos_client_configuration.this data.talos_cluster_kubeconfig.this + - terraform -chdir=examples/terraform/${TYPE} apply -destroy -auto-approve + when: + event: + - promote + target: + - e2e-talos-tf-destroy + +trigger: + event: + exclude: + - tag + - push + - pull_request + branch: + exclude: + - renovate/* + - dependabot/* + +--- +kind: pipeline +type: kubernetes +name: notify + +clone: + disable: true + +steps: + - name: slack + image: plugins/slack + settings: + webhook: + from_secret: slack_webhook + channel: proj-talos-maintainers + when: + status: + - success + - failure + +trigger: + branch: + exclude: + - renovate/* + - dependabot/* + status: + - success + - failure + +depends_on: + - default diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 06edc83..9b089e7 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -13,6 +13,10 @@ jobs: uses: hashicorp/setup-terraform@v2 with: terraform_wrapper: false + - name: Setup TF docs + uses: jaxxstorm/action-install-gh-release@v1.10.0 + with: + repo: terraform-docs/terraform-docs - name: dirty-check run: | make check-dirty diff --git a/Makefile b/Makefile index ba75098..5b1c702 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ TAG ?= $(shell git describe --tag --always --dirty) +TF_PROJECTS := $(shell find examples/terraform/ -name '.terraform' -prune -o -name 'main.tf' -exec dirname {} \;) + # renovate: datasource=helm depName=aws-cloud-controller-manager AWS_CCM_HELM_CHART_VERSION ?= 0.0.7 # renovate: datasource=github-releases depName=kubernetes/cloud-provider-aws @@ -10,7 +12,10 @@ fmt: terraform fmt -recursive .PHONY: generate -generate: aws-ccm +generate: aws-ccm tfdocs + +tfdocs: + $(foreach project,$(TF_PROJECTS),terraform-docs markdown --output-file README.md --output-mode inject $(project);) .PHONY: check-dirty check-dirty: fmt generate ## Verifies that source tree is not dirty diff --git a/examples/terraform/advanced/README.md b/examples/terraform/advanced/README.md index a228f0a..83c45c7 100644 --- a/examples/terraform/advanced/README.md +++ b/examples/terraform/advanced/README.md @@ -19,3 +19,73 @@ If different configurations are required, override them through command line wit Destroying the cluster should, again, be a simple `terraform destroy`. Getting the kubeconfig and talosconfig for this cluster can be done with `terraform output -raw kubeconfig > ` and `terraform output -raw talosconfig > `. + + +## Requirements + +| Name | Version | +|------|---------| +| [libvirt](#requirement\_libvirt) | 0.7.1 | +| [random](#requirement\_random) | 3.5.1 | +| [talos](#requirement\_talos) | 0.2.0 | +| [tls](#requirement\_tls) | 4.0.4 | + +## Providers + +| Name | Version | +|------|---------| +| [libvirt](#provider\_libvirt) | 0.7.1 | +| [random](#provider\_random) | 3.5.1 | +| [talos](#provider\_talos) | 0.2.0 | +| [tls](#provider\_tls) | 4.0.4 | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [bootstrap\_token](#module\_bootstrap\_token) | ./modules/bootstrap_token | n/a | +| [trustdinfo\_token](#module\_trustdinfo\_token) | ./modules/bootstrap_token | n/a | + +## Resources + +| Name | Type | +|------|------| +| [libvirt_domain.cp](https://registry.terraform.io/providers/dmacvicar/libvirt/0.7.1/docs/resources/domain) | resource | +| [libvirt_volume.cp](https://registry.terraform.io/providers/dmacvicar/libvirt/0.7.1/docs/resources/volume) | resource | +| [random_id.cluster_id](https://registry.terraform.io/providers/hashicorp/random/3.5.1/docs/resources/id) | resource | +| [random_id.cluster_secret](https://registry.terraform.io/providers/hashicorp/random/3.5.1/docs/resources/id) | resource | +| [random_id.secretbox_encryption_secret](https://registry.terraform.io/providers/hashicorp/random/3.5.1/docs/resources/id) | resource | +| [talos_machine_bootstrap.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_bootstrap) | resource | +| [talos_machine_configuration_apply.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_configuration_apply) | resource | +| [tls_cert_request.client_csr](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/cert_request) | resource | +| [tls_cert_request.k8s_client_csr](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/cert_request) | resource | +| [tls_locally_signed_cert.client_cert](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/locally_signed_cert) | resource | +| [tls_locally_signed_cert.k8s_client_cert](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/locally_signed_cert) | resource | +| [tls_private_key.client_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [tls_private_key.etcd_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [tls_private_key.k8s_aggregator_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [tls_private_key.k8s_client_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [tls_private_key.k8s_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [tls_private_key.k8s_serviceaccount_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [tls_private_key.os_key](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/private_key) | resource | +| [tls_self_signed_cert.etcd_cert](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/self_signed_cert) | resource | +| [tls_self_signed_cert.k8s_aggregator_cert](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/self_signed_cert) | resource | +| [tls_self_signed_cert.k8s_cert](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/self_signed_cert) | resource | +| [tls_self_signed_cert.os_cert](https://registry.terraform.io/providers/hashicorp/tls/4.0.4/docs/resources/self_signed_cert) | resource | +| [talos_client_configuration.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/client_configuration) | data source | +| [talos_machine_configuration.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [cluster\_name](#input\_cluster\_name) | A name to provide for the Talos cluster | `string` | n/a | yes | +| [iso\_path](#input\_iso\_path) | Path to the Talos ISO | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [kubeconfig](#output\_kubeconfig) | n/a | +| [talosconfig](#output\_talosconfig) | n/a | + \ No newline at end of file diff --git a/examples/terraform/advanced/modules/bootstrap_token/README.md b/examples/terraform/advanced/modules/bootstrap_token/README.md new file mode 100644 index 0000000..b8acc7f --- /dev/null +++ b/examples/terraform/advanced/modules/bootstrap_token/README.md @@ -0,0 +1,34 @@ + +## Requirements + +| Name | Version | +|------|---------| +| [random](#requirement\_random) | 3.5.1 | + +## Providers + +| Name | Version | +|------|---------| +| [random](#provider\_random) | 3.5.1 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [random_string.token_prefix](https://registry.terraform.io/providers/hashicorp/random/3.5.1/docs/resources/string) | resource | +| [random_string.token_suffix](https://registry.terraform.io/providers/hashicorp/random/3.5.1/docs/resources/string) | resource | + +## Inputs + +No inputs. + +## Outputs + +| Name | Description | +|------|-------------| +| [bootstrap\_token](#output\_bootstrap\_token) | n/a | + \ No newline at end of file diff --git a/examples/terraform/aws/README.md b/examples/terraform/aws/README.md index a08b0be..e2d4f76 100644 --- a/examples/terraform/aws/README.md +++ b/examples/terraform/aws/README.md @@ -1,19 +1,75 @@ -# AWS Terraform Example + +## Requirements -This example will create a load-balanced, HA Talos cluster on AWS. -It will use the official Sidero Labs AMI of Talos that is present and should result in a stable, maintainable cluster. +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | ~> 1.3 | +| [aws](#requirement\_aws) | ~> 4.0 | +| [talos](#requirement\_talos) | 0.3.0-beta.0 | -## Prereqs +## Providers -Ensure your AWS environment is configured correctly (see https://registry.terraform.io/providers/hashicorp/aws/latest/docs#environment-variables and https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html for details). -From this directory, issue `terraform init` to ensure the proper providers are pulled down. +| Name | Version | +|------|---------| +| [aws](#provider\_aws) | 4.67.0 | +| [talos](#provider\_talos) | 0.3.0-beta.0 | -## Usage +## Modules -To create a default cluster, this should be as simple as `terraform apply`. -This will create a cluster called `talos-aws-example` with 3 control plane nodes and a single worker in the default AWS region. -By default, the instances will be `c5.large`, with 2 VPU and 4GB RAM each. -If different specs or regions are required, override them through command line with the `-var` flag or by creating a varsfile and overriding with `-var-file`. -Destroying the cluster should, again, be a simple `terraform destroy`. +| Name | Source | Version | +|------|--------|---------| +| [cluster\_sg](#module\_cluster\_sg) | terraform-aws-modules/security-group/aws | ~> 4.0 | +| [elb\_k8s\_elb](#module\_elb\_k8s\_elb) | terraform-aws-modules/elb/aws | ~> 4.0 | +| [kubernetes\_api\_sg](#module\_kubernetes\_api\_sg) | terraform-aws-modules/security-group/aws//modules/https-443 | ~> 4.0 | +| [talos\_control\_plane\_nodes](#module\_talos\_control\_plane\_nodes) | terraform-aws-modules/ec2-instance/aws | ~> 4.0 | +| [talos\_worker\_group](#module\_talos\_worker\_group) | terraform-aws-modules/ec2-instance/aws | ~> 4.0 | +| [talos\_worker\_nodes](#module\_talos\_worker\_nodes) | terraform-aws-modules/ec2-instance/aws | ~> 4.0 | +| [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 3.0 | -Getting the kubeconfig and talosconfig for this cluster can be done with `terraform output -raw kubeconfig > ` and `terraform output -raw talosconfig > ` +## Resources + +| Name | Type | +|------|------| +| [aws_iam_policy.control_plane_ccm_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | +| [aws_iam_policy.worker_ccm_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource | +| [talos_machine_bootstrap.this](https://registry.terraform.io/providers/siderolabs/talos/0.3.0-beta.0/docs/resources/machine_bootstrap) | resource | +| [talos_machine_configuration_apply.controlplane](https://registry.terraform.io/providers/siderolabs/talos/0.3.0-beta.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_configuration_apply.worker](https://registry.terraform.io/providers/siderolabs/talos/0.3.0-beta.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_configuration_apply.worker_group](https://registry.terraform.io/providers/siderolabs/talos/0.3.0-beta.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_secrets.this](https://registry.terraform.io/providers/siderolabs/talos/0.3.0-beta.0/docs/resources/machine_secrets) | resource | +| [aws_ami.talos](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) | data source | +| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source | +| [talos_client_configuration.this](https://registry.terraform.io/providers/siderolabs/talos/0.3.0-beta.0/docs/data-sources/client_configuration) | data source | +| [talos_cluster_kubeconfig.this](https://registry.terraform.io/providers/siderolabs/talos/0.3.0-beta.0/docs/data-sources/cluster_kubeconfig) | data source | +| [talos_machine_configuration.controlplane](https://registry.terraform.io/providers/siderolabs/talos/0.3.0-beta.0/docs/data-sources/machine_configuration) | data source | +| [talos_machine_configuration.worker](https://registry.terraform.io/providers/siderolabs/talos/0.3.0-beta.0/docs/data-sources/machine_configuration) | data source | +| [talos_machine_configuration.worker_group](https://registry.terraform.io/providers/siderolabs/talos/0.3.0-beta.0/docs/data-sources/machine_configuration) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [ami\_id](#input\_ami\_id) | AMI ID to use for talos nodes, if not set the latest talos release ami id will be looked up | `string` | `""` | no | +| [ccm](#input\_ccm) | Whether to deploy aws cloud controller manager | `bool` | `false` | no | +| [cluster\_name](#input\_cluster\_name) | Name of cluster | `string` | `"talos-aws-example"` | no | +| [config\_patch\_files](#input\_config\_patch\_files) | Path to talos config path files that applies to all nodes | `list(string)` | `[]` | no | +| [config\_patch\_files\_control\_plane](#input\_config\_patch\_files\_control\_plane) | Path to talos config path files that applies to all control plane nodes | `list(string)` | `[]` | no | +| [config\_patch\_files\_worker](#input\_config\_patch\_files\_worker) | Path to talos config path files that applies to all worker nodes | `list(string)` | `[]` | no | +| [extra\_tags](#input\_extra\_tags) | Extra tags to add to the cluster cloud resources | `map(string)` | `{}` | no | +| [instance\_type\_control\_plane](#input\_instance\_type\_control\_plane) | Instance type to use for the control plane nodes | `string` | `"c5.large"` | no | +| [instance\_type\_worker](#input\_instance\_type\_worker) | Instance type to use for the worker nodes | `string` | `"c5.large"` | no | +| [kubernetes\_api\_allowed\_cidr](#input\_kubernetes\_api\_allowed\_cidr) | The CIDR from which to allow to access the Kubernetes API | `string` | `"0.0.0.0/0"` | no | +| [kubernetes\_version](#input\_kubernetes\_version) | Kubernetes version to use for the cluster, if not set the k8s version shipped with the talos sdk version will be used | `string` | `null` | no | +| [num\_control\_planes](#input\_num\_control\_planes) | Number of control plane nodes to create | `number` | `3` | no | +| [num\_workers](#input\_num\_workers) | Number of worker nodes to create | `number` | `1` | no | +| [talos\_api\_allowed\_cidr](#input\_talos\_api\_allowed\_cidr) | The CIDR from which to allow to access the Talos API | `string` | `"0.0.0.0/0"` | no | +| [vpc\_cidr](#input\_vpc\_cidr) | The IPv4 CIDR block for the VPC. | `string` | `"172.16.0.0/16"` | no | +| [worker\_groups](#input\_worker\_groups) | List of node worker node groups to create |
list(object({
name = string
instance_type = string
num_instances = optional(number, 1)
instance_profile = optional(string, null)
kubernetes_version = optional(string, null)
config_patch_files = optional(list(string), [])
tags = optional(map(string), {})
}))
| `[]` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [kubeconfig](#output\_kubeconfig) | The generated kubeconfig. | +| [talosconfig](#output\_talosconfig) | The generated talosconfig. | + \ No newline at end of file diff --git a/examples/terraform/aws/outputs.tf b/examples/terraform/aws/outputs.tf index bfa7d25..6f1a1cc 100644 --- a/examples/terraform/aws/outputs.tf +++ b/examples/terraform/aws/outputs.tf @@ -1,9 +1,11 @@ output "talosconfig" { - value = data.talos_client_configuration.this.talos_config - sensitive = true + description = "The generated talosconfig." + value = data.talos_client_configuration.this.talos_config + sensitive = true } output "kubeconfig" { - value = data.talos_cluster_kubeconfig.this.kubeconfig_raw - sensitive = true + description = "The generated kubeconfig." + value = data.talos_cluster_kubeconfig.this.kubeconfig_raw + sensitive = true } diff --git a/examples/terraform/azure/README.md b/examples/terraform/azure/README.md index 228b830..fad7ede 100644 --- a/examples/terraform/azure/README.md +++ b/examples/terraform/azure/README.md @@ -36,3 +36,70 @@ Destroying the cluster should, again, be a simple `terraform destroy`. Getting the kubeconfig and talosconfig for this cluster can be done with `terraform output -raw kubeconfig > ` and `terraform output -raw talosconfig > ` + + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | ~> 1.3 | +| [azurerm](#requirement\_azurerm) | ~> 3.0 | +| [talos](#requirement\_talos) | 0.2.0 | + +## Providers + +| Name | Version | +|------|---------| +| [azurerm](#provider\_azurerm) | 3.53.0 | +| [talos](#provider\_talos) | 0.2.0 | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [control\_plane\_sg](#module\_control\_plane\_sg) | Azure/network-security-group/azurerm | ~> 3.0 | +| [kubernetes\_api\_lb](#module\_kubernetes\_api\_lb) | Azure/loadbalancer/azurerm | ~> 4.0 | +| [talos\_control\_plane\_nodes](#module\_talos\_control\_plane\_nodes) | Azure/compute/azurerm | ~> 5.0 | +| [talos\_worker\_nodes](#module\_talos\_worker\_nodes) | Azure/compute/azurerm | ~> 5.0 | +| [vnet](#module\_vnet) | Azure/network/azurerm | ~> 5.0 | + +## Resources + +| Name | Type | +|------|------| +| [azurerm_image.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/image) | resource | +| [azurerm_network_interface_backend_address_pool_association.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_interface_backend_address_pool_association) | resource | +| [azurerm_resource_group.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) | resource | +| [azurerm_storage_account.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_account) | resource | +| [azurerm_storage_blob.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_blob) | resource | +| [azurerm_storage_container.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_container) | resource | +| [talos_machine_bootstrap.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_bootstrap) | resource | +| [talos_machine_configuration_apply.controlplane](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_configuration_apply.worker](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_secrets.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_secrets) | resource | +| [talos_client_configuration.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/client_configuration) | data source | +| [talos_cluster_kubeconfig.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/cluster_kubeconfig) | data source | +| [talos_machine_configuration.controlplane](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | +| [talos_machine_configuration.worker](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [azure\_location](#input\_azure\_location) | Azure location to use | `string` | `"West Europe"` | no | +| [cluster\_name](#input\_cluster\_name) | Name of cluster | `string` | `"talos-azure-example"` | no | +| [image\_file](#input\_image\_file) | Path to the Talos image file to be used for the virtual machines | `string` | `"./disk.vhd"` | no | +| [kubernetes\_api\_allowed\_cidr](#input\_kubernetes\_api\_allowed\_cidr) | The CIDR from which to allow to access the Kubernetes API | `string` | `"0.0.0.0/0"` | no | +| [num\_control\_planes](#input\_num\_control\_planes) | Number of control plane nodes to create | `number` | `3` | no | +| [num\_workers](#input\_num\_workers) | Number of worker nodes to create | `number` | `1` | no | +| [talos\_api\_allowed\_cidr](#input\_talos\_api\_allowed\_cidr) | The CIDR from which to allow to access the Talos API | `string` | `"0.0.0.0/0"` | no | +| [vm\_size](#input\_vm\_size) | VM size to use for the nodes | `string` | `"Standard_B2s"` | no | +| [vnet\_cidr](#input\_vnet\_cidr) | The IPv4 CIDR block for the Virtual Network. | `string` | `"172.16.0.0/16"` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [kubeconfig](#output\_kubeconfig) | n/a | +| [talosconfig](#output\_talosconfig) | n/a | + \ No newline at end of file diff --git a/examples/terraform/basic/README.md b/examples/terraform/basic/README.md index 27df1cd..ceeb6a2 100644 --- a/examples/terraform/basic/README.md +++ b/examples/terraform/basic/README.md @@ -18,3 +18,49 @@ If different configurations are required, override them through command line wit Destroying the cluster should, again, be a simple `terraform destroy`. Getting the kubeconfig and talosconfig for this cluster can be done with `terraform output -raw kubeconfig > ` and `terraform output -raw talosconfig > `. + + +## Requirements + +| Name | Version | +|------|---------| +| [talos](#requirement\_talos) | 0.2.0 | + +## Providers + +| Name | Version | +|------|---------| +| [talos](#provider\_talos) | 0.2.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [talos_machine_bootstrap.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_bootstrap) | resource | +| [talos_machine_configuration_apply.controlplane](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_configuration_apply.worker](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_secrets.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_secrets) | resource | +| [talos_client_configuration.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/client_configuration) | data source | +| [talos_cluster_kubeconfig.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/cluster_kubeconfig) | data source | +| [talos_machine_configuration.controlplane](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | +| [talos_machine_configuration.worker](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [cluster\_endpoint](#input\_cluster\_endpoint) | The endpoint for the Talos cluster | `string` | n/a | yes | +| [cluster\_name](#input\_cluster\_name) | A name to provide for the Talos cluster | `string` | n/a | yes | +| [node\_data](#input\_node\_data) | A map of node data |
object({
controlplanes = map(object({
install_disk = string
hostname = optional(string)
}))
workers = map(object({
install_disk = string
hostname = optional(string)
}))
})
|
{
"controlplanes": {
"10.5.0.2": {
"install_disk": "/dev/sda"
},
"10.5.0.3": {
"install_disk": "/dev/sda"
},
"10.5.0.4": {
"install_disk": "/dev/sda"
}
},
"workers": {
"10.5.0.5": {
"hostname": "worker-1",
"install_disk": "/dev/nvme0n1"
},
"10.5.0.6": {
"hostname": "worker-2",
"install_disk": "/dev/nvme0n1"
}
}
}
| no | + +## Outputs + +| Name | Description | +|------|-------------| +| [kubeconfig](#output\_kubeconfig) | n/a | +| [talosconfig](#output\_talosconfig) | n/a | + \ No newline at end of file diff --git a/examples/terraform/digitalocean/README.md b/examples/terraform/digitalocean/README.md index 38aa256..5fdc5cc 100644 --- a/examples/terraform/digitalocean/README.md +++ b/examples/terraform/digitalocean/README.md @@ -17,3 +17,62 @@ If different specs or regions are required, override them through command line w Destroying the cluster should, again, be a simple `terraform destroy`. Getting the kubeconfig and talosconfig for this cluster can be done with `terraform output -raw kubeconfig > ` and `terraform output -raw talosconfig > ` + + +## Requirements + +| Name | Version | +|------|---------| +| [digitalocean](#requirement\_digitalocean) | 2.28.0 | +| [talos](#requirement\_talos) | 0.2.0 | + +## Providers + +| Name | Version | +|------|---------| +| [digitalocean](#provider\_digitalocean) | 2.28.0 | +| [talos](#provider\_talos) | 0.2.0 | +| [tls](#provider\_tls) | 4.0.4 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [digitalocean_custom_image.talos_custom_image](https://registry.terraform.io/providers/digitalocean/digitalocean/2.28.0/docs/resources/custom_image) | resource | +| [digitalocean_droplet.talos_control_plane](https://registry.terraform.io/providers/digitalocean/digitalocean/2.28.0/docs/resources/droplet) | resource | +| [digitalocean_droplet.talos_workers](https://registry.terraform.io/providers/digitalocean/digitalocean/2.28.0/docs/resources/droplet) | resource | +| [digitalocean_loadbalancer.talos_lb](https://registry.terraform.io/providers/digitalocean/digitalocean/2.28.0/docs/resources/loadbalancer) | resource | +| [digitalocean_ssh_key.fake_ssh_key](https://registry.terraform.io/providers/digitalocean/digitalocean/2.28.0/docs/resources/ssh_key) | resource | +| [talos_machine_bootstrap.bootstrap](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_bootstrap) | resource | +| [talos_machine_configuration_apply.cp_config_apply](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_configuration_apply.worker_config_apply](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_secrets.machine_secrets](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_secrets) | resource | +| [tls_private_key.fake_ssh_key](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key) | resource | +| [talos_client_configuration.talosconfig](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/client_configuration) | data source | +| [talos_cluster_kubeconfig.kubeconfig](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/cluster_kubeconfig) | data source | +| [talos_machine_configuration.machineconfig_cp](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | +| [talos_machine_configuration.machineconfig_worker](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [cluster\_name](#input\_cluster\_name) | Name of cluster | `string` | `"talos-do"` | no | +| [do\_plan\_control\_plane](#input\_do\_plan\_control\_plane) | DO plan to use for control plane nodes | `string` | `"s-2vcpu-4gb"` | no | +| [do\_plan\_worker](#input\_do\_plan\_worker) | DO plan to use for worker nodes | `string` | `"s-2vcpu-4gb"` | no | +| [do\_region](#input\_do\_region) | DO region to use | `string` | `"nyc3"` | no | +| [num\_control\_plane](#input\_num\_control\_plane) | Number of control plane nodes to create | `number` | `3` | no | +| [num\_workers](#input\_num\_workers) | Number of worker nodes to create | `number` | `1` | no | +| [talos\_version](#input\_talos\_version) | Talos version to deploy | `string` | `"v1.4.0"` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [kubeconfig](#output\_kubeconfig) | n/a | +| [talosconfig](#output\_talosconfig) | n/a | + \ No newline at end of file diff --git a/examples/terraform/equinix-metal/README.md b/examples/terraform/equinix-metal/README.md index c26d172..dd006d7 100644 --- a/examples/terraform/equinix-metal/README.md +++ b/examples/terraform/equinix-metal/README.md @@ -20,3 +20,58 @@ If different specs or regions are required, override them through command line w Destroying the cluster should, again, be a simple `terraform destroy`. Getting the kubeconfig and talosconfig for this cluster can be done with `terraform output -raw kubeconfig > ` and `terraform output -raw talosconfig > `. + + +## Requirements + +| Name | Version | +|------|---------| +| [equinix](#requirement\_equinix) | 1.11.1 | +| [talos](#requirement\_talos) | 0.2.0 | + +## Providers + +| Name | Version | +|------|---------| +| [equinix](#provider\_equinix) | 1.11.1 | +| [talos](#provider\_talos) | 0.2.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [equinix_metal_device.talos_control_plane](https://registry.terraform.io/providers/equinix/equinix/1.11.1/docs/resources/metal_device) | resource | +| [equinix_metal_device.talos_worker](https://registry.terraform.io/providers/equinix/equinix/1.11.1/docs/resources/metal_device) | resource | +| [equinix_metal_reserved_ip_block.talos_control_plane_vip](https://registry.terraform.io/providers/equinix/equinix/1.11.1/docs/resources/metal_reserved_ip_block) | resource | +| [talos_machine_bootstrap.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_bootstrap) | resource | +| [talos_machine_configuration_apply.controlplane](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_configuration_apply.worker](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_secrets.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_secrets) | resource | +| [talos_client_configuration.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/client_configuration) | data source | +| [talos_cluster_kubeconfig.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/cluster_kubeconfig) | data source | +| [talos_machine_configuration.controlplane](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | +| [talos_machine_configuration.worker](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [cluster\_name](#input\_cluster\_name) | Name of cluster | `string` | `"talos-em"` | no | +| [em\_api\_token](#input\_em\_api\_token) | API token for Equinix Metal | `string` | n/a | yes | +| [em\_plan](#input\_em\_plan) | Equinix Metal server to use | `string` | `"c3.small.x86"` | no | +| [em\_project\_id](#input\_em\_project\_id) | Equinix Metal project ID | `string` | n/a | yes | +| [em\_region](#input\_em\_region) | Equinix Metal region to use | `string` | `"dc"` | no | +| [num\_control\_plane](#input\_num\_control\_plane) | Number of control plane nodes to create | `number` | `3` | no | +| [num\_workers](#input\_num\_workers) | Number of worker nodes to create | `number` | `1` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [kubeconfig](#output\_kubeconfig) | n/a | +| [talosconfig](#output\_talosconfig) | n/a | + \ No newline at end of file diff --git a/examples/terraform/hcloud/terraform/README.md b/examples/terraform/hcloud/terraform/README.md new file mode 100644 index 0000000..5ef4d04 --- /dev/null +++ b/examples/terraform/hcloud/terraform/README.md @@ -0,0 +1,65 @@ + +## Requirements + +| Name | Version | +|------|---------| +| [hcloud](#requirement\_hcloud) | 1.35.2 | +| [talos](#requirement\_talos) | 0.2.0 | + +## Providers + +| Name | Version | +|------|---------| +| [hcloud](#provider\_hcloud) | 1.35.2 | +| [talos](#provider\_talos) | 0.2.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [hcloud_load_balancer.controlplane_load_balancer](https://registry.terraform.io/providers/hetznercloud/hcloud/1.35.2/docs/resources/load_balancer) | resource | +| [hcloud_load_balancer_network.srvnetwork](https://registry.terraform.io/providers/hetznercloud/hcloud/1.35.2/docs/resources/load_balancer_network) | resource | +| [hcloud_load_balancer_service.controlplane_load_balancer_service_kubectl](https://registry.terraform.io/providers/hetznercloud/hcloud/1.35.2/docs/resources/load_balancer_service) | resource | +| [hcloud_load_balancer_service.controlplane_load_balancer_service_mayastor](https://registry.terraform.io/providers/hetznercloud/hcloud/1.35.2/docs/resources/load_balancer_service) | resource | +| [hcloud_load_balancer_service.controlplane_load_balancer_service_talosctl](https://registry.terraform.io/providers/hetznercloud/hcloud/1.35.2/docs/resources/load_balancer_service) | resource | +| [hcloud_load_balancer_target.load_balancer_target](https://registry.terraform.io/providers/hetznercloud/hcloud/1.35.2/docs/resources/load_balancer_target) | resource | +| [hcloud_network.network](https://registry.terraform.io/providers/hetznercloud/hcloud/1.35.2/docs/resources/network) | resource | +| [hcloud_network_subnet.subnet](https://registry.terraform.io/providers/hetznercloud/hcloud/1.35.2/docs/resources/network_subnet) | resource | +| [hcloud_server.controlplane_server](https://registry.terraform.io/providers/hetznercloud/hcloud/1.35.2/docs/resources/server) | resource | +| [hcloud_server.worker_server](https://registry.terraform.io/providers/hetznercloud/hcloud/1.35.2/docs/resources/server) | resource | +| [hcloud_volume.volumes](https://registry.terraform.io/providers/hetznercloud/hcloud/1.35.2/docs/resources/volume) | resource | +| [talos_machine_bootstrap.bootstrap](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_bootstrap) | resource | +| [talos_machine_secrets.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_secrets) | resource | +| [talos_client_configuration.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/client_configuration) | data source | +| [talos_cluster_kubeconfig.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/cluster_kubeconfig) | data source | +| [talos_machine_configuration.controlplane](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | +| [talos_machine_configuration.worker](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [cluster\_name](#input\_cluster\_name) | A name to provide for the Talos cluster | `string` | `"talos-hloud-cluster"` | no | +| [controlplane\_ip](#input\_controlplane\_ip) | n/a | `string` | `"10.0.0.3"` | no | +| [controlplane\_type](#input\_controlplane\_type) | Control plane | `string` | `"cpx31"` | no | +| [image\_id](#input\_image\_id) | Talos specific variables | `string` | n/a | yes | +| [load\_balancer\_type](#input\_load\_balancer\_type) | n/a | `string` | `"lb11"` | no | +| [location](#input\_location) | Workers | `string` | `"fsn1"` | no | +| [network\_zone](#input\_network\_zone) | Load balancer | `string` | `"eu-central"` | no | +| [private\_network\_ip\_range](#input\_private\_network\_ip\_range) | n/a | `string` | `"10.0.0.0/16"` | no | +| [private\_network\_name](#input\_private\_network\_name) | Networking | `string` | `"talos-network"` | no | +| [private\_network\_subnet\_range](#input\_private\_network\_subnet\_range) | n/a | `string` | `"10.0.0.0/24"` | no | +| [worker\_extra\_volume\_size](#input\_worker\_extra\_volume\_size) | Size of SSD volume to attach to workers | `number` | `10` | no | +| [workers](#input\_workers) | Worker definition | `any` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| [kubeconfig](#output\_kubeconfig) | n/a | +| [talosconfig](#output\_talosconfig) | n/a | + \ No newline at end of file diff --git a/examples/terraform/vultr/README.md b/examples/terraform/vultr/README.md index 63203fc..f9c804f 100644 --- a/examples/terraform/vultr/README.md +++ b/examples/terraform/vultr/README.md @@ -16,4 +16,56 @@ Each of these VMs will be 2 CPU / 4GB RAM VMs. If different specs or regions are required, override them through command line with the `-var` flag or by creating a varsfile and overriding with `-var-file`. Destroying the cluster should, again, be a simple `terraform destroy`. -Getting the kubeconfig and talosconfig for this cluster can be done with `terraform output -raw kubeconfig > ` and `terraform output -raw talosconfig > ` \ No newline at end of file +Getting the kubeconfig and talosconfig for this cluster can be done with `terraform output -raw kubeconfig > ` and `terraform output -raw talosconfig > ` + +## Requirements + +| Name | Version | +|------|---------| +| [talos](#requirement\_talos) | 0.2.0 | +| [vultr](#requirement\_vultr) | 2.12.0 | + +## Providers + +| Name | Version | +|------|---------| +| [talos](#provider\_talos) | 0.2.0 | +| [vultr](#provider\_vultr) | 2.12.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [talos_machine_bootstrap.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_bootstrap) | resource | +| [talos_machine_configuration_apply.controlplane](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_configuration_apply.worker](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_configuration_apply) | resource | +| [talos_machine_secrets.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/resources/machine_secrets) | resource | +| [vultr_instance.talos_control_plane](https://registry.terraform.io/providers/vultr/vultr/2.12.0/docs/resources/instance) | resource | +| [vultr_instance.talos_workers](https://registry.terraform.io/providers/vultr/vultr/2.12.0/docs/resources/instance) | resource | +| [vultr_load_balancer.talos_lb](https://registry.terraform.io/providers/vultr/vultr/2.12.0/docs/resources/load_balancer) | resource | +| [talos_client_configuration.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/client_configuration) | data source | +| [talos_cluster_kubeconfig.this](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/cluster_kubeconfig) | data source | +| [talos_machine_configuration.controlplane](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | +| [talos_machine_configuration.worker](https://registry.terraform.io/providers/siderolabs/talos/0.2.0/docs/data-sources/machine_configuration) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [cluster\_name](#input\_cluster\_name) | Name of cluster | `string` | `"talos-vultr"` | no | +| [num\_control\_plane](#input\_num\_control\_plane) | Number of control plane nodes to create | `number` | `3` | no | +| [num\_workers](#input\_num\_workers) | Number of worker nodes to create | `number` | `1` | no | +| [vultr\_plan](#input\_vultr\_plan) | Vultr plan to use | `string` | `"vc2-2c-4gb"` | no | +| [vultr\_region](#input\_vultr\_region) | Vultr region to use | `string` | `"atl"` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [kubeconfig](#output\_kubeconfig) | n/a | +| [talosconfig](#output\_talosconfig) | n/a | + \ No newline at end of file diff --git a/hack/backend.tf b/hack/backend.tf new file mode 100644 index 0000000..6602f20 --- /dev/null +++ b/hack/backend.tf @@ -0,0 +1,3 @@ +terraform { + backend "azurerm" {} +}