mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-07 09:36:44 +00:00
![Riley Karson](/assets/img/avatar_default.png)
```bash GO111MODULE=on go get github.com/hashicorp/terraform@pluginsdk-v0.12-early7 GO111MODULE=on go mod vendor GO111MODULE=on go mod tidy ```
42 lines
887 B
Go
42 lines
887 B
Go
package addrs
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// InputVariable is the address of an input variable.
|
|
type InputVariable struct {
|
|
referenceable
|
|
Name string
|
|
}
|
|
|
|
func (v InputVariable) String() string {
|
|
return "var." + v.Name
|
|
}
|
|
|
|
// AbsInputVariableInstance is the address of an input variable within a
|
|
// particular module instance.
|
|
type AbsInputVariableInstance struct {
|
|
Module ModuleInstance
|
|
Variable InputVariable
|
|
}
|
|
|
|
// InputVariable returns the absolute address of the input variable of the
|
|
// given name inside the receiving module instance.
|
|
func (m ModuleInstance) InputVariable(name string) AbsInputVariableInstance {
|
|
return AbsInputVariableInstance{
|
|
Module: m,
|
|
Variable: InputVariable{
|
|
Name: name,
|
|
},
|
|
}
|
|
}
|
|
|
|
func (v AbsInputVariableInstance) String() string {
|
|
if len(v.Module) == 0 {
|
|
return v.String()
|
|
}
|
|
|
|
return fmt.Sprintf("%s.%s", v.Module.String(), v.Variable.String())
|
|
}
|