@@ -12,72 +12,28 @@ exploiting the hot reload capabilities.
1212
1313## Configuring the resource via Terraform
1414
15- As the resource is quite simple to configure, you can use ` azurerm ` resource to
16- deploy an instance of the service. Below is an example showing how to configure
17- an instance with private connectivity and allowing authentication only via Entra
18- ID.
15+ The resource can be provisioned using the module
16+ [ ` azure_app_configuration ` ] ( https://registry.terraform.io/modules/pagopa-dx/azure-app-configuration/azurerm/latest ) ,
17+ which deploys an instance with private conenctivity and allowing authentication
18+ only via Entra ID.
1919
2020``` hcl
2121
22- resource "azurerm_app_configuration" "example" {
23- name = provider::azuredx::resource_name(merge(
24- var.naming_config,
25- {
26- name = "demo",
27- resource_type = "app_configuration",
28- })
29- )
30- resource_group_name = local.resource_group_name
31- location = local.environment.location
32-
33- identity {
34- type = "SystemAssigned"
35- }
36-
37- sku = "standard" # others are free and premium
38- data_plane_proxy_authentication_mode = "Pass-through"
39- local_auth_enabled = false
22+ module "appcs" {
23+ source = "pagopa-dx/azure-app-configuration/azurerm"
24+ version = "~> 0.0"
4025
41- public_network_access = "Disabled"
42- purge_protection_enabled = true
43-
44- tags = local.tags
45- }
26+ environment = local.environment
27+ resource_group_name = var.resource_group_name
4628
47- data "azurerm_private_dns_zone" "appconfig" {
48- name = "privatelink.azconfig.io"
49- resource_group_name = var.private_dns_zone_resource_group_name
50- }
29+ subnet_pep_id = data.azurerm_subnet.pep.id
5130
52- resource "azurerm_private_endpoint" "app_config" {
53- name = provider::azuredx::resource_name(merge(
54- var.naming_config,
55- {
56- name = "demo",
57- resource_type = "app_configuration_private_endpoint",
58- })
59- )
60- location = local.environment.location
61- resource_group_name = local.resource_group_name
62- subnet_id = var.subnet_pep_id
63-
64- private_service_connection {
65- name = provider::azuredx::resource_name(merge(
66- var.naming_config,
67- {
68- name = "demo",
69- resource_type = "app_configuration_private_endpoint",
70- })
71- )
72- private_connection_resource_id = azurerm_app_configuration.example.id
73- is_manual_connection = false
74- subresource_names = ["configurationStores"]
31+ virtual_network = {
32+ name = local.virtual_network.name
33+ resource_group_name = local.virtual_network.resource_group_name
7534 }
7635
77- private_dns_zone_group {
78- name = "private-dns-zone-group"
79- private_dns_zone_ids = [data.azurerm_private_dns_zone.appconfig.id]
80- }
36+ private_dns_zone_resource_group_name = data.azurerm_resource_group.network.name
8137
8238 tags = local.tags
8339}
@@ -86,7 +42,7 @@ module "roles" {
8642 source = "pagopa-dx/azure-role-assignments/azurerm"
8743 version = "~> 1.3"
8844
89- principal_id = module.test_app.app_service.app_service.principal_id
45+ principal_id = module.test_app.app_service.app_service.principal_id # example application which needs to access App Configuration
9046 subscription_id = data.azurerm_subscription.current.subscription_id
9147
9248 app_config = [
@@ -122,28 +78,27 @@ provider "azurerm" {
12278If your application has sensitive application settings (secrets), the
12379AppConfiguration instance should be configured to retrieve those secrets from
12480Azure Key Vault, to make them available to the application. The authentication
125- via identities between AppConfiguration and KeyVault is managed via Terraform:
81+ via identities between AppConfiguration and KeyVault is managed by the module
82+ [ ` azure_app_configuration ` ] ( https://registry.terraform.io/modules/pagopa-dx/azure-app-configuration/azurerm/latest ) ,
83+ which optionally accepts a KeyVault reference:
12684
12785``` hcl
12886
129- module "roles" {
130- source = "pagopa-dx/azure-role-assignments/azurerm"
131- version = "~> 1.3"
13287
133- principal_id = azurerm_app_configuration.example.identity[0].principal_id
134- subscription_id = data.azurerm_subscription.current.subscription_id
88+ module "appcs_with_kv" {
89+ source = "pagopa-dx/azure-app-configuration/azurerm"
90+ version = "~> 0.0"
13591
136- app_config = [
137- {
138- name = azurerm_app_configuration.example.name
139- resource_group_name = azurerm_app_configuration.example.resource_group_name
140- has_rbac_support = true # or false if KeyVault is using Access Policies
141- description = "Complete access to app configuration control plane and data"
142- roles = {
143- secrets = "Reader" # Allow AppConfiguration to read secrets from KeyVault
144- }
145- }
146- ]
92+ ...
93+
94+ key_vault = {
95+ subscription_id = data.azurerm_subscription.current.subscription_id
96+ name = azurerm_key_vault.kv.name
97+ resource_group_name = azurerm_key_vault.kv.resource_group_name
98+ has_rbac_support = true # or false if KeyVault uses Access Policies
99+ }
100+
101+ tags = local.tags
147102}
148103
149104```
0 commit comments