Unfortunately, no. You will have to assign the result of a function call to a variable before indexing into it due to the syntax of the Puppet DSL.
Because of the code that you posted above, can I assume that you are trying to loop through the interfaces and create a resource for each one? If so, be aware that Puppet does not work the same as typical imperative programming languages, and that was a big leap for me when I was learning it.
Instead, you can pass a structure that you've built into the
create_resources function to declare many of the same type of resource at once. Here is a good example for how to do that: https://docs.puppetlabs.com/references/latest/function.html#createresources
Of course, if I've read too much into your question, please forgive me! :)