mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
44 lines
806 B
Go
44 lines
806 B
Go
package aws
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
"github.com/hashicorp/terraform/config"
|
|
"github.com/hashicorp/terraform/terraform"
|
|
)
|
|
|
|
func TestResourceProvider_impl(t *testing.T) {
|
|
var _ terraform.ResourceProvider = new(ResourceProvider)
|
|
}
|
|
|
|
func TestResourceProvider_Configure(t *testing.T) {
|
|
rp := new(ResourceProvider)
|
|
|
|
raw := map[string]interface{}{
|
|
"access_key": "foo",
|
|
"secret_key": "bar",
|
|
"region": "us-east",
|
|
}
|
|
|
|
rawConfig, err := config.NewRawConfig(raw)
|
|
if err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
|
|
err = rp.Configure(terraform.NewResourceConfig(rawConfig))
|
|
if err != nil {
|
|
t.Fatalf("err: %s", err)
|
|
}
|
|
|
|
expected := Config{
|
|
AccessKey: "foo",
|
|
SecretKey: "bar",
|
|
Region: "us-east",
|
|
}
|
|
|
|
if !reflect.DeepEqual(rp.Config, expected) {
|
|
t.Fatalf("bad: %#v", rp.Config)
|
|
}
|
|
}
|