diff --git a/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py b/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py index e08d85eea91..dc8d48ebb88 100644 --- a/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py +++ b/lib/ansible/modules/extras/cloud/cloudstack/cs_instance.py @@ -485,8 +485,10 @@ class AnsibleCloudStackInstance(AnsibleCloudStack): instance = self.deploy_instance() else: instance = self.update_instance(instance) - - instance = self.ensure_tags(resource=instance, resource_type='UserVm') + + # In check mode, we do not necessarely have an instance + if instance: + instance = self.ensure_tags(resource=instance, resource_type='UserVm') return instance