Terraform: Creating RDS instance from snapshot errors - InvalidVPCNetworkStateFault: You cannot move DB instance _rds_instance_name_ to subnet group

Created on 4 Jan 2017  ยท  4Comments  ยท  Source: hashicorp/terraform

Hi,

I'm creating an issue off the back of a thread on the following PR - https://github.com/hashicorp/terraform/pull/10818

In there I've found that I can successfully create a RDS from snapshot on using 0.8.0 but cannot on 0.8.3 (yet to personally test .1 and .2)

The error message I get looks like the AWS api returning an error on a modify operation :

Error applying plan:
1 error(s) occurred:

* aws_db_instance._resource_name_: Error modifying DB Instance _rds_instance_name_: InvalidVPCNetworkStateFault: You cannot move DB instance _rds_instance_name_ to subnet group _subnet_group_name_. The specified DB subnet group and DB instance are in the same VPC. Choose a DB subnet group in different VPC than the specified DB instance and try again. status code: 400, request id: 7f594101-cced-11e6-b996-2141c7b3473f

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 gets passed in the correct values for security group id and subnet group etc, creates it but bombs out when the rds instance goes into a modifying state.

I believe @stack72 is already looking into this, but I'm raising the issue here so others can see a fix is being looked into.

bug provideaws regression

Most helpful comment

Hi all

I found the issue here, I am just opening a PR that fixes it

Paul

All 4 comments

Thanks for opening a real issue on this for tracking @sasq31 :)

I had the same bug. It had been introduced in 0.8.2 (working fine with 0.8.1).

My Terraform code :

resource "aws_db_subnet_group" "mysql" {
  name       = "${var.project_name}-mysql"
  subnet_ids = ["${aws_subnet.public.*.id}"]
}

resource "aws_db_instance" "mysql" {
  allocated_storage      = "${var.db_storage}"
  engine                 = "${var.db_engine}"
  instance_class         = "${var.db_instance_type}"
  username               = "${var.db_user}"
  password               = "${var.db_password}"
  db_subnet_group_name   = "${aws_db_subnet_group.mysql.id}"
  vpc_security_group_ids = ["${aws_security_group.mysql.id}"]
  snapshot_identifier    = "${var.db_snapshot}"
}

Hi all

I found the issue here, I am just opening a PR that fixes it

Paul

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gwagner picture gwagner  ยท  81Comments

jszwedko picture jszwedko  ยท  77Comments

FlorinAndrei picture FlorinAndrei  ยท  61Comments

felnne picture felnne  ยท  133Comments

shubhambhartiya picture shubhambhartiya  ยท  72Comments