github.com/paybyphone/terraform@v0.9.5-0.20170613192930-9706042ddd51/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  }