@@ -14,6 +14,10 @@ func resourceRuntimeconfigVariable() *schema.Resource {
14
14
Update : resourceRuntimeconfigVariableUpdate ,
15
15
Delete : resourceRuntimeconfigVariableDelete ,
16
16
17
+ Importer : & schema.ResourceImporter {
18
+ State : resourceRuntimeconfigVariableImport ,
19
+ },
20
+
17
21
Schema : map [string ]* schema.Schema {
18
22
"name" : {
19
23
Type : schema .TypeString ,
@@ -124,6 +128,20 @@ func resourceRuntimeconfigVariableDelete(d *schema.ResourceData, meta interface{
124
128
return nil
125
129
}
126
130
131
+ func resourceRuntimeconfigVariableImport (d * schema.ResourceData , meta interface {}) ([]* schema.ResourceData , error ) {
132
+ config := meta .(* Config )
133
+ parseImportId ([]string {"projects/(?P<project>[^/]+)/configs/(?P<parent>[^/]+)/variables/(?P<name>[^/]+)" , "(?P<parent>[^/]+)/(?P<name>[^/]+)" }, d , config )
134
+
135
+ // Replace import id for the resource id
136
+ id , err := replaceVars (d , config , "projects/{{project}}/configs/{{parent}}/variables/{{name}}" )
137
+ if err != nil {
138
+ return nil , fmt .Errorf ("Error constructing id: %s" , err )
139
+ }
140
+ d .SetId (id )
141
+
142
+ return []* schema.ResourceData {d }, nil
143
+ }
144
+
127
145
// resourceRuntimeconfigVariableFullName turns a given project, runtime config name, and a 'short name' for a runtime
128
146
// config variable into a full name (e.g. projects/my-project/configs/my-config/variables/my-variable).
129
147
func resourceRuntimeconfigVariableFullName (project , config , name string ) string {
0 commit comments