Difference between revisions of "Sops --encrypt --gcp-kms"

From wikieduonline
Jump to navigation Jump to search
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{lc}}
 
{{lc}}
[[sops --encrypt]] [[--gcp-kms]]
+
<code>[[sops --encrypt]] [[--gcp-kms]]</code>
  
You can define your key using <code>--gcp-kms</code> option or by defining a <code>[[SOPS_GCP_KMS]]</code> [[environment variable]]
+
You can define your key using <code>--gcp-kms</code> option or by defining a <code>[[SOPS_GCP_KMS_IDS]]</code> [[environment variable]]
 +
 
 +
Exporting your key:
 +
* <code>export [[SOPS_GCP_KMS]]="projects/your-project/locations/global/keyRings/your-keyring/cryptoKeys/your-sops-encryption-key"</code>
  
 
== Examples ==
 
== Examples ==
 
  [[sops --encrypt --gcp-kms]] $[[KMS_PATH]] secret.yaml > secret.enc.yaml
 
  [[sops --encrypt --gcp-kms]] $[[KMS_PATH]] secret.yaml > secret.enc.yaml
[[sops --encrypt --gcp-kms]] $[[KMS_PATH]] --in-place secret.yam
 
  
 +
[[sops --encrypt --gcp-kms]] $[[KMS_PATH]] --in-place your-secret.yaml
 +
(no output)
  
  sops --encrypt --gcp-kms only-one-file
+
  sops --encrypt --in-place [[--unencrypted-regex]] '^(description|metadata)$' k8s-secret.yaml
  [[Error: no file specified]]
+
  (no output)
  
 +
sops --encrypt --in-place [[--encrypted-regex]] '^(data|stringData)$' app-secret.yaml
 +
(no output)
  
Exporting your key:
+
[[sops --encrypt --in-place]] --encrypted-regex '^(secrets)$' your-secrets_dev.yaml
* <code>export [[SOPS_GCP_KMS]]="projects/your-project/locations/global/keyRings/your-keyring/cryptoKeys/your-sops-encryption-key"</code>
+
(no output)
  
 +
== Errors ==
 +
sops --encrypt --gcp-kms only-one-file
 +
[[Error: no file specified]]
  
 +
[[Failed to get the data key required to decrypt the SOPS file.]]
  
 
== Related ==
 
== Related ==

Latest revision as of 09:12, 24 November 2022

sops --encrypt --gcp-kms

You can define your key using --gcp-kms option or by defining a SOPS_GCP_KMS_IDS environment variable

Exporting your key:

  • export SOPS_GCP_KMS="projects/your-project/locations/global/keyRings/your-keyring/cryptoKeys/your-sops-encryption-key"

Examples[edit]

sops --encrypt --gcp-kms $KMS_PATH secret.yaml > secret.enc.yaml
sops --encrypt --gcp-kms $KMS_PATH --in-place your-secret.yaml
(no output)
sops --encrypt --in-place --unencrypted-regex '^(description|metadata)$' k8s-secret.yaml
(no output)
sops --encrypt --in-place --encrypted-regex '^(data|stringData)$' app-secret.yaml
(no output)
sops --encrypt --in-place --encrypted-regex '^(secrets)$' your-secrets_dev.yaml
(no output)

Errors[edit]

sops --encrypt --gcp-kms only-one-file
Error: no file specified
Failed to get the data key required to decrypt the SOPS file.

Related[edit]

See also[edit]

Advertising: