From e34a97abca04eb077abe24762880e5fe509b51d3 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 27 Feb 2019 12:59:08 -0500 Subject: [PATCH] backend/s3: Add debug logging and user agent Porting over previous behavior from terraform-provider-aws. --- backend/remote-state/s3/backend.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/backend/remote-state/s3/backend.go b/backend/remote-state/s3/backend.go index 6675064ca..303a25cc5 100644 --- a/backend/remote-state/s3/backend.go +++ b/backend/remote-state/s3/backend.go @@ -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)