From 9c5434aabaa176f51938beb562fe811703e22b44 Mon Sep 17 00:00:00 2001 From: Colin Wilson Date: Wed, 28 Apr 2021 04:24:24 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=A5=20remove=20k8s=20dashboard=20t?= =?UTF-8?q?emp=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/terraform.yaml | 3 --- server_init.tf | 1 - user_data/ks3_server_init.sh | 7 +------ 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml index d1895af..e1f00c8 100644 --- a/.github/workflows/terraform.yaml +++ b/.github/workflows/terraform.yaml @@ -1,9 +1,6 @@ name: 'Terraform GitHub Actions' on: - push: - branches: - - release pull_request: jobs: diff --git a/server_init.tf b/server_init.tf index 291d20c..fe14a93 100644 --- a/server_init.tf +++ b/server_init.tf @@ -23,7 +23,6 @@ resource "digitalocean_droplet" "k3s_server_init" { csi_crds_manifest = file("${path.module}/manifests/do-csi/crds.yaml") csi_driver_manifest = file("${path.module}/manifests/do-csi/driver.yaml") csi_sc_manifest = file("${path.module}/manifests/do-csi/snapshot-controller.yaml") - #k8s_dashboard = file("${path.module}/manifests/k8s-dashboard.yaml") }) } diff --git a/user_data/ks3_server_init.sh b/user_data/ks3_server_init.sh index 80bb6e0..0941718 100644 --- a/user_data/ks3_server_init.sh +++ b/user_data/ks3_server_init.sh @@ -54,9 +54,4 @@ EOF # csi snapshot controller cat <<'EOF' | sudo tee /var/lib/rancher/k3s/server/manifests/snapshot-controller.yaml ${csi_sc_manifest} -EOF - -# kubernetes dashboard -# cat <<'EOF' | sudo tee /var/lib/rancher/k3s/server/manifests/k8s-dashboard.yaml -# ${k8s_dashboard} -# EOF \ No newline at end of file +EOF \ No newline at end of file From 7cd0048b094b6711fe99ce8d519279f456c09f7c Mon Sep 17 00:00:00 2001 From: Colin Wilson Date: Wed, 28 Apr 2021 05:31:53 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=9A=9A=20move=20github=20acctions=20e?= =?UTF-8?q?xample=20to=20new=20dir=20=F0=9F=92=9A=20update=20github=20acti?= =?UTF-8?q?ons=20example=20module=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/terraform.yaml | 2 +- examples/default_deployment/README.md | 4 +++- examples/default_deployment/main.tf | 9 --------- examples/github_actions/README.md | 17 +++++++++++++++++ examples/github_actions/main.tf | 26 ++++++++++++++++++++++++++ examples/github_actions/outputs.tf | 3 +++ examples/github_actions/variables.tf | 2 ++ 7 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 examples/github_actions/README.md create mode 100644 examples/github_actions/main.tf create mode 100644 examples/github_actions/outputs.tf create mode 100644 examples/github_actions/variables.tf diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml index e1f00c8..7e6fd31 100644 --- a/.github/workflows/terraform.yaml +++ b/.github/workflows/terraform.yaml @@ -46,7 +46,7 @@ jobs: needs: terraform-fmt runs-on: ubuntu-latest env: - WORKING_DIR: "examples/default_deployment" + WORKING_DIR: "examples/github_actions" steps: - name: Checkout uses: actions/checkout@v2.3.4 diff --git a/examples/default_deployment/README.md b/examples/default_deployment/README.md index 345437a..15c3f0d 100644 --- a/examples/default_deployment/README.md +++ b/examples/default_deployment/README.md @@ -12,7 +12,9 @@ This example illustrates how to use the `terraform-digitalocean-ha-k3s` module. ## Outputs -TBC +| Name | Description | +|------|-------------| +| cluster_summary | A summary of the cluster's provisioned resources. | diff --git a/examples/default_deployment/main.tf b/examples/default_deployment/main.tf index baa93c2..91aee5e 100644 --- a/examples/default_deployment/main.tf +++ b/examples/default_deployment/main.tf @@ -1,13 +1,4 @@ terraform { - # Reconfigure the backend block to suit your needs - backend "remote" { - hostname = "app.terraform.io" - organization = "AIGISUK" - - workspaces { - name = "gh-actions-terraform-digitalocean-ha-k3s" - } - } required_providers { digitalocean = { source = "digitalocean/digitalocean" diff --git a/examples/github_actions/README.md b/examples/github_actions/README.md new file mode 100644 index 0000000..28ec51c --- /dev/null +++ b/examples/github_actions/README.md @@ -0,0 +1,17 @@ +# GitHub Actions Deployment Example + +This example is specifically for module tests. + + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|:----:|:-----:|:-----:| +| do_token | DigitalOcean Personal Access Token | string | N/A | yes | +| ssh_key_fingerprints | List of SSH Key fingerprints | list(string) | N/A | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| cluster_summary | A summary of the cluster's provisioned resources. | diff --git a/examples/github_actions/main.tf b/examples/github_actions/main.tf new file mode 100644 index 0000000..224ac2c --- /dev/null +++ b/examples/github_actions/main.tf @@ -0,0 +1,26 @@ +terraform { + # Reconfigure the backend block to suit your needs + backend "remote" { + hostname = "app.terraform.io" + organization = "AIGISUK" + + workspaces { + name = "gh-actions-terraform-digitalocean-ha-k3s" + } + } + required_providers { + digitalocean = { + source = "digitalocean/digitalocean" + } + } + required_version = ">= 0.13" +} + +provider "digitalocean" {} + +module "ha-k3s" { + source = "git::https://github.com/aigisuk/terraform-digitalocean-ha-k3s.git?ref=develop" + + do_token = var.do_token + ssh_key_fingerprints = var.ssh_key_fingerprints +} \ No newline at end of file diff --git a/examples/github_actions/outputs.tf b/examples/github_actions/outputs.tf new file mode 100644 index 0000000..b428b16 --- /dev/null +++ b/examples/github_actions/outputs.tf @@ -0,0 +1,3 @@ +output "cluster_summary" { + value = module.ha-k3s.cluster_summary +} \ No newline at end of file diff --git a/examples/github_actions/variables.tf b/examples/github_actions/variables.tf new file mode 100644 index 0000000..cff19bb --- /dev/null +++ b/examples/github_actions/variables.tf @@ -0,0 +1,2 @@ +variable "ssh_key_fingerprints" {} +variable "do_token" {} \ No newline at end of file