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

Update Go SDK to v55.3.0 #12263

Merged
merged 2 commits into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ func resourceSecurityCenterAutomation() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{
string(security.Alerts),
string(security.Assessments),
string(security.SecureScoreControls),
string(security.SecureScores),
string(security.SubAssessments),
string(security.EventSourceAlerts),
string(security.EventSourceAssessments),
string(security.EventSourceSecureScoreControls),
string(security.EventSourceSecureScores),
string(security.EventSourceSubAssessments),
}, false),
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ func resourceServerVulnerabilityAssessment() *pluginsdk.Resource {
Timeouts: &pluginsdk.ResourceTimeout{
Create: pluginsdk.DefaultTimeout(5 * time.Minute),
Read: pluginsdk.DefaultTimeout(5 * time.Minute),
Update: pluginsdk.DefaultTimeout(5 * time.Minute),
Delete: pluginsdk.DefaultTimeout(5 * time.Minute),
Delete: pluginsdk.DefaultTimeout(10 * time.Minute),
},

Schema: map[string]*pluginsdk.Schema{
Expand Down Expand Up @@ -147,17 +146,14 @@ func resourceServerVulnerabilityAssessmentDelete(d *pluginsdk.ResourceData, meta
time.Sleep(time.Duration(retry) * time.Second)
}

response, err := client.Delete(ctx, targetId.ResourceGroup, targetId.Provider, targetId.ResourceType, targetId.Name)
future, err := client.Delete(ctx, targetId.ResourceGroup, targetId.Provider, targetId.ResourceType, targetId.Name)
if err != nil {
// https://github.com/Azure/azure-rest-api-specs/issues/12308 the API report error even if delete was successful
if utils.ResponseWasStatusCode(response, 202) {
return nil
} else {
return fmt.Errorf("removing Server Vulnerability Assessment for %q: %+v\n", targetId.Id, err)
}
} else {
return nil
return fmt.Errorf("deleting Server Vulnerability Assessment %s: %v", targetId.Id, err)
}
if err := future.WaitForCompletionRef(ctx, client.Client); err != nil {
return fmt.Errorf("waiting for deletion of Server Vulnerability Assessment %s: %v", targetId.Id, err)
}
return nil
Comment on lines -150 to +156
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this future doesn't destroy correctly?

------- Stdout: -------
=== RUN   TestAccServerVulnerabilityAssessment_basic
=== PAUSE TestAccServerVulnerabilityAssessment_basic
=== CONT  TestAccServerVulnerabilityAssessment_basic
testing_new.go:21: WARNING: destroy failed, so remote objects may still exist and be subject to billing
testing_new.go:21: failed to destroy: exit status 1
Error: waiting for deletion of Server Vulnerability Assessment /subscriptions/*******/resourceGroups/acctestRG-sva-210618065036249376/providers/Microsoft.Compute/virtualMachines/acctestVM-210618065036249376: Future#WaitForCompletion: context has been cancelled: StatusCode=202 -- Original Error: context deadline exceeded
--- FAIL: TestAccServerVulnerabilityAssessment_basic (508.09s)
FAIL

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out needs to extend the timeout value from 5min -> 10min (local run it takes ~7min).

Test

💤  TF_ACC=1 go test -timeout=3h -v ./azurerm/internal/services/securitycenter -run="TestAccServerVulnerabilityAssessment_basic"                                                                                                                 
2021/06/18 15:41:17 [DEBUG] not using binary driver name, it's no longer needed
2021/06/18 15:41:17 [DEBUG] not using binary driver name, it's no longer needed
=== RUN   TestAccServerVulnerabilityAssessment_basic
=== PAUSE TestAccServerVulnerabilityAssessment_basic
=== CONT  TestAccServerVulnerabilityAssessment_basic
--- PASS: TestAccServerVulnerabilityAssessment_basic (859.07s)
PASS
ok      github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/securitycenter      859.265s

}

type TargetId struct {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/terraform-providers/terraform-provider-azurerm

require (
github.com/Azure/azure-sdk-for-go v55.2.0+incompatible
github.com/Azure/azure-sdk-for-go v55.3.0+incompatible
github.com/Azure/go-autorest/autorest v0.11.18
github.com/Azure/go-autorest/autorest/date v0.3.0
github.com/Azure/go-autorest/autorest/to v0.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ github.com/Azure/azure-sdk-for-go v42.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9mo
github.com/Azure/azure-sdk-for-go v45.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v47.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v51.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v55.2.0+incompatible h1:TL2/vJWJEPOrmv97nHcbvjXES0Ntlb9P95hqGA1J2dU=
github.com/Azure/azure-sdk-for-go v55.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v55.3.0+incompatible h1:rLKCdFMMCAXt/QZ96skZJUArYS3UDo9Qm1ZWzoDtC9E=
github.com/Azure/azure-sdk-for-go v55.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Loading