From 64cef5cd050fdf23b7cfc843f25a2386221f732c Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Tue, 6 Jun 2017 22:02:23 +0900 Subject: [PATCH] handle NewSession() error --- config/config.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 9cde121706..8a711f9254 100644 --- a/config/config.go +++ b/config/config.go @@ -1128,7 +1128,10 @@ func (c *EC2SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { return err } if c.Region == "" { - sess := session.Must(session.NewSession()) + sess, err := session.NewSession() + if err != nil { + return err + } metadata := ec2metadata.New(sess) region, err := metadata.Region() if err != nil {