Integrate Encryption into State Backends (#1288)

Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
Christian Mesh
2024-03-04 09:25:14 -05:00
committed by GitHub
parent ac3ed86617
commit 2f5dcd5c0a
95 changed files with 530 additions and 362 deletions

View File

@@ -16,6 +16,7 @@ import (
"time"
"github.com/opentofu/opentofu/internal/backend"
"github.com/opentofu/opentofu/internal/encryption"
"github.com/opentofu/opentofu/internal/legacy/helper/schema"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common"
"github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile"
@@ -38,6 +39,7 @@ const (
// Backend implements "backend".Backend for tencentCloud cos
type Backend struct {
*schema.Backend
encryption encryption.StateEncryption
credential *common.Credential
cosContext context.Context
@@ -54,7 +56,7 @@ type Backend struct {
}
// New creates a new backend for TencentCloud cos remote state.
func New() backend.Backend {
func New(enc encryption.StateEncryption) backend.Backend {
s := &schema.Backend{
Schema: map[string]*schema.Schema{
"secret_id": {
@@ -182,7 +184,7 @@ func New() backend.Backend {
},
}
result := &Backend{Backend: s}
result := &Backend{Backend: s, encryption: enc}
result.Backend.ConfigureFunc = result.configure
return result