forked from hashicorp/terraform-provider-azurerm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch_service_data_source_test.go
More file actions
71 lines (59 loc) · 2.15 KB
/
search_service_data_source_test.go
File metadata and controls
71 lines (59 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright IBM Corp. 2014, 2025
// SPDX-License-Identifier: MPL-2.0
package search_test
import (
"fmt"
"testing"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
)
type SearchServiceDataSource struct{}
func TestAccDataSourceSearchService_basic(t *testing.T) {
data := acceptance.BuildTestData(t, "data.azurerm_search_service", "test")
r := SearchServiceDataSource{}
data.DataSourceTest(t, []acceptance.TestStep{
{
Config: r.basic(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).Key("endpoint").Exists(),
check.That(data.ResourceName).Key("customer_managed_key_encryption_compliance_status").Exists(),
check.That(data.ResourceName).Key("replica_count").Exists(),
check.That(data.ResourceName).Key("partition_count").Exists(),
check.That(data.ResourceName).Key("primary_key").Exists(),
check.That(data.ResourceName).Key("secondary_key").Exists(),
check.That(data.ResourceName).Key("public_network_access_enabled").Exists(),
check.That(data.ResourceName).Key("identity.0.type").Exists(),
check.That(data.ResourceName).Key("identity.0.principal_id").Exists(),
check.That(data.ResourceName).Key("identity.0.tenant_id").Exists(),
check.That(data.ResourceName).Key("tags.environment").HasValue("production"),
),
},
})
}
func (SearchServiceDataSource) basic(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}
resource "azurerm_search_service" "test" {
name = "acctestsearchservice%d"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
sku = "standard"
identity {
type = "SystemAssigned"
}
tags = {
environment = "production"
}
}
data "azurerm_search_service" "test" {
name = azurerm_search_service.test.name
resource_group_name = azurerm_resource_group.test.name
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}