Skip to content

Commit 02c481b

Browse files
committed
Fix crashing bug
1 parent 2542092 commit 02c481b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
6+
## v0.12.6
7+
- Fix crashing bug in create IAM application
8+
69
## v0.12.5
710
- Add retry code to overcome IAM race condition in certain situations
811

hsdp/resource_iam_application.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func resourceIAMApplicationCreate(_ context.Context, d *schema.ResourceData, m i
6969
if resp.StatusCode != http.StatusConflict {
7070
return diag.FromErr(err)
7171
}
72-
createdApp, _, err = client.Applications.GetApplicationByName(app.Name)
72+
createdApp, resp, err = client.Applications.GetApplicationByName(app.Name)
7373
if err != nil {
7474
return diag.FromErr(err)
7575
}
@@ -84,6 +84,9 @@ func resourceIAMApplicationCreate(_ context.Context, d *schema.ResourceData, m i
8484
}
8585
// We found a matching existing application, go with it
8686
}
87+
if createdApp == nil {
88+
return diag.FromErr(fmt.Errorf("Unexpected failure creating '%s': [%v] [%v]", app.Name, err, resp))
89+
}
8790
d.SetId(createdApp.ID)
8891
_ = d.Set("name", createdApp.Name)
8992
_ = d.Set("description", createdApp.Description)

0 commit comments

Comments
 (0)