Handle the base64 encoding or decoding of a terraform plan file
Version added: 2.1.0
- This module performs base64-encoding of a terraform plan file and saves it into playbook execution stats similar to :ref:`ansible.builtin.set_stats <ansible.builtin.set_stats_module>` module.
- The module also performs base64-decoding of a terraform plan file from a variable defined into ansible facts and writes them into a file specified by the user.
Note
- For security reasons, this module should be used with no_log=true and register functionalities as the plan file can contain unencrypted secrets.
# Encode terraform plan file into default variable 'terraform_plan'
- name: Encode a terraform plan file into terraform_plan variable
cloud.terraform.plan_stash:
path: /path/to/terraform_plan_file
state: stash
no_log: true
# Encode terraform plan file into variable 'stashed_plan'
- name: Encode a terraform plan file into terraform_plan variable
cloud.terraform.plan_stash:
path: /path/to/terraform_plan_file
var_name: stashed_plan
state: stash
no_log: true
# Load terraform plan file from variable 'stashed_plan'
- name: Load a terraform plan file data from variable 'stashed_plan' into file 'tfplan'
cloud.terraform.plan_stash:
path: tfplan
var_name: stashed_plan
state: load
no_log: true
# Load terraform plan file from binary data
- name: Load a terraform plan file data from binary data
cloud.terraform.plan_stash:
path: tfplan
binary_data: "{{ terraform_binary_data }}"
state: load
no_log: true
- Aubin Bikouo (@abikouo)