Skip to content
This repository was archived by the owner on Nov 14, 2020. It is now read-only.

Fix bug when parse the Azure PostgreSQL version. #40

Merged
merged 1 commit into from
Jul 7, 2018
Merged

Fix bug when parse the Azure PostgreSQL version. #40

merged 1 commit into from
Jul 7, 2018

Conversation

robsonpeixoto
Copy link
Contributor

No description provided.

@JimPou
Copy link

JimPou commented Jul 2, 2018

Any ETA?

Copy link

@leowmjw leowmjw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use "SHOW server_version;" instead.

SHOW server_version;
 server_version
----------------
 9.6.6
(1 row)

@sean- sean- self-assigned this Jul 7, 2018
@sean- sean- merged commit c766a68 into hashicorp:master Jul 7, 2018
sean- added a commit that referenced this pull request Jul 7, 2018
@robsonpeixoto robsonpeixoto deleted the azure-support branch July 8, 2018 11:06
@gaurav218
Copy link

When I try connecting to PostgreSQL DB on Azure it fails with below error
Error: Error running plan: 2 error(s) occurred:

provider.postgresql: Error initializing PostgreSQL client: error detecting capabilities: error PostgreSQL version: dial tcp :5432: getsockopt: connection refused
provider.postgresql.pgconnect: Error initializing PostgreSQL client: error detecting capabilities: error PostgreSQL version: dial tcp 191.X.X.X:5432: getsockopt: connection timed out

I am trying to connect DB and create users, below is my tf file appreciate if anyone can help in this regard as it has been 2 weeks but no success. I had already tried multiple things like commenting some variables but still same issue. Also since this is a PAAS I can't use provisioner like local-exec or remote-exec with psql commands to create user as we don't have access to Server.
postgresql region begin ---------------------------------------

variable hostname {
description = "hostname of PostgreSQL Instance"
}

variable administrator_login {
description = "administrator login user name"
}

variable administrator_login_password{
description = "administrator login password"
}

variable user_password {
description="user password"
}

provider "postgresql" {
alias = "pgconnect"
host = "${var.hostname}"
port = "5432"
#database = "postgres"
username = "${var.administrator_login}"
password = "${var.administrator_login_password}"
sslmode = "require"
#connect_timeout = 15
#expected_version = "9.6.0"
}

resource "postgresql_database" "postgres" {
provider = "postgresql.pgconnect"
name = "postgres"
}

resource "postgresql_role" "approle" {
name = "app_role"
login = true
password = "${var.user_password}"
}

resource "postgresql_role" "monitorrole" {
name = "monitor_role"
login = true
password = "${var.user_password}"
}
#--------------------------------------------------------------------#

@robsonpeixoto
Copy link
Contributor Author

You need to add the public ip from the vm that are running the terraform on postgresql firewall
https://www.terraform.io/docs/providers/azurerm/r/postgresql_firewall_rule.html

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants