diff --git a/mmv1/products/colab/RuntimeTemplate.yaml b/mmv1/products/colab/RuntimeTemplate.yaml index ab5a6f71ff50..e88cc8d4cbbd 100644 --- a/mmv1/products/colab/RuntimeTemplate.yaml +++ b/mmv1/products/colab/RuntimeTemplate.yaml @@ -39,7 +39,7 @@ iam_policy: - 'projects/{{project}}/locations/{{location}}/notebookRuntimeTemplates/{{runtime_template}}' - '{{runtime_template}}' custom_code: - post_create: 'templates/terraform/post_create/accesspolicy.tmpl' + post_create: 'templates/terraform/post_create/colab_runtime_template.tmpl' examples: - name: 'colab_runtime_template_basic' primary_resource_id: 'runtime-template' diff --git a/mmv1/templates/terraform/post_create/accesspolicy.tmpl b/mmv1/templates/terraform/post_create/accesspolicy.tmpl index 3eee2620770f..84bad5bef8e8 100644 --- a/mmv1/templates/terraform/post_create/accesspolicy.tmpl +++ b/mmv1/templates/terraform/post_create/accesspolicy.tmpl @@ -4,7 +4,7 @@ resp := res["response"].(map[string]interface{}) name := tpgresource.GetResourceNameFromSelfLink(resp["name"].(string)) -log.Printf("[DEBUG] Setting resource name, id to %s", name) +log.Printf("[DEBUG] Setting AccessPolicy name, id to %s", name) if err := d.Set("name", name); err != nil { return fmt.Errorf("Error setting name: %s", err) } diff --git a/mmv1/templates/terraform/post_create/colab_runtime_template.tmpl b/mmv1/templates/terraform/post_create/colab_runtime_template.tmpl new file mode 100644 index 000000000000..61b91dfd180c --- /dev/null +++ b/mmv1/templates/terraform/post_create/colab_runtime_template.tmpl @@ -0,0 +1,10 @@ +// The operation for this resource contains the generated name that we need +// in order to perform a READ. We need to access the object inside of it as +// a map[string]interface, so let's do that. + +resp := res["response"].(map[string]interface{}) +name := tpgresource.GetResourceNameFromSelfLink(resp["name"].(string)) +log.Printf("[DEBUG] Setting resource name, id to %s", name) +if err := d.Set("name", name); err != nil { + return fmt.Errorf("Error setting name: %s", err) +} \ No newline at end of file