Loading...
Loading...
### Terraform Version ```shell Terraform v1.13.3 on darwin_arm64 ``` ### Terraform Configuration Files ```terraform resource "azurerm_postgresql_flexible_server" "server" { name = local.server_name resource_group_name = var.resource_group_name location = var.azure_location administrator_login = var.pgsql_admin_login administrator_password = random_password.dbadmin.result version = var.pgsql_version storage_mb = var.pgsql_storage_mb create_mode = var.pgsql_create_mode sku_name = var.pgsql_sku_name auto_grow_enabled = var.pgsql_storage_auto_grow_enabled delegated_subnet_id = var.delegated_subnet_id private_dns_zone_id = var.private_dns_zone_id geo_redundant_backup_enabled = var.pgsql_geo_redundant_backup_enabled public_network_access_enabled = local.pgsql_public_network_access_enabled tags = var.tags authentication { password_auth_enabled = true active_directory_auth_enabled = var.active_directory_auth_enabled tenant_id = var.active_directory_auth_enabled ? var.tenant_id : null } dynamic "high_availability" { for_each = local.high_availability_configuration content { mode = var.pgsql_high_availability_mode } } lifecycle { ignore_changes = [ # To avoid the error `zone` and `high_availability.0.standby_availability_zone` # should only be either exchanged with each other or unchanged" when no `zone` is provided. # https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server zone, high_availability.0.standby_availability_zone ] } } resource "azurerm_postgresql_flexible_server_active_directory_administrator" "ad_admin" { for_each = local.active_directory_administrators server_name = azurerm_postgresql_flexible_server.server.name resource_group_name = azurerm_postgresql_flexible_server.server.resource_group_name tenant_id = var.tenant_id object_id = each.value.object_id principal_name = each.value.principal_name principal_type = each.value.principal_type } resource "azurerm_management_lock" "pgsql" { count = var.create_management_lock ? 1 : 0 name = "lock-${local.server_name}" lock_level = "CanNotDelete" scope = azurerm_postgresql_flexible_server.server.id notes = "'CanNotDelete' lock applied to '${local.server_name}'." } ``` ```terraform resource "azurerm_resource_group" "primary" { name = "rg-${local.resource_suffix}" location = var.azure_location tags = local.tags } resource "azurerm_management_lock" "primary_resource_group" { count = var.create_resource_group_lock_for_primary ? 1 : 0 name = "lock-${azurerm_resource_group.primary.name}" lock_level = "CanNotDelete" scope = azurerm_resource_group.primary.id notes = "'CanNotDelete' lock applied to '${azurerm_resource_group.primary.name}'." } module "postgresql_flexible_server" { source = "./modules/postgresql_flexible_server" for_each = var.pgsql_servers resource_group_name = azurerm_resource_group.primary.name azure_location = var.azure_location alz_location = var.alz_location workload_type = local.workload_type environment = each.value.environment_override != null ? each.value.environment_override : var.environment delegated_subnet_id = data.azurerm_subnet.pgsql.id private_dns_zone_id = data.azurerm_private_dns_zone.flex_server.id # kv_id = module.key_vault.id pgsql_admin_login = each.value.administrator_login_username pgsql_geo_redundant_backup_enabled = each.value.geo_redundant_backup_enabled pgsql_high_availability = each.value.high_availability pgsql_high_availability_mode = each.value.high_availability_mode # ZoneRedundant is not possible in West Europe & France Central at the time of writing (03/02/2023) pgsql_backup_retention_days = each.value.backup_retention_days pgsql_create_mode = each.value.create_mode pgsql_public_network_access_enabled = each.value.public_network_access_enabled pgsql_version = each.value.version create_management_lock = false active_directory_auth_enabled = each.value.active_directory_auth_enabled tenant_id = data.azurerm_client_config.current.tenant_id active_directory_administrators = each.value.active_directory_administrators tags = local.tags resource_name_suffix = each.key pgsql_storage_mb = each.value.storage_mb pgsql_sku_name = each.value.sku_name pgsql_storage_auto_grow_enabled = can(each.value.storage_auto_grow_enabled) ? each.value.storage_auto_grow_enabled : false } ``` ### Debug Output ``` 2025-10-15T19:13:52.324+0200 [TRACE] GRPCProvider: GetProviderSchema 2025-10-15T19:13:52.324+0200 [TRACE] GRPCProvider: returning cached schema: EXTRA_VALUE_AT_END=registry.terraform.io/hashicorp/azurerm 2025-10-15T19:13:52.324+0200 [TRACE] provider.terraform-provider-azurerm_v4.48.0_x5: Received request: tf_req_id=7d3287c9-2c87-a2c1-8172-07180832674a tf_rpc=ApplyResourceChange @module=sdk.proto tf_proto_version=5.10 tf_provider_addr=registry.terraform.io/hashicorp/azurerm tf_resource_type=azurerm_postgresql_flexible_server @caller=github.com/hashicorp/terraform-plugin-go@v0.29.0/tfprotov5/tf5server/server.go:931 timestamp="2025-10-15T19:13:52.324+0200" 2025-10-15T19:13:52.324+0200 [TRACE] provider.terraform-provider-azurerm_v4.48.0_x5: Sending request downstream: tf_provider_addr=registry.terraform.io/hashicorp/azurerm tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-go@v0.29.0/tfprotov5/internal/tf5serverlogging/downstream_request.go:22 @module=sdk.proto tf_proto_version=5.10 tf_req_id=7d3287c9-2c87-a2c1-8172-07180832674a tf_resource_type=azurerm_postgresql_flexible_server timestamp="2025-10-15T19:13:52.324+0200" 2025-10-15T19:13:52.324+0200 [TRACE] provider.terraform-provider-azurerm_v4.48.0_x5: calling downstream server: @module=sdk.mux tf_mux_provider="*schema.GRPCProviderServer" tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-mux@v0.21.0/internal/logging/mux.go:19 timestamp="2025-10-15T19:13:52.324+0200" 2025-10-15T19:13:52.324+0200 [TRACE] provider.terraform-provider-azurerm_v4.48.0_x5: Calling downstream: @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.38.1/helper/schema/resource.go:979 @module=sdk.helper_schema tf_mux_provider="*schema.GRPCProviderServer" tf_provider_addr=registry.terraform.io/hashicorp/azurerm tf_req_id=7d3287c9-2c87-a2c1-8172-07180832674a tf_resource_type=azurerm_postgresql_flexible_server tf_rpc=ApplyResourceChange timestamp="2025-10-15T19:13:52.324+0200" 2025-10-15T19:13:52.324+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: [DEBUG] AzureRM Request: 2025-10-15T19:13:52.324+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: GET /subscriptions/some-id/resourceGroups/rg-bnl-we1-nonprod-service-deploy-shared-pgsql-sccplus/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgsql-company-we1-nonprod-service-labs-sccplus-001?api-version=2024-08-01 HTTP/1.1 2025-10-15T19:13:52.324+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Host: management.azure.com 2025-10-15T19:13:52.324+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: User-Agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 servers/2024-08-01) HashiCorp Terraform/1.13.3 (+https://www.terraform.io) terraform-provider-azurerm/dev pid-222c6c49-1b0a-5959-a213-6608f9eb8820 2025-10-15T19:13:52.324+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Content-Type: application/json; charset=utf-8 2025-10-15T19:13:52.324+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Accept-Encoding: gzip 2025-10-15T19:13:52.324+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5 2025-10-15T19:13:52.324+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5 2025-10-15T19:13:52.324+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: [DEBUG] GET https://management.azure.com/subscriptions//resourceGroups/rg-bnl-we1-nonprod-service-deploy-shared-pgsql-sccplus/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgsql-company-we1-nonprod-service-labs-sccplus-001?api-version=2024-08-01 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: [DEBUG] AzureRM Response for https://management.azure.com/subscriptions//resourceGroups/rg-bnl-we1-nonprod-service-deploy-shared-pgsql-sccplus/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgsql-company-we1-nonprod-service-labs-sccplus-001?api-version=2024-08-01: 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: HTTP/2.0 404 Not Found 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Content-Length: 316 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Cache-Control: no-cache 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Content-Type: application/json; charset=utf-8 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Date: Wed, 15 Oct 2025 17:13:52 GMT 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Expires: -1 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Pragma: no-cache 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Strict-Transport-Security: max-age=31536000; includeSubDomains 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Cache: CONFIG_NOCACHE 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Content-Type-Options: nosniff 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Ms-Correlation-Request-Id: ae53c7ed-0a0a-4294-9853-0286397e7d44 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Ms-Failure-Cause: gateway 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Ms-Request-Id: ae53c7ed-0a0a-4294-9853-0286397e7d44 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Ms-Routing-Request-Id: WESTEUROPE:20251015T171353Z:ae53c7ed-0a0a-4294-9853-0286397e7d44 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Msedge-Ref: Ref A: AB9548FF03334C898E0B573CD70F52B8 Ref B: CH1AA2020603049 Ref C: 2025-10-15T17:13:53Z 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: {"error":{"code":"ResourceNotFound","message":"The Resource 'Microsoft.DBforPostgreSQL/flexibleServers/pgsql-company-we1-nonprod-service-labs-sccplus-001' under resource group 'rg-bnl-we1-nonprod-service-deploy-shared-pgsql-sccplus' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"}} 2025-10-15T19:13:53.200+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: [DEBUG]: Default 'storage_tier' Set -> "P4" 2025-10-15T19:13:53.202+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: [DEBUG] AzureRM Request: 2025-10-15T19:13:53.202+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: PUT /subscriptions/some-id/resourceGroups/rg-bnl-we1-nonprod-service-deploy-shared-pgsql-sccplus/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgsql-company-we1-nonprod-service-labs-sccplus-001?api-version=2024-08-01 HTTP/1.1 2025-10-15T19:13:53.202+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Host: management.azure.com 2025-10-15T19:13:53.202+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: User-Agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 servers/2024-08-01) HashiCorp Terraform/1.13.3 (+https://www.terraform.io) terraform-provider-azurerm/dev pid-222c6c49-1b0a-5959-a213-6608f9eb8820 2025-10-15T19:13:53.202+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Content-Length: 1291 2025-10-15T19:13:53.202+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Content-Type: application/json; charset=utf-8 2025-10-15T19:13:53.202+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Accept-Encoding: gzip 2025-10-15T19:13:53.202+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5 2025-10-15T19:13:53.202+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: {"identity":{"type":"None","userAssignedIdentities":null},"location":"westeurope","properties":{"administratorLogin":"dbadmin","administratorLoginPassword":"f3NWwCNaQUZCU4sBjhU9G74m5fbn06uW","authConfig":{"activeDirectoryAuth":"Enabled","passwordAuth":"Enabled","tenantId":"6e06e42d-6925-47c6-b9e7-9581c7ca302a"},"backup":{"geoRedundantBackup":"Disabled"},"createMode":"Update","highAvailability":{"mode":"Disabled"},"network":{"delegatedSubnetResourceId":"/subscriptions/some-id/resourceGroups/rg-d-we1-company-default-primary-networking/providers/Microsoft.Network/virtualNetworks/vnet-d-we1-company-default-primary/subnets/sub-d-we1-enterprise-44-81-46-192-28","privateDnsZoneArmResourceId":"/subscriptions/some-id/resourceGroups/rg-bnl-global-nonprod-shared-resources/providers/Microsoft.Network/privateDnsZones/flex.nonprod.postgres.database.azure.com","publicNetworkAccess":"Disabled"},"storage":{"autoGrow":"Disabled","storageSizeGB":32,"tier":"P4"},"version":"16"},"sku":{"name":"Standard_B2s","tier":"Burstable"},"tags":{"alz_location":"we1","app.service":"AS_Postgress_SQL_Cloud_Database_BNL_T","business_unit":"labs","created_with":"terraform","deployment_mode":"automation","environment":"nonprod","workload_type":"service"}} 2025-10-15T19:13:53.202+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: [DEBUG] PUT https://management.azure.com/subscriptions//resourceGroups/rg-bnl-we1-nonprod-service-deploy-shared-pgsql-sccplus/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgsql-company-we1-nonprod-service-labs-sccplus-001?api-version=2024-08-01 2025-10-15T19:13:53.739+0200 [TRACE] dag/walk: vertex "module.postgresql_flexible_server.output.server_name (expand)" is waiting for "module.postgresql_flexible_server[\"labs-sccplus-001\"].azurerm_postgresql_flexible_server.server" 2025-10-15T19:13:53.739+0200 [TRACE] dag/walk: vertex "module.postgresql_flexible_server.azurerm_postgresql_flexible_server_active_directory_administrator.ad_admin (expand)" is waiting for "module.postgresql_flexible_server[\"labs-sccplus-001\"].azurerm_postgresql_flexible_server.server" 2025-10-15T19:13:53.739+0200 [TRACE] dag/walk: vertex "module.postgresql_flexible_server (close)" is waiting for "module.postgresql_flexible_server.azurerm_management_lock.pgsql (expand)" 2025-10-15T19:13:53.739+0200 [TRACE] dag/walk: vertex "root" is waiting for "provider[\"registry.terraform.io/hashicorp/azurerm\"] (close)" 2025-10-15T19:13:53.739+0200 [TRACE] dag/walk: vertex "module.postgresql_flexible_server.output.server_fqdn (expand)" is waiting for "module.postgresql_flexible_server[\"labs-sccplus-001\"].azurerm_postgresql_flexible_server.server" 2025-10-15T19:13:53.739+0200 [TRACE] dag/walk: vertex "module.postgresql_flexible_server[\"labs-sccplus-001\"].azurerm_postgresql_flexible_server_active_directory_administrator.ad_admin[\"73ba5a92-37cd-458f-a17f-d3784f4db77f\"]" is waiting for "module.postgresql_flexible_server.azurerm_postgresql_flexible_server_active_directory_administrator.ad_admin (expand)" 2025-10-15T19:13:53.739+0200 [TRACE] dag/walk: vertex "module.postgresql_flexible_server.azurerm_management_lock.pgsql (expand)" is waiting for "module.postgresql_flexible_server[\"labs-sccplus-001\"].azurerm_postgresql_flexible_server.server" 2025-10-15T19:13:53.739+0200 [TRACE] dag/walk: vertex "module.postgresql_flexible_server.output.server_id (expand)" is waiting for "module.postgresql_flexible_server[\"labs-sccplus-001\"].azurerm_postgresql_flexible_server.server" 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: [DEBUG] AzureRM Response for https://management.azure.com/subscriptions//resourceGroups/rg-bnl-we1-nonprod-service-deploy-shared-pgsql-sccplus/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgsql-company-we1-nonprod-service-labs-sccplus-001?api-version=2024-08-01: 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: HTTP/2.0 404 Not Found 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Content-Length: 200 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Cache-Control: no-cache 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Content-Type: application/json; charset=utf-8 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Date: Wed, 15 Oct 2025 17:13:53 GMT 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Expires: -1 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Pragma: no-cache 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: Strict-Transport-Security: max-age=31536000; includeSubDomains 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Cache: CONFIG_NOCACHE 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Content-Type-Options: nosniff 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Ms-Correlation-Request-Id: 1ba10015-f24c-4e94-ac9f-b01a08ac547a 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Ms-Operation-Identifier: tenantId=6e06e42d-6925-47c6-b9e7-9581c7ca302a,objectId=43ffb199-78a3-4fed-bce5-a82b8e2cda7f/westeurope/8c23b5ce-ed90-4995-8d0f-4810c00f009d 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Ms-Ratelimit-Remaining-Subscription-Global-Writes: 2999 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Ms-Ratelimit-Remaining-Subscription-Writes: 199 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Ms-Request-Id: b6f21f60-3392-4732-ba55-959c3b82c154 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Ms-Routing-Request-Id: WESTEUROPE:20251015T171354Z:1ba10015-f24c-4e94-ac9f-b01a08ac547a 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: X-Msedge-Ref: Ref A: 14540C50CE3046B19D4FCDF9DF175961 Ref B: CH1AA2020603033 Ref C: 2025-10-15T17:13:53Z 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5 2025-10-15T19:13:54.507+0200 [DEBUG] provider.terraform-provider-azurerm_v4.48.0_x5: {"error":{"code":"ResourceNotFound","message":"The requested resource of type 'Microsoft.DBforPostgreSQL/flexibleServers' with name 'pgsql-company-we1-nonprod-service-labs-sccplus-001' was not found."}} 2025-10-15T19:13:54.507+0200 [TRACE] provider.terraform-provider-azurerm_v4.48.0_x5: Called downstream: @caller=github.com/hashicorp/terraform-plugin-sdk/v2@v2.38.1/helper/schema/resource.go:981 @module=sdk.helper_schema tf_mux_provider="*schema.GRPCProviderServer" tf_rpc=ApplyResourceChange tf_provider_addr=registry.terraform.io/hashicorp/azurerm tf_req_id=7d3287c9-2c87-a2c1-8172-07180832674a tf_resource_type=azurerm_postgresql_flexible_server timestamp="2025-10-15T19:13:54.507+0200" 2025-10-15T19:13:54.507+0200 [TRACE] provider.terraform-provider-azurerm_v4.48.0_x5: Received downstream response: tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-go@v0.29.0/tfprotov5/internal/tf5serverlogging/downstream_request.go:61 @module=sdk.proto diagnostic_warning_count=0 tf_provider_addr=registry.terraform.io/hashicorp/azurerm tf_req_duration_ms=2183 diagnostic_error_count=1 tf_proto_version=5.10 tf_req_id=7d3287c9-2c87-a2c1-8172-07180832674a tf_resource_type=azurerm_postgresql_flexible_server timestamp="2025-10-15T19:13:54.507+0200" 2025-10-15T19:13:54.507+0200 [ERROR] provider.terraform-provider-azurerm_v4.48.0_x5: Response contains error diagnostic: tf_rpc=ApplyResourceChange diagnostic_detail="" diagnostic_summary= | creating Flexible Server (Subscription: "some-id" | Resource Group Name: "rg-bnl-we1-nonprod-service-deploy-shared-pgsql-sccplus" | Flexible Server Name: "pgsql-company-we1-nonprod-service-labs-sccplus-001"): performing Create: unexpected status 404 (404 Not Found) with error: ResourceNotFound: The requested resource of type 'Microsoft.DBforPostgreSQL/flexibleServers' with name 'pgsql-company-we1-nonprod-service-labs-sccplus-001' was not found. tf_proto_version=5.10 tf_provider_addr=registry.terraform.io/hashicorp/azurerm tf_req_id=7d3287c9-2c87-a2c1-8172-07180832674a @caller=github.com/hashicorp/terraform-plugin-go@v0.29.0/tfprotov5/internal/diag/diagnostics.go:58 @module=sdk.proto diagnostic_severity=ERROR tf_resource_type=azurerm_postgresql_flexible_server timestamp="2025-10-15T19:13:54.507+0200" 2025-10-15T19:13:54.507+0200 [TRACE] provider.terraform-provider-azurerm_v4.48.0_x5: Served request: tf_provider_addr=registry.terraform.io/hashicorp/azurerm tf_req_id=7d3287c9-2c87-a2c1-8172-07180832674a tf_resource_type=azurerm_postgresql_flexible_server tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-go@v0.29.0/tfprotov5/tf5server/server.go:957 @module=sdk.proto tf_proto_version=5.10 timestamp="2025-10-15T19:13:54.507+0200" 2025-10-15T19:13:54.508+0200 [TRACE] maybeTainted: module.postgresql_flexible_server["labs-sccplus-001"].azurerm_postgresql_flexible_server.server encountered an error during creation, so it is now marked as tainted 2025-10-15T19:13:54.508+0200 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/hashicorp/azurerm" is in the global cache 2025-10-15T19:13:54.508+0200 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for module.postgresql_flexible_server["labs-sccplus-001"].azurerm_postgresql_flexible_server.server 2025-10-15T19:13:54.508+0200 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for module.postgresql_flexible_server["labs-sccplus-001"].azurerm_postgresql_flexible_server.server 2025-10-15T19:13:54.508+0200 [TRACE] evalApplyProvisioners: module.postgresql_flexible_server["labs-sccplus-001"].azurerm_postgresql_flexible_server.server is tainted, so skipping provisioning 2025-10-15T19:13:54.508+0200 [TRACE] maybeTainted: module.postgresql_flexible_server["labs-sccplus-001"].azurerm_postgresql_flexible_server.server was already tainted, so nothing to do 2025-10-15T19:13:54.508+0200 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/hashicorp/azurerm" is in the global cache 2025-10-15T19:13:54.508+0200 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for module.postgresql_flexible_server["labs-sccplus-001"].azurerm_postgresql_flexible_server.server 2025-10-15T19:13:54.508+0200 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for module.postgresql_flexible_server["labs-sccplus-001"].azurerm_postgresql_flexible_server.server 2025-10-15T19:13:54.508+0200 [DEBUG] State storage *remote.State declined to persist a state snapshot 2025-10-15T19:13:54.508+0200 [ERROR] vertex "module.postgresql_flexible_server[\"labs-sccplus-001\"].azurerm_postgresql_flexible_server.server" error: creating Flexible Server (Subscription: "some-id" Resource Group Name: "rg-bnl-we1-nonprod-service-deploy-shared-pgsql-sccplus" Flexible Server Name: "pgsql-company-we1-nonprod-service-labs-sccplus-001"): performing Create: unexpected status 404 (404 Not Found) with error: ResourceNotFound: The requested resource of type 'Microsoft.DBforPostgreSQL/flexibleServers' with name 'pgsql-company-we1-nonprod-service-labs-sccplus-001' was not found. 2025-10-15T19:13:54.509+0200 [TRACE] vertex "module.postgresql_flexible_server[\"labs-sccplus-001\"].azurerm_postgresql_flexible_server.server": visit complete, with errors 2025-10-15T19:13:54.509+0200 [TRACE] dag/walk: upstream of "module.postgresql_flexible_server.azurerm_management_lock.pgsql (expand)" errored, so skipping 2025-10-15T19:13:54.509+0200 [TRACE] dag/walk: upstream of "module.postgresql_flexible_server.output.server_name (expand)" errored, so skipping 2025-10-15T19:13:54.509+0200 [TRACE] dag/walk: upstream of "module.postgresql_flexible_server.output.server_id (expand)" errored, so skipping 2025-10-15T19:13:54.509+0200 [TRACE] dag/walk: upstream of "module.postgresql_flexible_server.azurerm_postgresql_flexible_server_active_directory_administrator.ad_admin (expand)" errored, so skipping 2025-10-15T19:13:54.509+0200 [TRACE] dag/walk: upstream of "module.postgresql_flexible_server.output.server_fqdn (expand)" errored, so skipping 2025-10-15T19:13:54.509+0200 [TRACE] dag/walk: upstream of "module.postgresql_flexible_server[\"labs-sccplus-001\"].azurerm_postgresql_flexible_server_active_directory_administrator.ad_admin[\"73ba5a92-37cd-458f-a17f-d3784f4db77f\"]" errored, so skipping 2025-10-15T19:13:54.509+0200 [TRACE] dag/walk: upstream of "module.postgresql_flexible_server (close)" errored, so skipping 2025-10-15T19:13:54.509+0200 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/hashicorp/azurerm\"] (close)" errored, so skipping 2025-10-15T19:13:54.509+0200 [TRACE] dag/walk: upstream of "root" errored, so skipping 2025-10-15T19:13:54.509+0200 [TRACE] terraform.contextPlugins: Schema for provider "registry.terraform.io/hashicorp/azurerm" is in the global cache 2025-10-15T19:13:54.509+0200 [DEBUG] states/remote: state read serial is: 3; serial is: 3 2025-10-15T19:13:54.509+0200 [DEBUG] states/remote: state read lineage is: d9627449-b93a-05ae-5ba9-1ff22b0843e6; lineage is: d9627449-b93a-05ae-5ba9-1ff22b0843e6 2025-10-15T19:13:54.511+0200 [DEBUG] HEAD https://satfstatenonprod19519.blob.core.windows.net/tfstate/bnl-azure-labs-deploy-shared-pgsql-sccplus/env:labs-sccplus-nonprod 2025-10-15T19:13:54.746+0200 [DEBUG] PUT https://satfstatenonprod19519.blob.core.windows.net/tfstate/bnl-azure-labs-deploy-shared-pgsql-sccplus/env:labs-sccplus-nonprod 2025-10-15T19:13:54.956+0200 [DEBUG] HEAD https://satfstatenonprod19519.blob.core.windows.net/tfstate/bnl-azure-labs-deploy-shared-pgsql-sccplus/env:labs-sccplus-nonprod 2025-10-15T19:13:55.145+0200 [DEBUG] HEAD https://satfstatenonprod19519.blob.core.windows.net/tfstate/bnl-azure-labs-deploy-shared-pgsql-sccplus/env:labs-sccplus-nonprod 2025-10-15T19:13:55.339+0200 [DEBUG] PUT https://satfstatenonprod19519.blob.core.windows.net/tfstate/bnl-azure-labs-deploy-shared-pgsql-sccplus/env:labs-sccplus-nonprod?comp=metadata 2025-10-15T19:13:55.543+0200 [DEBUG] PUT https://satfstatenonprod19519.blob.core.windows.net/tfstate/bnl-azure-labs-deploy-shared-pgsql-sccplus/env:labs-sccplus-nonprod?comp=lease 2025-10-15T19:13:55.759+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF" 2025-10-15T19:13:55.775+0200 [INFO] provider: plugin process exited: plugin=.terraform/providers/registry.terraform.io/hashicorp/azurerm/4.48.0/darwin_arm64/terraform-provider-azurerm_v4.48.0_x5 id=55177 2025-10-15T19:13:55.775+0200 [DEBUG] provider: plugin exited ``` ### Expected Behavior The code should create the PosgreSQL Flexible server ### Actual Behavior It fails with the error ``` 2025-10-15T19:13:54.507+0200 [ERROR] provider.terraform-provider-azurerm_v4.48.0_x5: Response contains error diagnostic: tf_rpc=ApplyResourceChange diagnostic_detail="" diagnostic_summary= | creating Flexible Server (Subscription: "some-id" | Resource Group Name: "rg-bnl-we1-nonprod-service-deploy-shared-pgsql-sccplus" | Flexible Server Name: "pgsql-company-we1-nonprod-service-labs-sccplus-001"): performing Create: unexpected status 404 (404 Not Found) with error: ResourceNotFound: The requested resource of type 'Microsoft.DBforPostgreSQL/flexibleServers' with name 'pgsql-company-we1-nonprod-service-labs-sccplus-001' was not found. tf_proto_version=5.10 tf_provider_addr=registry.terraform.io/hashicorp/azurerm tf_req_id=7d3287c9-2c87-a2c1-8172-07180832674a @caller=github.com/hashicorp/terraform-plugin-go@v0.29.0/tfprotov5/internal/diag/diagnostics.go:58 @module=sdk.proto diagnostic_severity=ERROR tf_resource_type=azurerm_postgresql_flexible_server timestamp="2025-10-15T19:13:54.507+0200" ``` ### Steps to Reproduce terraform init terraform apply ### Additional Context This is part of a larger code base that I've been using for 5 years to create PostgreSQL servers in Azure. Over time, there has been changes, but it's the same code base. Today I was trying to create a PostgreSQL in a new subscription and I'm getting an error. For troubleshooting, I've successfully created a PostgreSQL via the Azure portal; I've checked if the namespace is registered (yes, it was registered), the user logged in the Azure portal and in the terminal is the same; that user is able to create other resources (such as key vaults, resource groups, storage accounts, etc). I've also created a smaller project that only creates the PostgreSQL server, to remove any potential conflicts. > NOTE: I've added partially the debug information because I'm getting a `500` error from GitHub when I'm trying to create or update a gist. ### References _No response_ ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.