@ -9,6 +9,9 @@ terraform {
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  } 
 
					 
					 
					 
					  } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					} 
 
					 
					 
					 
					} 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					data  " coder_workspace "  " me "  { } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					data  " coder_workspace_owner "  " me "  { } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					#  Add  required  var iables  for  your  module s  and  remove  any  unneeded  var iables 
 
					 
					 
					 
					#  Add  required  var iables  for  your  module s  and  remove  any  unneeded  var iables 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					variable  " agent_id "  { 
 
					 
					 
					 
					variable  " agent_id "  { 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  type         = string 
 
					 
					 
					 
					  type         = string 
 
				
			 
			
		
	
	
		
		
			
				
					
						
							
								 
							 
						
						
							
								 
							 
						
						
					 
					 
					@ -36,6 +39,15 @@ variable "share" {
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  } 
 
					 
					 
					 
					  } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					} 
 
					 
					 
					 
					} 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					variable  " subdomain "  { 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					  type     = bool 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					  default  = true 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					  validation  { 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    condition      = var . share  ==  " owner "  | |  var . share  ==  " authenticated "  | |  var . share  ==  " public " 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    error_message  = " Incorrect value. Please set either 'owner', 'authenticated', or 'public'. " 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					  } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					} 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					variable  " order "  { 
 
					 
					 
					 
					variable  " order "  { 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  type         = number 
 
					 
					 
					 
					  type         = number 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  description  = " The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order). " 
 
					 
					 
					 
					  description  = " The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order). " 
 
				
			 
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
							 
						
					 
					 
					@ -49,17 +61,27 @@ resource "coder_script" "jupyterlab" {
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  script  = templatefile ( " ${ path . module } /run.sh " ,  { 
 
					 
					 
					 
					  script  = templatefile ( " ${ path . module } /run.sh " ,  { 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    LOG_PATH  :  var . log_path , 
 
					 
					 
					 
					    LOG_PATH  :  var . log_path , 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					    PORT  :  var . port 
 
					 
					 
					 
					    PORT  :  var . port 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    BASE_URL  :  var . subdomain  ?  " http://localhost: ${ var . port } /@ ${ data . coder_workspace_owner . me . name } / ${ data . coder_workspace . me . name } /apps/jupyterlab "  :  " " 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  } ) 
 
					 
					 
					 
					  } ) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  run_on_start  = true 
 
					 
					 
					 
					  run_on_start  = true 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					} 
 
					 
					 
					 
					} 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					
 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					resource  " coder_app "  " jupyterlab "  { 
 
					 
					 
					 
					resource  " coder_app "  " jupyterlab "  { 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  agent_id      = var . agent_id 
 
					 
					 
					 
					  agent_id      = var . agent_id 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  slug          = " jupyterlab " 
 
					 
					 
					 
					  slug          = " jupyterlab "  #  sync  with  with  end  of  subdomain  URL  
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					  display_name  = " JupyterLab " 
 
					 
					 
					 
					  display_name  = " JupyterLab " 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  url           = " http://localhost: ${ var . port } " 
 
					 
					 
					 
					  url           = var . subdomain  ?  " http://localhost: ${ var . port } /@ ${ data . coder_workspace_owner . me . name } / ${ data . coder_workspace . me . name } /apps/jupyterlab "  :  " http://localhost: ${ var . port } " 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					  icon          = " /icon/jupyter.svg " 
 
					 
					 
					 
					  icon          = " /icon/jupyter.svg " 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  subdomain     = true 
 
					 
					 
					 
					  subdomain     = var . subdomain 
 
				
			 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 
					 
					 
					  share         = var . share 
 
					 
					 
					 
					  share         = var . share 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					  order         = var . order 
 
					 
					 
					 
					  order         = var . order 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					  dynamic  " healthcheck "  { 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    for_each  = var . subdomain  ?  toset ( [ true ] )  :  toset ( [ ] ) 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    content  { 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					      url        = " http://localhost: ${ var . port } /@ ${ data . coder_workspace_owner . me . name } / ${ data . coder_workspace . me . name } /apps/jupyterlab " 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					      interval   = 6 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					      threshold  = 10 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					    } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					 
					 
					 
					 
					  } 
 
				
			 
			
		
	
		
		
			
				
					
					 
					 
					 
					} 
 
					 
					 
					 
					}