Fix GCE deployment error with Ansible 12 JSON parsing (#14860)

In Ansible 12, jinja2_native mode is always enabled, which changes how
JSON strings are handled. The file lookup returns JSON content as a
string, but it's no longer automatically converted to a dict.

This caused GCE deployments to fail with "Invalid resource field value"
because project_id was empty - accessing .project_id on a string returns
undefined, which then defaulted to an empty env var.

Add the `| from_json` filter to explicitly parse the JSON credentials
file into a dict, as recommended by the Ansible 12 porting guide.

Fixes #14854

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Dan Guido
2025-11-25 13:26:01 -05:00
committed by GitHub
co-authored by Claude
parent b2242ec849
commit 2e8540b378
+1 -1
View File
@@ -17,7 +17,7 @@
no_log: true
- set_fact:
credentials_file_lookup: "{{ lookup('file', credentials_file_path) }}"
credentials_file_lookup: "{{ lookup('file', credentials_file_path) | from_json }}"
no_log: true
- set_fact: