terraform: remove unused function
This commit is contained in:
parent
73e2a43427
commit
7a97396583
|
@ -48,21 +48,6 @@ const (
|
||||||
FlagHasTainted
|
FlagHasTainted
|
||||||
)
|
)
|
||||||
|
|
||||||
// Vars returns the mapping of variables that should be replaced in
|
|
||||||
// configuration based on the attributes of this resource.
|
|
||||||
func (r *Resource) Vars() map[string]string {
|
|
||||||
if r.State == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
vars := make(map[string]string)
|
|
||||||
for ak, av := range r.State.Attributes {
|
|
||||||
vars[fmt.Sprintf("%s.%s", r.Id, ak)] = av
|
|
||||||
}
|
|
||||||
|
|
||||||
return vars
|
|
||||||
}
|
|
||||||
|
|
||||||
// ResourceConfig holds the configuration given for a resource. This is
|
// ResourceConfig holds the configuration given for a resource. This is
|
||||||
// done instead of a raw `map[string]interface{}` type so that rich
|
// done instead of a raw `map[string]interface{}` type so that rich
|
||||||
// methods can be added to it to make dealing with it easier.
|
// methods can be added to it to make dealing with it easier.
|
||||||
|
|
|
@ -7,31 +7,6 @@ import (
|
||||||
"github.com/hashicorp/terraform/config"
|
"github.com/hashicorp/terraform/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestResource_Vars(t *testing.T) {
|
|
||||||
r := new(Resource)
|
|
||||||
|
|
||||||
if len(r.Vars()) > 0 {
|
|
||||||
t.Fatalf("bad: %#v", r.Vars())
|
|
||||||
}
|
|
||||||
|
|
||||||
r = &Resource{
|
|
||||||
Id: "key",
|
|
||||||
State: &InstanceState{
|
|
||||||
Attributes: map[string]string{
|
|
||||||
"foo": "bar",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
expected := map[string]string{
|
|
||||||
"key.foo": "bar",
|
|
||||||
}
|
|
||||||
actual := r.Vars()
|
|
||||||
if !reflect.DeepEqual(actual, expected) {
|
|
||||||
t.Fatalf("bad: %#v", actual)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestResourceConfigGet(t *testing.T) {
|
func TestResourceConfigGet(t *testing.T) {
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
Config map[string]interface{}
|
Config map[string]interface{}
|
||||||
|
|
Loading…
Reference in New Issue