iam seeing bellow error while creating global cluster
module.aurora_global.aws_rds_global_cluster.global: Creating… ╷ │ Error: error creating RDS Global Cluster: InvalidParameterCombination: When creating global cluster from existing db cluster, value for engineVersion should not be specified since it will be inherited from source cluster │ status code: 400, request id: 2c159c59-7e8c-4bd4-bdfb-cca92f5f8a20 │ │ with module.aurora_global.aws_rds_global_cluster.global, │ on …/modules/database/rds/aurora_global/main.tf line 3, in resource “aws_rds_global_cluster” “global”: │ 3: resource “aws_rds_global_cluster” “global” { │
Terraform version - 1.2.2
AWS provider 4.13
code:
#Cluster Creation
resource "aws_rds_cluster" "aurora_cluster" {
cluster_identifier = var.cluster_identifier
database_name = var.database_name
master_username = var.master_username
master_password = var.master_password
engine = var.engine
global_cluster_identifier = var.global_cluster_identifier
replication_source_identifier = var.replication_source_identifier
source_region = var.source_region
allow_major_version_upgrade = "true"
iam_database_authentication_enabled = var.iam_database_authentication_enabled
engine_version = var.engine == "aurora" ? var.mysql_version : var.postgre_version
port = var.engine == "aurora" ? var.mysql_port : var.postgre_port
backup_retention_period = var.backup_retention_period
preferred_maintenance_window = var.cluster_preferred_maintenance_window
preferred_backup_window = var.preferred_backup_window
db_subnet_group_name = var.db_subnet_group_name
db_cluster_parameter_group_name = var.db_cluster_parameter_group_name
db_instance_parameter_group_name = var.db_cluster_parameter_group_name
vpc_security_group_ids = var.securitygroup_id
storage_encrypted = var.storage_encrypted
apply_immediately = var.apply_immediately
copy_tags_to_snapshot = "true"
enabled_cloudwatch_logs_exports = ["postgresql"]
kms_key_id = var.kms_key_id
lifecycle {
ignore_changes = [kms_key_id, master_password, source_region, replication_source_identifier, database_name, global_cluster_identifier ]
}
skip_final_snapshot = var.skip_final_snapshot
snapshot_identifier = var.snapshot_identifier
deletion_protection = var.deletion_protection
tags = merge(
var.default_tags,
{
"name" = format("%s", var.cluster_identifier)
},
)
}
#Cluster Instance creation
resource "aws_rds_cluster_instance" "aurora_cluster_instance" {
identifier = var.cluster_identifier
engine = var.engine
cluster_identifier = aws_rds_cluster.aurora_cluster.id
instance_class = var.instance_class
publicly_accessible = var.publicly_accessible
db_parameter_group_name = var.db_parameter_group_name
auto_minor_version_upgrade = var.auto_minor_version_upgrade
monitoring_role_arn = "arn:aws:iam::${var.account_id}:role/${var.monitoring_role}"
monitoring_interval = var.monitoring_interval
ca_cert_identifier = var.ca_cert_identifier
performance_insights_enabled = "true"
preferred_maintenance_window = var.instance_preferred_maintenance_window
performance_insights_kms_key_id = var.kms_key_id
apply_immediately = var.apply_immediately
lifecycle {
ignore_changes = [performance_insights_kms_key_id, engine_version]
}
copy_tags_to_snapshot = "true"
tags = merge(
var.default_tags,
{
"name" = format("%s", var.cluster_identifier)
},
)
}
# Replica Resource
resource "aws_rds_cluster_instance" "aurora_cluster_replica" {
count = var.enable_replica ? var.number_of_replicas : 0
identifier = "${var.application_id}${var.cluster_subsysid}-${var.id_dbengine}${var.dbtype["id_dbtype.${var.engine}"]}-r${count.index + 1}${var.dbenv["id_dbenv.${var.environment}"]}"
engine = var.engine
cluster_identifier = aws_rds_cluster.aurora_cluster.id
instance_class = var.instance_class
publicly_accessible = "false"
db_parameter_group_name = var.db_cluster_parameter_group_name
auto_minor_version_upgrade = var.auto_minor_version_upgrade
monitoring_role_arn = "arn:aws:iam::${var.account_id}:role/${var.monitoring_role}"
monitoring_interval = var.monitoring_interval
ca_cert_identifier = var.ca_cert_identifier
performance_insights_enabled = "true"
performance_insights_kms_key_id = var.kms_key_id
apply_immediately = var.apply_immediately
lifecycle {
ignore_changes = [performance_insights_kms_key_id, engine_version]
}
preferred_maintenance_window = var.replica_preferred_maintenance_window
copy_tags_to_snapshot = "true"
tags = merge(
var.default_tags,
{
"name" = "${var.application_id}${var.cluster_subsysid}-${var.id_dbengine}${var.dbtype["id_dbtype.${var.engine}"]}-r${count.index + 1}${var.dbenv["id_dbenv.${var.environment}"]}"
},
)
}
resource "aws_rds_global_cluster" "global" {
global_cluster_identifier = "${var.global_cluster_identifier}"
source_db_cluster_identifier = "${var.source_db_cluster_identifier}"
force_destroy = "true"
deletion_protection = "${var.deletion_protection}"
engine_version = var.engine_version
lifecycle {
ignore_changes = [storage_encrypted]
}
}