Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add role_arn to S3StorageConfig #33

Merged
merged 1 commit into from
Sep 3, 2021
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
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