why template_parameters is required to use the cloudformation module?

Hi,

I have a clouformation template that is working with no parameters defined , it’s working with no problems with CloufFormation in the AWS console but in order to use it in Ansible it is required to have parameters defined.

If I don’t define any parameters in ansible I get the following error :

“”"

failed: [localhost] => {“failed”: true}
msg: missing required arguments: template_parameters

FATAL: all hosts have already failed – aborting

“”"

If I set a parameter value in Ansible for the same template I get :

“”"

failed: [localhost] => {“failed”: true}
msg: {“Error”:{“Code”:“ValidationError”,“Message”:“Parameter values specified for a template which does not require them.”,“Type”:“Sender”},“RequestId”:“9b84302e-5064-11e3-bb60-872966d33ed4”}

FATAL: all hosts have already failed – aborting

“”"

Why do we need to set parameters in Ansible if we can use templates with no parameters at all in AWS ? Is there a way to overcome this issue or maybe start considering to remove the template_parameters as a required argument and make it optional ?

Regards,
Nicolas.

Nicolas,

This is a very good question. I'm the module's original author. When
I wrote it, I didn't foresee people using CloudFormation templates
without parameters. That was short-sighted. Please feel free to
submit a pull request adding this feature.

Thanks,

James

hi James,

At the moment I don’t have the knowledge and the time for the learning curve to write code and submit a pull request but hopefully I’ll be able to do that in the future as I’m planning to write my own modules at some point.

If anyone else willing to submit a pull request, besides removing the template parameters another good improvement will be to remove them completely when the state=absent as they don’t have any use at all when you delete a stack.

Thanks for this module James, it works really good :wink:

Nicolas,

File a feature request on github, and if/when I have time, I will try
to make an attempt at it.

Thanks,

James

Sounds like all is required is to make it required/False and then if set to None, set to {} ?

That should work.

Nicolas,

A time-fairy appeared and granted me a few minutes :slight_smile:

Feel free to try this: https://github.com/ansible/ansible/pull/4968.
Please comment on that pull request if it works for you.

Thanks

James