Skip to content

Commit cb45669

Browse files
Copilottobio
andcommitted
Add documentation and examples for write-only attributes
Co-authored-by: tobio <[email protected]>
1 parent ad84228 commit cb45669

File tree

3 files changed

+83
-4
lines changed

3 files changed

+83
-4
lines changed

docs/resources/kibana_import_saved_objects.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Create sets of Kibana saved objects from a file created by the export API. See h
1212

1313
## Example Usage
1414

15+
### Basic usage
16+
1517
```terraform
1618
provider "elasticstack" {
1719
kibana {}
@@ -26,15 +28,44 @@ EOT
2628
}
2729
```
2830

29-
<!-- schema generated by tfplugindocs -->
30-
## Schema
31+
### Using write-only attributes
3132

32-
### Required
33+
The `file_contents_wo` and `file_contents_wo_version` attributes provide write-only alternatives to `file_contents`.
34+
These attributes are not stored in the Terraform state, making them useful for sensitive content management.
3335

34-
- `file_contents` (String) The contents of the exported saved objects file.
36+
```terraform
37+
provider "elasticstack" {
38+
kibana {}
39+
}
40+
41+
# Example using write-only file_contents_wo attribute
42+
resource "elasticstack_kibana_import_saved_objects" "settings_write_only" {
43+
overwrite = true
44+
file_contents_wo = <<-EOT
45+
{"attributes":{"buildNum":42747,"defaultIndex":"metricbeat-*","theme:darkMode":true},"coreMigrationVersion":"7.0.0","id":"7.14.0","managed":false,"references":[],"type":"config","typeMigrationVersion":"7.0.0","updated_at":"2021-08-04T02:04:43.306Z","version":"WzY1MiwyXQ=="}
46+
{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":1,"missingRefCount":0,"missingReferences":[]}
47+
EOT
48+
}
49+
50+
# Example using write-only file_contents_wo with version tracking
51+
resource "elasticstack_kibana_import_saved_objects" "settings_with_version" {
52+
overwrite = true
53+
file_contents_wo = <<-EOT
54+
{"attributes":{"buildNum":42747,"defaultIndex":"metricbeat-*","theme:darkMode":true},"coreMigrationVersion":"7.0.0","id":"7.14.0","managed":false,"references":[],"type":"config","typeMigrationVersion":"7.0.0","updated_at":"2021-08-04T02:04:43.306Z","version":"WzY1MiwyXQ=="}
55+
{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":1,"missingRefCount":0,"missingReferences":[]}
56+
EOT
57+
file_contents_wo_version = "v1.0.0"
58+
}
59+
```
60+
61+
<!-- schema generated by tfplugindocs -->
62+
## Schema
3563

3664
### Optional
3765

66+
- `file_contents` (String) The contents of the exported saved objects file.
67+
- `file_contents_wo` (String, Sensitive) The contents of the exported saved objects file (write-only, not stored in state).
68+
- `file_contents_wo_version` (String, Sensitive) Version or identifier for the file contents (write-only, not stored in state).
3869
- `ignore_import_errors` (Boolean) If set to true, errors during the import process will not fail the configuration application
3970
- `overwrite` (Boolean) Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by overwriting the destination object.
4071
- `space_id` (String) An identifier for the space. If space_id is not provided, the default space is used.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
provider "elasticstack" {
2+
kibana {}
3+
}
4+
5+
# Example using write-only file_contents_wo attribute
6+
resource "elasticstack_kibana_import_saved_objects" "settings_write_only" {
7+
overwrite = true
8+
file_contents_wo = <<-EOT
9+
{"attributes":{"buildNum":42747,"defaultIndex":"metricbeat-*","theme:darkMode":true},"coreMigrationVersion":"7.0.0","id":"7.14.0","managed":false,"references":[],"type":"config","typeMigrationVersion":"7.0.0","updated_at":"2021-08-04T02:04:43.306Z","version":"WzY1MiwyXQ=="}
10+
{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":1,"missingRefCount":0,"missingReferences":[]}
11+
EOT
12+
}
13+
14+
# Example using write-only file_contents_wo with version tracking
15+
resource "elasticstack_kibana_import_saved_objects" "settings_with_version" {
16+
overwrite = true
17+
file_contents_wo = <<-EOT
18+
{"attributes":{"buildNum":42747,"defaultIndex":"metricbeat-*","theme:darkMode":true},"coreMigrationVersion":"7.0.0","id":"7.14.0","managed":false,"references":[],"type":"config","typeMigrationVersion":"7.0.0","updated_at":"2021-08-04T02:04:43.306Z","version":"WzY1MiwyXQ=="}
19+
{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":1,"missingRefCount":0,"missingReferences":[]}
20+
EOT
21+
file_contents_wo_version = "v1.0.0"
22+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "{{.Name}} {{.Type}} - {{.RenderedProviderName}}"
4+
subcategory: "Kibana"
5+
description: |-
6+
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
7+
---
8+
9+
# {{.Name}} ({{.Type}})
10+
11+
{{ .Description | trimspace }}
12+
13+
## Example Usage
14+
15+
### Basic usage
16+
17+
{{ tffile "examples/resources/elasticstack_kibana_import_saved_objects/resource.tf" }}
18+
19+
### Using write-only attributes
20+
21+
The `file_contents_wo` and `file_contents_wo_version` attributes provide write-only alternatives to `file_contents`.
22+
These attributes are not stored in the Terraform state, making them useful for sensitive content management.
23+
24+
{{ tffile "examples/resources/elasticstack_kibana_import_saved_objects/resource-write-only.tf" }}
25+
26+
{{ .SchemaMarkdown | trimspace }}

0 commit comments

Comments
 (0)