Skip to content

Commit 2719c5a

Browse files
committed
Add docs for inventory lookup
1 parent 75e6db8 commit 2719c5a

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

docs/resources/inventory.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,29 @@ output "inventory_xyz" {
114114
- `named_url` (String) Named URL of the inventory
115115
- `organization_name` (String) Name for the organization.
116116
- `url` (String) URL of the inventory
117+
118+
## Inventory Look Up
119+
120+
You can look up inventories by using either the `id` or a combination of `name` and `organization_name`.
121+
122+
Creating a new inventory in the Default organization:
123+
```terraform
124+
resource "aap_inventory" "sample" {
125+
name = "My Sample Inventory"
126+
organization_name = "Default"
127+
description = "A new inventory for testing"
128+
variables = jsonencode(yamldecode(local.values_variables))
129+
}
130+
```
131+
132+
You can access this inventory using either the `id` or the combination of `name` and `organization_name`.
133+
```terraform
134+
data "aap_inventory" "sample" {
135+
id = aap_inventory.sample.id
136+
}
137+
138+
data "aap_inventory" "sample" {
139+
name = aap_inventory.sample.name
140+
organization_name = aap_inventory.sample.organization_name
141+
}
142+
```

templates/resources/inventory.md.tmpl

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
page_title: "{{ .Name }} {{ .Type }} - {{ .ProviderName }}"
3+
description: |-
4+
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
5+
---
6+
7+
# {{ .Name }} ({{ .Type }})
8+
9+
{{ .Description | trimspace }}
10+
11+
{{ if .HasExample }}
12+
## Example Usage
13+
14+
{{ tffile .ExampleFile }}
15+
{{ end }}
16+
17+
{{ .SchemaMarkdown | trimspace }}
18+
19+
## Inventory Look Up
20+
21+
You can look up inventories by using either the `id` or a combination of `name` and `organization_name`.
22+
23+
Creating a new inventory in the Default organization:
24+
```terraform
25+
resource "aap_inventory" "sample" {
26+
name = "My Sample Inventory"
27+
organization_name = "Default"
28+
description = "A new inventory for testing"
29+
variables = jsonencode(yamldecode(local.values_variables))
30+
}
31+
```
32+
33+
You can access this inventory using either the `id` or the combination of `name` and `organization_name`.
34+
```terraform
35+
data "aap_inventory" "sample" {
36+
id = aap_inventory.sample.id
37+
}
38+
39+
data "aap_inventory" "sample" {
40+
name = aap_inventory.sample.name
41+
organization_name = aap_inventory.sample.organization_name
42+
}
43+
```

0 commit comments

Comments
 (0)