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

azure_rm_deployment deletes the whole resource group in state absent #1227

Closed
mayoubb opened this issue Jul 31, 2023 · 3 comments
Closed

azure_rm_deployment deletes the whole resource group in state absent #1227

mayoubb opened this issue Jul 31, 2023 · 3 comments
Labels
has_pr PR fixes have been made medium_priority Medium priority

Comments

@mayoubb
Copy link

mayoubb commented Jul 31, 2023

SUMMARY

I am using the module azure_rm_deployment to create ARM deployments under resource group
If state=present, template will be created.

If state=present and deployment exists, it will be updated.

If state=absent, the resource group will be removed.

why ?! if the state is absent , only the deploymenet name specified should be deleted and not the whole resource groupe

ISSUE TYPE
  • Bug Report
COMPONENT NAME

azure_rm_deployment

ANSIBLE VERSION
ansible [core 2.14.3]
  config file = None
  configured module search path = ['/home/jenkins/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
  ansible collection location = /home/jenkins/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True


COLLECTION VERSION
azure.azcollection

CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
# Destroy a template deployment
- name: Destroy Azure Deploy
  azure_rm_deployment:
    resource_group: myResourceGroup
    name: myDeployment
    state: absent

EXPECTED RESULTS

The deployement template ONLY should be removed (deleted)

ACTUAL RESULTS
The whole resource_groupe was deleted
all resources are lost (Vms,AKS,storages .....)

if we go back to the git code : 
result = self.rm_client.resource_groups.begin_delete(self.resource_group,name)
IT SHOULD BE:
result = self.rm_client.deployments.begin_delete(self.resource_group,name)
or 
result = self.rm_client.deployments.delete(self.resource_group)

@Fred-sun
Copy link
Collaborator

Fred-sun commented Aug 1, 2023

Fixed by #1231

@mayoubb
Copy link
Author

mayoubb commented Aug 1, 2023

documentation should be fixed as well

@Fred-sun Fred-sun added has_pr PR fixes have been made medium_priority Medium priority labels Aug 2, 2023
@Fred-sun
Copy link
Collaborator

Fred-sun commented Aug 2, 2023

@mayoubb Already update! Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has_pr PR fixes have been made medium_priority Medium priority
Projects
None yet
Development

No branches or pull requests

2 participants