-
Notifications
You must be signed in to change notification settings - Fork 258
Open
Description
Terraform Version
Terraform 1.3
cyrilgdn/postgresql 1.25.0
Affected Resource(s)
- postgresql_publication_slot
Terraform Configuration Files
provider "postgresql" {
host = "my-rds-database-replica.us-east-1.rds.amazonaws.com"
port = "5432"
username = "mydbuser"
password = <>
database = "mydb"
superuser = false
alias = "my_rds_database_replica"
}
resource "postgresql_replication_slot" "my_logical_slot" {
provider = postgresql.my_rds_database_replica
name = "my_logical_slot"
database = "mydb"
plugin = "pgoutput"
}
Debug Output
n/a
Panic Output
n/a
Expected Behaviour
A logical replication slot should have been created on the RDS replica database
Actual Behaviour
Error: could not start transaction: pq: cannot set transaction read-write mode during recovery
Step To Reproduce
- Create an RDS PostgreSQL database with running version 16.x or later with
rds.logical_replication=1
in the parameter set. - Create an RDS Replica database from the second database with the same configuration
- Configure the Terraform with the hostname from the replica
terraform plan
Important Factoids
PostgreSQL supports logical replication slots being created on replica in recovery mode from version 16.
Creating the replication slot manually on the database from a psql
command line using the command SELECT FROM pg_create_logical_replication_slot("my_logical_slot","pgoutput");
works. The issue appears to be with the database/sql package attempting to switch the connection into read-write mode.
Metadata
Metadata
Assignees
Labels
No labels