github.com/hs0210/hashicorp-terraform@v0.11.12-beta1/terraform/eval_count_computed.go (about)

     1  package terraform
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hashicorp/terraform/config"
     7  )
     8  
     9  // EvalCountCheckComputed is an EvalNode that checks if a resource count
    10  // is computed and errors if so. This can possibly happen across a
    11  // module boundary and we don't yet support this.
    12  type EvalCountCheckComputed struct {
    13  	Resource *config.Resource
    14  }
    15  
    16  // TODO: test
    17  func (n *EvalCountCheckComputed) Eval(ctx EvalContext) (interface{}, error) {
    18  	if n.Resource.RawCount.Value() == unknownValue() {
    19  		return nil, fmt.Errorf(
    20  			"%s: value of 'count' cannot be computed",
    21  			n.Resource.Id())
    22  	}
    23  
    24  	return nil, nil
    25  }