summaryrefslogtreecommitdiff
path: root/vendor/github.com/hashicorp/terraform/terraform/eval_count_computed.go
blob: 54a8333e0fc455d84a9145b31152bb936fa090f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package terraform

import (
	"fmt"

	"github.com/hashicorp/terraform/config"
)

// EvalCountCheckComputed is an EvalNode that checks if a resource count
// is computed and errors if so. This can possibly happen across a
// module boundary and we don't yet support this.
type EvalCountCheckComputed struct {
	Resource *config.Resource
}

// TODO: test
func (n *EvalCountCheckComputed) Eval(ctx EvalContext) (interface{}, error) {
	if n.Resource.RawCount.Value() == unknownValue() {
		return nil, fmt.Errorf(
			"%s: value of 'count' cannot be computed",
			n.Resource.Id())
	}

	return nil, nil
}