Skip to content

Commit

Permalink
examplesss
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei-Predoiu committed Sep 27, 2022
1 parent 93cd735 commit 1aa3a40
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 37 deletions.
11 changes: 11 additions & 0 deletions examples/data-sources/table_row/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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" : "[email protected]"
}
}
15 changes: 15 additions & 0 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
terraform {
required_providers {
servicenow-data = {
source = "local/providers/servicenow-data"
version = "1.0.0"
}
# add other providers here
}
required_version = ">= 0.13"
}
provider "servicenow-data" {
sn_api_url = "..."
sn_api_user = "..."
sn_api_pass = "..."
}
37 changes: 0 additions & 37 deletions examples/providers.tf

This file was deleted.

21 changes: 21 additions & 0 deletions examples/resources/table_row/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

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" : "[email protected]"
}
}

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}"
}
}
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
)

// Run "go generate" to format example terraform files and generate the docs for the registry/website

// If you do not have terraform installed, you can remove the formatting command, but its suggested to
// ensure the documentation is formatted properly.
//go:generate terraform fmt -recursive ./examples/

// Run the docs generation tool, check its repository for more information on how it works and how docs
// can be customized.
func main() {
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: Provider,
Expand Down

0 comments on commit 1aa3a40

Please sign in to comment.