terraform-provider-postgresql
terraform-provider-postgresql copied to clipboard
Error: Plugin did not respond
Terraform Version
0.15.4
Provider Version
1.13.0
Affected Resource(s)
postgresql_database
Terraform Configuration Files
provider "postgresql" {
host = jsondecode(data.aws_secretsmanager_secret_version.secret.secret_string)["host"]
port = jsondecode(data.aws_secretsmanager_secret_version.secret.secret_string)["port"]
database = "postgres"
username = jsondecode(data.aws_secretsmanager_secret_version.secret.secret_string)["username"]
password = jsondecode(data.aws_secretsmanager_secret_version.secret.secret_string)["password"]
sslmode = "require"
connect_timeout = 15
expected_version = 10.14
}
resource "postgresql_database" "test_db" {
name = "test_db"
owner = "postgres"
template = "DEFAULT"
lc_collate = "DEFAULT"
connection_limit = -1
allow_connections = true
depends_on = [module.db]
}
Panic Output
postgresql_database.test_db: Still creating... [10s elapsed]
╷
│ Error: Plugin did not respond
│
│ with postgresql_database.test_db,
│ on postgres-setup.tf line 16, in resource "postgresql_database" "test_db":
│ 16: resource "postgresql_database" "test_db" {
│
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may
│ contain more details.
╵
Releasing state lock. This may take a few moments...
Stack trace from the terraform-provider-postgresql_v1.13.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xd7affa]
goroutine 27 [running]:
database/sql.(*Tx).grabConn(0x0, 0x12537a0, 0xc000038100, 0x10, 0xc0002fe670, 0x17ddde0, 0x17f65e0)
database/sql/sql.go:2112 +0x5a
database/sql.(*Tx).ExecContext(0x0, 0x12537a0, 0xc000038100, 0x10b0a97, 0x4a, 0xc00011f5c0, 0x1, 0x1, 0xc00018c960, 0xc0000421e0, ...)
database/sql/sql.go:2362 +0x4c
database/sql.(*Tx).Exec(...)
database/sql/sql.go:2372
github.com/terraform-providers/terraform-provider-postgresql/postgresql.pgLockRole(0x0, 0xc0000384d8, 0x8, 0x0, 0x123eba0)
github.com/terraform-providers/terraform-provider-postgresql/postgresql/helpers.go:447 +0xd1
github.com/terraform-providers/terraform-provider-postgresql/postgresql.createDatabase(0xc0005c0840, 0xc000372d90, 0x0, 0x0)
github.com/terraform-providers/terraform-provider-postgresql/postgresql/resource_postgresql_database.go:128 +0x157c
github.com/terraform-providers/terraform-provider-postgresql/postgresql.resourcePostgreSQLDatabaseCreate(0xc0005c0840, 0xc000372d90, 0x0, 0x0)
github.com/terraform-providers/terraform-provider-postgresql/postgresql/resource_postgresql_database.go:110 +0x39
github.com/terraform-providers/terraform-provider-postgresql/postgresql.PGResourceFunc.func1(0xc000372d90, 0xf22540, 0xc0000ab440, 0x2, 0x1826b20)
github.com/terraform-providers/terraform-provider-postgresql/postgresql/helpers.go:22 +0x8e
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc0001ec400, 0xc0005b6f50, 0xc0006aa880, 0xf22540, 0xc0000ab440, 0xf35201, 0xc000098df8, 0xc0006319e0)
github.com/hashicorp/[email protected]/helper/schema/resource.go:305 +0x375
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc0001ec800, 0xc00011fa38, 0xc0005b6f50, 0xc0006aa880, 0xc0000abdc8, 0xc00018a730, 0xf371e0)
github.com/hashicorp/[email protected]/helper/schema/provider.go:289 +0x99
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00018a260, 0x1253810, 0xc000630150, 0xc0005c0420, 0xc00018a260, 0xc000630150, 0xc00020cba0)
github.com/hashicorp/[email protected]/internal/helper/plugin/grpc_provider.go:885 +0x88b
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1032620, 0xc00018a260, 0x1253810, 0xc000630150, 0xc0005c03c0, 0x0, 0x1253810, 0xc000630150, 0xc00033e000, 0x180)
github.com/hashicorp/[email protected]/internal/tfplugin5/tfplugin5.pb.go:3189 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0002c2fc0, 0x125e1b8, 0xc000533380, 0xc00044ff00, 0xc00047a960, 0x17e70e0, 0x0, 0x0, 0x0)
google.golang.org/[email protected]/server.go:1210 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc0002c2fc0, 0x125e1b8, 0xc000533380, 0xc00044ff00, 0x0)
google.golang.org/[email protected]/server.go:1533 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000458200, 0xc0002c2fc0, 0x125e1b8, 0xc000533380, 0xc00044ff00)
google.golang.org/[email protected]/server.go:871 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/[email protected]/server.go:869 +0x1fd
Error: The terraform-provider-postgresql_v1.13.0 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
Error: Terraform exited with code 1.
Expected Behavior
postgresql_database resource is created
Actual Behavior
Plugin did not respond
Steps to Reproduce
terraform apply
Important Factoids
Using Amazon Aurora Postgresql
I ran into this problem today, also using RDS Postgresql, got the exact same stack trace, and found this issue. But after going back and analyzing the output I noticed:
| │ Error: error detecting capabilities: error PostgreSQL version: dial tcp x.x.x.x:1433: connect: operation timed out │ │ with module.myappdb.postgresql_database.myappdb_schema, │ on main.tf line 158, in resource "postgresql_database" "myappdb_schema": │ 158: resource "postgresql_database" "myappdb_schema" { │
1433 was not the correct port, I'm not sure how that got there, but once I changed it to 5432, and it started working. You might also have a connection issue. Double check your security groups and that you are getting the correct connection information secrets manager.
I ran into this in v1.14.0 as well while destroying a postgresql_database resource.
There are no errors reported before the crash.
Stack trace from the terraform-provider-postgresql_v1.14.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xd7bcba]
goroutine 29 [running]:
database/sql.(*Tx).grabConn(0x0, 0x125b980, 0xc000038130, 0x7fcc4164ff18, 0x20, 0xc000579568, 0x47685c)
database/sql/sql.go:2112 +0x5a
database/sql.(*Tx).ExecContext(0x0, 0x125b980, 0xc000038130, 0x108ad4a, 0x19, 0x0, 0x0, 0x0, 0x58, 0xc00018eb60, ...)
database/sql/sql.go:2362 +0x4c
database/sql.(*Tx).Exec(...)
database/sql/sql.go:2372
github.com/terraform-providers/terraform-provider-postgresql/postgresql.pgLockRole(0x0, 0xc0000d4350, 0x9, 0x0, 0x1246bc0)
github.com/terraform-providers/terraform-provider-postgresql/postgresql/helpers.go:461 +0x7e
github.com/terraform-providers/terraform-provider-postgresql/postgresql.resourcePostgreSQLDatabaseDelete(0xc0005f1e60, 0xc0004dc770, 0x0, 0x0)
github.com/terraform-providers/terraform-provider-postgresql/postgresql/resource_postgresql_database.go:237 +0x8b3
github.com/terraform-providers/terraform-provider-postgresql/postgresql.PGResourceFunc.func1(0xc0004dc770, 0xf29520, 0xc0000fe120, 0x24, 0x1830b40)
github.com/terraform-providers/terraform-provider-postgresql/postgresql/helpers.go:22 +0x8e
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).Apply(0xc000166600, 0xc000603180, 0xc0000a9be0, 0xf29520, 0xc0000fe120, 0x40e101, 0x20, 0x10055c0)
github.com/hashicorp/[email protected]/helper/schema/resource.go:278 +0x4a6
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).Apply(0xc000166b00, 0xc000579a38, 0xc000603180, 0xc0000a9be0, 0x1830b40, 0x0, 0x0)
github.com/hashicorp/[email protected]/helper/schema/provider.go:289 +0x99
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ApplyResourceChange(0xc00000ed50, 0x125b9f0, 0xc0005cb0b0, 0xc000201680, 0xc00000ed50, 0xc0005cb0b0, 0xc0005b4ba0)
github.com/hashicorp/[email protected]/internal/helper/plugin/grpc_provider.go:885 +0x88b
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1039600, 0xc00000ed50, 0x125b9f0, 0xc0005cb0b0, 0xc000201620, 0x0, 0x125b9f0, 0xc0005cb0b0, 0xc00037e360, 0x102)
github.com/hashicorp/[email protected]/internal/tfplugin5/tfplugin5.pb.go:3189 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000157c00, 0x1266458, 0xc00008ac00, 0xc0004fc300, 0xc0005d46f0, 0x17f1100, 0x0, 0x0, 0x0)
google.golang.org/[email protected]/server.go:1210 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc000157c00, 0x1266458, 0xc00008ac00, 0xc0004fc300, 0x0)
google.golang.org/[email protected]/server.go:1533 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000038540, 0xc000157c00, 0x1266458, 0xc00008ac00, 0xc0004fc300)
google.golang.org/[email protected]/server.go:871 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/[email protected]/server.go:869 +0x1fd
Error: The terraform-provider-postgresql_v1.14.0 plugin crashed!
just hit this as well. TF 1.0.6 on provider version 1.14.0. Postgres engine version 13.3.
Ran into this issue today in version 1.19.0, also during destruction of a database resource.