https://pulumi.com logo
Title
s

silly-address-30441

03/29/2021, 5:16 PM
I'm having a hard time setting up read replica for a Postgres RDS server. My first attempt failed with
error modifying DB Instance (read-replicaf4d753f): InvalidParameterCombination: Cannot change master user password on an RDS postgres Read Replica because it uses physical replication and therefore cannot differ from its parent
even though the replica was created and visible in the console. Is there a trick I'm missing?
My code is:
const readReplica = new aws.rds.Instance('read-replica', {
  engine: 'postgres',
  engineVersion: '13',
  instanceClass: instanceClass,
  allocatedStorage: 5,
  dbSubnetGroupName: dbSubnetGroup.id,
  vpcSecurityGroupIds: [dbSecurityGroup.id],
  name: dbName,
  username: dbUsername,
  password: dbPassword,
  allowMajorVersionUpgrade: false,
  autoMinorVersionUpgrade: true,
  storageEncrypted: true,
  maxAllocatedStorage: 500,
  deletionProtection: true,
  performanceInsightsEnabled: true,
  backupRetentionPeriod: 30,
  replicateSourceDb: db.arn,
});
b

billowy-army-68599

03/29/2021, 5:19 PM
it looks like the dbpassword isn't the same as your master instance?
s

silly-address-30441

03/29/2021, 5:20 PM
That's almost exactly the same code that generates my main instance, so I don't know how that would happen
username: dbUsername,
  password: dbPassword,
pulls from the same place
b

billowy-army-68599

03/29/2021, 5:23 PM
I don't think you need to set the master password and username on replicas, try removing those params
s

silly-address-30441

03/29/2021, 5:24 PM
yeah, looking at https://github.com/terraform-aws-modules/terraform-aws-rds/issues/103 I was just about to try that
Yep, that worked. Thank you!
Hm, but oddly, if I run
pulumi up
a second time, it wants to change it again.
I created a read replica and it looks fine
but the second time I run pulumi up, I get
└─ aws:rds:Instance  read-replica  update     [diff: ~replicateSourceDb]
and I believe that will fail if I run it again
Yep,
aws:rds:Instance (read-replica):
    error: 1 error occurred:
        * updating urn:pulumi:dev::core::aws:rds/instance:Instance::read-replica: 1 error occurred:
        * cannot elect new source database for replication
b

billowy-army-68599

03/29/2021, 9:56 PM
you'll need to see
ignoreChanges
perhaps?
s

silly-address-30441

03/29/2021, 10:14 PM
huh, nifty. I've never used that before.
I wonder why I need that here
But adding
{ ignoreChanges: ['replicateSourceDb']  }
seems to work