From f1495905fe1a73d6f948c3e9f0df9bc4cdc9d102 Mon Sep 17 00:00:00 2001 From: Marcos Diez Date: Mon, 16 Oct 2023 03:09:56 -0300 Subject: [PATCH] show examples in documentation (#58) --- docs/data-sources/table_row.md | 24 +++++++++--- docs/resources/table_row.md | 39 ++++++++++++++----- .../data-source.tf | 0 .../resource.tf | 0 4 files changed, 48 insertions(+), 15 deletions(-) rename examples/data-sources/{table_row => servicenow-data_table_row}/data-source.tf (100%) rename examples/resources/{table_row => servicenow-data_table_row}/resource.tf (100%) diff --git a/docs/data-sources/table_row.md b/docs/data-sources/table_row.md index b3f82d5..2e669de 100644 --- a/docs/data-sources/table_row.md +++ b/docs/data-sources/table_row.md @@ -10,7 +10,21 @@ description: |- A row in a SN table - +## Example Usage + +```terraform +data "servicenow-data_table_row" "example-with-sys_id" { + table_id = "sys_user" + sys_id = "7a9dde3e6fa4310005a9fbf7eb3ee495" +} + +data "servicenow-data_table_row" "example-with-email-query" { + table_id = "sys_user" + row_data = { + "email" : "example.value@example.com" + } +} +``` ## Schema @@ -22,19 +36,17 @@ A row in a SN table ### Optional - `row_data` (Map of String) Columns -- `sys_id` (String) - -### Read-Only - -- `id` (String) The ID of this resource. - `sys_class_name` (String) - `sys_created_by` (String) - `sys_created_on` (String) - `sys_domain` (String) - `sys_domain_path` (String) +- `sys_id` (String) - `sys_mod_count` (String) - `sys_tags` (String) - `sys_updated_by` (String) - `sys_updated_on` (String) +### Read-Only +- `id` (String) The ID of this resource. diff --git a/docs/resources/table_row.md b/docs/resources/table_row.md index 9833f77..7adea35 100644 --- a/docs/resources/table_row.md +++ b/docs/resources/table_row.md @@ -10,7 +10,30 @@ description: |- A row in a SN table - +## Example Usage + +```terraform +data "servicenow-data_table_row" "example-with-sys_id" { + table_id = "sys_user" + sys_id = "7a9dde3e6fa4310005a9fbf7eb3ee495" +} + +data "servicenow-data_table_row" "example-with-email-query" { + table_id = "sys_user" + row_data = { + "email" : "example.value@example.com" + } +} + +resource "servicenow-data_table_row" "example-row" { + table_id = "x_example_table" + row_data = { + "field1" : "value1", + "field2" : "value2" + "approvers" : "${data.servicenow-data_table_row.example-with-email-query.sys_id},${data.servicenow-data_table_row.example-with-sys_id.sys_id}" + } +} +``` ## Schema @@ -22,21 +45,21 @@ A row in a SN table ### Optional - `row_data` (Map of String) Columns -- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) - -### Read-Only - -- `id` (String) The ID of this resource. - `sys_class_name` (String) - `sys_created_by` (String) - `sys_created_on` (String) - `sys_domain` (String) - `sys_domain_path` (String) -- `sys_id` (String) - `sys_mod_count` (String) - `sys_tags` (String) - `sys_updated_by` (String) - `sys_updated_on` (String) +- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + +### Read-Only + +- `id` (String) The ID of this resource. +- `sys_id` (String) ### Nested Schema for `timeouts` @@ -48,5 +71,3 @@ Optional: - `delete` (String) - `read` (String) - `update` (String) - - diff --git a/examples/data-sources/table_row/data-source.tf b/examples/data-sources/servicenow-data_table_row/data-source.tf similarity index 100% rename from examples/data-sources/table_row/data-source.tf rename to examples/data-sources/servicenow-data_table_row/data-source.tf diff --git a/examples/resources/table_row/resource.tf b/examples/resources/servicenow-data_table_row/resource.tf similarity index 100% rename from examples/resources/table_row/resource.tf rename to examples/resources/servicenow-data_table_row/resource.tf