@@ -27,6 +27,11 @@ const createProjectFormSchema = z.object({
27
27
name : z . string ( ) . min ( 1 , "Project name is required" ) ,
28
28
repository : z . number ( ) . int ( ) . positive ( "Please select a repository" ) ,
29
29
terraformDir : z . string ( ) . min ( 1 , "Terraform working directory is required" ) ,
30
+ iac_type : z . enum ( [ "terraform" , "terragrunt" , "opentofu" ] ) . default ( "terraform" ) ,
31
+ workspace : z . string ( ) . default ( "default" ) . optional ( ) ,
32
+ workflow_file : z . string ( ) . default ( "digger_workflow.yml" ) . optional ( ) ,
33
+ include_patterns : z . string ( ) . optional ( ) ,
34
+ exclude_patterns : z . string ( ) . optional ( ) ,
30
35
branch : z . string ( ) . min ( 1 , "Branch is required" ) . default ( "main" ) ,
31
36
labels : z . array ( z . string ( ) ) ,
32
37
managedState : z . boolean ( ) . default ( true ) ,
@@ -65,6 +70,9 @@ export default function CreateProjectForm({ organizationId, repositories, teams,
65
70
name : "" ,
66
71
repository : repositories [ 0 ] ?. id || 0 ,
67
72
terraformDir : "" ,
73
+ iac_type : "terraform" ,
74
+ workflow_file : "digger_workflow.yml" ,
75
+ workspace : "default" ,
68
76
managedState : true ,
69
77
labels : [ ] ,
70
78
teamId : teamId || null ,
@@ -77,17 +85,22 @@ export default function CreateProjectForm({ organizationId, repositories, teams,
77
85
async ( data : CreateProjectFormData ) => {
78
86
const slug = generateSlug ( data . name ) ;
79
87
return await createProjectAction ( {
80
- organizationId,
81
- teamId : data . teamId ,
82
88
name : data . name ,
83
89
slug,
84
90
repoId : data . repository ,
85
- managedState : data . managedState ,
91
+ branch : data . branch ,
92
+ organizationId : organizationId ,
93
+ teamId : data . teamId ,
86
94
terraformWorkingDir : data . terraformDir ,
87
- branch : data . branch || '' ,
95
+ iac_type : data . iac_type ,
96
+ workspace : data . workspace ,
97
+ workflow_file : data . workflow_file ,
98
+ include_patterns : data . include_patterns ,
99
+ exclude_patterns : data . exclude_patterns ,
88
100
labels : data . labels ,
101
+ managedState : data . managedState ,
89
102
is_drift_detection_enabled : data . is_drift_detection_enabled ,
90
- drift_crontab : data . drift_crontab || '' ,
103
+ drift_crontab : data . drift_crontab ,
91
104
} ) ;
92
105
} ,
93
106
{
@@ -311,53 +324,95 @@ export default function CreateProjectForm({ organizationId, repositories, teams,
311
324
< CardHeader >
312
325
< div className = "flex flex-col" >
313
326
< CardTitle className = "text-lg " > Configuration</ CardTitle >
314
- < CardDescription className = "text-sm text-muted-foreground" > Specify branch and working directory for Terraform</ CardDescription >
327
+ < CardDescription className = "text-sm text-muted-foreground" > Specify key settings for Terraform</ CardDescription >
315
328
</ div >
316
329
</ CardHeader >
317
330
< CardContent >
318
- < div >
319
- < Label htmlFor = "terraformDir" > Terraform Working Directory *</ Label >
320
- < Controller
321
- name = "terraformDir"
322
- control = { control }
323
- render = { ( { field } ) => (
324
- < div className = "relative" >
325
- < Input
326
- id = "terraformDir"
327
- placeholder = "e.g. ./"
328
- className = { `mt-1 ${ errors . terraformDir ? 'border-destructive' : '' } ` }
329
- { ...field }
330
- />
331
- { errors . terraformDir && (
332
- < div className = "flex items-center mt-1 text-destructive" >
333
- < AlertCircle className = "h-4 w-4 mr-1" />
334
- < span className = "text-sm" > { errors . terraformDir . message } </ span >
335
- </ div >
336
- ) }
337
- </ div >
338
- ) }
339
- />
340
- < Label htmlFor = "branch" > Branch</ Label >
341
- < Controller
342
- name = "branch"
343
- control = { control }
344
- render = { ( { field } ) => (
345
- < div className = "relative" >
346
- < Input
347
- id = "branch"
348
- placeholder = "if not specified, main branch will be used"
349
- className = { `mt-1 ${ errors . branch ? 'border-destructive' : '' } ` }
350
- { ...field }
351
- />
352
- { errors . branch && (
353
- < div className = "flex items-center mt-1 text-destructive" >
354
- < AlertCircle className = "h-4 w-4 mr-1" />
355
- < span className = "text-sm" > { errors . branch . message } </ span >
356
- </ div >
357
- ) }
358
- </ div >
359
- ) }
360
- />
331
+ < div className = "space-y-4" >
332
+ < motion . div
333
+ initial = { { opacity : 0 } }
334
+ animate = { { opacity : 1 } }
335
+ transition = { { duration : 0.15 , delay : 0.4 } }
336
+ >
337
+ < Label htmlFor = "terraformDir" > Terraform Working Directory *</ Label >
338
+ < Controller
339
+ name = "terraformDir"
340
+ control = { control }
341
+ render = { ( { field } ) => (
342
+ < div className = "relative" >
343
+ < Input
344
+ id = "terraformDir"
345
+ placeholder = "e.g. ./"
346
+ className = { `mt-1 ${ errors . terraformDir ? 'border-destructive' : '' } ` }
347
+ { ...field }
348
+ />
349
+ { errors . terraformDir && (
350
+ < div className = "flex items-center mt-1 text-destructive" >
351
+ < AlertCircle className = "h-4 w-4 mr-1" />
352
+ < span className = "text-sm" > { errors . terraformDir . message } </ span >
353
+ </ div >
354
+ ) }
355
+ </ div >
356
+ ) }
357
+ />
358
+ </ motion . div >
359
+ < motion . div
360
+ initial = { { opacity : 0 } }
361
+ animate = { { opacity : 1 } }
362
+ transition = { { duration : 0.15 , delay : 0.4 } }
363
+ >
364
+ < Label htmlFor = "branch" > Branch</ Label >
365
+ < Controller
366
+ name = "branch"
367
+ control = { control }
368
+ render = { ( { field } ) => (
369
+ < div className = "relative" >
370
+ < Input
371
+ id = "branch"
372
+ placeholder = "if not specified, main branch will be used"
373
+ className = { `mt-1 ${ errors . branch ? 'border-destructive' : '' } ` }
374
+ { ...field }
375
+ />
376
+ { errors . branch && (
377
+ < div className = "flex items-center mt-1 text-destructive" >
378
+ < AlertCircle className = "h-4 w-4 mr-1" />
379
+ < span className = "text-sm" > { errors . branch . message } </ span >
380
+ </ div >
381
+ ) }
382
+ </ div >
383
+ ) }
384
+ />
385
+ </ motion . div >
386
+
387
+ < motion . div
388
+ initial = { { opacity : 0 } }
389
+ animate = { { opacity : 1 } }
390
+ transition = { { duration : 0.15 , delay : 0.4 } }
391
+ >
392
+ < Label htmlFor = "iac_type" > IAC type</ Label >
393
+ < Controller
394
+ name = "iac_type"
395
+ control = { control }
396
+ render = { ( { field } ) => (
397
+ < Select onValueChange = { field . onChange } value = { field . value } >
398
+ < SelectTrigger >
399
+ < SelectValue placeholder = "Select IAC type" />
400
+ </ SelectTrigger >
401
+ < SelectContent className = "rounded-xl" >
402
+ < SelectItem value = "terraform" className = "rounded-lg" >
403
+ Terraform
404
+ </ SelectItem >
405
+ < SelectItem value = "terragrunt" className = "rounded-lg" >
406
+ Terragrunt
407
+ </ SelectItem >
408
+ < SelectItem value = "opentofu" className = "rounded-lg" >
409
+ Opentofu
410
+ </ SelectItem >
411
+ </ SelectContent >
412
+ </ Select >
413
+ ) }
414
+ />
415
+ </ motion . div >
361
416
</ div >
362
417
</ CardContent >
363
418
</ MotionCard >
@@ -376,6 +431,69 @@ export default function CreateProjectForm({ organizationId, repositories, teams,
376
431
</ CardHeader >
377
432
< CardContent >
378
433
< div className = "space-y-4" >
434
+ < motion . div
435
+ initial = { { opacity : 0 } }
436
+ animate = { { opacity : 1 } }
437
+ transition = { { duration : 0.15 , delay : 0.4 } }
438
+ >
439
+ < Label htmlFor = "workspace" > Workspace</ Label >
440
+ < Controller
441
+ name = "workspace"
442
+ control = { control }
443
+ render = { ( { field } ) => (
444
+ < Input id = "workspace" { ...field } />
445
+ ) }
446
+ />
447
+ </ motion . div >
448
+
449
+ < motion . div
450
+ initial = { { opacity : 0 } }
451
+ animate = { { opacity : 1 } }
452
+ transition = { { duration : 0.15 , delay : 0.4 } }
453
+ >
454
+ < Label htmlFor = "workflow_file" > Workflow file</ Label >
455
+ < Controller
456
+ name = "workflow_file"
457
+ control = { control }
458
+ render = { ( { field } ) => (
459
+ < Input id = "workflow_file" { ...field } />
460
+ ) }
461
+ />
462
+ </ motion . div >
463
+
464
+ < div className = "grid grid-cols-2 gap-6" >
465
+
466
+ < motion . div
467
+ initial = { { opacity : 0 } }
468
+ animate = { { opacity : 1 } }
469
+ transition = { { duration : 0.15 , delay : 0.4 } }
470
+ >
471
+ < Label htmlFor = "include_patterns" > Include patterns</ Label >
472
+ < Controller
473
+ name = "include_patterns"
474
+ control = { control }
475
+ render = { ( { field } ) => (
476
+ < Input id = "include_patterns" { ...field } />
477
+ ) }
478
+ />
479
+ </ motion . div >
480
+
481
+ < motion . div
482
+ initial = { { opacity : 0 } }
483
+ animate = { { opacity : 1 } }
484
+ transition = { { duration : 0.15 , delay : 0.4 } }
485
+ >
486
+ < Label htmlFor = "Exclude patterns" > Exclude patterns</ Label >
487
+ < Controller
488
+ name = "exclude_patterns"
489
+ control = { control }
490
+ render = { ( { field } ) => (
491
+ < Input id = "exclude_patterns" { ...field } />
492
+ ) }
493
+ />
494
+ </ motion . div >
495
+
496
+ </ div >
379
497
< div >
380
498
< Label htmlFor = "labels" > Labels</ Label >
381
499
< Controller
0 commit comments