From a256b763aef7fb7bd823b7df40ab2cf52230818d Mon Sep 17 00:00:00 2001 From: Bruno Schaatsbergen Date: Mon, 22 Jul 2024 15:24:22 +0200 Subject: [PATCH] docs: separate worker and controller led resources (#619) * docs: separate worker and controller led resources * docs: change title for consistency * docs: make docs * chore: use unique names for workers and add an 'Example Usage' section --- docs/resources/worker.md | 11 ++++++-- .../boundary_worker/controller_led.tf | 5 ++++ examples/resources/boundary_worker/main.tf | 13 --------- .../{resource.tf => worker_led.tf} | 8 +----- templates/resources/worker.md.tmpl | 28 +++++++++++++++++++ 5 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 examples/resources/boundary_worker/controller_led.tf delete mode 100644 examples/resources/boundary_worker/main.tf rename examples/resources/boundary_worker/{resource.tf => worker_led.tf} (51%) create mode 100644 templates/resources/worker.md.tmpl diff --git a/docs/resources/worker.md b/docs/resources/worker.md index dbb2a471..fe1ed9fe 100644 --- a/docs/resources/worker.md +++ b/docs/resources/worker.md @@ -1,5 +1,4 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "boundary_worker Resource - terraform-provider-boundary" subcategory: "" description: |- @@ -12,16 +11,22 @@ The resource allows you to create a self-managed worker object. ## Example Usage +### Controller-led worker + ```terraform resource "boundary_worker" "controller_led" { scope_id = "global" - name = "worker 1" + name = "controller-led-worker-1" description = "self managed worker with controller led auth" } +``` +### Worker-led worker + +```terraform resource "boundary_worker" "worker_led" { scope_id = "global" - name = "worker 2" + name = "worker-led-worker-1" description = "self managed worker with worker led auth" worker_generated_auth_token = var.worker_generated_auth_token } diff --git a/examples/resources/boundary_worker/controller_led.tf b/examples/resources/boundary_worker/controller_led.tf new file mode 100644 index 00000000..1cdd541b --- /dev/null +++ b/examples/resources/boundary_worker/controller_led.tf @@ -0,0 +1,5 @@ +resource "boundary_worker" "controller_led" { + scope_id = "global" + name = "controller-led-worker-1" + description = "self managed worker with controller led auth" +} diff --git a/examples/resources/boundary_worker/main.tf b/examples/resources/boundary_worker/main.tf deleted file mode 100644 index 7955758b..00000000 --- a/examples/resources/boundary_worker/main.tf +++ /dev/null @@ -1,13 +0,0 @@ -resource "boundary_worker" "controller_led" { - scope_id = "global" - name = "worker 1" - description = "self managed worker with controller-led auth" - worker_generated_auth_token = var.worker_generated_auth_token -} - -resource "boundary_worker" "worker_led" { - scope_id = "global" - name = "worker 2" - description = "self managed worker with worker-led auth" - worker_generated_auth_token = var.worker_generated_auth_token -} \ No newline at end of file diff --git a/examples/resources/boundary_worker/resource.tf b/examples/resources/boundary_worker/worker_led.tf similarity index 51% rename from examples/resources/boundary_worker/resource.tf rename to examples/resources/boundary_worker/worker_led.tf index 49f427f7..c6d630a9 100644 --- a/examples/resources/boundary_worker/resource.tf +++ b/examples/resources/boundary_worker/worker_led.tf @@ -1,12 +1,6 @@ -resource "boundary_worker" "controller_led" { - scope_id = "global" - name = "worker 1" - description = "self managed worker with controller led auth" -} - resource "boundary_worker" "worker_led" { scope_id = "global" - name = "worker 2" + name = "worker-led-worker-1" description = "self managed worker with worker led auth" worker_generated_auth_token = var.worker_generated_auth_token } diff --git a/templates/resources/worker.md.tmpl b/templates/resources/worker.md.tmpl new file mode 100644 index 00000000..26f0e48f --- /dev/null +++ b/templates/resources/worker.md.tmpl @@ -0,0 +1,28 @@ +--- +page_title: "boundary_worker Resource - terraform-provider-boundary" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# boundary_worker (Resource) + +{{ .Description | trimspace }} + +## Example Usage + +### Controller-led worker + +{{tffile "examples/resources/boundary_worker/controller_led.tf"}} + +### Worker-led worker + +{{tffile "examples/resources/boundary_worker/worker_led.tf"}} + +{{ .SchemaMarkdown | trimspace }} + +## Import + +Import is supported using the following syntax: + +{{codefile "shell" "examples/resources/boundary_worker/import.sh" }}