Hi,
I’m working on deploy Azure Container Registry with Azure DevOps. Everything works fine till I added Private Endpoint block to my Terraform template. Then I getting error on terraform plan stage like below:
2022-09-19T16:07:51.7254270Z [command]/opt/hostedtoolcache/terraform/1.2.9/x64/terraform plan
2022-09-19T16:08:06.4506037Z e[0me[1mazurerm_container_registry.acr: Refreshing state... [id=/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxxxxxxxxxxxxxxxx-003-rg/providers/Microsoft.ContainerRegistry/registries/crbabogtest2]e[0m
2022-09-19T16:08:07.3578116Z e[31m╷e[0me[0m
2022-09-19T16:08:07.3578884Z e[31m│e[0m e[0me[1me[31mError: e[0me[0me[1mInsufficient features blockse[0m
2022-09-19T16:08:07.3579344Z e[31m│e[0m e[0m
2022-09-19T16:08:07.3579766Z e[31m│e[0m e[0me[0m on <empty> line 0:
2022-09-19T16:08:07.3580220Z e[31m│e[0m e[0m (source code not available)
2022-09-19T16:08:07.3580635Z e[31m│e[0m e[0m
2022-09-19T16:08:07.3581085Z e[31m│e[0m e[0mAt least 1 "features" blocks are required.
2022-09-19T16:08:07.3581518Z e[31m╵e[0me[0m
2022-09-19T16:08:07.3613616Z ##[error]Terraform command 'plan' failed with exit code '1'.
2022-09-19T16:08:07.3666473Z ##[error]e[31m╷e[0me[0m
e[31m│e[0m e[0me[1me[31mError: e[0me[0me[1mInsufficient features blockse[0m
e[31m│e[0m e[0m
e[31m│e[0m e[0me[0m on <empty> line 0:
e[31m│e[0m e[0m (source code not available)
e[31m│e[0m e[0m
e[31m│e[0m e[0mAt least 1 "features" blocks are required.
e[31m╵e[0me[0m
2022-09-19T16:08:07.3672017Z ##[section]Finishing: terraform plan
After few days of tries, I’m a bit lost where I made mistake. Could I ask you for help?
MAIN.TF:
resource "azurerm_container_registry" "acr" {
provider = azurerm.Test-001
name = var.ACRNAME
resource_group_name = var.RESOURCEGROUPNAME
location = var.region
sku = "Premium"
admin_enabled = true
zone_redundancy_enabled = false
public_network_access_enabled = false
}
resource "azurerm_private_endpoint" "main" {
name = "${var.ACRNAME}-pe"
resource_group_name = var.RESOURCEGROUPNAME
location = var.region
subnet_id = "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxxxxxxxxxxxxxxxx/providers/Microsoft.Network/virtualNetworks/xxxxxxxxxxxxxxxxxxxxxxxxxx/subnets/xxxxxxxxxxxxxxxxxxxxxxxxxx-001-sub"
private_dns_zone_group {
name = "default"
private_dns_zone_ids = ["/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxxxxxxxxxxxxxxxx-001-rg/providers/Microsoft.Network/privateDnsZones/privatelink.azurecr.io"]
}
private_service_connection {
is_manual_connection = false
private_connection_resource_id = azurerm_container_registry.acr.id
name = "${var.ACRNAME}-psc"
subresource_names = ["registry"]
}
}
PROVIDERS.TF:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.16.0"
}
}
}
provider "azurerm" {
features {}
subscription_id = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
alias = "Test-001"
}
Thank you for all advices and suggestions.