From 952dac37c16b1c249672e0127f56c4927a2d9d29 Mon Sep 17 00:00:00 2001 From: Shern Shiou Tan Date: Wed, 29 May 2019 19:10:01 +0200 Subject: [PATCH] Add slash to defaultIAMSecurityCredsPath (#1115) Also add slash to security credential url at test --- pkg/credentials/iam_aws.go | 2 +- pkg/credentials/iam_aws_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/credentials/iam_aws.go b/pkg/credentials/iam_aws.go index 310785209d..5732f2e4b6 100644 --- a/pkg/credentials/iam_aws.go +++ b/pkg/credentials/iam_aws.go @@ -53,7 +53,7 @@ type IAM struct { const ( defaultIAMRoleEndpoint = "http://169.254.169.254" defaultECSRoleEndpoint = "http://169.254.170.2" - defaultIAMSecurityCredsPath = "/latest/meta-data/iam/security-credentials" + defaultIAMSecurityCredsPath = "/latest/meta-data/iam/security-credentials/" ) // https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html diff --git a/pkg/credentials/iam_aws_test.go b/pkg/credentials/iam_aws_test.go index b33f9bd500..90f980693e 100644 --- a/pkg/credentials/iam_aws_test.go +++ b/pkg/credentials/iam_aws_test.go @@ -67,7 +67,7 @@ func initTestServerNoRoles() *httptest.Server { func initTestServer(expireOn string, failAssume bool) *httptest.Server { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.URL.Path == "/latest/meta-data/iam/security-credentials" { + if r.URL.Path == "/latest/meta-data/iam/security-credentials/" { fmt.Fprintln(w, "RoleName") } else if r.URL.Path == "/latest/meta-data/iam/security-credentials/RoleName" { if failAssume {