Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update attributes and add integration tests #31

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
python-version: ${{ matrix.python_ver }}

- name: Install Poetry
uses: Gr1N/setup-poetry@v8
uses: Gr1N/setup-poetry@v9

# Install the head of the given branch (devel, stable-2.10)
- name: Install ansible-base (${{ matrix.ansible }})
Expand Down
152 changes: 152 additions & 0 deletions .github/workflows/zpa-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: ZPA Test

on:
pull_request:
types: [opened, synchronize]
merge_group:
types: [checks_requested]
push:
branches:
- master
schedule:
- cron: '0 14 * * 1-5' # UTC
workflow_dispatch:

jobs:
zpa-qa1-tenants:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
environment:
- ZPA_QA_TENANT01
- ZPA_QA_TENANT02
environment: ${{ matrix.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Set up Poetry
uses: Gr1N/setup-poetry@v9

- name: Install Ansible
run: pip install ansible

- name: Install collection from Galaxy
run: ansible-galaxy collection install zscaler.zpacloud

- name: Install dependencies
run: poetry install

- name: Run tests with retry
uses: nick-fields/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: poetry run ansible-playbook tests/integration/run_all_tests.yml
env:
ZPA_CLIENT_ID: ${{ secrets.ZPA_CLIENT_ID }}
ZPA_CLIENT_SECRET: ${{ secrets.ZPA_CLIENT_SECRET }}
ZPA_CUSTOMER_ID: ${{ secrets.ZPA_CUSTOMER_ID }}
ZPA_CLOUD: ${{ secrets.ZPA_CLOUD }}
OKTA_CLIENT_ORGURL: ${{ secrets.OKTA_CLIENT_ORGURL }}
OKTA_CLIENT_TOKEN: ${{ secrets.OKTA_CLIENT_TOKEN }}

zpa-beta-tenants:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
environment:
- ZPA_BETA_TENANT01
environment: ${{ matrix.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Set up Poetry
uses: Gr1N/setup-poetry@v9

- name: Install Ansible
run: pip install ansible

- name: Install collection from Galaxy
run: ansible-galaxy collection install zscaler.zpacloud

- name: Install dependencies
run: poetry install

- name: Run tests with retry
uses: nick-fields/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: poetry run ansible-playbook tests/integration/run_all_tests.yml
env:
ZPA_CLIENT_ID: ${{ secrets.ZPA_CLIENT_ID }}
ZPA_CLIENT_SECRET: ${{ secrets.ZPA_CLIENT_SECRET }}
ZPA_CUSTOMER_ID: ${{ secrets.ZPA_CUSTOMER_ID }}
ZPA_CLOUD: ${{ secrets.ZPA_CLOUD }}
OKTA_CLIENT_ORGURL: ${{ secrets.OKTA_CLIENT_ORGURL }}
OKTA_CLIENT_TOKEN: ${{ secrets.OKTA_CLIENT_TOKEN }}
needs:
- zpa-qa1-tenants

zpa-prod-tenants:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
environment:
- ZPA_PROD_TENANT01
environment: ${{ matrix.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Set up Poetry
uses: Gr1N/setup-poetry@v9

- name: Install Ansible
run: pip install ansible

- name: Install collection from Galaxy
run: ansible-galaxy collection install zscaler.zpacloud

- name: Install dependencies
run: poetry install

- name: Run tests with retry
uses: nick-fields/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: poetry run ansible-playbook tests/integration/run_all_tests.yml
env:
ZPA_CLIENT_ID: ${{ secrets.ZPA_CLIENT_ID }}
ZPA_CLIENT_SECRET: ${{ secrets.ZPA_CLIENT_SECRET }}
ZPA_CUSTOMER_ID: ${{ secrets.ZPA_CUSTOMER_ID }}
ZPA_CLOUD: ${{ secrets.ZPA_CLOUD }}
OKTA_CLIENT_ORGURL: ${{ secrets.OKTA_CLIENT_ORGURL }}
OKTA_CLIENT_TOKEN: ${{ secrets.OKTA_CLIENT_TOKEN }}
needs:
- zpa-qa1-tenants
- zpa-beta-tenants
4 changes: 2 additions & 2 deletions plugins/modules/zpa_app_protection_custom_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
description: "The names of the AppProtection rule"
type: list
elements: str
required: true
required: false
type:
description: The type of the AppProtection rule.
required: false
Expand Down Expand Up @@ -490,7 +490,7 @@ def main():
rhs=dict(type="str", required=False),
),
),
names=dict(type="list", elements="str", required=True),
names=dict(type="list", elements="str", required=False),
type=dict(
type="str",
required=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,16 @@
operator: "{{ operator }}"
conditions:
- operator: "AND"
negated: false
operands:
- object_type: "PLATFORM"
lhs: ios
rhs: "true"
- operator: "AND"
negated: false
operands:
- object_type: "POSTURE"
lhs: "{{ posture_udid }}"
rhs: "false"
- operator: "AND"
negated: false
operands:
- object_type: "TRUSTED_NETWORK"
lhs: "{{ network_id }}"
Expand All @@ -123,19 +120,16 @@
operator: "{{ operator }}"
conditions:
- operator: "AND"
negated: false
operands:
- object_type: "PLATFORM"
lhs: ios
rhs: "true"
- operator: "AND"
negated: false
operands:
- object_type: "POSTURE"
lhs: "{{ posture_udid }}"
rhs: "false"
- operator: "AND"
negated: false
operands:
- object_type: "TRUSTED_NETWORK"
lhs: "{{ network_id }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,16 @@
operator: "{{ operator }}"
conditions:
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "PLATFORM"
lhs: ios
rhs: "true"
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "POSTURE"
lhs: "{{ posture_udid }}"
rhs: "false"
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "TRUSTED_NETWORK"
lhs: "{{ network_id }}"
Expand All @@ -118,19 +115,16 @@
operator: "{{ operator }}"
conditions:
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "PLATFORM"
lhs: ios
rhs: "true"
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "POSTURE"
lhs: "{{ posture_udid }}"
rhs: "false"
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "TRUSTED_NETWORK"
lhs: "{{ network_id }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,11 @@
operator: "{{ operator }}"
conditions:
- operator: "OR"
negated: false
operands:
- object_type: "CLIENT_TYPE"
lhs: "id"
rhs: "zpn_client_type_exporter"
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "PLATFORM"
lhs: ios
Expand All @@ -111,13 +109,11 @@
operator: "{{ operator }}"
conditions:
- operator: "OR"
negated: false
operands:
- object_type: "CLIENT_TYPE"
lhs: "id"
rhs: "zpn_client_type_exporter"
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "PLATFORM"
lhs: ios
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,21 @@
- "{{ server_group_id }}"
conditions:
- operator: "AND"
negated: false
operands:
- object_type: "COUNTRY_CODE"
lhs: CA
rhs: "true"
- operator: "AND"
negated: false
operands:
- object_type: "PLATFORM"
lhs: ios
rhs: "true"
- operator: "AND"
negated: false
operands:
- object_type: "POSTURE"
lhs: "{{ posture_udid }}"
rhs: "false"
- operator: "AND"
negated: false
operands:
- object_type: "TRUSTED_NETWORK"
lhs: "{{ network_id }}"
Expand Down Expand Up @@ -146,25 +142,21 @@
- "{{ server_group_id }}"
conditions:
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "COUNTRY_CODE"
lhs: CA
rhs: "true"
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "PLATFORM"
lhs: ios
rhs: "true"
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "POSTURE"
lhs: "{{ posture_udid }}"
rhs: "false"
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "TRUSTED_NETWORK"
lhs: "{{ network_id }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,11 @@
operator: "{{ operator }}"
conditions:
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "PLATFORM"
lhs: ios
rhs: "true"
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "POSTURE"
lhs: "{{ posture_udid }}"
Expand All @@ -111,13 +109,11 @@
operator: "{{ operator }}"
conditions:
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "PLATFORM"
lhs: ios
rhs: "true"
- operator: "{{ operator }}"
negated: false
operands:
- object_type: "POSTURE"
lhs: "{{ posture_udid }}"
Expand Down