Skip to content
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

AppInsights: working around a breaking API change. #1769

Merged
merged 1 commit into from
Aug 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions azurerm/resource_arm_application_insights.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,19 @@ func resourceArmApplicationInsightsCreateOrUpdate(d *schema.ResourceData, meta i
Tags: expandTags(tags),
}

_, err := client.CreateOrUpdate(ctx, resGroup, name, insightProperties)
resp, err := client.CreateOrUpdate(ctx, resGroup, name, insightProperties)
if err != nil {
return err
// @tombuildsstuff - from 2018-08-14 the Create call started returning a 201 instead of 200
// which doesn't match the Swagger - this works around it until that's fixed
// BUG: https://github.com/Azure/azure-sdk-for-go/issues/2465
if resp.StatusCode != http.StatusCreated {
return fmt.Errorf("Error creating Application Insights %q (Resource Group %q): %+v", name, resGroup, err)
}
}

read, err := client.Get(ctx, resGroup, name)
if err != nil {
return err
return fmt.Errorf("Error retrieving Application Insights %q (Resource Group %q): %+v", name, resGroup, err)
}
if read.ID == nil {
return fmt.Errorf("Cannot read AzureRM Application Insights '%s' (Resource Group %s) ID", name, resGroup)
Expand Down