In any case I don’t know if not liking the / is an Azure thing, but it works okay for GCP – I can have list of string and it won’t complain about / or needing to escape it. As for escaping stuff…off the top of my head I think it was multiple (2 or 3) backslashes to escape (although I think that was pre-1.0). You can give that a try and see if it helps (sorry, I don’t have any Azure examples on hand to try it on.
Extremely sorry for the delay in response.
The issue is not yet resolved. I am able to plan but it fails while applying the changes.
I tried deleting .terraform and still did not work.
Are you able to create the resource or just get the plan for creation ?
Oh!!! I think i know what your issue is. The code you pasted…that’s not exactly what you have right? Because the example wouldn’t really work in practice as your resource name is the just “test” so even if you have a for_each loop, they would overwrite each other and only the last datasource gets created. I assume you have a variable in the name field (i.e. name = "test-${each.value}") and that’s the part that’s giving you the error you’re seeing about invalid characters ‘<’ looking for beginning of value
I think you’re looking for a “map” instead of a list. So then your key can be a simple string that you can append to the name and the value can have the / that you use for event_log_name. I’ve made (and tested) the changes below, see if that resolves your issue:
Yeah, that’s what I was trying to say earlier – that it was the name part that twas giving you the error and not the event_log_name = each.value. Anyway, I’m glad it’s resolved
EDIT: and as I mentioned, if you want to be able to append a unique identifier to the name as you go through your for_each loop, you’ll probably have to use a map and use key as the unique identifier and value as your event_log_name