Closed adamevoila closed 4 months ago
Also when I tried to deploy everything at once from zero this happens. So I first have to deploy the subnet module before I can run the postgres deployment.
╷ │ Error: Invalid for_each argument │ │ on .terraform/modules/postgresql_flexible/r-firewall.tf line 2, in resource "azurerm_postgresql_flexible_server_firewall_rule" "firewall_rules": │ 2: for_each = var.delegated_subnet_id == null ? var.allowed_cidrs : {} │ ├──────────────── │ │ var.allowed_cidrs is empty map of string │ │ var.delegated_subnet_id is a string, known only after apply │ │ The "for_each" map includes keys derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full │ set of keys that will identify the instances of this resource. │ │ When working with unknown values in for_each, it's better to define the map keys statically in your configuration and place apply-time results only │ in the map values. │ │ Alternatively, you could use the -target planning option to first apply only the resources that the for_each value depends on, and then apply a │ second time to fully converge.
Thanks for this opened issue, we will try to reproduce and fix the module in this context.
I think this issue is the reason. https://github.com/hashicorp/terraform-provider-azurerm/issues/26098
Can you please test the 7.4.0 version of the module?
I added public_network_access_enabled
parameter.
Hello I just tested it and it's working fine :) thank you very much
Community Note
When using the claranet/db-postgresql-flexible/azurerm module to deploy an Azure PostgreSQL Flexible Server with a virtual network configuration, a conflict arises due to the lack of an option to disable public network access. The module requires the allowed_cidrs attribute to be specified, even when public access is not desired. Setting allowed_cidrs to an empty map {} does not resolve the issue, as the module still attempts to configure both public network access and virtual network integration, resulting in the following error: Copy codeError: creating Flexible Server (Subscription: "28197c15-da6c-4e66-b241-cd23f9550102" Resource Group Name: "rg-test-tsp1-acc" Flexible Server Name: "psqlf-test-tsp1-gwc-acc"): performing Create: unexpected status 400 (400 Bad Request) with error: ConflictingPublicNetworkAccessAndVirtualNetworkConfiguration: Conflicting configuration is detected between Public Network Access and Virtual Network arguments. Public Network Access is not supported along with Virtual Network feature. The documentation does not provide any information on how to disable public network access or resolve this conflict.
Please advise on how to resolve this issue or provide guidance on disabling public network access when using the claranet/db-postgresql-flexible/azurerm module with virtual network integration.
Terraform Version
1.7.2
AzureRM Provider Version
Affected Resource(s)/Data Source(s)
azurerm_postgresql_flexible_server.postgresql_flexible_server
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
The module should allow for the creation of an Azure PostgreSQL Flexible Server with virtual network integration and public network access disabled.
Actual Behaviour
The module encounters a conflict between the public network access and virtual network configuration, preventing the successful creation of the Azure PostgreSQL Flexible Server.
Steps to Reproduce
I mainly just used yor example deployment. https://github.com/claranet/terraform-azurerm-db-postgresql-flexible/tree/master/examples/delegated_subnet
terraform plan is no problem.
Important Factoids
No response
References
No response