Skip to content

Commit 182cb3c

Browse files
authored
chore: handle not found error in policy resource (#149)
* chore: dependency update * fix: lint * fix: lint * chore: support multiple columns * chore: support raw_expression * chore: implement tests * chore: update * fix: lint * fix: lint
1 parent 50b5adc commit 182cb3c

19 files changed

+2927
-55
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.9.2
1+
3.9.3

provider/data_source_database.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func dataSourceDatabase() *schema.Resource {
125125

126126
func dataSourceDatabaseRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
127127
c := m.(api.Client)
128-
databaseName := d.Get("database").(string)
128+
databaseName := d.Get("name").(string)
129129

130130
database, err := c.GetDatabase(ctx, databaseName)
131131
if err != nil {

provider/data_source_instance_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestAccInstanceDataSource_NotFound(t *testing.T) {
6060
"test_instance",
6161
"mock-id",
6262
),
63-
ExpectError: regexp.MustCompile("Cannot found instance"),
63+
ExpectError: regexp.MustCompile(`Cannot found instance`),
6464
},
6565
},
6666
})

provider/data_source_policy_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func TestAccPolicyDataSource_NotFound(t *testing.T) {
6262
"",
6363
v1pb.PolicyType_MASKING_EXCEPTION,
6464
),
65-
ExpectError: regexp.MustCompile("Cannot found policy projects/project-sample/policies/MASKING_EXCEPTION"),
65+
ExpectError: regexp.MustCompile(`Cannot found policy projects/project-sample/policies/MASKING_EXCEPTION`),
6666
},
6767
},
6868
})

provider/data_source_project_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestAccProjectDataSource_NotFound(t *testing.T) {
5656
"mock_instance",
5757
"mock-id",
5858
),
59-
ExpectError: regexp.MustCompile("Cannot found project"),
59+
ExpectError: regexp.MustCompile(`Cannot found project`),
6060
},
6161
},
6262
})

provider/data_source_user.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, m interface
9191
}
9292

9393
func setUser(d *schema.ResourceData, user *v1pb.User) diag.Diagnostics {
94+
if err := d.Set("name", user.Name); err != nil {
95+
return diag.Errorf("cannot set name for user: %s", err.Error())
96+
}
9497
if err := d.Set("title", user.Title); err != nil {
9598
return diag.Errorf("cannot set title for user: %s", err.Error())
9699
}

0 commit comments

Comments
 (0)