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

AWS Aurora - Crashing - Multi AZ Issues #5418

Closed
boxrick opened this issue Mar 2, 2016 · 8 comments
Closed

AWS Aurora - Crashing - Multi AZ Issues #5418

boxrick opened this issue Mar 2, 2016 · 8 comments

Comments

@boxrick
Copy link

boxrick commented Mar 2, 2016

When using AWS Provider for Aurora ( AWS_RDS_CLUSTER & AWS_RDS_CLUSTER_INSTANCE ) I am having multiple issues:

  1. Each time I provision an Aurora instance, it creates it in 3 AZ even though I specify only 2. Then each time I re-run it destroys and re-creates because it tries to make it in 2 but then makes it in 3 again.
    https://gist.github.com/boxrick/12758f0d67d1a64c01e8

  2. Provisioning Aurora similar to the example on https://www.terraform.io/docs/providers/aws/r/rds_cluster_instance.html. Results in all sorts of !!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!! & panic: runtime error: invalid memory address or nil pointer dereference. This has ruined various of my configurations and deployments controlled by Terraform.

@boxrick
Copy link
Author

boxrick commented Mar 2, 2016

Upon further digging it seems my second issue is related to the following:

#5350

@phinze
Copy link
Contributor

phinze commented Mar 18, 2016

Hi @boxrick - sorry about the trouble here! Digging in now and will follow up when I have more info for you.

@phinze phinze self-assigned this Mar 18, 2016
@phinze
Copy link
Contributor

phinze commented Mar 18, 2016

Full config reproducing issue (1) in us-west-2:

variable "azs" {
  default = "us-west-2a,us-west-2b"
}

resource "aws_vpc" "main" {
  cidr_block = "10.123.0.0/16"
}

resource "aws_subnet" "private" {
  vpc_id = "${aws_vpc.main.id}"
  count             = "${length(split(",", var.azs))}"
  availability_zone = "${element(split(",", var.azs), count.index)}"
  cidr_block        = "10.123.${count.index}.0/24"
}

# Group for assigning rds instance to subnets
resource "aws_db_subnet_group" "aurora" {
  name = "phinze-test-db-subnetgroup"
  description = "it is silly that this is required in the API"
  subnet_ids = ["${aws_subnet.private.*.id}"]
}

resource "aws_rds_cluster" "default" {
  cluster_identifier   = "phinze-test-cluster-aurora"
  availability_zones   = ["us-west-2a","us-west-2b"]
  database_name        = "mydb"
  master_username      = "myuser"
  master_password      = "longerthan8chars"
  db_subnet_group_name = "${aws_db_subnet_group.aurora.name}"
}

resource "aws_rds_cluster_instance" "aurora_instance" {
  identifier           = "phinze-test-cluster-instance-aurora"
  cluster_identifier   = "${aws_rds_cluster.default.id}"
  instance_class       = "db.r3.large"
  db_subnet_group_name = "${aws_db_subnet_group.aurora.name}"
}

@phinze
Copy link
Contributor

phinze commented Mar 18, 2016

Okay looks like the AZ issue is an upstream API problem:

https://gist.github.com/phinze/34c87dc974e70681a41a

I've reached out to AWS Support about this and will report what I hear. Digging into (2) now.

@boxrick
Copy link
Author

boxrick commented Mar 18, 2016

I ultimately got around this by using 3azs, I'm happy to share the config for that.

However this is still one to be fixed.

@phinze
Copy link
Contributor

phinze commented Mar 18, 2016

@boxrick yeah looks like at the moment the AWS API doesn't listen to the AvailabilityZones parameter and always returns the full set of active AZs in your region. So current workaround is to either specify all of them or omit it from the resource and let it be a computed value.

phinze added a commit that referenced this issue Mar 18, 2016
Usage of a helper function was assuming that an error would be returned
in a not found condition, when in fact a nil pointer was
returned.

Attached test crashes w/o fix, passes with it.

Fixes #5350
Refs #5418
phinze added a commit that referenced this issue Mar 18, 2016
Usage of a helper function was assuming that an error would be returned
in a not found condition, when in fact a nil pointer was
returned.

Attached test crashes w/o fix, passes with it.

Fixes #5350
Refs #5418
phinze added a commit that referenced this issue Mar 18, 2016
Usage of a helper function was assuming that an error would be returned
in a not found condition, when in fact a nil pointer was
returned.

Attached test crashes w/o fix, passes with it.

Fixes #5350
Refs #5418
@phinze
Copy link
Contributor

phinze commented Mar 18, 2016

Okay just found #3754 which has more discussion around the AZs issue, and closed the crasher in #5717. So I believe the best thing to do here is to close this and consolidate conversation around the original AZs issue in #3754. Let me know if you feel like there's anything else outstanding that needs to be tracked here though! 👍

@ghost
Copy link

ghost commented Apr 27, 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 27, 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