Skip to content

Commit

Permalink
Add validation to provider fields in both SDK and PF implementations …
Browse files Browse the repository at this point in the history
…of provider schema (#9050)

* Add empty-string validator for PF provider

* Add empty-string validator for SDK provider, move SDK validators to separate file

* Add empty string validators to : credentials, access_token, impersonate_service_account, project, billing_project, region, zone

* Add unit tests for `ValidateEmptyStrings`

* Remove empty string test case from `ValidateCredentials`

* Add acceptace tests showing that empty strings in provider block results in a validation error, and empty provider blocks have no validation errors

* Make the SDK provider's `ValidateCredentials` validator reject empty strings

* Update acceptance test after change in `credentials` validation

* Fix test definitions to avoid fall-through

* Update validation error message in code and tests

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician committed Sep 23, 2023
1 parent 181e7ec commit e14ba70
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/hcl/v2 v2.14.1
github.com/hashicorp/terraform-json v0.14.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20230922211636-dd58dbd7b600
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20230923012357-5eb5f9921f47
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.3
github.com/zclconf/go-cty v1.11.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfD
github.com/hashicorp/terraform-plugin-mux v0.8.0 h1:WCTP66mZ+iIaIrCNJnjPEYnVjawTshnDJu12BcXK1EI=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0 h1:FtCLTiTcykdsURXPt/ku7fYXm3y19nbzbZcUxHx9RbI=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0/go.mod h1:80wf5oad1tW+oLnbXS4UTYmDCrl7BuN1Q+IA91X1a4Y=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20230922211636-dd58dbd7b600 h1:gz9Iy+wMO6gPLUXdFUNDsxSRNxK199RJ8TGU5qMRvp8=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20230922211636-dd58dbd7b600/go.mod h1:PK7PrQnwlP2eFuSyQD0/txEh4sF50euI3EYbd3GkZik=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20230923012357-5eb5f9921f47 h1:HTyZnJsxljvQkEhTv3bYpkpZCH9NmxnMLB/3ugrmFf0=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20230923012357-5eb5f9921f47/go.mod h1:PK7PrQnwlP2eFuSyQD0/txEh4sF50euI3EYbd3GkZik=
github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U=
github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A=
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=
Expand Down

0 comments on commit e14ba70

Please sign in to comment.