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

db_instance_id is returning the DB Resource ID #498

Closed
1 task done
jwoytek opened this issue Jun 8, 2023 · 6 comments · Fixed by #489
Closed
1 task done

db_instance_id is returning the DB Resource ID #498

jwoytek opened this issue Jun 8, 2023 · 6 comments · Fixed by #489

Comments

@jwoytek
Copy link

jwoytek commented Jun 8, 2023

Description

I am using this module as part of a module in our project's infrastructure. I recently began adding some automated monitoring and was trying to set up some alarms for some RDS metrics. When I attempted to have the module output the db_instance_id, I instead get the db_resource_id returned.

The console indicates that an appropriate identifier is set, and requesting the arn for the rds instance shows the identifier correctly.

  • ✋ I have searched the open/closed issues and my issue is not listed.

Versions

  • Module version [Required]: 5.9.0

  • Terraform version: 1.4.6

  • Provider version(s): 5.1.0

Reproduction Code [Required]

output "db_instance_id" {
  value = module.db.db_instance_id
}

Steps to reproduce the behavior:

  1. Deploy RDS using module
  2. Request db_instance_id of the deployed database

Expected behavior

db_instance_id should return the instance identifier and not the resource identifier.

Actual behavior

db_instance_id returns the resource identifier.

Terminal Output Screenshot(s)

Example (partially redacted):

app_db_id = "db-63B5TPHO4P6G2NRAVXEEXXXXXX"
oauth_db_id = "db-IC6E5RWM5UD6OOYMFTKIXXXXXX"

Additional context

Note that another infrastructure deployment operating with provider version 4.58.0 and module version 5.6.0 returns the instance identifier correctly.

@jwoytek
Copy link
Author

jwoytek commented Jun 8, 2023

I may have found a thread to pull on here:

hashicorp/terraform-provider-aws#507

This ticket in the AWS provider is to allow users to change the DB identifier without destroying the existing resource. It seems there are some changes in a commit referenced there that have the module use the resource identifier instead of the instance identifier in some cases. I haven't parsed this fully yet, but this might be part of the issue.

@jwoytek
Copy link
Author

jwoytek commented Jun 8, 2023

OK, I believe I have found the issue.

dee-kryvenko/terraform-provider-aws@7eed983#diff-ca7f85b82bb2b9a4d5dcceea9a2f6a17fa978071f44c026f954e005598c61eecR1349

The id field of aws_db_instance is now returning the resource ID, due to the change in the previously referenced ticket.

This line:
dee-kryvenko/terraform-provider-aws@7eed983#diff-ca7f85b82bb2b9a4d5dcceea9a2f6a17fa978071f44c026f954e005598c61eecR1420

... appears to create a new and currently undocumented attribute named identifier that will return the actual instance identifier.

This was merged as hashicorp/terraform-provider-aws#31232.

I do not have the ability to test a fix at the moment, but it appears that in addition to the issue in this module, there is probably also a documentation update that needs to be made on the provider end (submitted here: hashicorp/terraform-provider-aws#31854).

@jwoytek
Copy link
Author

jwoytek commented Jun 8, 2023

Ugh I missed that this is the same as #495 (and handled by PR #496) because my search was apparently not awesome enough.

@antonbabenko
Copy link
Member

This issue has been resolved in version 6.0.0 🎉

@cfernhout
Copy link

Thanks, this change had broken some stuff inexplicably when upgrading. Thanks for the report and fix! 🙏

@github-actions
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 Jul 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants