mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
Integrate Encryption into State Backends (#1288)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user