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:
commit
364c3e70b7
|
@ -10,7 +10,9 @@ import (
|
||||||
"github.com/aws/aws-sdk-go/service/s3"
|
"github.com/aws/aws-sdk-go/service/s3"
|
||||||
awsbase "github.com/hashicorp/aws-sdk-go-base"
|
awsbase "github.com/hashicorp/aws-sdk-go-base"
|
||||||
"github.com/hashicorp/terraform/backend"
|
"github.com/hashicorp/terraform/backend"
|
||||||
|
"github.com/hashicorp/terraform/helper/logging"
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
|
"github.com/hashicorp/terraform/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
// New creates a new backend for S3 remote state.
|
// 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),
|
AssumeRolePolicy: data.Get("assume_role_policy").(string),
|
||||||
AssumeRoleSessionName: data.Get("session_name").(string),
|
AssumeRoleSessionName: data.Get("session_name").(string),
|
||||||
CredsFilename: data.Get("shared_credentials_file").(string),
|
CredsFilename: data.Get("shared_credentials_file").(string),
|
||||||
|
DebugLogging: logging.IsDebugOrHigher(),
|
||||||
IamEndpoint: data.Get("iam_endpoint").(string),
|
IamEndpoint: data.Get("iam_endpoint").(string),
|
||||||
MaxRetries: data.Get("max_retries").(int),
|
MaxRetries: data.Get("max_retries").(int),
|
||||||
Profile: data.Get("profile").(string),
|
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),
|
SkipMetadataApiCheck: data.Get("skip_metadata_api_check").(bool),
|
||||||
StsEndpoint: data.Get("sts_endpoint").(string),
|
StsEndpoint: data.Get("sts_endpoint").(string),
|
||||||
Token: data.Get("token").(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)
|
sess, err := awsbase.GetSession(cfg)
|
||||||
|
|
Loading…
Reference in New Issue