I tried to automate the deployment of the Azure Arc data controller with Azure Arc SQL-managed instance using Terraform I was able to provision the requirement successfully
Since we have through the different IAC tools like ARM templets, Ansible & Terraform
For deployment with ARM templates refer to the doc shared in comments. Here I used to deploy the infrastructure using the terraform As you mentioned any one of these three mentioned is valid here.
My terraform configuration:
data "azurerm_resource_group" "example" {
name = "v-bolliv"
}
# Deploy Azure Arc Data Controller
resource "azurerm_kubernetes_cluster" "arc_data_controller" {
name = "arc-data-controller"
location = data.azurerm_resource_group.example.location
resource_group_name = data.azurerm_resource_group.example.name
dns_prefix = "arc-data-controller"
default_node_pool {
name = "default"
node_count = 1
vm_size = "Standard_D2_v2"
os_disk_size_gb = 30
}
identity {
type = "SystemAssigned"
}
addon_profile {
kube_dashboard {
enabled = true
}
}
}
resource "azurerm_virtual_network" "example" {
name = "vnet-mi"
resource_group_name = data.azurerm_resource_group.example.name
address_space = ["10.0.0.0/16"]
location = data.azurerm_resource_group.example.location
}
resource "azurerm_subnet" "example" {
name = "subnet-mi"
resource_group_name = data.azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefixes = ["10.0.0.0/24"]
delegation {
name = "managedinstancedelegation"
service_delegation {
name = "Microsoft.Sql/managedInstances"
actions = ["Microsoft.Network/virtualNetworks/subnets/join/action", "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action"]
}
}
}
resource "azurerm_route_table" "example" {
name = "routetable-mi"
location = data.azurerm_resource_group.example.location
resource_group_name = data.azurerm_resource_group.example.name
disable_bgp_route_propagation = false
depends_on = [
azurerm_subnet.example,
]
}
resource "azurerm_subnet_route_table_association" "example" {
subnet_id = azurerm_subnet.example.id
route_table_id = azurerm_route_table.example.id
}
# Deploy Azure Arc SQL Managed Instance
resource "azurerm_sql_managed_instance" "arc_sql_managed_instance" {
name = "arc-sql-managed-instance"
location = data.azurerm_resource_group.example.location
resource_group_name = data.azurerm_resource_group.example.name
sku_name = "GP_Gen5"
storage_size_in_gb = 32
vcores = 4
administrator_login = "adminuser"
administrator_login_password = "Intel@190994"
subnet_id = azurerm_subnet.example.id
license_type = "BasePrice"
extended_auditing_policy {
azure_arc_managed_instance_auditing_policy {
is_enabled = true
}
}
depends_on = [
azurerm_subnet_route_table_association.example,
]
}
Output:

