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