https://pulumi.com logo
#aws
Title
# aws
b

better-judge-55322

03/28/2024, 3:18 PM
Hi Folks, I'm creating the aurora postgres global databases using code
Copy code
cluster, err := rds.NewAuroraCluster(ctx, name, &rds.AuroraClusterArgs{
    ClusterIdentifier: pulumi.String(cmeta.ChildName(name)),
    Description:       pulumi.String(cmeta.ChildDesc("App DB Cluster")),
    SubnetIds:         pulumi.ToStringArray(cmeta.RegionInfo.PublicSubnetIds),
    Engine:            rds.AuroraEnginePostgres,
    EngineVersion:     pulumi.String("14.6"),
    NumberOfInstances: pgConfig.RequireInt("instanceCount"),
    InstanceClass:     pulumi.String(pgConfig.Require("instanceType")),
    Serverlessv2ScalingConfiguration: &awsRds.ClusterServerlessv2ScalingConfigurationArgs{
       MaxCapacity: pulumi.Float64(4),
       MinCapacity: pulumi.Float64(2),
    },
}, pulumi.Provider(cmeta.AWSProvider))
if err != nil {
    return err
}

desiredRegion := "us-west-2"

// Create a provider for the desired region
provider, err := aws.NewProvider(ctx, "awsProvider", &aws.ProviderArgs{
    Region: pulumi.String(desiredRegion),
})
if err != nil {
    return err
}

// Create the global cluster using aws.rds.GlobalCluster
globalRdsCluster, err := awsRds.NewGlobalCluster(ctx, cmeta.ChildName("global-db"), &awsRds.GlobalClusterArgs{
    GlobalClusterIdentifier:   pulumi.String(cmeta.ChildName("global-db")), // Name for the new global cluster
    SourceDbClusterIdentifier: cluster.ClusterArn,                          // ARN of the existing cluster
    ForceDestroy:              pulumi.Bool(true),
}, pulumi.IgnoreChanges([]string{"GlobalClusterIdentifier"}))

// Create the RDS cluster from snapshot
secondarycluster, err := rds.NewAuroraCluster(ctx, cmeta.ChildName("secondary"), &rds.AuroraClusterArgs{
    ClusterIdentifier: pulumi.String(cmeta.ChildName("secondary")),
    Description:       pulumi.String(cmeta.ChildDesc("secondary DB Cluster")),
    SubnetIds: pulumi.StringArray{
       pulumi.String("subnet-029h98809"),
       pulumi.String("subnet-035gsbxkab"),
    },
    Engine:            rds.AuroraEnginePostgres,
    EngineVersion:     pulumi.String("14.6"),
    NumberOfInstances: pgConfig.RequireInt("instanceCount"),
    InstanceClass:     pulumi.String(pgConfig.Require("instanceType")),
    Serverlessv2ScalingConfiguration: &awsRds.ClusterServerlessv2ScalingConfigurationArgs{
       MaxCapacity: pulumi.Float64(4),
       MinCapacity: pulumi.Float64(2),
    },
    GlobalClusterIdentifier: globalRdsCluster.GlobalClusterIdentifier,
}, pulumi.Provider(provider), pulumi.DependsOn([]pulumi.Resource{cluster})) // Add pulumi.Provider(provider) here
if err != nil {
    return err
}
Getting error - creating RDS Cluster (falcon-dev-test-secondary): InvalidParameterCombination: Cannot specify database name for cross region replication cluster status code: 400, request id: 4dc70fc9-5eb1-427c-8335-c122737dff56 I'm not mentioning database name still getting this error Also, Ive marked the globalclusteridentifier as ignore but still when I again do a pulumi up it shows changes in the databse and then fails to do any update, Has anyone faced such a scenario. Please let me know.