"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "internal/plans/objchange/objchange.go" between
terraform-1.0.8.tar.gz and terraform-1.0.9.tar.gz

About: Terraform is a tool for building, changing, and versioning a datacenter infrastructure (written in Go).

objchange.go  (terraform-1.0.8):objchange.go  (terraform-1.0.9)
skipping to change at line 40 skipping to change at line 40
// the proposed state value. // the proposed state value.
if config.IsNull() && prior.IsNull() { if config.IsNull() && prior.IsNull() {
return prior return prior
} }
if prior.IsNull() { if prior.IsNull() {
// In this case, we will construct a synthetic prior value that i s // In this case, we will construct a synthetic prior value that i s
// similar to the result of decoding an empty configuration block , // similar to the result of decoding an empty configuration block ,
// which simplifies our handling of the top-level attributes/bloc ks // which simplifies our handling of the top-level attributes/bloc ks
// below by giving us one non-null level of object to pull values from. // below by giving us one non-null level of object to pull values from.
prior = AllBlockAttributesNull(schema) //
// "All attributes null" happens to be the definition of EmptyVal
ue for
// a Block, so we can just delegate to that
prior = schema.EmptyValue()
} }
return proposedNew(schema, prior, config) return proposedNew(schema, prior, config)
} }
// PlannedDataResourceObject is similar to proposedNewBlock but tailored for // PlannedDataResourceObject is similar to proposedNewBlock but tailored for
// planning data resources in particular. Specifically, it replaces the values // planning data resources in particular. Specifically, it replaces the values
// of any Computed attributes not set in the configuration with an unknown // of any Computed attributes not set in the configuration with an unknown
// value, which serves as a placeholder for a value to be filled in by the // value, which serves as a placeholder for a value to be filled in by the
// provider when the data resource is finally read. // provider when the data resource is finally read.
// //
skipping to change at line 261 skipping to change at line 264
} }
default: default:
// Should never happen, since the above cases are comprehensive. // Should never happen, since the above cases are comprehensive.
panic(fmt.Sprintf("unsupported block nesting mode %s", schema.Nes ting)) panic(fmt.Sprintf("unsupported block nesting mode %s", schema.Nes ting))
} }
return newV return newV
} }
func proposedNewAttributes(attrs map[string]*configschema.Attribute, prior, conf ig cty.Value) map[string]cty.Value { func proposedNewAttributes(attrs map[string]*configschema.Attribute, prior, conf ig cty.Value) map[string]cty.Value {
if prior.IsNull() {
prior = AllAttributesNull(attrs)
}
newAttrs := make(map[string]cty.Value, len(attrs)) newAttrs := make(map[string]cty.Value, len(attrs))
for name, attr := range attrs { for name, attr := range attrs {
priorV := prior.GetAttr(name) var priorV cty.Value
if prior.IsNull() {
priorV = cty.NullVal(prior.Type().AttributeType(name))
} else {
priorV = prior.GetAttr(name)
}
configV := config.GetAttr(name) configV := config.GetAttr(name)
var newV cty.Value var newV cty.Value
switch { switch {
case attr.Computed && attr.Optional: case attr.Computed && attr.Optional:
// This is the trickiest scenario: we want to keep the pr ior value // This is the trickiest scenario: we want to keep the pr ior value
// if the config isn't overriding it. Note that due to so me // if the config isn't overriding it. Note that due to so me
// ambiguity here, setting an optional+computed attribute from // ambiguity here, setting an optional+computed attribute from
// config and then later switching the config to null in a // config and then later switching the config to null in a
// subsequent change causes the initial config value to b e "sticky" // subsequent change causes the initial config value to b e "sticky"
// unless the provider specifically overrides it during i ts own // unless the provider specifically overrides it during i ts own
 End of changes. 3 change blocks. 
5 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)