Skip to content

Commit

Permalink
successful generation
Browse files Browse the repository at this point in the history
  • Loading branch information
BBBmau committed Oct 23, 2024
1 parent d3c770b commit a076cce
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if d.Get("name").(string) == "" {
return v.(string)
}

return d.Get("name")
}
4 changes: 4 additions & 0 deletions mmv1/templates/terraform/decoders/vertex_ai_models.go.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if res["model"] != "" {
res["name"] = res["model"]
}
return res, nil
13 changes: 13 additions & 0 deletions mmv1/templates/terraform/examples/vertex_ai_model_basic.tf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "google_vertex_ai_models" "<%= ctx[:primary_resource_id] %>" {
display_name = "<%= ctx[:vars]['display_name'] %>"
description = "sample description"
labels = {
"key1" : "value1",
"key2" : "value2"
}
region = "us-central1"
encryption_spec {
kms_key_name = "<%= ctx[:vars]['kms_key_name'] %>"
}
depends_on = [google_kms_crypto_key_iam_member.crypto_key]
}
9 changes: 9 additions & 0 deletions mmv1/templates/terraform/pre_create/vertex_ai_models.go.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var postRequestType string
if _, ok := d.GetOk("model"); ok {
postRequestType = ":upload"
}

if _, ok := d.GetOk("source_model"); ok {
postRequestType = ":copy"
}
url = regexp.MustCompile("PRE_CREATE_REPLACE_ME").ReplaceAllLiteralString(url, postRequestType)

0 comments on commit a076cce

Please sign in to comment.