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

Aurora Module -- Creating Instance From Snapshot Fails on 1.30 #5450

Closed
jseiser opened this issue Aug 4, 2018 · 7 comments · Fixed by #5479
Closed

Aurora Module -- Creating Instance From Snapshot Fails on 1.30 #5450

jseiser opened this issue Aug 4, 2018 · 7 comments · Fixed by #5479
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/rds Issues and PRs that pertain to the rds service.
Milestone

Comments

@jseiser
Copy link
Contributor

jseiser commented Aug 4, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

0.11.7

Affected Resource(s)

  • aws_rds_cluster
  • aws_rds_cluster_instance

Terraform Configuration Files

resource "aws_rds_cluster" "cluster" {
  cluster_identifier_prefix    = "${format("%s-%s-%s", var.customer, var.project, var.environment)}"
  engine                       = "${var.engine}"
  engine_version               = "${var.engine_version}"
  database_name                = "${var.database_name}"
  master_username              = "${var.username}"
  master_password              = "${var.password}"
  backup_retention_period      = "${var.backup_retention_period}"
  preferred_backup_window      = "${var.preferred_backup_window}"
  preferred_maintenance_window = "${var.preferred_maintenance_window}"
  vpc_security_group_ids       = ["${aws_security_group.aurora.id}"]
  apply_immediately            = "${var.apply_immediately}"
  db_subnet_group_name         = "${aws_db_subnet_group.db_subnet_group.id}"
  final_snapshot_identifier    = "${format("rds-%s-aurora-%s-%s", var.customer, var.project, var.environment)}"
  skip_final_snapshot          = true
  storage_encrypted            = "${var.storage_encrypted}"
  snapshot_identifier          = "${var.snapshot_identifier}"

  lifecycle {
    create_before_destroy = true
  }

  tags {
    Name        = "${format("rds-%s-aurora-%s-%s-%s", var.customer, var.project, var.function, var.environment)}"
    Customer    = "${var.customer}"
    Environment = "${var.environment}"
    Terraform   = true
    Database    = "Aurora"
  }
}

resource "aws_rds_cluster_instance" "cluster_instances" {
  count                      = "${var.instance_count}"
  identifier                 = "${format("rds-%s-aurora-%s-%s-%d", var.customer, var.project, var.environment, count.index)}"
  engine                     = "${var.engine}"
  engine_version             = "${var.engine_version}"
  cluster_identifier         = "${aws_rds_cluster.cluster.id}"
  instance_class             = "${var.instance_class}"
  apply_immediately          = "${var.apply_immediately}"
  auto_minor_version_upgrade = "${var.auto_minor_version_upgrade}"

  lifecycle {
    create_before_destroy = true
  }

  tags {
    Name        = "${format("rds-%s-aurora-%s-%s-%s-%d", var.customer, var.project, var.function, var.environment, count.index)}"
    Customer    = "${var.customer}"
    Environment = "${var.environment}"
    Project     = "${var.project}"
    Owner       = "${var.owner}"
    Function    = "${var.function}"
    Terraform   = true
  }
}

Debug Output

Panic Output

Expected Behavior

Cluster and instance should have been created from the snapshot.

Actual Behavior

Cluster created, but its not managed. Another plan attempts to create another one.

Error: Error applying plan:

1 error(s) occurred:

* module.aurora.aws_rds_cluster.cluster: 1 error(s) occurred:

* aws_rds_cluster.cluster: InvalidParameterValue: The parameter ResourceName must be provided and must not be blank.
	status code: 400, request id: fa52736f-c76c-450a-a1fb-7f23042b59fd

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.

Steps to Reproduce

Upgrade aws-provider to 1.30.0
terraform apply

Important Factoids

References

@bflad bflad added bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/rds Issues and PRs that pertain to the rds service. labels Aug 6, 2018
@myoung34
Copy link
Contributor

myoung34 commented Aug 8, 2018

This also happens in non clusters, just a psql aws_db_instance. Downgraded version fixed it

variable "engine" {
  default = "postgres"
}

variable "engine_version" {
  default = "9.6.6"
}

variable "family" {
  default = "postgres9.6"
}

10:54:42 
10:54:42 Error: Error applying plan:
10:54:42 
10:54:42 1 error(s) occurred:
10:54:42 
10:54:42 * module.rds.aws_db_instance.default: 1 error(s) occurred:
10:54:42 
10:54:42 * aws_db_instance.default: InvalidParameterValue: The parameter ResourceName must be provided and must not be blank.
10:54:42 	status code: 400, request id: 3b05a927-738a-4afe-8322-863e877bcedc
10:54:42 
10:54:42 Terraform does not automatically rollback in the face of errors.
10:54:42 Instead, your Terraform state file has been partially updated with
10:54:42 any resources that successfully completed. Please address the error
10:54:42 above and apply again to incrementally change your infrastructure.

@bflad
Copy link
Contributor

bflad commented Aug 8, 2018

@myoung34 can you please open a separate bug report with full details of your aws_db_instance configuration? I had written an acceptance test to cover this error within aws_db_instance and verify the fix, but maybe there are other parts to it.

@myoung34
Copy link
Contributor

myoung34 commented Aug 8, 2018

@bflad done in #5477

@bflad
Copy link
Contributor

bflad commented Aug 8, 2018

Fix for aws_rds_cluster with snapshot_identifier and tags submitted: #5479

@bflad
Copy link
Contributor

bflad commented Aug 8, 2018

The fix for aws_rds_cluster has been merged and will release with version 1.31.0 of the AWS provider, likely later today. 👍

@bflad
Copy link
Contributor

bflad commented Aug 9, 2018

This has been released in version 1.31.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 4, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/rds Issues and PRs that pertain to the rds service.
Projects
None yet
3 participants