@@ -19,6 +19,7 @@ func TestAccResourceKibanaSecurityRole(t *testing.T) {
1919 roleName := sdkacctest .RandStringFromCharSet (10 , sdkacctest .CharSetAlphaNum )
2020 roleNameRemoteIndices := sdkacctest .RandStringFromCharSet (10 , sdkacctest .CharSetAlphaNum )
2121 minSupportedRemoteIndicesVersion := version .Must (version .NewSemver ("8.10.0" ))
22+ minSupportedDescriptionVersion := version .Must (version .NewVersion ("8.15.0" ))
2223
2324 resource .Test (t , resource.TestCase {
2425 PreCheck : func () { acctest .PreCheck (t ) },
@@ -48,6 +49,19 @@ func TestAccResourceKibanaSecurityRole(t *testing.T) {
4849 utils .TestCheckResourceListAttr ("elasticstack_kibana_security_role.test" , "kibana.0.spaces" , []string {"default" }),
4950 ),
5051 },
52+ {
53+ SkipFunc : versionutils .CheckIfVersionIsUnsupported (minSupportedDescriptionVersion ),
54+ Config : testAccResourceSecurityRoleWithDescription (roleName ),
55+ Check : resource .ComposeTestCheckFunc (
56+ resource .TestCheckResourceAttr ("elasticstack_kibana_security_role.test" , "name" , roleName ),
57+ resource .TestCheckNoResourceAttr ("elasticstack_kibana_security_role.test" , "kibana.0.feature.#" ),
58+ resource .TestCheckNoResourceAttr ("elasticstack_kibana_security_role.test" , "elasticsearch.0.indices.0.field_security.#" ),
59+ utils .TestCheckResourceListAttr ("elasticstack_kibana_security_role.test" , "elasticsearch.0.run_as" , []string {"elastic" , "kibana" }),
60+ utils .TestCheckResourceListAttr ("elasticstack_kibana_security_role.test" , "kibana.0.base" , []string {"all" }),
61+ utils .TestCheckResourceListAttr ("elasticstack_kibana_security_role.test" , "kibana.0.spaces" , []string {"default" }),
62+ resource .TestCheckResourceAttr ("elasticstack_kibana_security_role.test" , "description" , "Role description" ),
63+ ),
64+ },
5165 {
5266 SkipFunc : versionutils .CheckIfVersionIsUnsupported (minSupportedRemoteIndicesVersion ),
5367 Config : testAccResourceSecurityRoleRemoteIndicesCreate (roleNameRemoteIndices ),
@@ -174,6 +188,32 @@ resource "elasticstack_kibana_security_role" "test" {
174188 ` , roleName )
175189}
176190
191+ func testAccResourceSecurityRoleWithDescription (roleName string ) string {
192+ return fmt .Sprintf (`
193+ provider "elasticstack" {
194+ elasticsearch {}
195+ kibana {}
196+ }
197+
198+ resource "elasticstack_kibana_security_role" "test" {
199+ name = "%s"
200+ description = "Role description"
201+ elasticsearch {
202+ cluster = [ "create_snapshot" ]
203+ indices {
204+ names = ["sample"]
205+ privileges = ["create", "read", "write"]
206+ }
207+ run_as = ["kibana", "elastic"]
208+ }
209+ kibana {
210+ base = [ "all" ]
211+ spaces = ["default"]
212+ }
213+ }
214+ ` , roleName )
215+ }
216+
177217func testAccResourceSecurityRoleRemoteIndicesCreate (roleName string ) string {
178218 return fmt .Sprintf (`
179219provider "elasticstack" {
0 commit comments