aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/route53/setup.go8
-rw-r--r--test/grpc_test.go3
2 files changed, 9 insertions, 2 deletions
diff --git a/plugin/route53/setup.go b/plugin/route53/setup.go
index 31169edaf..3b47fad59 100644
--- a/plugin/route53/setup.go
+++ b/plugin/route53/setup.go
@@ -120,8 +120,14 @@ func setup(c *caddy.Controller, f func(*credentials.Credentials) route53iface.Ro
return plugin.Error("route53", c.Errf("unknown property '%s'", c.Val()))
}
}
+
+ session, err := session.NewSession(&aws.Config{})
+ if err != nil {
+ return plugin.Error("route53", err)
+ }
+
providers = append(providers, &credentials.EnvProvider{}, sharedProvider, &ec2rolecreds.EC2RoleProvider{
- Client: ec2metadata.New(session.New(&aws.Config{})),
+ Client: ec2metadata.New(session),
})
client := f(credentials.NewChainCredentials(providers))
ctx := context.Background()
diff --git a/test/grpc_test.go b/test/grpc_test.go
index fe273e789..a0d48490d 100644
--- a/test/grpc_test.go
+++ b/test/grpc_test.go
@@ -22,7 +22,8 @@ func TestGrpc(t *testing.T) {
}
defer g.Stop()
- conn, err := grpc.Dial(tcp, grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(5*time.Second))
+ ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
+ conn, err := grpc.DialContext(ctx, tcp, grpc.WithInsecure(), grpc.WithBlock())
if err != nil {
t.Fatalf("Expected no error but got: %s", err)
}