Skip to content

Commit

Permalink
resource/aws_instance: Guard check for aws_instance UserData to preve…
Browse files Browse the repository at this point in the history
…nt panic

Fixes: hashicorp#581

This is just a simple guard clause to make sure that we are checking
UserData is not nil before we check that the UserData.Value is not nil
  • Loading branch information
stack72 authored and jocgir committed Aug 28, 2017
1 parent 3db74bb commit f6584cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aws/resource_aws_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ func resourceAwsInstanceRead(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return err
}
if attr.UserData.Value != nil {
if attr.UserData != nil && attr.UserData.Value != nil {
d.Set("user_data", userDataHashSum(*attr.UserData.Value))
}
}
Expand Down

0 comments on commit f6584cd

Please sign in to comment.