Skip to content

Commit

Permalink
upgrade to sdkv2 (#7291)
Browse files Browse the repository at this point in the history
* sdkv2

* Fix fmt.Errorf usage that was garbling error output.

* Only one provider in tests.

* Return errors instead of panicking.

* Fix use of ConfigureFunc => ConfigureContextFunc.

* More verbose logging for batch context errors.

* Log batcher parent context's status

* Formatf fix

* Fix diag.FromErr panic

* log state for resources and datasources to find diff

* Use temporary SDK branch for more parseable diffs

* Fix StopContext

* Ignore top-level % fields in state

* check for error before wrapping it in NonRetryableError

* Only parse IAM policies if they're set

* Update to use SDK fixes for data sources.

* Require random provider.

* Properly source random for import.

* Use latest sdk proposals

Include the collision detection between TestCase.ProviderFactories and
TestCase.ExternalProviders.

* Update to latest SDK master.

* Fix compute import test.

* Bubble up test errors.

* changes after merge with master

* after fixing some test failures

* fix container node pool invalid settings test

* rebase with mm master changes

* add external providers: random

* fix TestAccComputeInstance_scratchDisk test

* merge most recent changes from master

* update data_loss_prevention to use sdkv2

* remove set partial in compute instance

* fix lint errors

* merge with most recent master, fix iam tests

* generated from most recent commits

* update to fix container tests - take out lint fixes, now a separate branch in mm

* most recent merge with master

* update to latest sdk version on master

* go back to using sdk v2.0.1

* most recent changes to mm - update to 2.0.3

* mm changes from code review

* revert change back to hashicorp github org rather than terraform-providers

* fixes from upstream mm

Co-authored-by: Paddy Carver <paddy@carvers.co>
  • Loading branch information
megan07 and paddycarver committed Sep 17, 2020
1 parent cf7d21a commit d1014fe
Show file tree
Hide file tree
Showing 935 changed files with 3,460 additions and 2,581 deletions.
9 changes: 4 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ require (
github.com/client9/misspell v0.3.4
github.com/davecgh/go-spew v1.1.1
github.com/dnaeon/go-vcr v1.0.1
github.com/dustinkirkland/golang-petname v0.0.0-20170921220637-d3c2ba80e75e // indirect
github.com/gammazero/deque v0.0.0-20180920172122-f6adf94963e4 // indirect
github.com/gammazero/workerpool v0.0.0-20181230203049-86a96b5d5d92
github.com/gogo/protobuf v1.2.0 // indirect
github.com/golangci/golangci-lint v1.18.0
github.com/hashicorp/errwrap v1.0.0
github.com/hashicorp/go-cleanhttp v0.5.1
github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/go-version v1.2.0
github.com/hashicorp/terraform-plugin-sdk v1.11.0
github.com/hashicorp/go-version v1.2.1
github.com/hashicorp/terraform v0.13.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.0.3
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/hashstructure v1.0.0
github.com/sirupsen/logrus v1.2.0 // indirect
github.com/stoewer/go-strcase v1.0.2
github.com/terraform-providers/terraform-provider-random v0.0.0-20190925200408-30dac3233094
golang.org/x/net v0.0.0-20200822124328-c89045814202
Expand Down
418 changes: 382 additions & 36 deletions go.sum

Large diffs are not rendered by default.

19 changes: 18 additions & 1 deletion google/batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,24 @@ func (b *RequestBatcher) SendRequestWithTimeout(batchKey string, request *BatchR
case <-ctx.Done():
break
}
return nil, fmt.Errorf("Request %s timed out after %v", batchKey, timeout)
if b.parentCtx.Err() != nil {
switch b.parentCtx.Err() {
case context.Canceled:
return nil, fmt.Errorf("Parent context of request %s canceled", batchKey)
case context.DeadlineExceeded:
return nil, fmt.Errorf("Parent context of request %s timed out", batchKey)
default:
return nil, fmt.Errorf("Parent context of request %s encountered an error: %v", batchKey, ctx.Err())
}
}
switch ctx.Err() {
case context.Canceled:
return nil, fmt.Errorf("Request %s canceled", batchKey)
case context.DeadlineExceeded:
return nil, fmt.Errorf("Request %s timed out after %v", batchKey, timeout)
default:
return nil, fmt.Errorf("Error making request %s: %v", batchKey, ctx.Err())
}
}

// registerBatchRequest safely sees if an existing batch has been started
Expand Down
2 changes: 1 addition & 1 deletion google/common_diff_suppress.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"reflect"
"strings"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func optionalPrefixSuppress(prefix string) schema.SchemaDiffSuppressFunc {
Expand Down
2 changes: 1 addition & 1 deletion google/common_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"time"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
cloudresourcemanager "google.golang.org/api/cloudresourcemanager/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion google/common_polling.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sync"
"time"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions google/compute_instance_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"reflect"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
computeBeta "google.golang.org/api/compute/v0.beta"
"google.golang.org/api/googleapi"
)
Expand Down
Loading

0 comments on commit d1014fe

Please sign in to comment.