Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file.

## 0.38.5
- Fix externalID handling by @njvrzm in [#246](https://github.com/grafana/grafana-aws-sdk/pull/246)
- Add CloudWatch AWS/EKS metrics and dimensions by @jangaraj in [#242](https://github.com/grafana/grafana-aws-sdk/pull/242)
- Bump github.com/grafana/grafana-plugin-sdk-go by @dependabot in [#241](https://github.com/grafana/grafana-aws-sdk/pull/241)

## 0.38.4
- Add AvailableMemory metric for the DMS service by @andriikushch in [#244](https://github.com/grafana/grafana-aws-sdk/pull/244)
- Github actions: Add token write permission by @idastambuk in [#243](https://github.com/grafana/grafana-aws-sdk/pull/243)
Expand Down
5 changes: 0 additions & 5 deletions pkg/awsauth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ func (rcp *awsConfigProvider) GetConfig(ctx context.Context, authSettings Settin
}
}

_, err = cfg.Credentials.Retrieve(ctx)
if err != nil {
return aws.Config{}, fmt.Errorf("error retrieving credentials: %w", err)
}

rcp.cache[key] = cfg
return cfg, nil
}
Expand Down
19 changes: 11 additions & 8 deletions pkg/awsauth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ func (tc testCase) Run(t *testing.T) {
require.Error(t, err)
} else {
require.NoError(t, err)
tc.assertConfig(t, cfg)
creds, _ := cfg.Credentials.Retrieve(ctx)
if tc.authSettings.GetAuthType() == AuthTypeKeys && tc.authSettings.SessionToken != "" {
assert.Equal(t, tc.authSettings.SessionToken, creds.SessionToken)
creds, err := cfg.Credentials.Retrieve(ctx)
if tc.assumeRoleShouldFail {
require.Error(t, err)
} else {
tc.assertConfig(t, cfg)
if tc.authSettings.GetAuthType() == AuthTypeKeys && tc.authSettings.SessionToken != "" {
assert.Equal(t, tc.authSettings.SessionToken, creds.SessionToken)
}
accessKey, secret := tc.getExpectedKeyAndSecret(t)
assert.Equal(t, accessKey, creds.AccessKeyID)
assert.Equal(t, secret, creds.SecretAccessKey)
}
accessKey, secret := tc.getExpectedKeyAndSecret(t)
assert.Equal(t, accessKey, creds.AccessKeyID)
assert.Equal(t, secret, creds.SecretAccessKey)
}
if isStsEndpoint(&tc.authSettings.Endpoint) {
assert.Equal(t, tc.authSettings.Endpoint, *client.assumeRoleClient.stsConfig.BaseEndpoint)
Expand Down Expand Up @@ -208,7 +212,6 @@ func TestGetAWSConfig_Keys_AssumeRule(t *testing.T) {
AssumeRoleARN: "arn:aws:iam::1234567890:role/aws-service-role",
},
assumeRoleShouldFail: true,
shouldError: true,
},
}.runAll(t)
}
Expand Down