On Mon, 13 Feb 2023 at 15:55, Tony Wong <[email protected]> wrote:

>     "msg": "Failed to decode the policy as valid JSON: Expecting value: line 
> 1 column 1 (char 0)"

So, you will need to use proper JSON.
Give this a try:

---
- name: test
  hosts: localhost
  tasks:
  - name: Create IAM Managed Policy
    amazon.aws.iam_policy:
      iam_type: role
      iam_name: "aws_test_role"
      policy_name: "PrismaCloud-IAM-ReadOnly-Policy"
      policy_json: "{{ policy | to_json }}"
      state: present
    vars:
      actions:
        - acm-pca:ListTags
        - acm-pca:GetPolicy
        - acm-pca:GetPolicy
      policy: |
        Version: "2012-10-17"
        Statement:
        {% for action in actions %}
          - Action: {{ action }}
            Effect: Allow
            Resource: "*"
        {% endfor %}

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLZKn4GQEjnRUGTTsZ358_mJ6a1cpqyRPtbXvMzoUNtvJQ%40mail.gmail.com.

Reply via email to