Hi all,
I have written a small
terraform.tf file (DB parameter group, DB subnet group and DB instance) for RDS.After terraform destroy I get this following error. Can anyone help me in this regard?
After terraform destroy I get the following error:
* aws_db_parameter_group.test-parameter-group: InvalidDBParameterGroupState: One or more database instances are still members of this parameter group <parameter-name>, so the group cannot be deleted
status code: 400, request id: a6fb332c-d6ac-4396-9e5a-020b6d606aae
* aws_db_instance.test-rds-mysql (destroy): 1 error(s) occurred:
* aws_db_instance.test-rds-mysql: DB Instance FinalSnapshotIdentifier is required when a final snapshot is required
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
Terraform Version:0.9.11
Regards
Pradeep
* aws_db_subnet_group.test-rds-subnet-group: Error creating DB Subnet Group: DBSubnetGroupAlreadyExists: The DB subnet group 'test-subnet' already exists.
status code: 400, request id: 1be1b561-3cdd-4c17-9dec-758460fe0e7f
* aws_db_parameter_group.test-parameter-group: Error creating DB Parameter Group: DBParameterGroupAlreadyExists: Parameter group xxxx already exists
status code: 400, request id: ea0bb620-18bb-4882-9651-ea6ba42e8d66
Note: Even if I do terraform destroy and create I am getting same error.
Rds.tf
======
resource "aws_db_subnet_group" "test-rds-subnet-group" {
name = "${var.RDS_SUBNET_PARAMETERS}"
description = "RDS Security Group Name"
}
resource "aws_db_parameter_group" "test-parameter-group" {
name = "${var.RDS_PARAM_NAME}"
family = "mysql5.6"
parameter {
name = "collation_server"
value = "utf8_general_ci"
apply_method = "immediate"
}
parameter {
name = "character_set_server"
value = "utf8"
apply_method = "immediate"
}
parameter {
name = "table_open_cache"
value = "256"
apply_method = "immediate"
}
parameter {
name = "tmp_table_size"
value = "1024"
apply_method = "immediate"
}
parameter {
name = "innodb_additional_mem_pool_size"
value = "3145728"
apply_method = "pending-reboot"
}
parameter {
name = "innodb_flush_log_at_trx_commit"
value = "1"
apply_method = "immediate"
}
parameter {
name = "innodb_log_buffer_size"
value = "8388608"
apply_method = "pending-reboot"
}
}
resource "aws_db_instance" "test-rds-mysql" {
depends_on = ["aws_security_group.test-sg-rds"]
identifier = "${var.RDS_INSTANCE_IDENTIFIER}"
allocated_storage = "${var.RDS_DB_SIZE}"
engine = "${var.RDS_ENGINE}"
engine_version = "${var.RDS_ENGINE_VERSION}"
instance_class = "${var.RDS_INSTANCE_TYPE}"
name = "${var.RDS_INSTANCE_NAME}"
username = "${var.RDS_USER}"
password = "${var.RDS_PASSWORD}"
parameter_group_name = "${var.RDS_PARAM_NAME}"
storage_type = "${var.RDS_STORAGE_TYPE}"
auto_minor_version_upgrade = "true"
license_model = "${var.RDS_LICENSE_MODEL}"
multi_az = "false"
maintenance_window = "${var.RDS_PREFERRED_MAINT_WINDOW}"
backup_retention_period = "${var.RDS_BACKUP_RETENTION_PERIOD}"
backup_window = "${var.RDS_PREFERRED_BACKUP_WINDOW}"
}
After terraform destroy I get the following error:
* aws_db_parameter_group.test-parameter-group: InvalidDBParameterGroupState: One or more database instances are still members of this parameter group <parameter-name>, so the group cannot be deleted
status code: 400, request id: a6fb332c-d6ac-4396-9e5a-020b6d606aae
* aws_db_instance.test-rds-mysql (destroy): 1 error(s) occurred:
* aws_db_instance.test-rds-mysql: DB Instance FinalSnapshotIdentifier is required when a final snapshot is required
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.