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

Amazon lowercases db_subnet_group_name #2320

Closed
SamBarker opened this issue Jun 12, 2015 · 6 comments · Fixed by #2513
Closed

Amazon lowercases db_subnet_group_name #2320

SamBarker opened this issue Jun 12, 2015 · 6 comments · Fixed by #2513

Comments

@SamBarker
Copy link

I'm trying to work out why terraform continually destroys and adds my DB instances. I finally spotted that its because I'm using db_subnet_group_name, which forces a new resource.

I've marked the DB instances as depending on the aws_db_subnet_group, but the aws_db_subnet_group is not being marked for change.

Looking at the RDS instance in the AWS console Amazon have lowercased the group name! My config looks like:

resource "aws_db_subnet_group" "db_subnet_group" {
  name = "${var.envType} DB"
  description = "${var.envType} DB"
  subnet_ids = [
    "${aws_subnet.rds-a.id}",
    "${aws_subnet.rds-b.id}"]
}

resource "aws_db_instance" "modeA-db" {
  identifier = "modeA_db"
  allocated_storage = "8"
  engine = "mysql"
  engine_version = "5.6.22"
  instance_class = "db.m.large"
  username = "user"
  password = "test123"
  db_subnet_group_name = "${var.envType} DB"
  maintenance_window = "sun:00:30-sun:01:00"
  storage_type = "standard"
  port = "${var.db-port}"
  publicly_accessible = false
  multi_az = false
  availability_zone = "${var.zone-a}"
  vpc_security_group_ids = [
    "${aws_security_group.rds-demo-db.id}",
    "${aws_security_group.rds-live-db.id}"]

  depends_on = "aws_db_subnet_group.db_subnet_group"
}

Additionally it would be good if the aws_db_subnet_group exposed its name as an output.

I'm going to update my config to use lowecase names but I think terraform should lowercase the group name automatically

@radeksimko
Copy link
Member

I remember having very similar issues in some order RDS resources.

I think terraform should lowercase the group name automatically

I don't think Terraform should be as magic as AWS API 😃 and do things user may not expect.
I'd rather see validation giving error, once we have the support for validation in place.

@SamBarker
Copy link
Author

While I agree that terraform shouldn't do magic I do think it should behave
consistently with AWS which does mean enforcing lowercase names.

As I see it the problem with just doing validation is that the instances
get destroyed and recreated whithout a change which is obviously not good
news if there is data in them.
On 13/06/2015 2:25 PM, "Radek Simko" notifications@github.com wrote:

I remember having very similar issues in some order RDS resources.

I think terraform should lowercase the group name automatically

I don't think Terraform should be as magic as AWS API [image: 😃]
and do things user may not expect.
I'd rather see validation giving error, once we have the support for
validation #2265 in place.


Reply to this email directly or view it on GitHub
#2320 (comment)
.


IMPORTANT NOTICE: MahiFX Limited (MahiFX), (company no. 2446590) is
registered in New Zealand. MahiFX is authorised and regulated by the
Australian Securities and Investment Commission ARBN 152 535 085, AFSL
414198. This email, its attachments and any rights attaching hereto are
confidential and intended exclusively for the person to whom the email is
addressed. If you are not the intended recipient, do not read, copy,
disclose or use the contents in any way. Please notify the sender by return
email and destroy the email and attachments immediately. MahiFX does not
accept any liability for any changes made to this email or attachments
after sending by MahiFX. You must scan this email and attachments for
viruses. The opinions expressed are not necessarily those of MahiFX. MahiFX
accepts no liability for any loss, damage or consequence, whether caused by
our own negligence or not, resulting directly or indirectly from the use of
this email and attachments.

For more information about MahiFX Limited see mahifx.com.

@radeksimko
Copy link
Member

As I see it the problem with just doing validation is that the instances
get destroyed and recreated whithout a change which is obviously not good
news if there is data in them.

I'm not sure I get that, why should instances get even touched, when validation prevents any further action if the name isn't lowercase?

@SamBarker
Copy link
Author

Sorry just flown from NZ to UK not thinking clearly enough. As long as the
validation actually prevents a the diff being generated then yes it does
the job.
On 13/06/2015 8:24 PM, "Radek Simko" notifications@github.com wrote:

As I see it the problem with just doing validation is that the instances
get destroyed and recreated whithout a change which is obviously not good
news if there is data in them.

I'm not sure I get that, why should instances get even touched, when
validation prevents any further action if the name isn't lowercase?


Reply to this email directly or view it on GitHub
#2320 (comment)
.


IMPORTANT NOTICE: MahiFX Limited (MahiFX), (company no. 2446590) is
registered in New Zealand. MahiFX is authorised and regulated by the
Australian Securities and Investment Commission ARBN 152 535 085, AFSL
414198. This email, its attachments and any rights attaching hereto are
confidential and intended exclusively for the person to whom the email is
addressed. If you are not the intended recipient, do not read, copy,
disclose or use the contents in any way. Please notify the sender by return
email and destroy the email and attachments immediately. MahiFX does not
accept any liability for any changes made to this email or attachments
after sending by MahiFX. You must scan this email and attachments for
viruses. The opinions expressed are not necessarily those of MahiFX. MahiFX
accepts no liability for any loss, damage or consequence, whether caused by
our own negligence or not, resulting directly or indirectly from the use of
this email and attachments.

For more information about MahiFX Limited see mahifx.com.

@radeksimko
Copy link
Member

@SamBarker No worries 😃 it happens to me from time to time too.

@ghost
Copy link

ghost commented May 2, 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 May 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants