diff --git a/provider/resource_opensearch_roles_mapping_test.go b/provider/resource_opensearch_roles_mapping_test.go index 06aa464..62d6b21 100644 --- a/provider/resource_opensearch_roles_mapping_test.go +++ b/provider/resource_opensearch_roles_mapping_test.go @@ -26,6 +26,27 @@ func TestAccOpensearchOpenDistroRolesMapping(t *testing.T) { Providers: testAccOpendistroProviders, CheckDestroy: testAccCheckOpensearchRolesMappingDestroy, Steps: []resource.TestStep{ + { + Config: testAccOpenDistroRoleMappingTestOnlyUser(randomName), + Check: resource.ComposeTestCheckFunc( + testCheckOpensearchRolesMappingExists("opensearch_roles_mapping.test"), + resource.TestCheckResourceAttr( + "opensearch_roles_mapping.test", + "id", + "readall", + ), + resource.TestCheckResourceAttr( + "opensearch_roles_mapping.test", + "users.#", + "1", + ), + resource.TestCheckResourceAttr( + "opensearch_roles_mapping.test", + "description", + randomName, + ), + ), + }, { Config: testAccOpenDistroRolesMappingResource(randomName), Check: resource.ComposeTestCheckFunc( @@ -128,3 +149,17 @@ resource "opensearch_roles_mapping" "test" { } `, resourceName) } + +func testAccOpenDistroRoleMappingTestOnlyUser(resourceName string) string { + return fmt.Sprintf(` +resource "opensearch_roles_mapping" "test" { + role_name = "readall" + users = [ + "admin", + + ] + + description = "%s" +} + `, resourceName) +}