@ -24,23 +24,28 @@ variable "project_directory" {
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  description  = " The directory to open in the IDE. e.g. /home/coder/project " 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				} 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				variable  " gateway_ide_product_code "  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				variable  " default "  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  type         = string 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  description  = " Default IDE " 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  default      = null 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				} 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				variable  " jetbrains_ides "  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  type         = list ( string ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  description  = " The list of IDE product codes, e.g. ['GO', 'WS'] or ['ALL'] " 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  default      = [ " ALL " ] 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  description  = " The list of IDE product codes, e.g. [ " GO " ,  " WS " ] 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  default      = var . default  ! =  null  &&  var . default  ! =  " "  ?  var . default  :  null 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  validation  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    condition  = ( 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				      length ( var . gateway_ide_product_code )  = =  1  &&  var . gateway_ide_product_code [ 0 ]  = =  " ALL "  | | 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				      alltrue ( [ 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        for  code  in  var . gateway_ide_product_code  :  contains ( [ " IU " ,  " IC " ,  " PS " ,  " WS " ,  " PY " ,  " PC " ,  " CL " ,  " GO " ,  " DB " ,  " RD " ,  " RM " ] ,  code ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				        for  code  in  var . jetbrains_ides  :  contains ( [ " IU " ,  " IC " ,  " PS " ,  " WS " ,  " PY " ,  " PC " ,  " CL " ,  " GO " ,  " DB " ,  " RD " ,  " RM " ] ,  code ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				      ] ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    ) 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    error_message  = " The  gateway_ide_product_code must be ['ALL'] or  a list of valid product codes. https://plugins.jetbrains.com/docs/marketplace/product-codes.html" 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    error_message  = " The  jetbrains_ides must be  a list of valid product codes. https://plugins.jetbrains.com/docs/marketplace/product-codes.html" 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				} 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				locals  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  gateway _ides = { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  jetbrains _ides = { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    " GO "  =  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				      icon   = " /icon/goland.svg " , 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				      name   = " GoLand " , 
 
			
		 
		
	
	
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
				
			
			 
			 
			
				@ -108,7 +113,7 @@ data "coder_parameter" "jetbrains_ide" {
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  default       = local . gateway_ides [ " GO " ] . value 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  dynamic  " option "  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    for_each  = contains ( var . gateway_ide_product_code ,  " ALL " )  ?  local . gateway_ides  :   {  for  key ,  value  in  local . gateway_ides  :  key  =>  value  if  contains ( var . gateway_ide_product_code ,  key )  } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    for_each  = {  for  key ,  value  in  local . gateway_ides  :  key  =>  value  if  contains ( var . jetbrains_ides ,  key )  } 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				    content  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				      icon   = option . value . icon 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				      name   = option . value . name 
 
			
		 
		
	
	
		
			
				
					
						
						
						
							
								 
							 
						
					 
				
			
			 
			 
			
				@ -127,3 +132,7 @@ resource "coder_app" "gateway" {
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  icon          = data . coder_parameter . jetbrains_ide . option [ index ( data . coder_parameter . jetbrains_ide . option . * . value ,  data . coder_parameter . jetbrains_ide . value ) ] . icon 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  external      = true 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				} 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				output  " jetbrains_ides "  { 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				  value  = data . coder_parameter . jetbrains_ide . value 
 
			
		 
		
	
		
			
				 
				 
			
			 
			 
			
				}