title: If condition in terraform to create user from yaml vars
body: <p>Variables are loading from yaml file</p>
  <p>project_tst.yml</p>
  <pre><code>project_key: tst
  
  user_config_data:
      - rt_env: adm
        groups: false
        disable_ui_access: true
      - rt_env: dev
        groups: true
        disable_ui_access: false
      - rt_env: prod
        groups: true
        disable_ui_access: false
      - rt_env: dev
        groups: true
        ro: true
        disable_ui_access: false
      - rt_env: prod
        groups: true
        ro: true
        disable_ui_access: false
      ```
  
  `lookups.tf
  
  locals {
    tst_project_file  = file(&quot;project_tst.yml&quot;)
    tst_project = yamldecode(local.tst_project_file)
  }`
  </code></pre>
  <p>Any help to create 5 users from the yaml file using terraform</p>
  <pre><code>resource &quot;artifactory_user&quot; &quot;users&quot; {
      for_each  = local.tst_project[&quot;user_config_data&quot;]
      admin                      = false
      disable_ui_access          = &quot;${each.value[&quot;disable_ui_access&quot;]}&quot;
      email                      = 
      groups                     = [
          &quot;readers&quot;,
      ]
      internal_password_disabled = false
      name                       = &quot;${local.tst_project[&quot;project_key&quot;]}_${each.value[&quot;rt_env&quot;]}_user&quot;
      profile_updatable          = true
  }
  </code></pre>
  <p>If &quot;ro&quot; is &quot;true&quot; then the username should be</p>
  <ol>
  <li>tst_ro_dev_user</li>
  <li>tst_ro_dev_prod</li>
  </ol>
  <p>Otherwise</p>
  <ol start="3">
  <li>tst_adm_user</li>
  <li>tst_dev_user</li>
  <li>tst_prod_user</li>
  </ol>
  <p>Is this possible ?</p>
  <p>As a work around I am now using two resources, one is for &quot;ro&quot; and other for without &quot;ro&quot;. This works fine and yaml vars changed like below</p>
  <pre><code>user_config_data:
    rw:
      adm:
        groups: false
        disable_ui_access: true
      dev:
        groups: true
        disable_ui_access: false
      prod:
        groups: true
        disable_ui_access: false
    ro:
      dev:
        groups: true
        disable_ui_access: false
      prod:
        groups: true
        disable_ui_access: false
  </code></pre>