File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -459,9 +459,10 @@ func (m schemaMap) diffList(
459459 o , n , _ , computedList := d .diffChange (k )
460460 nSet := n != nil
461461
462- // If we have an old value, but no new value set but we're computed,
463- // then nothing has changed.
464- if o != nil && n == nil && schema .Computed {
462+ // If we have an old value and no new value is set or will be
463+ // computed once all variables can be interpolated and we're
464+ // computed, then nothing has changed.
465+ if o != nil && n == nil && ! computedList && schema .Computed {
465466 return nil
466467 }
467468
Original file line number Diff line number Diff line change @@ -1466,6 +1466,57 @@ func TestSchemaMap_Diff(t *testing.T) {
14661466
14671467 Err : false ,
14681468 },
1469+
1470+ {
1471+ Schema : map [string ]* Schema {
1472+ "internal" : & Schema {
1473+ Type : TypeBool ,
1474+ Required : true ,
1475+ },
1476+
1477+ "instances" : & Schema {
1478+ Type : TypeSet ,
1479+ Elem : & Schema {Type : TypeString },
1480+ Optional : true ,
1481+ Computed : true ,
1482+ Set : func (v interface {}) int {
1483+ return len (v )
1484+ },
1485+ },
1486+ },
1487+
1488+ State : & terraform.InstanceState {
1489+ Attributes : map [string ]string {
1490+ "internal" : "false" ,
1491+ "instances.#" : "0" ,
1492+ },
1493+ },
1494+
1495+ Config : map [string ]interface {}{
1496+ "internal" : true ,
1497+ "instances" : []interface {}{"${var.foo}" },
1498+ },
1499+
1500+ ConfigVariables : map [string ]string {
1501+ "var.foo" : config .UnknownVariableValue ,
1502+ },
1503+
1504+ Diff : & terraform.InstanceDiff {
1505+ Attributes : map [string ]* terraform.ResourceAttrDiff {
1506+ "internal" : & terraform.ResourceAttrDiff {
1507+ Old : "0" ,
1508+ New : "1" ,
1509+ },
1510+
1511+ "instances.#" : & terraform.ResourceAttrDiff {
1512+ Old : "0" ,
1513+ NewComputed : true ,
1514+ },
1515+ },
1516+ },
1517+
1518+ Err : false ,
1519+ },
14691520 }
14701521
14711522 for i , tc := range cases {
You can’t perform that action at this time.
0 commit comments