---

- name: create terraform state db
  postgresql_db: db="{{ terraform_db }}"
  become: true
  become_user: postgres
  become_method: su

- name: create terraform state db user
  postgresql_user:
    name: "{{ terraform_db_user }}"
    db: "{{ terraform_db }}"
    password: "{{ vault_terraform_db_password }}"
    encrypted: true
    priv: "ALL"
  become: true
  become_user: postgres
  become_method: su
