Pre-provision variable

Hello,
I’m trying to write a terraform spec template deploying azure resource and i have a question :
Is there a way to “read” in the terraform code the values entered in the “group” part of the provisionning process :

In the documentation, preprovionning variables are suggested , bet when i try, it goes :

Error: Invalid index


  on local-variables.tf line 15, in locals:
  15:   subscription_id = local.sub_ids["<%=cloudcode%>"]
    ├────────────────
    │ local.sub_ids is object with 9 attributes

The given key does not identify an element in this collection value.

surprizingly, it works for <%=instance.name>

it really stuck me in my project. Can you help me ?

Have you tried using <%=zone.code%>

yes i did

Error: Invalid index

  on local-variables.tf line 15, in locals:
  15:   subscription_id = local.sub_ids["<%=zone.code%>"]
    ├────────────────
    │ local.sub_ids is object with 9 attributes

The given key does not identify an element in this collection value.


Do you have a code set on that cloud or are you just trying to pass the name that shows up in the drop down?

what do you mean by “code set” ? Indeed I wan’t to pass the name that shows up in drop down.
I didn’t find it in the logs, so i tried to do this via customoptions, but nothing works as it should

I believe he is referring to the code that you can set for the cloud to be called via the API, etc.
Infrastructure > Clouds > Edit

Yes, everything si set up properly. variables are not properly accessible through terraform (at least in my use case).
For example, “<%=instance.name%>” works, but not “<%=instance.contextName%>”.
“<%=instance%>” replies a string representing a list containing several “key:value”, including contextName.
It’s incomprehensible.