-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new resource: servicecatalog_order (#59)
* new resource: servicecatalog_order * cleanup --------- Co-authored-by: Andrei Predoiu <[email protected]>
- Loading branch information
1 parent
f149590
commit 92fa401
Showing
9 changed files
with
1,004 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "servicenow-data_servicecatalog_order Resource - terraform-provider-servicenow-data" | ||
subcategory: "" | ||
description: |- | ||
A Service Now ServiceCatalog order. It consumes the "ordernow" API ( https://developer.servicenow.com/dev.do#!/reference/api/utah/rest/cServiceCatalogAPI#servicecat-POST-items-order_now ) | ||
Please note that Service Now catalog orders are immutable. | ||
That means if you try to destroy an order, it will be removed from terraform but nothing will happen in Service Now. | ||
Also, if you try to update an order, it will be removed from terraform and a new one will be created. In other words, you will end up with two orders in service now. | ||
--- | ||
|
||
# servicenow-data_servicecatalog_order (Resource) | ||
|
||
A Service Now ServiceCatalog order. It consumes the "order_now" API ( https://developer.servicenow.com/dev.do#!/reference/api/utah/rest/c_ServiceCatalogAPI#servicecat-POST-items-order_now ) | ||
|
||
Please note that Service Now catalog orders are immutable. | ||
That means if you try to destroy an order, it will be removed from terraform but nothing will happen in Service Now. | ||
Also, if you try to update an order, it will be removed from terraform and a new one will be created. In other words, you will end up with two orders in service now. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "servicenow-data_servicecatalog_order" "order" { | ||
sc_cat_item_id = "e2a2e5bc1b757850d5a68773604bcb32" | ||
variables = { | ||
"var1" : "value1", | ||
"var2" : "value2", | ||
"var3" : "value3", | ||
} | ||
} | ||
# sample output | ||
# "result": { | ||
# "$$uiNotification": [], | ||
# "number": "REQ0227772", | ||
# "parent_id": null, | ||
# "parent_table": "task", | ||
# "request_id": "24e3e99e97f53110af6574971153afaa", | ||
# "request_number": "REQ0227772", | ||
# "sys_id": "24e3e99e97f53110af6574971153afaa", | ||
# "table": "sc_request" | ||
# } | ||
data "servicenow-data_table_row" "request" { | ||
table_id = "sc_request" | ||
row_data = { | ||
"number" : servicenow-data_servicecatalog_order.order.request_number | ||
} | ||
} | ||
data "servicenow-data_table_row" "request_item" { | ||
table_id = "sc_req_item" | ||
row_data = { | ||
"request" : data.servicenow-data_table_row.request.sys_id | ||
} | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `sc_cat_item_id` (String) The id of the catalog item to order | ||
- `variables` (Map of String) Name-value pairs of all mandatory cart item variables. Mandatory variables are defined on the associated form. | ||
|
||
### Optional | ||
|
||
- `get_portal_messages` (String) | ||
- `sysparm_also_request_for` (String) Comma-separated string of user sys_ids of other users for which to order the specified item. User sys_ids are located in the User [sys_user] table. | ||
- `sysparm_no_validation` (String) | ||
- `sysparm_quantity` (Number) Quantity of the item. Cannot be a negative number. | ||
- `sysparm_requested_for` (String) Sys_id of the user for whom to order the specified item. Located in the User [sys_user] table. | ||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
- `number` (String) Number of the generated request | ||
- `parent_id` (String) If available, the sys_id of the parent record from which the request is created | ||
- `parent_table` (String) If available, the name of the parent table from which the request is created. | ||
- `request_id` (String) Sys_id of the order request. | ||
- `request_number` (String) Request number. | ||
- `sys_id` (String) Sys_id of the order. | ||
- `table` (String) Table name of the request. | ||
|
||
<a id="nestedblock--timeouts"></a> | ||
### Nested Schema for `timeouts` | ||
|
||
Optional: | ||
|
||
- `create` (String) | ||
- `default` (String) | ||
- `delete` (String) | ||
- `read` (String) | ||
- `update` (String) |
34 changes: 34 additions & 0 deletions
34
examples/resources/servicenow-data_servicecatalog_order/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
resource "servicenow-data_servicecatalog_order" "order" { | ||
sc_cat_item_id = "e2a2e5bc1b757850d5a68773604bcb32" | ||
variables = { | ||
"var1" : "value1", | ||
"var2" : "value2", | ||
"var3" : "value3", | ||
} | ||
} | ||
|
||
# sample output | ||
# "result": { | ||
# "$$uiNotification": [], | ||
# "number": "REQ0227772", | ||
# "parent_id": null, | ||
# "parent_table": "task", | ||
# "request_id": "24e3e99e97f53110af6574971153afaa", | ||
# "request_number": "REQ0227772", | ||
# "sys_id": "24e3e99e97f53110af6574971153afaa", | ||
# "table": "sc_request" | ||
# } | ||
|
||
data "servicenow-data_table_row" "request" { | ||
table_id = "sc_request" | ||
row_data = { | ||
"number" : servicenow-data_servicecatalog_order.order.request_number | ||
} | ||
} | ||
|
||
data "servicenow-data_table_row" "request_item" { | ||
table_id = "sc_req_item" | ||
row_data = { | ||
"request" : data.servicenow-data_table_row.request.sys_id | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.