-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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/aws: elastic beanstalk invalid setting crash #7222
provider/aws: elastic beanstalk invalid setting crash #7222
Conversation
Thanks! I appreciate the work you did digging in and fixing these! |
@@ -642,3 +663,26 @@ func dropGeneratedSecurityGroup(settingValue string, meta interface{}) string { | |||
|
|||
return strings.Join(legitGroups, ",") | |||
} | |||
|
|||
func describeBeanstalkEvents(conn *elasticbeanstalk.ElasticBeanstalk, environmentId string, t time.Time) error { |
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.
A better name might be describeBeanstalkErrors
since this only checks for ERRORs.
I'd also prefer a []string
of the errors, (or even a []*elasticbeanstalk.EventDescription
rather than concatenating them into an error value. A function returning an error generally indicated the call failed.
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.
@jbardin Thanks for the feedback here, sorry it took a bit of time for me to get around to this.
- I agree with changing the name to describeBeanstalkErrors. Originally, I was contemplating having a parameter to set the level of events returned, but I think error is all we really need.
- I tried two approaches here, but ran into issues with both. Can you elaborate on how to do this? I tried both returning a slice of errors and a slice of strings. I pushed the slice of errors example to branch on my fork: dharrisio@950de0f
What I ran into were type errors about returning[]error
as typeerror
. There was a similar issue with using a slice of strings:[]string
as typestring
in argument tofmt.Errorf
.
oops, just missed the merge ;) My comments were only stylistic, so nothing that can't be cleaned up later if need be. |
Hi @dharrisio, sorry for the delayed reply. This is mostly a style comment, and really only has an impact if someone else tries to reuse this function elsewhere in the code, so don't worry about it too much. re: #2, This makes more sense once you change the name to As for the return type, (IMHO) I think it shouldn't return an Though if you do ever need to bundle multiple errors like this, all you need is to define an Error() method on a container for those errors. Internally we use these for added functionality:
|
@jbardin Thanks for the explanation on the errors, that helps a lot! My reasoning for having this return an error is that the Beanstalk API doesn't return an error in some cases. When this happens we don't know if the resource was not created or updated until we get the errors from describe events. When this happens we don't want Terraform to continue creating/updating other resources in the graph. From my understanding, in that case, we would want this to be returned as an error? As an example, expanded on from #6624
In this case, the environment creation will fail, and we would not want to create/update the r53 record to point to the bad environment. To further complicate and confuse things, we probably do not want errors when deleting the resource because it is possible to get some false positives. In this case I had to run Example output using multierror: https://gist.github.com/dharrisio/8024591dfaabb0bfdd73ee39d9ff17e8 |
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. |
This fixes the crash in #6624/#6707/#7197. It also adds functionality to relay any failures from the elastic beanstalk environment events. As an example, the config
Results in the following output
Most of the tests on this pass, with one exception. The worker tier test fails, I was only able to reproduce the issue in us-west-2, so it might be temporary.