Skip to content

Commit

Permalink
Fix bug when injecting override database_secret during backup
Browse files Browse the repository at this point in the history
  • Loading branch information
rooftopcellist committed Apr 9, 2024
1 parent 405d935 commit 5511f93
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions roles/restore/tasks/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@
set_fact:
_generated_pg_secret_name: "{{ deployment_name }}-postgres-configuration"

- name: Override postgres_configuration_secret
- name: Set tmp database dict
set_fact:
_tmp_database: "{{ spec['database'] | combine({'database_secret': _generated_pg_secret_name}, recursive=True) }}"
no_log: "{{ no_log }}"

- name: Override database_secret
set_fact:
spec:
"{{ spec | combine({'postgres_configuration_secret': _generated_pg_secret_name}, recursive=True) }}"
when: secrets['postgresConfigurationSecret']['data']['type'] | b64decode == 'managed'
"{{ spec | combine({'database': _tmp_database}, recursive=True) }}"
when: secrets['databaseConfigurationSecret']['data']['type'] | b64decode == 'managed'

- name: If deployment is managed, set the database_host in the pg config secret
block:
Expand Down

0 comments on commit 5511f93

Please sign in to comment.