Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ... Error: Error connecting to PostgreSQL server (scheme: postgres): XXXXdXXXXial tcp 127.0.0.1:5432: connect: connection refused #6

Open
leonavevor opened this issue Apr 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@leonavevor
Copy link

leonavevor commented Apr 9, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.6.6

AzureRM Provider Version

7.3.0

Affected Resource(s)/Data Source(s)

postgres flexible server deployment

Terraform Configuration Files

in the process of postgres db creation, terraform fails right after apply the firewall filters.

such as making more configurations after postgres flexible server is deployed.
For example the following configuration wouldn't complete and fails after the firewall filters are applied.


module "postgresql_users" {
  source  = "claranet/users/postgresql"
  version = "6.0.0"

  for_each = module.postgresql_flexible.postgresql_flexible_databases_names
  administrator_login = module.postgresql_flexible.postgresql_flexible_administrator_login
  database = each.key
}

module "postgresql_configuration" {
  source  = "claranet/database-configuration/postgresql"
  version = "6.0.0"

  for_each = module.postgresql_flexible.postgresql_flexible_databases_names

  administrator_login = module.postgresql_flexible.postgresql_flexible_administrator_login
  database_admin_user = module.postgresql_users[each.key].user
  database            = each.key
  schema_name         = each.key
}

Debug Output/Panic Output

module.accelerator.module.postgresql_flexible.azurerm_postgresql_flexible_server_firewall_rule.firewall_rules["0"]: Still creating... [30s elapsed]
module.accelerator.module.postgresql_flexible.azurerm_postgresql_flexible_server_firewall_rule.firewall_rules["0"]: Still creating... [40s elapsed]
module.accelerator.module.postgresql_flexible.azurerm_postgresql_flexible_server_firewall_rule.firewall_rules["0"]: Still creating... [50s elapsed]
module.accelerator.module.postgresql_flexible.azurerm_postgresql_flexible_server_firewall_rule.firewall_rules["0"]: Still creating... [1m0s elapsed]
module.accelerator.module.postgresql_flexible.azurerm_postgresql_flexible_server_firewall_rule.firewall_rules["0"]: Creation complete after 1m2s [id=/subscriptions/xxxxxxxxxxxxxxxx/resourceGroups/rg-fgeasf9/providers/Microsoft.DBforPostgreSQL/flexibleServers/psqlf-default-stack-bla-dev/firewallRules/0]
╷
│ Error: Error connecting to PostgreSQL server  (scheme: postgres): XXXXdXXXXial tcp 127.0.0.1:5432: connect: connection refused
│ 
│   with module.accelerator.module.postgresql_configuration["main_db"].postgresql_grant.revoke_public,
│   on .terraform/modules/accelerator.postgresql_configuration/r-psql-db-config.tf line 1, in resource "postgresql_grant" "revoke_public":
│    1: resource "postgresql_grant" "revoke_public" {
│ 
╵

Expected Behaviour

should apply the firewall filter as the last process so that other operations are not blocked.

Actual Behaviour

fails in the middle of deployment

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@leonavevor leonavevor added the bug Something isn't working label Apr 9, 2024
@Shr3ps
Copy link
Member

Shr3ps commented Apr 9, 2024

Hello,

how did you configure the postgresql provider? did you use the code we have in our examples?

If you look at your error, the provider is trying to connect to 127.0.0.1 (which is not related to firewall settings...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants