@@ -388,19 +388,19 @@ func resource{{ $.ResourceName -}}Create(d *schema.ResourceData, meta interface{
388388 {{- $renderedIdFromName := " false" }}
389389 {{- range $prop := $ .GettableProperties }}
390390 {{- /* Check if prop is potentially computed */ }}
391- {{- if and ($ .InPostCreateComputed $prop ) (and ( or $prop .Output $prop .DefaultFromApi ) ( not $prop .IgnoreRead ) ) }}
391+ {{- if and ($ .InPostCreateComputed $prop ) (or $prop .Output $prop .DefaultFromApi ) }}
392392 {{- if and (eq $prop .CustomFlatten " templates/terraform/custom_flatten/id_from_name.tmpl" ) (eq $renderedIdFromName " false" ) }}
393393 // Setting ` name` field so that ` id_from_name` flattener will work properly.
394394 if err := d.Set (" name" , flatten{{ if $ .NestedQuery -}}Nested{{end }}{{ $ .ResourceName -}}Name(opRes[" name" ], d, config)); err != nil {
395395 return err
396396 }
397397 {{- $renderedIdFromName = " true" }}
398398 {{- end }}
399- {{- if and $prop .Output ( not $prop .IgnoreRead ) }}
399+ {{- if $prop .Output }}
400400 if err := d.Set (" {{ underscore $prop.Name -}}" , flatten{{ if $ .NestedQuery -}}Nested{{end }}{{ $ .ResourceName -}}{{ camelize $prop .Name " upper" -}}(opRes[" {{ $prop.ApiName -}}" ], d, config)); err != nil {
401401 return err
402402 }
403- {{- else if and $prop .DefaultFromApi ( not $prop .IgnoreRead ) }}
403+ {{- else if $prop .DefaultFromApi }}
404404 // {{ underscore $prop .Name }} is set by API when unset
405405 if tpgresource.IsEmptyValue (reflect.ValueOf (d.Get (" {{ underscore $prop.Name }}" ))) {
406406 if err := d.Set (" {{ underscore $prop.Name -}}" , flatten{{ if $ .NestedQuery -}}Nested{{end }}{{ $ .ResourceName -}}{{ camelize $prop .Name " upper" -}}(opRes[" {{ $prop.ApiName -}}" ], d, config)); err != nil {
@@ -689,7 +689,7 @@ func resource{{ $.ResourceName -}}Read(d *schema.ResourceData, meta interface{})
689689 return fmt.Errorf (" Error reading {{ $.Name -}}: %s " , err)
690690 }
691691{{- end }}
692- {{ range $prop := $ .ReadProperties }}
692+ {{ range $prop := $ .GettableProperties }}
693693{{if $prop .FlattenObject -}}
694694// Terraform must set the top level schema field, but since this object contains collapsed properties
695695// it's difficult to know what the top level should be. Instead we just loop over the map returned from flatten.
@@ -1216,9 +1216,7 @@ func resource{{ $.ResourceName }}Import(d *schema.ResourceData, meta interface{}
12161216}
12171217{{ end }}
12181218{{- range $prop := $.GettableProperties }}
1219- {{- if not $prop.IgnoreRead }}
1220- {{ template " flattenPropertyMethod" $prop -}}
1221- {{- end }}
1219+ {{ template " flattenPropertyMethod" $prop -}}
12221220{{- end }}
12231221{{- range $prop := $.SettableProperties }}
12241222 {{- template " expandPropertyMethod" $prop -}}
@@ -1284,19 +1282,19 @@ func resource{{ $.ResourceName -}}PostCreateSetComputedFields(d *schema.Resource
12841282 {{- $renderedIdFromName := " false" }}
12851283 {{- range $prop := $.GettableProperties }}
12861284 {{- /* Check if prop is potentially computed */}}
1287- {{- if and ($.InPostCreateComputed $prop) (and ( or $prop.Output $prop.DefaultFromApi) (not $prop.IgnoreRead) ) }}
1285+ {{- if and ($.InPostCreateComputed $prop) (or $prop.Output $prop.DefaultFromApi) }}
12881286 {{- if and (eq $prop.CustomFlatten " templates/terraform/custom_flatten/id_from_name.tmpl " ) (eq $renderedIdFromName " false" ) }}
12891287 // Setting `name` field so that `id_from_name` flattener will work properly.
12901288 if err := d.Set(" name" , flatten{{ if $.NestedQuery -}}Nested{{end}}{{ $.ResourceName -}}Name(res[" name" ], d, config)); err != nil {
12911289 return fmt.Errorf(`Error setting computed identity field " name" : %s `, err)
12921290 }
12931291 {{- $renderedIdFromName = " true" }}
12941292 {{- end }}
1295- {{- if and $prop.Output (not $prop.IgnoreRead) }}
1293+ {{- if $prop.Output }}
12961294 if err := d.Set(" {{ underscore $prop .Name -}}" , flatten{{ if $.NestedQuery -}}Nested{{end}}{{ $.ResourceName -}}{{ camelize $prop.Name " upper" -}}(res[" {{ $prop .ApiName -}}" ], d, config)); err != nil {
12971295 return fmt.Errorf(`Error setting computed identity field " {{ underscore $prop .Name }}" : %s `, err)
12981296 }
1299- {{- else if and $prop.DefaultFromApi (not $prop.IgnoreRead) }}
1297+ {{- else if $prop.DefaultFromApi }}
13001298 // {{ underscore $prop.Name }} is set by API when unset
13011299 if tpgresource.IsEmptyValue(reflect.ValueOf(d.Get(" {{ underscore $prop .Name }}" ))) {
13021300 if err := d.Set(" {{ underscore $prop .Name -}}" , flatten{{ if $.NestedQuery -}}Nested{{end}}{{ $.ResourceName -}}{{ camelize $prop.Name " upper" -}}(res[" {{ $prop .ApiName -}}" ], d, config)); err != nil {
0 commit comments