Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With aws_db_instance when you remove the snapshot_identifier it wants to force a new resource #11196

Closed
donnoman opened this issue Jan 13, 2017 · 2 comments

Comments

@donnoman
Copy link

donnoman commented Jan 13, 2017

Terraform Version

Terraform v0.8.4

Affected Resource(s)

  • aws_db_instance

Terraform Configuration Files

  apply_immediately    = true
  allocated_storage    = 10
  engine               = "mariadb"
  engine_version       = "10.0.24"
  instance_class       = "db.t2.medium"
  # add this back in after RDS has been created
  name                 = "wordpress"
  identifier           = "lh-wordpress-${var.stage}"
  multi_az             = true
  username             = "${var.aws_rds_username}"
  password             = "${var.aws_rds_password}"
  db_subnet_group_name = "${var.aws_vpc_subnet_shared}"
  vpc_security_group_ids = ["${aws_security_group.rds.id}"]
  parameter_group_name = "default.mariadb10.0"
  final_snapshot_identifier = "lh-wordpress-${var.stage}-final"
  # remove the snapshot_identifier
  # snapshot_identifier = "lh-wordpress-staging-before-tf"
  copy_tags_to_snapshot = true
  backup_retention_period = 30
  backup_window = "07:00-08:00"
  maintenance_window = "sun:10:00-sun:11:00"
  tags {
    Name = "lh-wordpress-${var.stage}"
    cluster = "lh-wordpress-${var.stage}"
    terraform = "true"
  }
}

Debug Output

    snapshot_identifier:               "lh-wordpress-staging-before-tf" => "" (forces new resource)

Expected Behavior

No change required. In the future and for other environments I don't want this snapshot used. This snapshot was a restoration, because the last terraform run killed my DB

Actual Behavior

It wants to kill my newly restored db

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply with the snapshot you need restored
  2. remove the snapshot_identifier you no longer need because your db is now working
  3. terraform apply
@donnoman
Copy link
Author

I resolved myself without killing my db with the following

  1. terraform state rm module.site.aws_db_instance.default
  2. terraform import module.site.aws_db_instance.default lh-wordpress-staging
  3. terraform apply

@ghost
Copy link

ghost commented Apr 10, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants