Skip to content

Commit fd7315d

Browse files
committed
complete testing
1 parent 737ad63 commit fd7315d

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

docs/resources/elasticsearch_security_role.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ Optional:
9999

100100
- **field_security** (Block List, Max: 1) The document fields that the owners of the role have read access to. (see [below for nested schema](#nestedblock--indices--field_security))
101101
- **query** (String) A search query that defines the documents the owners of the role have read access to.
102+
- **allow_restricted_indices** (Boolean) Include matching restricted indices in names parameter (usage is strongly discouraged as it can grant unrestricted operations on critical data, make the entire system unstable or leak sensitive information).
102103

103104
<a id="nestedblock--indices--field_security"></a>
104105
### Nested Schema for `indices.field_security`

internal/elasticsearch/security/role.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func ResourceRole() *schema.Resource {
127127
Optional: true,
128128
},
129129
"allow_restricted_indices": {
130-
Description: "Include matching restricted indices in names parameter.",
130+
Description: "Include matching restricted indices in names parameter. Usage is strongly discouraged as it can grant unrestricted operations on critical data, make the entire system unstable or leak sensitive information.",
131131
Type: schema.TypeBool,
132132
Optional: true,
133133
},

internal/elasticsearch/security/role_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func TestAccResourceSecurityRole(t *testing.T) {
2424
Config: testAccResourceSecurityRoleCreate(roleName),
2525
Check: resource.ComposeTestCheckFunc(
2626
resource.TestCheckResourceAttr("elasticstack_elasticsearch_security_role.test", "name", roleName),
27+
resource.TestCheckResourceAttr("elasticstack_elasticsearch_security_role.test", "indices.0.allow_restricted_indices", "true"),
2728
resource.TestCheckTypeSetElemAttr("elasticstack_elasticsearch_security_role.test", "indices.*.names.*", "index1"),
2829
resource.TestCheckTypeSetElemAttr("elasticstack_elasticsearch_security_role.test", "indices.*.names.*", "index2"),
2930
resource.TestCheckTypeSetElemAttr("elasticstack_elasticsearch_security_role.test", "cluster.*", "all"),
@@ -41,6 +42,7 @@ func TestAccResourceSecurityRole(t *testing.T) {
4142
resource.TestCheckNoResourceAttr("elasticstack_elasticsearch_security_role.test", "run_as"),
4243
resource.TestCheckNoResourceAttr("elasticstack_elasticsearch_security_role.test", "global"),
4344
resource.TestCheckNoResourceAttr("elasticstack_elasticsearch_security_role.test", "applications"),
45+
resource.TestCheckNoResourceAttr("elasticstack_elasticsearch_security_role.test", "indices.0.allow_restricted_indices"),
4446
),
4547
},
4648
},
@@ -60,6 +62,7 @@ resource "elasticstack_elasticsearch_security_role" "test" {
6062
indices {
6163
names = ["index1", "index2"]
6264
privileges = ["all"]
65+
allow_restricted_indices = true
6366
}
6467
6568
applications {

main.tf

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)