Skip to content

Commit

Permalink
Add role_arn to S3StorageConfig
Browse files Browse the repository at this point in the history
Fixes #32
  • Loading branch information
minamijoyo committed Jul 20, 2021
1 parent 61dc64f commit 5f0a58c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ The `s3` storage has the following attributes:
- `access_key` (optional): AWS access key. This can also be sourced from the `AWS_ACCESS_KEY_ID` environment variable, AWS shared credentials file, or AWS shared configuration file.
- `secret_key` (optional): AWS secret key. This can also be sourced from the `AWS_SECRET_ACCESS_KEY` environment variable, AWS shared credentials file, or AWS shared configuration file.
- `profile` (optional): Name of AWS profile in AWS shared credentials file or AWS shared configuration file to use for credentials and/or configuration. This can also be sourced from the `AWS_PROFILE` environment variable.
- `role_arn` (optional): Amazon Resource Name (ARN) of the IAM Role to assume.

The following attributes are also available, but they are intended to use with `localstack` for testing.

Expand Down
3 changes: 3 additions & 0 deletions history/storage_s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ type S3StorageConfig struct {
SecretKey string `hcl:"secret_key,optional"`
// Name of AWS profile in AWS shared credentials file.
Profile string `hcl:"profile,optional"`
// Amazon Resource Name (ARN) of the IAM Role to assume.
RoleARN string `hcl:"role_arn,optional"`
// Skip credentials validation via the STS API.
SkipCredentialsValidation bool `hcl:"skip_credentials_validation,optional"`
// Skip usage of EC2 Metadata API.
Expand Down Expand Up @@ -109,6 +111,7 @@ func NewS3Storage(config *S3StorageConfig, client S3Client) (*S3Storage, error)
func newS3Client(config *S3StorageConfig) (S3Client, error) {
cfg := &awsbase.Config{
AccessKey: config.AccessKey,
AssumeRoleARN: config.RoleARN,
Profile: config.Profile,
Region: config.Region,
SecretKey: config.SecretKey,
Expand Down

0 comments on commit 5f0a58c

Please sign in to comment.