Skip to content

Commit

Permalink
fix: segfault when creating new databases with cf provider (#3159)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvmakine authored Oct 18, 2024
1 parent a398d0a commit 30acfc8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/ftl-provisioner-cloudformation/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,27 @@ func updateResources(outputs []types.Output, update []*provisioner.Resource) err
for _, resource := range update {
if resource.ResourceId == key.ResourceID {
if postgres, ok := resource.Resource.(*provisioner.Resource_Postgres); ok {
if postgres.Postgres == nil {
postgres.Postgres = &provisioner.PostgresResource{}
}
if postgres.Postgres.Output == nil {
postgres.Postgres.Output = &provisioner.PostgresResource_PostgresResourceOutput{}
}

switch key.PropertyName {
case PropertyDBReadEndpoint:
postgres.Postgres.Output.ReadDsn = endpointToDSN(*output.OutputValue, key.ResourceID, 5432)
case PropertyDBWriteEndpoint:
postgres.Postgres.Output.WriteDsn = endpointToDSN(*output.OutputValue, key.ResourceID, 5432)
}
} else if mysql, ok := resource.Resource.(*provisioner.Resource_Mysql); ok {
if mysql.Mysql == nil {
mysql.Mysql = &provisioner.MysqlResource{}
}
if mysql.Mysql.Output == nil {
mysql.Mysql.Output = &provisioner.MysqlResource_MysqlResourceOutput{}
}

switch key.PropertyName {
case PropertyDBReadEndpoint:
mysql.Mysql.Output.ReadDsn = endpointToDSN(*output.OutputValue, key.ResourceID, 5432)
Expand Down

0 comments on commit 30acfc8

Please sign in to comment.