Skip to content

Commit

Permalink
Merge pull request #17082 from dspatoulas/PS-820/fix_deployments_bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavison committed Feb 11, 2021
2 parents 497b0c0 + 48f807f commit ba56348
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/17082.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_lambda_function: Prevent crash when using `Image` package type
```
2 changes: 1 addition & 1 deletion aws/resource_aws_lambda_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ func expandLambdaFileSystemConfigs(fscMaps []interface{}) []*lambda.FileSystemCo
func flattenLambdaImageConfig(response *lambda.ImageConfigResponse) []map[string]interface{} {
settings := make(map[string]interface{})

if response == nil || response.Error != nil {
if response == nil || response.Error != nil || response.ImageConfig == nil {
return nil
}

Expand Down
6 changes: 6 additions & 0 deletions aws/resource_aws_lambda_function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3140,3 +3140,9 @@ resource "aws_lambda_function" "test" {
}
`, rName, runtime))
}

func TestFlattenLambdaImageConfigShouldNotFailWithEmptyImageConfig(t *testing.T) {
t.Parallel()
response := lambda.ImageConfigResponse{}
flattenLambdaImageConfig(&response)
}

0 comments on commit ba56348

Please sign in to comment.