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

Provider enforcing only lowercase alphanumeric characters and hyphens allowed in parameter group "name" makes importing impossible #12144

Closed
iMartyn opened this issue Feb 24, 2020 · 12 comments · Fixed by #33704
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.
Milestone

Comments

@iMartyn
Copy link

iMartyn commented Feb 24, 2020

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 other comments that do not add relevant new information or questions, 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

Terraform v0.12.21 (same with 0.12.20)

  • provider.aws v2.50.0

Affected Resource(s)

  • aws_db_parameter_group

Terraform Configuration Files

resource "aws_db_parameter_group" "default-postgres9-6" {
    name        = "default.postgres9.6"
    family      = "postgres9.6"
    description = "Default parameter group for postgres9.6"
... rest is not relevant ...
}

Debug Output

Partial output https://gist.github.com/iMartyn/09aea39aff770335ce533ca3373a27c0#file-terraform-debug-txt - too much useful information to others in the full output to make that public.

Panic Output

No panic, just errors

Expected Behavior

Given that this resource exists on aws, I should be able to import it into terraform.

Actual Behavior

Cannot execute plan

Error: only lowercase alphanumeric characters and hyphens allowed in parameter group "name"

  on dbpg.tf line 1874, in resource "aws_db_parameter_group" "default-postgres9-6":
1874: resource "aws_db_parameter_group" "default-postgres9-6" {

Steps to Reproduce

  1. create pg database point and click and then use something like terraforming to create terraform to import resources into. or just create a db parameter group name with something like the hcl above.
  2. terraform plan

Important Factoids

The DB was pre-existing, I'm trying to import everything into terraform that has been created by point-and-click.

References

I'm not the only one facing this problem :
https://stackoverflow.com/questions/57386371/terraform-rds-instance-errors-with-lowercase-alphanumeric-characters-and-hypens

@ghost ghost added the service/rds Issues and PRs that pertain to the rds service. label Feb 24, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 24, 2020
@ewbankkit
Copy link
Contributor

Similar:

@iMartyn Please try using the ignore_changes attribute:

lifecycle {
  ignore_changes = ["name"]
}

@anton-simonov
Copy link

anton-simonov commented Feb 27, 2020

Hi @ewbankkit, I have the same issue with importing aws_db_option_group. The ignore_changes attribute didn't help.

@sarogers
Copy link

When attempting to modify a default RDS DB parameter group in the AWS management console I get:

Error saving: Cannot modify a default parameter group. (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterValue; Request ID: dc027191-3090-4cb2-8aff-4a567662ac7e), Cannot modify a default parameter group. (Service: AmazonRDS; Status Code: 400; Error Code: InvalidParameterValue; Request ID: eb45e3c5-c017-49a3-bc2a-e6012d1145a2)

So, for my purposes, there's no point in managing the DB parameter group state since it seems to be immutable. For the purpose of assigning the parameter group to a DB, perhaps it's also irrelevant since it gets assigned in the absence of an explicit DB parameter group? A little bit of explicitness is sacrificed but nothing that leaving a comment stating that the default DB parameter group is intentionally being used wouldn't address. For me the biggest downside has been that it was confusing to run into, so maybe something in the docs then?

@d4nyll
Copy link

d4nyll commented Jul 20, 2020

Similar situation for option groups - trying to import an option group named default:postgres-10. Fails with the same error.

@erezinchy
Copy link

Facing same issue . Any update on this?

@voroniys
Copy link

With big noise Hashicorp announced a release of Terraform 1.0. And it was released with the errors that were reported a year ago and to fix which just tiny change in one line code with regexp needed.
So, more than year later, with version 1.0 still suffering from the same bug :(

@dimisjim
Copy link
Contributor

@voroniys This is an issue in the provider, not core terraform

@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 26, 2021
@VladoPortos
Copy link

Issue still exists:

│ Error: only lowercase alphanumeric characters and hyphens allowed in parameter group "name"
│
│   with aws_db_parameter_group.spot-rds-postgres-parmeters,
│   on RDS.tf line 42, in resource "aws_db_parameter_group" "spot-rds-postgres-parmeters":
│   42:     name   = "default.postgres13"
│

This is imported resource and the value is: default.postgres13 in aws

@aminsafarini
Copy link

I am encountering the same issue with a parameter group that is attached to a Redshift cluster. I am using the default in aws which is default.redshift-1.0. I tired using the latest provider version 4.50.0 (released 4 days ago at the time of this writing) and the issue remains... Any suggestions?

@autotune
Copy link
Contributor

autotune commented Oct 1, 2023

I am working on this now. It is a little bit mind boggling that no one has decided to take this on yet, the fix is simple and this is clearly a high priority. @iMartyn

@github-actions
Copy link

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

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 12, 2023
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. service/rds Issues and PRs that pertain to the rds service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.