diff --git a/quickstart/101-cognitive-services-account/main.tf b/quickstart/101-cognitive-services-account/main.tf new file mode 100644 index 00000000..78b13afd --- /dev/null +++ b/quickstart/101-cognitive-services-account/main.tf @@ -0,0 +1,24 @@ +resource "random_pet" "rg_name" { + prefix = var.resource_group_name_prefix +} + +resource "azurerm_resource_group" "rg" { + name = random_pet.rg_name.id + location = var.resource_group_location +} + +resource "random_string" "azurerm_cognitive_account_name" { + length = 13 + lower = true + numeric = false + special = false + upper = false +} + +resource "azurerm_cognitive_account" "cognitive_service" { + name = "CognitiveService-${random_string.azurerm_cognitive_account_name.result}" + location = azurerm_resource_group.rg.location + resource_group_name = azurerm_resource_group.rg.name + sku_name = var.sku + kind = "CognitiveServices" +} diff --git a/quickstart/101-cognitive-services-account/outputs.tf b/quickstart/101-cognitive-services-account/outputs.tf new file mode 100644 index 00000000..ae1df838 --- /dev/null +++ b/quickstart/101-cognitive-services-account/outputs.tf @@ -0,0 +1,7 @@ +output "resource_group_name" { + value = azurerm_resource_group.rg.name +} + +output "azurerm_cognitive_account_name" { + value = azurerm_cognitive_account.cognitive_service.name +} diff --git a/quickstart/101-cognitive-services-account/providers.tf b/quickstart/101-cognitive-services-account/providers.tf new file mode 100644 index 00000000..4fd5f6ba --- /dev/null +++ b/quickstart/101-cognitive-services-account/providers.tf @@ -0,0 +1,16 @@ +terraform { + required_version = ">=1.0" + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~>3.0" + } + random = { + source = "hashicorp/random" + version = "~>3.0" + } + } +} +provider "azurerm" { + features {} +} \ No newline at end of file diff --git a/quickstart/101-cognitive-services-account/readme.md b/quickstart/101-cognitive-services-account/readme.md new file mode 100644 index 00000000..ee580dad --- /dev/null +++ b/quickstart/101-cognitive-services-account/readme.md @@ -0,0 +1,18 @@ +# Azure Cognitive Services account + +This template deploys an Azure Cognitive Services account. + +## Terraform resource types + +- [random_pet](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) +- [azurerm_resource_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) +- [random_string](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) +- [azurerm_cognitive_account](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cognitive_account) + +## Variables + +| Name | Description | Default | +|-|-|-| +| `resource_group_name_prefix` | Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription. | rg | +| `resource_group_location` | Location of the resource group. | eastus | +| `sku` | The sku name of the Azure Analysis Services server to create. | S0 | diff --git a/quickstart/101-cognitive-services-account/variables.tf b/quickstart/101-cognitive-services-account/variables.tf new file mode 100644 index 00000000..207e4d60 --- /dev/null +++ b/quickstart/101-cognitive-services-account/variables.tf @@ -0,0 +1,17 @@ +variable "resource_group_location" { + type = string + description = "Location for all resources." + default = "eastus" +} + +variable "resource_group_name_prefix" { + type = string + description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription." + default = "rg" +} + +variable "sku" { + type = string + description = "The sku name of the Azure Analysis Services server to create. Choose from: B1, B2, D1, S0, S1, S2, S3, S4, S8, S9. Some skus are region specific. See https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-overview#availability-by-region" + default = "S0" +}