Recently, because of a compliance thing, I had to move the provider and postgresql_schema from Terraform deployment in the Jenkins to AWS Lambda.
Initially it was creating the connection and schema properly, but since there was lots of waste of time in whitelisting the endpoints for RDS Clusters which had PostgreSQL Instances, we opt to move connection & schema to a Lambda which resides in VPC.
The lambda works perfectly fine, but when I am trying to discard the connection and schema from TF Deployment:
provider "postgresql" {
host = value
port = 5432
database = value
username = value
password = value
expected_version = value
sslmode = "require"
connect_timeout = 15
superuser = false
}
resource "postgresql_schema" "xyz" {
name = "cde"
database = value
}
I am getting the following error:
Error initializing PostgreSQL client: error detecting capabilities: error PostgreSQL version: dial tcp :5432: getsockopt: connection refused
I am not sure, how can I discard above TF code, while get past the above error. Because I just don't need it anymore :(, since it's handled by lambda.
Any advice is helpful, thank you!!!