Closed whites11 closed 1 month ago
I created an explicit struct for all terraform Objects used in the service resource. This allows to avoid having hardcorded field names all over the place.
Example:
To create an Endpoint in the terraform state, instead of doing:
obj, _ := types.ObjectValue(endpointObjectType.AttrTypes, map[string]attr.Value{ "protocol": types.StringValue(endpoint.Protocol), "host": types.StringValue(endpoint.Host), "port": types.Int64Value(int64(endpoint.Port)), })
now you can do
models.Endpoint{ Protocol: types.StringValue(endpoint.Protocol), Host: types.StringValue(endpoint.Host), Port: types.Int64Value(int64(endpoint.Port)) }.ObjectValue()
and the field names are known by the models.Endpoint type only.
models.Endpoint
I also moved the terraform model definitions again (sorry)
I created an explicit struct for all terraform Objects used in the service resource. This allows to avoid having hardcorded field names all over the place.
Example:
To create an Endpoint in the terraform state, instead of doing:
now you can do
and the field names are known by the
models.Endpoint
type only.I also moved the terraform model definitions again (sorry)