github.com/hooklift/terraform@v0.11.0-beta1.0.20171117000744-6786c1361ffe/terraform/transform_config_old.go (about)

     1  package terraform
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hashicorp/terraform/config"
     7  )
     8  
     9  // varNameForVar returns the VarName value for an interpolated variable.
    10  // This value is compared to the VarName() value for the nodes within the
    11  // graph to build the graph edges.
    12  func varNameForVar(raw config.InterpolatedVariable) string {
    13  	switch v := raw.(type) {
    14  	case *config.ModuleVariable:
    15  		return fmt.Sprintf("module.%s.output.%s", v.Name, v.Field)
    16  	case *config.ResourceVariable:
    17  		return v.ResourceId()
    18  	case *config.UserVariable:
    19  		return fmt.Sprintf("var.%s", v.Name)
    20  	default:
    21  		return ""
    22  	}
    23  }