mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
terraform: remove unused function
This commit is contained in:
parent
73e2a43427
commit
7a97396583
@ -48,21 +48,6 @@ const (
|
||||
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
|
||||
// done instead of a raw `map[string]interface{}` type so that rich
|
||||
// methods can be added to it to make dealing with it easier.
|
||||
|
@ -7,31 +7,6 @@ import (
|
||||
"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) {
|
||||
cases := []struct {
|
||||
Config map[string]interface{}
|
||||
|
Loading…
Reference in New Issue
Block a user