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 can't send int type parameter to ARM template #35536
Comments
Files identified in the description: If these files are inaccurate, please update the |
seeing the same |
i will look into this today |
Seems like this more generic issue -- not just this module. Please refer to this discussion here, as people are experiencing this problem in many other places. The problem is that jinjia template will be always expanded to string. So if you do: Also there's a proposal to solve this problem, so "!!int" or "!!float" could be used to ensure proper data type is passed: At this point i am considering following solution (in the module):
If somebody votes for this solution I will make a fix! |
Looks like you could just do the string to int conversion in the ARM template. { |
@MarkRoddick but this would require changes in existing ARM template. If existing ARM template expects number as a parameter, there's no way to pass it right now. |
yeah agreed, but least its a workaround if you are using custom ARM templates |
I also modified my ARM template converting from string to int. |
I was thinking about this issue during Chinese New Year holidays, and I think I figured out the only proper solution (before there's any generic fix).
@ilseokoh @MarkRoddick do you think that would be good approach? |
implemented the solution as mentioned above. |
While that PR should help I would have thought you could still get this working right now. I've done some digging myself with a test module and found that the int type was still preserved in jinja, e.g.
Still resulted in an integer. If needs_info |
yes, it's preserved, and you can convert sth to integer too, but eventually you have to put in in "" as you can't start field with naked {{ }} in ansible and it's get converted back to string. |
@zikalino I tested that, it still stayed the same as the original variable declaration. The quotation is just a yaml rule but the parsing is technically done in jinja |
@jborean93 you mean putting "{{ something integer in }}" resulted in integer? i have to retest that. perhaps something was fixed somewhere else in the meantime. |
in the latest devel branch, that example I gave you meant I didn't test it out with the |
yes {{ var | int }} is converted to int, bit if you do "{{ var | int }}" it's converted back to string, so there's no workaround for this. |
@zikalino I'm not fully sure on the rules but if you omit the |
yes, i will retest it again. |
@ilseokoh This issue is waiting for your response. Please respond or the issue will be closed. |
@ilseokoh You have not responded to information requests in this issue so we will assume it no longer affects you. If you are still interested in this, please create a new issue with the requested information. |
ISSUE TYPE
Bug Report
COMPONENT NAME
lib/ansible/modules/cloud/azure/azure_rm_deployment.py
ANSIBLE VERSION
CONFIGURATION
no result
OS / ENVIRONMENT
Ubuntu 16.04.3 LTS
SUMMARY
I want to put the 'int' type parameter value from playbook to arm template parameter.
But there is an error
STEPS TO REPRODUCE
command line:
playbook task
ARM Template
EXPECTED RESULTS
I want to have VMs on azure without errors.
another failed try:
parameters:
FieldVMCount:
value: "{{ fieldvmcount | int }}"
--> failed
NO error with hard-coded int number in the playbook task,
parameters:
FieldVMCount:
value: 10
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: