Skip to content

Commit

Permalink
Minor adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren Voswinkel committed Feb 22, 2021
1 parent 2f6420b commit 41b5b87
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions builtin/logical/aws/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1444,8 +1444,8 @@ func TestBackend_iamTagsCrud(t *testing.T) {
LogicalBackend: getBackend(t),
Steps: []logicaltest.TestStep{
testAccStepConfig(t),
testAccStepWriteIamTags(t, "test", map[string]string{"key1":"value1", "key2":"value2"}),
testAccStepReadIamTags(t, "test", map[string]string{"key1":"value1", "key2":"value2"}),
testAccStepWriteIamTags(t, "test", map[string]string{"key1": "value1", "key2": "value2"}),
testAccStepReadIamTags(t, "test", map[string]string{"key1": "value1", "key2": "value2"}),
testAccStepDeletePolicy(t, "test"),
testAccStepReadIamTags(t, "test", map[string]string{}),
},
Expand Down Expand Up @@ -1473,7 +1473,7 @@ func testAccStepReadIamTags(t *testing.T, name string, tags map[string]string) l
return nil
}

return fmt.Errorf("bad: %#v", resp)
return fmt.Errorf("vault response not received")
}

expected := map[string]interface{}{
Expand Down
1 change: 0 additions & 1 deletion builtin/logical/aws/path_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ func (b *backend) pathRolesWrite(ctx context.Context, req *logical.Request, d *f
}

if iamTags, ok := d.GetOk("iam_tags"); ok {

roleEntry.IAMTags = iamTags.(map[string]string)
}

Expand Down
12 changes: 8 additions & 4 deletions builtin/logical/aws/secret_access_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package aws
import (
"context"
"fmt"
"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/helper/awsutil"
"github.com/hashicorp/vault/sdk/logical"
"math/rand"
"regexp"
"time"

"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/helper/awsutil"
"github.com/hashicorp/vault/sdk/logical"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/sts"
Expand Down Expand Up @@ -290,12 +291,15 @@ func (b *backend) secretAccessKeysCreate(
if len(role.IAMTags) > 0 {
var tags []*iam.Tag
for key, value := range role.IAMTags {
// This assignment needs to be done in order to create unique addresses for
// these variables. Without doing so, all the tags will be copies of the last
// tag listed in the role.
k, v := key, value
tags = append(tags, &iam.Tag{Key: &k, Value: &v})
}

_, err = iamClient.TagUser(&iam.TagUserInput{
Tags: tags,
Tags: tags,
UserName: &username,
})

Expand Down

0 comments on commit 41b5b87

Please sign in to comment.