Skip to content

Commit

Permalink
✨ Add vault_gkms_copy_sa var, auto-unseal uses default instance SA …
Browse files Browse the repository at this point in the history
…credentials (#298)
  • Loading branch information
fairglen authored Dec 7, 2022
1 parent 2d37c10 commit 623d40a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,11 @@ This Auto-unseal mechanism is Open Source in Vault 1.0 but would require Enterpr
- GCP Project where the key reside.
- Default value: ''
### `vault_gkms_copy_sa`
- Copy GCP SA credentials file from Ansible control node to Vault server. When not `true` and no value is specified for `vault_gkms_credentials_src_file`, the default instance service account credentials are used.
- Default value: `"true"`
### `vault_gkms_credentials_src_file`
- User-specified source directory for GCP Credential on Ansible control node.
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ vault_gkms_credentials: '/home/vault/vault-kms.json'
vault_gkms_region: 'global'
vault_gkms_key_ring: 'vault'
vault_gkms_crypto_key: 'vault_key'
vault_gkms_copy_sa: true

# pkcs11 seal
vault_enterprise_premium_hsm: false
Expand Down
3 changes: 2 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@
mode: "0600"
when:
- vault_gkms | bool
- vault_gkms_credentials_content | length > 0
- vault_gkms_credentials_content | length > 0 or
vault_gkms_copy_sa | bool

- name: "Copy GCP Credentials for gcs backend"
copy:
Expand Down
2 changes: 2 additions & 0 deletions templates/vault_seal_gcpkms.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
seal "gcpckms" {
{% if vault_gkms_copy_sa and vault_gkms_credentials_src_file is defined and vault_gkms_credentials|length -%}
credentials = "{{ vault_gkms_credentials }}"
{% endif -%}
project = "{{ vault_gkms_project }}"
region = "{{ vault_gkms_region }}"
key_ring = "{{ vault_gkms_key_ring }}"
Expand Down

0 comments on commit 623d40a

Please sign in to comment.