Skip to content

Commit

Permalink
Merge pull request #89 from abolfazl8131/master
Browse files Browse the repository at this point in the history
feat(elb&efs):declare elb and efs
  • Loading branch information
abolfazl8131 authored Nov 23, 2024
2 parents 1c7c077 + 56e4a5d commit 76b0e70
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 64 deletions.
16 changes: 0 additions & 16 deletions app/media/MyTerraform/modules/s3/main.tf

This file was deleted.

10 changes: 0 additions & 10 deletions app/media/MyTerraform/modules/s3/terraform.tfvars

This file was deleted.

24 changes: 0 additions & 24 deletions app/media/MyTerraform/modules/s3/variables.tf

This file was deleted.

11 changes: 0 additions & 11 deletions app/media/MyTerraform/modules/s3/versions.tf

This file was deleted.

23 changes: 22 additions & 1 deletion app/models/terraform_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,25 @@ class ArgoApplication(BaseModel):
class IaCTemplateGenerationArgoCD(BaseModel):
argocd_application:ArgoApplication | None = None
argocd_repository:bool = True



class IaCTemplateGenerationELB(BaseModel):
security_group:bool = True
lb_target_group:bool = True
lb:bool = True
lb_listener:bool = True
lb_listener_rule:bool = True
key_pair:bool = True
launch_configuration:bool = True
autoscaling_group:bool = True
autoscaling_attachment:bool = True
autoscaling_policy:bool = True



class IaCTemplateGenerationEFS(BaseModel):
security_group:bool = True
efs_file_system:bool = True
efs_mount_target:bool = True
efs_backup_policy:bool = True

30 changes: 28 additions & 2 deletions app/routes/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
IaCTemplateGenerationEC2,
IaCTemplateGenerationS3,
IaCTemplateGenerationIAM,
IaCTemplateGenerationArgoCD
IaCTemplateGenerationArgoCD,
IaCTemplateGenerationELB,
IaCTemplateGenerationEFS
)

from fastapi import Response
Expand All @@ -25,6 +27,8 @@
from app.template_generators.terraform.aws.IAM import (IaC_template_generator_iam)
from app.template_generators.terraform.aws.s3 import (IaC_template_generator_s3)
from app.template_generators.terraform.argocd import (IaC_template_generator_argocd)
from app.template_generators.terraform.aws.ELB import (IaC_template_generator_elb)
from app.template_generators.terraform.aws.EFS import (IaC_template_generator_efs)
import os

@app.post("/IaC-basic/")
Expand Down Expand Up @@ -102,4 +106,26 @@ async def IaC_template_generation_argocd(request:IaCTemplateGenerationArgoCD) ->
output = gpt_service(generated_prompt)
edit_directory_generator("terraform_generator",output)
execute_pythonfile("MyTerraform","terraform_generator")
return Output(output='output')
return Output(output='output')



@app.post("/IaC-template/aws/elb")
async def IaC_template_generation_aws_elb(request:IaCTemplateGenerationELB) -> Output:
if os.environ.get("TEST"):
return Output(output='output (nothing special)')
generated_prompt = IaC_template_generator_elb(request)
output = gpt_service(generated_prompt)
edit_directory_generator("terraform_generator",output)
execute_pythonfile("MyTerraform","terraform_generator")
return Output(output='output')

@app.post("/IaC-template/aws/efs")
async def IaC_template_generation_aws_efs(request:IaCTemplateGenerationEFS) -> Output:
if os.environ.get("TEST"):
return Output(output='output (nothing special)')
generated_prompt = IaC_template_generator_efs(request)
output = gpt_service(generated_prompt)
edit_directory_generator("terraform_generator",output)
execute_pythonfile("MyTerraform","terraform_generator")
return Output(output='output')
2 changes: 2 additions & 0 deletions app/template_generators/terraform/aws/EFS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def IaC_template_generator_efs(input) -> str:
pass
2 changes: 2 additions & 0 deletions app/template_generators/terraform/aws/ELB.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def IaC_template_generator_elb(input) -> str:
pass

0 comments on commit 76b0e70

Please sign in to comment.