-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: Creation of an Instance with a Capacity Reservation ID #278
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Hello @bryantbiggs, Would it be possible for your to review this PR ? Thanks in advance. Bests. Keep up the good work ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be deleting the README documentation - not sure why our checks are still passing with all this being deleted. Please update when you get a chance
@bryantbiggs thanks for your feedback. this was due to the fact that I mistakenly removed the end of tfdocs hook in the complete example README: Now pre-commit hooks run correctly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @schniber !
### [4.1.1](v4.1.0...v4.1.1) (2022-07-21) ### Bug Fixes * Creation of an Instance with a Capacity Reservation ID ([#278](#278)) ([f12ac95](f12ac95))
This PR is included in version 4.1.1 🎉 |
I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Description
When trying to call the module with the specification of a Capacity Reservation ID, the module ends up with the following error:
╷
│ Error: Invalid function argument
│
│ on .terraform/modules/terraform-aws-ec2-instance/main.tf line 45, in resource "aws_instance" "this":
│ 45: capacity_reservation_id = lookup(capacity_reservation_target.value, "capacity_reservation_id", null)
│ ├────────────────
│ │ capacity_reservation_target.value is "cr-xxxxxxxx"
│
│ Invalid value for "inputMap" parameter: lookup() requires a map as the
│ first argument.
╵
As per line 45 analysis, it looks like the bug is in the following statement:
capacity_reservation_id = lookup(capacity_reservation_target.value, "capacity_reservation_id", null)
it should rather be as follows:
capacity_reservation_id = lookup(capacity_reservation_target, "capacity_reservation_id", null)
In this case, terraform should lookup in the capacity reservation target map (since it is the iterator in the for_each) rather than in its value for the mapping of the attribute capacity reservation id
Motivation and Context
Fixes #277
Breaking Changes
No breaking changes, just fixing a typo in line 45 in the main.tf
How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectsThis fix is hard to test since it requires to have an ongoing capacity reservation which is released by AWS.
In order to test this, I stopped at the plan stage.
pre-commit run -a
on my pull request