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_ips
optional - list of string -
id
optional computed - string -
location
required - string -
name
required - string -
partition_count
optional computed - number -
primary_key
optional computed - string -
public_network_access_enabled
optional - bool -
query_keys
optional computed - list of object -
replica_count
optional computed - number -
resource_group_name
required - string -
secondary_key
optional computed - string -
sku
required - string -
tags
optional - map from string to string -
identity
list block-
principal_id
optional computed - string -
tenant_id
optional computed - string -
type
required - string
-
-
timeouts
single 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
apiVersion
required - stringidentity
optionaltype
required - stringThe identity type.
location
required - stringThe geo-location where the resource lives
name
required - 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.
properties
requiredhostingMode
optional - 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'.
networkRuleSet
optionalipRules
optional arrayvalue
optional - 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.
partitionCount
optional - 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.
publicNetworkAccess
optional - 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.
replicaCount
optional - 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.
sku
optionalname
optional - 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.'.
tags
optional - stringResource tags.
type
required - 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.