Azure Search Service
This page shows how to write Terraform and Azure Resource Manager for Search Service and write them securely.
azurerm_search_service (Terraform)
The Service in Search can be configured in Terraform with the resource name azurerm_search_service. The following sections describe 8 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_search_service" "basic" {
name = "example-search-service"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
sku = "basic"
partition_count = 2
resource "azurerm_search_service" "basic" {
name = "example-search-service"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
sku = "basic"
partition_count = 2
resource "azurerm_search_service" "properties" {
name = format("%s-search-ukso", local.name_prefix)
resource_group_name = azurerm_resource_group.properties.name
location = azurerm_resource_group.properties.location
sku = "basic"
resource "azurerm_search_service" "search" {
name = var.name
resource_group_name = var.rg_name
location = var.location
sku = "free"
resource "azurerm_search_service" "positive2" {
name = "example-search-service"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
sku = "standard"
}
resource "azurerm_search_service" "positive1" {
name = "example-search-service"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
sku = "standard"
public_network_access_enabled = true
resource "azurerm_search_service" "example" {
name = "example-search-service"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
sku = "standard"
public_network_access_enabled = false
resource "azurerm_search_service" "search" {
name = "customername"
resource_group_name = azurerm_resource_group.paas_rsg.name
location = azurerm_resource_group.paas_rsg.location
sku = "free"
Parameters
-
allowed_ipsoptional - list of string -
idoptional computed - string -
locationrequired - string -
namerequired - string -
partition_countoptional computed - number -
primary_keyoptional computed - string -
public_network_access_enabledoptional - bool -
query_keysoptional computed - list of object -
replica_countoptional computed - number -
resource_group_namerequired - string -
secondary_keyoptional computed - string -
skurequired - string -
tagsoptional - map from string to string -
identitylist block-
principal_idoptional computed - string -
tenant_idoptional computed - string -
typerequired - string
-
-
timeoutssingle block
Explanation in Terraform Registry
Manages a Search Service.
Microsoft.Search/searchServices (Azure Resource Manager)
The searchServices in Microsoft.Search can be configured in Azure Resource Manager with the resource name Microsoft.Search/searchServices. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
"type": "Microsoft.Search/searchServices",
"apiVersion": "2015-08-19",
"location": "West Us",
"sku": { "name": "free" },
"properties": { }
}
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
"type": "Microsoft.Search/searchServices",
"tags": {
"app-name": "My e-commerce app"
},
"sku": {
"name": "standard"
Parameters
apiVersionrequired - stringidentityoptionaltyperequired - stringThe identity type.
locationrequired - stringThe geo-location where the resource lives
namerequired - stringThe name of the Azure Cognitive Search service to create or update. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Search service names must be globally unique since they are part of the service URI (https://<name>.search.windows.net). You cannot change the service name after the service is created.
propertiesrequiredhostingModeoptional - stringApplicable only for the standard3 SKU. You can set this property to enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For all other SKUs, this value must be 'default'.
networkRuleSetoptionalipRulesoptional arrayvalueoptional - stringValue corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in CIDR format (eg., 123.1.2.3/24) to be allowed.
partitionCountoptional - integerThe number of partitions in the search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 and 3.
publicNetworkAccessoptional - stringThis value can be set to 'enabled' to avoid breaking changes on existing customer resources and templates. If set to 'disabled', traffic over public interface is not allowed, and private endpoint connections would be the exclusive access method.
replicaCountoptional - integerThe number of replicas in the search service. If specified, it must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU.
skuoptionalnameoptional - stringThe SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or up to 3 partitions with more indexes if you also set the hostingMode property to 'highDensity'). 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.'.
tagsoptional - stringResource tags.
typerequired - string
Frequently asked questions
What is Azure Search Service?
Azure Search Service is a resource for Search of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Search Service?
For Terraform, the gilyas/infracost, infracost/infracost and DoesDotNet/propt-properties source code examples are useful. See the Terraform Example section for further details.
For Azure Resource Manager, the chironconsulting/ARM-Schema-Templates, assing/alerts-extension and assing/alerts-extension source code examples are useful. See the Azure Resource Manager Example section for further details.