-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
feat(aws_instance): add instance market options block #202
base: main
Are you sure you want to change the base?
feat(aws_instance): add instance market options block #202
Conversation
Hello @hans-d & @jamengual please review the PR above for the ec2 module improvement Thank you |
c078527
to
48ebfae
Compare
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.
Looks good @haidargit - a couple of comments
💥 This pull request now has conflicts. Could you fix it @haidargit? 🙏 |
|
That new example directory isn't getting run by terratest. Was adding the example strictly as a way of documenting the feature? Here are some options worth considering
Here is the existing tfvars https://github.com/cloudposse/terraform-aws-ec2-instance/blob/main/examples/complete/fixtures.us-east-2.tfvars which could then have an additional tfvars beside it such as fixtures.us-east-2.spot.tfvars. Here is how the tfvars get inserted into the test
|
Hi @nitrocode, thanks for the insight Correct, using the existing example directories is sufficient. i have updated my code to use the current
|
Thanks for addressing the changes. How come the _enabled flag is still used? I thought it was removed when this comment was raised? |
9259333
to
3389dbb
Compare
💥 This pull request now has conflicts. Could you fix it @haidargit? 🙏 |
/terratest |
@haidargit see code annotations and test failures |
Thanks for resolving some of the issues. There seem to be a few remaining. Please fix all of them and then resubmit the PR. I moved it to a draft for now. |
Hi @nitrocode, Could you kindly review the latest commit when you get a chance? Much appreciated! |
Co-authored-by: nitrocode <[email protected]>
Co-authored-by: nitrocode <[email protected]>
Co-authored-by: nitrocode <[email protected]>
Co-authored-by: nitrocode <[email protected]>
Co-authored-by: nitrocode <[email protected]>
Co-authored-by: nitrocode <[email protected]>
5aab533
to
c184687
Compare
Hello @nitrocode, @joe-niland I've updated the code. Could you help review the latest commit? c184687 the changes included the instance market options variable adjustment, custom validation for market type, and several other minor fix Thank you 🙏🏻 |
/terratest |
examples/complete/variables.tf
Outdated
default = null | ||
validation { | ||
condition = contains(["spot", "capacity-block"], var.instance_market_options.market_type) |
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.
It's failing on this condition
TestExternalEniComplete 2024-10-15T22:07:13Z logger.go:66: │ Error: Attempt to get attribute from null value
TestExternalEniComplete 2024-10-15T22:07:13Z logger.go:66: │
TestExternalEniComplete 2024-10-15T22:07:13Z logger.go:66: │ on ../../variables.tf line 65, in variable "instance_market_options":
TestExternalEniComplete 2024-10-15T22:07:13Z logger.go:66: │ 65: condition = contains(["spot", "capacity-block"], var.instance_market_options.market_type)
TestExternalEniComplete 2024-10-15T22:07:13Z logger.go:66: │ ├────────────────
TestExternalEniComplete 2024-10-15T22:07:13Z logger.go:66: │ │ var.instance_market_options is null
TestExternalEniComplete 2024-10-15T22:07:13Z logger.go:66: │
TestExternalEniComplete 2024-10-15T22:07:13Z logger.go:66: │ This value is null, so it does not have any attributes.
TestExternalEniComplete 2024-10-15T22:07:13Z logger.go:66: ╵
TestExternalEniComplete 2024-10-15T22:07:13Z retry.go:99: Returning due to fatal error: FatalError{Underlying: error while running command: exit status 1; ╷
│ Error: Attempt to get attribute from null value
│
│ on ../../variables.tf line 65, in variable "instance_market_options":
│ 65: condition = contains(["spot", "capacity-block"], var.instance_market_options.market_type)
│ ├────────────────
│ │ var.instance_market_options is null
│
│ This value is null, so it does not have any attributes.
╵}
destroy.go:11:
Error Trace: destroy.go:11
panic.go:523
testing.go:999
apply.go:15
examples_complete_test.go:109
Error: Received unexpected error:
FatalError{Underlying: error while running command: exit status 1; ╷
│ Error: Attempt to get attribute from null value
│
│ on ../../variables.tf line 65, in variable "instance_market_options":
│ 65: condition = contains(["spot", "capacity-block"], var.instance_market_options.market_type)
│ ├────────────────
│ │ var.instance_market_options is null
│
│ This value is null, so it does not have any attributes.
╵}
Test: TestExternalEniComplete
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.
Hi @nitrocode,
i have put the fix for the error and tried to run the terraform plan
on examples/external-eni
in my local, it succeeded.
please review for my latest changes. Thanks for the feedback!
233c5aa
to
b6ae4ad
Compare
/terratest |
/terratest |
what
examples/complete
directorywhy
references
others:
module documentation is updated (guide: Updating Module Documentation)
update the
versions.tf
files in the example directories as a complement (guide: Updating the Module Examples)(done) terraform testing (plan+apply) is performed by using
examples/complete
directory on current PR branchfeature/spot-instance-enablement
targeting self-owned AWS cloud account