Skip to content

Commit 867ae23

Browse files
feat: add the description field to featurestore entity type (#6984) (#13641)
Signed-off-by: Modular Magician <[email protected]>
1 parent 229c607 commit 867ae23

4 files changed

+41
-0
lines changed

.changelog/6984.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
vertexai: added the field `description` to `google_vertex_ai_featurestore_entitytype`
3+
```

google/resource_vertex_ai_featurestore_entitytype.go

+32
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ func resourceVertexAIFeaturestoreEntitytype() *schema.Resource {
4949
ForceNew: true,
5050
Description: `The name of the Featurestore to use, in the format projects/{project}/locations/{location}/featurestores/{featurestore}.`,
5151
},
52+
"description": {
53+
Type: schema.TypeString,
54+
Optional: true,
55+
Description: `Optional. Description of the EntityType.`,
56+
},
5257
"labels": {
5358
Type: schema.TypeMap,
5459
Optional: true,
@@ -192,6 +197,12 @@ func resourceVertexAIFeaturestoreEntitytypeCreate(d *schema.ResourceData, meta i
192197
}
193198

194199
obj := make(map[string]interface{})
200+
descriptionProp, err := expandVertexAIFeaturestoreEntitytypeDescription(d.Get("description"), d, config)
201+
if err != nil {
202+
return err
203+
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
204+
obj["description"] = descriptionProp
205+
}
195206
labelsProp, err := expandVertexAIFeaturestoreEntitytypeLabels(d.Get("labels"), d, config)
196207
if err != nil {
197208
return err
@@ -293,6 +304,9 @@ func resourceVertexAIFeaturestoreEntitytypeRead(d *schema.ResourceData, meta int
293304
return handleNotFoundError(err, d, fmt.Sprintf("VertexAIFeaturestoreEntitytype %q", d.Id()))
294305
}
295306

307+
if err := d.Set("description", flattenVertexAIFeaturestoreEntitytypeDescription(res["description"], d, config)); err != nil {
308+
return fmt.Errorf("Error reading FeaturestoreEntitytype: %s", err)
309+
}
296310
if err := d.Set("create_time", flattenVertexAIFeaturestoreEntitytypeCreateTime(res["createTime"], d, config)); err != nil {
297311
return fmt.Errorf("Error reading FeaturestoreEntitytype: %s", err)
298312
}
@@ -319,6 +333,12 @@ func resourceVertexAIFeaturestoreEntitytypeUpdate(d *schema.ResourceData, meta i
319333
billingProject := ""
320334

321335
obj := make(map[string]interface{})
336+
descriptionProp, err := expandVertexAIFeaturestoreEntitytypeDescription(d.Get("description"), d, config)
337+
if err != nil {
338+
return err
339+
} else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) {
340+
obj["description"] = descriptionProp
341+
}
322342
labelsProp, err := expandVertexAIFeaturestoreEntitytypeLabels(d.Get("labels"), d, config)
323343
if err != nil {
324344
return err
@@ -345,6 +365,10 @@ func resourceVertexAIFeaturestoreEntitytypeUpdate(d *schema.ResourceData, meta i
345365
log.Printf("[DEBUG] Updating FeaturestoreEntitytype %q: %#v", d.Id(), obj)
346366
updateMask := []string{}
347367

368+
if d.HasChange("description") {
369+
updateMask = append(updateMask, "description")
370+
}
371+
348372
if d.HasChange("labels") {
349373
updateMask = append(updateMask, "labels")
350374
}
@@ -449,6 +473,10 @@ func resourceVertexAIFeaturestoreEntitytypeImport(d *schema.ResourceData, meta i
449473
return []*schema.ResourceData{d}, nil
450474
}
451475

476+
func flattenVertexAIFeaturestoreEntitytypeDescription(v interface{}, d *schema.ResourceData, config *Config) interface{} {
477+
return v
478+
}
479+
452480
func flattenVertexAIFeaturestoreEntitytypeCreateTime(v interface{}, d *schema.ResourceData, config *Config) interface{} {
453481
return v
454482
}
@@ -592,6 +620,10 @@ func flattenVertexAIFeaturestoreEntitytypeMonitoringConfigCategoricalThresholdCo
592620
return v
593621
}
594622

623+
func expandVertexAIFeaturestoreEntitytypeDescription(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
624+
return v, nil
625+
}
626+
595627
func expandVertexAIFeaturestoreEntitytypeLabels(v interface{}, d TerraformResourceData, config *Config) (map[string]string, error) {
596628
if v == nil {
597629
return map[string]string{}, nil

google/resource_vertex_ai_featurestore_entitytype_generated_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ resource "google_vertex_ai_featurestore_entitytype" "entity" {
7272
labels = {
7373
foo = "bar"
7474
}
75+
description = "test description"
7576
featurestore = google_vertex_ai_featurestore.featurestore.id
7677
monitoring_config {
7778
snapshot_analysis {

website/docs/r/vertex_ai_featurestore_entitytype.html.markdown

+5
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ resource "google_vertex_ai_featurestore_entitytype" "entity" {
5151
labels = {
5252
foo = "bar"
5353
}
54+
description = "test description"
5455
featurestore = google_vertex_ai_featurestore.featurestore.id
5556
monitoring_config {
5657
snapshot_analysis {
@@ -131,6 +132,10 @@ The following arguments are supported:
131132
(Optional)
132133
The name of the EntityType. This value may be up to 60 characters, and valid characters are [a-z0-9_]. The first character cannot be a number.
133134

135+
* `description` -
136+
(Optional)
137+
Optional. Description of the EntityType.
138+
134139
* `labels` -
135140
(Optional)
136141
A set of key/value label pairs to assign to this EntityType.

0 commit comments

Comments
 (0)