Skip to content

Commit

Permalink
Enforce v2 sdk in all resources and other generated files. (GoogleClo…
Browse files Browse the repository at this point in the history
  • Loading branch information
nat-henderson authored Sep 17, 2020
1 parent 7048643 commit 366360e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

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

<%# Since most resources define a "basic" config as their first example, we can reuse that config to create a resource to test IAM resources with. -%>
Expand Down
1 change: 1 addition & 0 deletions templates/terraform/examples/base_configs/test_file.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)
<%
raise 'skip_test should be true if resource is not importable' \
Expand Down
14 changes: 14 additions & 0 deletions templates/terraform/resource.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@

package google

import (
<%- # We list all the v2 imports here, because we run 'goimports' to guess the correct
# set of imports, which will never guess the major version correctly. -%>
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
)

<%= lines(compile(pwd + '/' + object.custom_code.constants)) if object.custom_code.constants -%>

<%
Expand Down
1 change: 1 addition & 0 deletions templates/terraform/sweeper_file.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

<%
Expand Down

0 comments on commit 366360e

Please sign in to comment.