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

Cannot update Public IP with SKU different than basic #738

Closed
verhyppo opened this issue Jan 25, 2022 · 1 comment · Fixed by #752
Closed

Cannot update Public IP with SKU different than basic #738

verhyppo opened this issue Jan 25, 2022 · 1 comment · Fixed by #752

Comments

@verhyppo
Copy link
Contributor

verhyppo commented Jan 25, 2022

SUMMARY

What I'm trying to do:

  1. Create AKS cluster with network_profile.load_balancer_sku = standard
  2. install ingress nginx via helm on that AKS to automatically provision a load balancer
  3. set back the domain_name for the IP address just generated.
    It seems to me that the sku parameter as declared here is not actually propagated to the Azure api
ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible [core 2.12.1]
  config file = /Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg
  configured module search path = ['/Users/veronica/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/veronica/.local/share/virtualenvs/ansible-infrastructure-NHxU_Lfa/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/veronica/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/veronica/.local/share/virtualenvs/ansible-infrastructure-NHxU_Lfa/bin/ansible
  python version = 3.9.9 (main, Nov 21 2021, 03:23:44) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
# /Users/veronica/.ansible/collections/ansible_collections
Collection         Version
------------------ -------
azure.azcollection 1.11.0 

# /Users/veronica/.local/share/virtualenvs/ansible-infrastructure-NHxU_Lfa/lib/python3.9/site-packages/ansible_collections
Collection         Version
------------------ -------
azure.azcollection 1.10.0 
CONFIGURATION
ANSIBLE_FORCE_COLOR(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = True
CACHE_PLUGIN(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = /tmp/facts_cache
CACHE_PLUGIN_TIMEOUT(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = 3600
CALLBACKS_ENABLED(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = ['yaml', 'profile_tasks']
DEFAULT_FORKS(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = 20
DEFAULT_GATHERING(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = smart
DEFAULT_LOAD_CALLBACK_PLUGINS(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = True
DEFAULT_ROLES_PATH(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = ['/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/roles', '/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/roles_infra', '/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/galaxy_roles']
DEFAULT_STDOUT_CALLBACK(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = yaml
DEFAULT_UNDEFINED_VAR_BEHAVIOR(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = True
DISPLAY_SKIPPED_HOSTS(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = False
HOST_KEY_CHECKING(/Users/veronica/Documents/Workspaces/ansible/ansible-infrastructure/ansible/ansible.cfg) = False
OS / ENVIRONMENT

macOS Monterey
Ubuntu 20.04

STEPS TO REPRODUCE
- name: Update the public ip's dns name
  azure_rm_publicipaddress:
    resource_group: "<REDACTED>"
    name: "<REDACTED>"
    domain_name: "<REDACTED>"
    subscription_id: "<REDACTED>"
    allocation_method: static
    sku: standard
EXPECTED RESULTS

IP address domain is correctly set to the value

ACTUAL RESULTS
The full traceback is:
  File "/var/folders/zj/kygpf26n11l_vx3g3h6pztpc0000gn/T/ansible_azure_rm_publicipaddress_payload_79gzid3t/ansible_azure_rm_publicipaddress_payload.zip/ansible_collections/azure/azcollection/plugins/modules/azure_rm_publicipaddress.py", line 397, in create_or_update_pip
  File "/Users/veronica/.local/share/virtualenvs/ansible-infrastructure-NHxU_Lfa/lib/python3.9/site-packages/azure/mgmt/network/v2020_06_01/operations/_public_ip_addresses_operations.py", line 269, in create_or_update
    raw_result = self._create_or_update_initial(
  File "/Users/veronica/.local/share/virtualenvs/ansible-infrastructure-NHxU_Lfa/lib/python3.9/site-packages/azure/mgmt/network/v2020_06_01/operations/_public_ip_addresses_operations.py", line 229, in _create_or_update_initial
    raise exp
fatal: [localhost]: FAILED! => changed=false 
  invocation:
    module_args:
      ad_user: null
      adfs_authority_url: null
      allocation_method: static
      api_profile: latest
      append_tags: true
      auth_source: auto
      cert_validation_mode: null
      client_id: null
      cloud_environment: AzureCloud
      domain_name: <REDACTED>
      idle_timeout: null
      ip_tags: null
      location: null
      log_mode: null
      log_path: null
      name: <REDACTED>
      password: null
      profile: null
      resource_group: <REDACTED>
      secret: null
      sku: standard
      state: present
      subscription_id: <REDACTED>
      tags: null
      tenant: null
      version: ipv4
  msg: |-
    Error creating or updating <REDACTED> - Azure Error: PublicIPSKUDowngradeFeatureNotEnabled
    Message: PublicIP /subscriptions/<REDACTED>/resourceGroups/<REDACTED>/providers/Microsoft.Network/publicIPAddresses/<REDACTED> SKU downgrade feature flag Microsoft.Network/AllowPublicIPSkuDowngrade is not enabled for this subscription /subscriptions/<REDACTED>/resourceGroups//providers/Microsoft.Network/subscriptions/.
@verhyppo
Copy link
Contributor Author

it seems to me that I was right by saying that now the API requests requests a sku field when updating the resource that need to match the actual value already present in the PIP.
In fact, when the pip is updated, the sku does not get populated and by momentarily patching the library manually, it seems to work:
https://github.com/ansible-collections/azure/blob/dev/plugins/modules/azure_rm_publicipaddress.py#L381

pip = self.network_models.PublicIPAddress(
                        location=results['location'],
                        public_ip_allocation_method=results['public_ip_allocation_method'],
                        # Added this line line
                        sku=self.network_models.PublicIPAddressSku(name=self.sku) if self.sku else None,
                        tags=results['tags']
                    )

xuzhang3 pushed a commit that referenced this issue Feb 14, 2022
- sku seems to be mandatory in Azure API
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant