Skip to content

Commit

Permalink
Juho/fixedy (#3564)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvmakine authored Nov 28, 2024
1 parent 5e55167 commit 0df2353
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions cmd/ftl-provisioner-cloudformation/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ func (p *PostgresTemplater) AddToTemplate(template *goformation.Template) error
clusterID := cloudformationResourceID(p.resourceID, "cluster")
instanceID := cloudformationResourceID(p.resourceID, "instance")
template.Resources[clusterID] = &rds.DBCluster{
Engine: ptr("aurora-postgresql"),
MasterUsername: ptr("root"),
ManageMasterUserPassword: ptr(true),
DBSubnetGroupName: ptr(p.config.DatabaseSubnetGroupARN),
VpcSecurityGroupIds: []string{p.config.DatabaseSecurityGroup},
EngineMode: ptr("provisioned"),
Port: ptr(5432),
Engine: ptr("aurora-postgresql"),
MasterUsername: ptr("root"),
ManageMasterUserPassword: ptr(true),
DBSubnetGroupName: ptr(p.config.DatabaseSubnetGroupARN),
VpcSecurityGroupIds: []string{p.config.DatabaseSecurityGroup},
EngineMode: ptr("provisioned"),
Port: ptr(5432),
EnableIAMDatabaseAuthentication: ptr(true),
ServerlessV2ScalingConfiguration: &rds.DBCluster_ServerlessV2ScalingConfiguration{
MinCapacity: ptr(0.5),
MaxCapacity: ptr(10.0),
Expand Down Expand Up @@ -92,7 +93,7 @@ func PostgresPostUpdate(ctx context.Context, secrets *secretsmanager.Client, byN
return fmt.Errorf("failed to create database: %w", err)
}
}
if _, err := db.ExecContext(ctx, "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO ftluser;"); err != nil {
if _, err := db.ExecContext(ctx, "GRANT ALL ON SCHEMA public TO ftluser; GRANT ALL PRIVILEGES ON DATABASE "+resourceID+" TO ftluser;"); err != nil {
return fmt.Errorf("failed to grant FTL user privileges: %w", err)
}
}
Expand Down

0 comments on commit 0df2353

Please sign in to comment.