Skip to content

intel/terraform-intel-azure-mssql-managed-instance

Intel Logo

Intel® Optimized Cloud Modules for Terraform

© Copyright 2024, Intel Corporation

Azure MSSQL Managed Instance Module

The example creates an Intel Optimized Azure MSSQL Managed Instance. Instance Selection and Intel Optimizations have been defaulted in the code. This instance is created on Intel's Xeon Scalable 2.8 GHz processor (Ice Lake) Premium Series Gen5 processor.

The instance is pre-configured with parameters within the database parameter group that is optimized for Intel architecture. The goal of this module is to get you started with an instance configured to run best on Intel architecture.

This module uses a predefined resource group, virtual network, subnet, and network security group.

Important Notice

Important Notice

Provisioning an Azure MSSQL Managed Instance can take up to 6 hours!

More information can be found Overview of Azure SQL Managed Instance management operations.

Performance Data

Normalized 16 vCPU MS SQL NOPM

#

Normalized 8 vCPU MS SQL NOPM

Usage

See examples folder for code ./examples/intel-optimized-azure-mssql-managed-server/main.tf

Example of main.tf

# Example of how to pass variable for instance password:
# terraform apply -var="administrator_login_password=..."
# Environment variables can also be used https://www.terraform.io/language/values/variables#environment-variables

Provision Intel Cloud Optimization Module

variables.tf

  variable "administrator_login_password" {
  description = "Password for the admin login user."
  type        = string
  sensitive   = true
}

main.tf

module "optimized-mssql-managed-instance" {
  name                         = "terraformtestingexample"
  source                       = "intel/azure-mssql-managed-instance/intel"
  administrator_login_password = var.administrator_login_password
  resource_group_name          = "resource_group_example"
  license_type                 = "BasePrice"
  sku_name                     = "GP_Gen5"
  storage_size_in_gb           = 32
  tags                         = {
    owner       = "owner@company.com"
    duration    = "4"
  }
}

Run Terraform

terraform init  
terraform plan
terraform apply


Note that this example may create resources. Run terraform destroy when you don't need these resources anymore.

Considerations

More information about pricing and sku types can be found at: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mssql_managed_instance.

It is important to choose the sku types and vcore options based off of the Terraform documentation and not the pricing calculator because those are the only options that the Azure provider supports.

It is important to either create or associate a predefined a route table to a SQL managed instance subnet that will be associated with the network security group. More details can be found here: https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/vnet-existing-add-subnet?view=azuresql

Requirements

Name Version
azurerm ~>3.86

Providers

Name Version
azurerm ~>3.86

Modules

No modules.

Resources

Name Type
azurerm_mssql_managed_instance.mssql_managed_instance resource
azurerm_network_security_group.nsg data source
azurerm_resource_group.rg data source
azurerm_subnet.subnet data source
azurerm_virtual_network.vnet data source

Inputs

Name Description Type Default Required
administrator_login The administrator login name for the new server string n/a yes
administrator_login_password The password associated with the administrator_login user string n/a yes
azurerm_resource_group_name Name of the resource group to be imported string n/a yes
azurerm_subnet_name The name of the preconfigured subnet string n/a yes
azurerm_virtual_network_name Name of the preconfigured virtual network string n/a yes
license_type What type of license the managed instance will use. Possible values are LicenseIncluded and BasePrice string "LicenseIncluded" no
mi_name The name of the managed instance to be created string n/a yes
nsg_name The name of the network security group to be imported string n/a yes
sku_name The SKU that will be configured for the provisioned virtual machine. Possible values are GP_Gen4, GP_Gen5, GP_Gen8IM, GP_Gen8IH, BC_Gen4, BC_Gen5, BC_Gen8IM or BC_Gen8IH string "GP_Gen8IH" no
storage_size_in_gb The maximum size of storage to be configured on the virtual machine. This should be a multiple of 32 GB number 256 no
tags A mapping of tags to assign to the resource map(any) {} no
vcore_count Number of cores that should be assigned to the SQL Managed Instance. Values can be 8, 16, or 24 for Gen4 SKUs, or 4, 8, 16, 24, 32, 40, 64, or 80 for Gen5 SKUs. number 8 no

Outputs

Name Description
administrator_login MSSQL managed instance administrator username
license_type The type of license the instance used
location Location where the virtual machine will be created
managed_instance_id The ID of the managed instance
network_security_group_id The ID of the preconfigured virtual network
resource_group_name The resource group where the instance resides
sku_name Instance SKU in use for the managed instance that was created
storage_size_in_gb The number of GBs associated with the instance
subnet_id The ID of the preconfigured subnet
tags The tags associated with the instance
timeouts The timeout constraints associated with the instance if configured
vcores Number of vcores on the managed instance
virtual_network_id The ID of the preconfigured virtual network
vm_name The name of the instance being created

About

Intel Cloud Optimization Module - Azure MSSQL Managed Instance

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages