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

New modules for webapp network access restrictions #594

Merged
merged 18 commits into from
Aug 12, 2021

Conversation

l3ender
Copy link
Contributor

@l3ender l3ender commented Aug 4, 2021

SUMMARY

This PR includes new modules to accomplish ability to configure a webapp's network access restrictions.

Resolves #379.

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

azure_rm_webappaccessrestriction
azure_rm_webappaccessrestriction_info

ADDITIONAL INFORMATION
- name: "Configure webapp network access restrictions"
  azure_rm_webappaccessrestriction:
    name: webapp{{ rpfx }}
    resource_group: "{{ resource_group }}"
    ip_security_restrictions:
      - name: "Datacenter 1"
        action: "Allow"
        ip_address: "1.2.3.4/24"
        priority: 1
      - name: "Datacenter 2"
        action: "Allow"
        ip_address: "5.6.7.8/24"
        priority: 2
    scm_ip_security_restrictions:
      - name: "Datacenter 1"
        action: "Allow"
        ip_address: "1.2.3.4/24"
        priority: 1
    scm_ip_security_restrictions_use_main: false
  register: output

- name: "Delete webapp network access restrictions"
  azure_rm_webappaccessrestriction:
    name: webapp{{ rpfx }}
    resource_group: "{{ resource_group }}"
    state: absent
  register: output

Output looks like:

ok: [localhost] => {
    "msg": {
        "changed": true,
        "failed": false,
        "ip_security_restrictions": [
            {
                "action": "Allow",
                "description": null,
                "ip_address": "1.2.3.4/24",
                "name": "Datacenter 1",
                "priority": 1
            },
            {
                "action": "Allow",
                "description": null,
                "ip_address": "5.6.7.8/24",
                "name": "Datacenter 2",
                "priority": 2
            }
        ],
        "scm_ip_security_restrictions": [
            {
                "action": "Allow",
                "description": null,
                "ip_address": "1.2.3.4/24",
                "name": "Datacenter 1",
                "priority": 1
            }
        ],
        "scm_ip_security_restrictions_use_main": false
    }
}

ok: [localhost] => {
    "msg": {
        "changed": true,
        "failed": false,
        "ip_security_restrictions": [],
        "scm_ip_security_restrictions": [],
        "scm_ip_security_restrictions_use_main": false
    }
}

@l3ender
Copy link
Contributor Author

l3ender commented Aug 4, 2021

Hi @Fred-sun, here is another PR with new modules. Please review and advise. Thank you!

@Fred-sun
Copy link
Collaborator

Fred-sun commented Aug 5, 2021

@l3ender Please add module name "azure_rm_webapp_accessrestriction" to pr-pipeline.yml. Another, change name to "azure_rm_webappaccessrestriction" , keep same with other modules! Thank you very much!

@Fred-sun Fred-sun added medium_priority Medium priority new_module_pr Add new modules work in In trying to solve, or in working with contributors labels Aug 5, 2021
plugins/modules/azure_rm_webapp_accessrestriction.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_webapp_accessrestriction.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_webapp_accessrestriction.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_webapp_accessrestriction.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_webapp_accessrestriction.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_webapp_accessrestriction.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_webapp_accessrestriction.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_webapp_accessrestriction.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_webapp_accessrestriction.py Outdated Show resolved Hide resolved
plugins/modules/azure_rm_webapp_accessrestriction_info.py Outdated Show resolved Hide resolved
@Fred-sun
Copy link
Collaborator

Fred-sun commented Aug 5, 2021

@l3ender Please add use cases related to the azure_rm_webapp_accessrestriction_info.py module in tests/integration/targets/azure_rm_webapp_accessrestriction/tasks/main.yml, thank you!

@Fred-sun
Copy link
Collaborator

Fred-sun commented Aug 5, 2021

@l3ender You are advised to change the module name to --azure_rm_webappaccessrestriction. to ensure that the module name is consistent with other modules. Thank you very much!

@l3ender l3ender requested a review from Fred-sun August 6, 2021 01:32
@l3ender
Copy link
Contributor Author

l3ender commented Aug 6, 2021

@Fred-sun PR is updated, please check again. Thank you!

@Fred-sun Fred-sun added ready_for_review The PR has been modified and can be reviewed and merged and removed work in In trying to solve, or in working with contributors labels Aug 6, 2021
Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@l3ender ansible core new request! Thank you very much!

@xuzhang3
Copy link
Collaborator

LGTM

@xuzhang3 xuzhang3 merged commit 2a8915e into ansible-collections:dev Aug 12, 2021
@xuzhang3 xuzhang3 deleted the webapp-access-restriction branch August 12, 2021 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium_priority Medium priority new_module_pr Add new modules ready_for_review The PR has been modified and can be reviewed and merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure web app networking (access restrictions)
3 participants