fix: Stack creation panics if no project is provided in the creation options#1284
fix: Stack creation panics if no project is provided in the creation options#1284arybolovlev wants to merge 4 commits intomainfrom
Conversation
ctrombley
left a comment
There was a problem hiding this comment.
Thanks @arybolovlev !
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes 1 out of 2 committers have signed the CLA.
Aleksandr Rybolovlev seems not to be a GitHub user. Have you signed the CLA already but the status is still pending? Recheck it. |
1 similar comment
|
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes 1 out of 2 committers have signed the CLA.
Aleksandr Rybolovlev seems not to be a GitHub user. Have you signed the CLA already but the status is still pending? Recheck it. |
Description
When a new Stack is created without the mandatory
Projectfield in theStackCreateOptionsstructure, the creation process panics instead of returning a validation error.The following code will panic because the
Projectfield is a pointer, and the validation method does not check whether it isnil:This PR adds a nil pointer check to ensure that the
ErrRequiredProjecterror is returned if theProjectfield is not set, or if it is set butProject.IDis empty.Testing plan
I have added a unit test for the
valid()method of theStackCreateOptionsstructure.External links
Output from tests
Including output from tests may require access to a TFE instance. Ignore this section if you have no environment to test against.
Rollback Plan
Roll back to the previous version.
Changes to Security Controls
No.