Answers: <p>ChatGPT answers :)</p>
  <pre><code>callback_urls = concat(
    var.target_infra == &quot;prod&quot; ?
      (var.application_name == &quot;techno&quot; ?
        [&quot;https://${local.domain_name}.${local.pe_subdomain_name[var.target_infra]}/auth&quot;] :
        [&quot;https://${local.domain_name}.${local.pe_subdomain_name[var.target_infra]}/setup/auth&quot;]
      ) :
      (var.application_name == &quot;techno&quot; ?
        [
          &quot;https://${local.domain_name}.${var.environment}.${local.pe_subdomain_name[var.target_infra]}/auth&quot;,
          &quot;http://localhost:3000/auth&quot;
        ] :
        [&quot;https://${local.domain_name}.${var.environment}.${local.pe_subdomain_name[var.target_infra]}/setup/auth&quot;]
      )
    )
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2023-12-13T16:15:43.133Z
Answers: 2023-12-13T16:15:43.133Z
Answers: Devang Sanghani
Body: <p>I need to have two urls in case if my environment is nonprod(sit,uat,dev) and my application is Techno, otherwise only one url. In order to do that, I have made every string into a list here, so that the returned value is consistent. Otherwise I get <code>The true and false result expressions must have consistent types</code> error.</p>
  <p>Now, with this, I am getting this error :</p>
  <p><code>Inappropriate value for attribute callback_urls: element 0: string required.</code></p>
  <p>How to achieve this ?</p>
  <pre><code>callback_urls = [var.target_infra == &quot;prod&quot; ? (var.application_name == &quot;techno&quot; ? [&quot;https://${local.domain_name}.${local.pe_subdomain_name[var.target_infra]}/auth&quot;] : [&quot;https://${local.domain_name}.${local.pe_subdomain_name[var.target_infra]}/setup/auth&quot;]) : (var.application_name == &quot;techno&quot; ? [&quot;https://${local.domain_name}.${var.environment}.${local.pe_subdomain_name[var.target_infra]}/auth&quot;, &quot;http://localhost:3000/auth&quot;] : [&quot;https://${local.domain_name}.${var.environment}.${local.pe_subdomain_name[var.target_infra]}/setup/auth&quot;])]
  </code></pre>
  
Tags: <amazon-web-services><terraform>
Title: Terraform conditions : How to have a multiple values in case of False condition?
UserDisplayName: Devang Sanghani
ThreadText: # Terraform conditions : How to have a multiple values in case of False condition?
  
  (Asked by: username_0 on 2023-12-13)
  
  I need to have two urls in case if my environment is nonprod(sit,uat,dev) and my application is Techno, otherwise only one url. In order to do that, I have made every string into a list here, so that the returned value is consistent. Otherwise I get `The true and false result expressions must have consistent types` error.
  
  Now, with this, I am getting this error :
  
  `Inappropriate value for attribute callback_urls: element 0: string required.`
  
  How to achieve this ?
  
  ```
  callback_urls = [var.target_infra == "prod" ? (var.application_name == "techno" ? ["https://${local.domain_name}.${local.pe_subdomain_name[var.target_infra]}/auth"] : ["https://${local.domain_name}.${local.pe_subdomain_name[var.target_infra]}/setup/auth"]) : (var.application_name == "techno" ? ["https://${local.domain_name}.${var.environment}.${local.pe_subdomain_name[var.target_infra]}/auth", "http://localhost:3000/auth"] : ["https://${local.domain_name}.${var.environment}.${local.pe_subdomain_name[var.target_infra]}/setup/auth"])]
  
  ```
  
  **Tags:** amazon-web-services, terraform
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-12-13. Score: 0
  
  ChatGPT answers :)
  
  ```
  callback_urls = concat(
    var.target_infra == "prod" ?
      (var.application_name == "techno" ?
        ["https://${local.domain_name}.${local.pe_subdomain_name[var.target_infra]}/auth"] :
        ["https://${local.domain_name}.${local.pe_subdomain_name[var.target_infra]}/setup/auth"]
      ) :
      (var.application_name == "techno" ?
        [
          "https://${local.domain_name}.${var.environment}.${local.pe_subdomain_name[var.target_infra]}/auth",
          "http://localhost:3000/auth"
        ] :
        ["https://${local.domain_name}.${var.environment}.${local.pe_subdomain_name[var.target_infra]}/setup/auth"]
      )
    )
  
  ```
  
  
  ---
  
  