Repository: opentofu/opentofu
File: internal/backend/remote-state/s3/backend.go (Go)

Code before:
	"github.com/opentofu/opentofu/internal/encryption"
	"github.com/opentofu/opentofu/internal/httpclient"
	"github.com/opentofu/opentofu/internal/logging"
	"github.com/opentofu/opentofu/internal/tfdiags"
	"github.com/opentofu/opentofu/version"
	"github.com/zclconf/go-cty/cty"
	"github.com/zclconf/go-cty/cty/gocty"
)

func New(enc encryption.StateEncryption) backend.Backend {
	return &Backend{encryption: enc}
}

type Backend struct {
	encryption encryption.StateEncryption
	s3Client   *s3.Client
	dynClient  *dynamodb.Client
	awsConfig  aws.Config

	bucketName            string
	keyName               string
	serverSideEncryption  bool
	customerEncryptionKey []byte
	acl                   string
	lockfile_tags         map[string]string
	statefile_tags        map[string]string
	kmsKeyID              string
	ddbTable              string
	workspaceKeyPrefix    string
	skipS3Checksum        bool
	useLockfile           bool
}

// ConfigSchema returns a description of the expected configuration
// structure for the receiving backend.
// This structure is mirrored by the encryption aws_kms key provider and should be kept in sync.
func (b *Backend) ConfigSchema() *configschema.Block {
	return &configschema.Block{
		Attributes: map[string]*configschema.Attribute{
			"bucket": {
				Type:        cty.String,
				Required:    true,
				Description: "The name of the S3 bucket",
			},
			"key": {
				Type:        cty.String,
				Required:    true,
				Description: "The path to the state file inside the bucket",
			},
			"region": {
				Type:        cty.String,

Review comment (suggestion):
```suggestion
	lockfileTags         map[string]string
	statefileTags        map[string]string
```
https://go.dev/doc/effective_go#mixed-caps

Code after:
	"github.com/opentofu/opentofu/internal/encryption"
	"github.com/opentofu/opentofu/internal/httpclient"
	"github.com/opentofu/opentofu/internal/logging"
	"github.com/opentofu/opentofu/internal/tfdiags"
	"github.com/opentofu/opentofu/version"
	"github.com/zclconf/go-cty/cty"
	"github.com/zclconf/go-cty/cty/gocty"
)

func New(enc encryption.StateEncryption) backend.Backend {
	return &Backend{encryption: enc}
}

type Backend struct {
	encryption encryption.StateEncryption
	s3Client   *s3.Client
	dynClient  *dynamodb.Client
	awsConfig  aws.Config

	bucketName            string
	keyName               string
	serverSideEncryption  bool
	customerEncryptionKey []byte
	acl                   string
	lockTags              map[string]string
	stateTags             map[string]string
	kmsKeyID              string
	ddbTable              string
	workspaceKeyPrefix    string
	skipS3Checksum        bool
	useLockfile           bool
}

// ConfigSchema returns a description of the expected configuration
// structure for the receiving backend.
// This structure is mirrored by the encryption aws_kms key provider and should be kept in sync.
func (b *Backend) ConfigSchema() *configschema.Block {
	return &configschema.Block{
		Attributes: map[string]*configschema.Attribute{
			"bucket": {
				Type:        cty.String,
				Required:    true,
				Description: "The name of the S3 bucket",
			},
			"key": {
				Type:        cty.String,
				Required:    true,
				Description: "The path to the state file inside the bucket",
			},
			"region": {
				Type:        cty.String,