Merge pull request #20497 from hashicorp/f-s3-backend-logging-and-user-agent

backend/s3: Add debug logging and user agent
This commit is contained in:
Brian Flad 2019-02-27 14:29:54 -05:00 committed by GitHub
commit 364c3e70b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -10,7 +10,9 @@ import (
"github.com/aws/aws-sdk-go/service/s3"
awsbase "github.com/hashicorp/aws-sdk-go-base"
"github.com/hashicorp/terraform/backend"
"github.com/hashicorp/terraform/helper/logging"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/version"
)
// New creates a new backend for S3 remote state.
@ -296,6 +298,7 @@ func (b *Backend) configure(ctx context.Context) error {
AssumeRolePolicy: data.Get("assume_role_policy").(string),
AssumeRoleSessionName: data.Get("session_name").(string),
CredsFilename: data.Get("shared_credentials_file").(string),
DebugLogging: logging.IsDebugOrHigher(),
IamEndpoint: data.Get("iam_endpoint").(string),
MaxRetries: data.Get("max_retries").(int),
Profile: data.Get("profile").(string),
@ -305,6 +308,11 @@ func (b *Backend) configure(ctx context.Context) error {
SkipMetadataApiCheck: data.Get("skip_metadata_api_check").(bool),
StsEndpoint: data.Get("sts_endpoint").(string),
Token: data.Get("token").(string),
UserAgentProducts: []*awsbase.UserAgentProduct{
{Name: "APN", Version: "1.0"},
{Name: "HashiCorp", Version: "1.0"},
{Name: "Terraform", Version: version.String()},
},
}
sess, err := awsbase.GetSession(cfg)