Team,
I have an aurora-db that was created manually and now i am trying to import it into terraform.
I created this .tf
file and ran terraform plan
, which gives me the plan output and it shows it is trying to create the instance.
source = "terraform-aws-modules/rds-aurora/aws"
name = "aurora-db-dev"
engine = "aurora-postgresql"
engine_mode = "provisioned"
engine_version = "15.4"
master_username = "master"
storage_encrypted = true
storage_type = "aurora-iopt1"
vpc_id = module.vpc.vpc_id
db_subnet_group_name = aws_db_subnet_group.serverless-v2.name
db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.d.name
db_cluster_db_instance_parameter_group_name = aws_db_parameter_group.d.name
db_parameter_group_name = aws_db_parameter_group.dcp-d.name
deletion_protection = true
manage_master_user_password = false
master_password = random_password.master-v2.result
serverlessv2_scaling_configuration = {
min_capacity = var.rds_autoscaling_min_capacity
max_capacity = var.rds_autoscaling_max_capacity
}
instance_class = "db.serverless"
instances = {
one = {identifier = "aurora-db-1"}
two = {identifier = "aurora-db-2"}
}
security_group_rules = {
vpc_ingress = {
cidr_blocks = [var.vpc_cidr]
}
}
# availability_zones = var.rds_azs
apply_immediately = true
monitoring_interval = 10
# enabled_cloudwatch_logs_exports = ["postgresql"]
skip_final_snapshot = true
}
plan is:
# module.cluster-serverless-v2-import.aws_rds_cluster.this[0] will be created
+ resource "aws_rds_cluster" "this" {
+ allocated_storage = (known after apply)
+ allow_major_version_upgrade = false
+ apply_immediately = true
+ arn = (known after apply)
+ availability_zones = (known after apply)
+ backtrack_window = 0
+ backup_retention_period = (known after apply)
+ ca_certificate_identifier = (known after apply)
+ ca_certificate_valid_till = (known after apply)
+ cluster_identifier = "aurora-db-dev"
but when i import it
terraform import module.cluster-serverless-v2-import.aws_rds_cluster.this aurora-db-dev
it fails with this output
│ Error: Configuration for import target does not exist
│
│ The configuration for the given import module.cluster-serverless-v2-import.aws_rds_cluster.this does not exist. All target instances must have an
│ associated configuration to be imported.
Trying to understand what is going wrong here. Doing the same steps on a simple EC2 instance (viar resource and not module worked)