terraform_encryption_migration

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptedContentService

type EncryptedContentService interface {
	Encrypt(passphrase *passphrase.Passphrase, content *content.Content) (*content.EncryptedContent, error)
	Decrypt(passphrase *passphrase.Passphrase, encryptedContent *content.EncryptedContent) (*content.Content, error)
	Serialize(encryptedContent *content.EncryptedContent) ([]byte, error)
	Deserialize(encoded []byte) (*content.EncryptedContent, error)
}

type EncryptedPassphraseService

type EncryptedPassphraseService interface {
	Serialize(encryptedPassphrase *passphrase.EncryptedPassphrase) ([]byte, error)
	Encrypt(
		publicKey *stdRsa.PublicKey,
		passphrase *passphrase.Passphrase,
	) (*passphrase.EncryptedPassphrase, error)
	Deserialize(encoded []byte) (*passphrase.EncryptedPassphrase, error)
	Decrypt(
		privateKey *stdRsa.PrivateKey,
		encryptedPassphrase *passphrase.EncryptedPassphrase,
	) (*passphrase.Passphrase, error)
	GeneratePassphrase(length int) (*passphrase.Passphrase, error)
}

type EncryptedPayloadService

type EncryptedPayloadService interface {
	Encrypt(publicKey *stdRsa.PublicKey, payload *payload.Payload) (*payload.EncryptedPayload, error)
	Decrypt(privateKey *stdRsa.PrivateKey, encryptedPayload *payload.EncryptedPayload) (*payload.Payload, error)
	Serialize(encryptedPayload *payload.EncryptedPayload) ([]byte, error)
	Deserialize(encodedContent []byte) (*payload.EncryptedPayload, error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewTerraformEncryptionMigrationService

func NewTerraformEncryptionMigrationService(terraformSvc terraformService) *Service

func (*Service) ConvertIniContentToLegacyTerraformContent

func (s *Service) ConvertIniContentToLegacyTerraformContent(
	passphraseLength int,
	iniContent *ini.Content,
	pubKey *stdRsa.PublicKey,
	encryptedPassphraseSvc EncryptedPassphraseService,
	encryptedContentSvc EncryptedContentService,
) (*terraform.Content, error)

func (*Service) ConvertIniContentToV1TerraformContent

func (s *Service) ConvertIniContentToV1TerraformContent(
	passphraseLength int,
	iniContent *ini.Content,
	pubKey *stdRsa.PublicKey,
	encryptedPassphraseSvc EncryptedPassphraseService,
	encryptedPayloadSvc EncryptedPayloadService,
) (*terraform.Content, error)

func (*Service) MigrateEncryptedTerraformResourceHcl

func (s *Service) MigrateEncryptedTerraformResourceHcl(
	hclParser hcl.Parser,
	hclBytes []byte,
	privKey *stdRsa.PrivateKey,
	pubKey *stdRsa.PublicKey,
	legacyEncryptedContentSvc EncryptedContentService,
	encryptedPassphraseSvc EncryptedPassphraseService,
	encryptedPayloadSvc EncryptedPayloadService,
) (*ast.File, error)

MigrateEncryptedTerraformResourceHcl parses and migrates a HCL terraform file with `vault_encrypted_secret` terraform resources encrypted that were using `legacy encrypt` cmd. It decrypts, encrypts and replaces existing terraform `vaulted`. It does not lose/modify resources that are not `vault_encrypted_secret`.

func (*Service) RotateOrRekeyEncryptedTerraformResourceHcl

func (s *Service) RotateOrRekeyEncryptedTerraformResourceHcl(
	hclParser hcl.Parser,
	hclBytes []byte,
	privKey *stdRsa.PrivateKey,
	pubKey *stdRsa.PublicKey,
	encryptedPassphraseSvc EncryptedPassphraseService,
	encryptedPayloadSvc EncryptedPayloadService,
) (*ast.File, error)

RotateOrRekeyEncryptedTerraformResourceHcl parses and rotates a HCL terraform file with `vault_encrypted_secret` terraform resources encrypted that were using `encrypt` cmd. It decrypts, encrypts and replaces existing terraform `vaulted`. It does not lose/modify resources that are not `vault_encrypted_secret`.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL