Skip to content

Commit

Permalink
Outputs now written to file
Browse files Browse the repository at this point in the history
  • Loading branch information
xanmanning committed Feb 7, 2021
1 parent 36c1587 commit 2a3c2f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ my spare time so I cannot promise a speedy fix delivery.
| Variable | Description | Default Value |
|---------------------------|--------------------------------------------------------------------------------|---------------|
| `terraform_min_version` | Specify a minimum version of Terraform, eg. `0.11.0`. Specify `false` to skip. | `false` |
| `terraform_min_version` | Specify a maximum version of Terraform, eg. `0.12.0`. Specify `false` to skip. | `false` |
| `terraform_max_version` | Specify a maximum version of Terraform, eg. `0.12.0`. Specify `false` to skip. | `false` |
| `terraform_binary_path` | Path to Terraform binary. Specify `false` to use Terraform in `${PATH}`. | `false` |
| `terraform_exec_projects` | List of Terraform projects to plan/apply. See example below. | [] |
| `terraform_destroy_all` | Destroy all projects listed in `terraform_exec_projects` - Use with caution! | `false` |
Expand Down
8 changes: 8 additions & 0 deletions tasks/terraform-apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
variables: "{{ proj.variables | default(omit) }}"
register: terraform_exec_result

- name: Ensure outputs are written to JSON file
copy:
dest: "{{ proj.output_file | default(proj.project_path + '/outputs.json') }}"
content: |
{{ (terraform_exec_result.outputs | default({})) | to_nice_json(indent=2) }}
mode: 0600
when: terraform_exec_result.outputs is defined

- name: Ensure Terraform plan file is removed after run
file:
path: "{{ proj.plan_file | default('project.tfplan') }}"
Expand Down

0 comments on commit 2a3c2f8

Please sign in to comment.