]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/terraform/helper/schema/field_reader_config.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / terraform / helper / schema / field_reader_config.go
index 55a301d81a65b156527c508e10d794d4ee35a9e6..808375ceb7eb4c08285024edc54eee2e7f67443b 100644 (file)
@@ -2,6 +2,7 @@ package schema
 
 import (
        "fmt"
+       "log"
        "strconv"
        "strings"
        "sync"
@@ -93,6 +94,22 @@ func (r *ConfigFieldReader) readField(
                }
        }
 
+       if protoVersion5 {
+               switch schema.Type {
+               case TypeList, TypeSet, TypeMap, typeObject:
+                       // Check if the value itself is unknown.
+                       // The new protocol shims will add unknown values to this list of
+                       // ComputedKeys. This is the only way we have to indicate that a
+                       // collection is unknown in the config
+                       for _, unknown := range r.Config.ComputedKeys {
+                               if k == unknown {
+                                       log.Printf("[DEBUG] setting computed for %q from ComputedKeys", k)
+                                       return FieldReadResult{Computed: true, Exists: true}, nil
+                               }
+                       }
+               }
+       }
+
        switch schema.Type {
        case TypeBool, TypeFloat, TypeInt, TypeString:
                return r.readPrimitive(k, schema)