Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
QueueMin committed May 23, 2024
2 parents 43e7ba7 + 8a9c819 commit aafdb02
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sskai_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,15 @@ def create_setup():
if build_type == "create":
# Container build
container_create_command = f"./container_build.sh {ecr_uri} {region} {awscli_profile}"
print("Building and Deploying in progress.")
subprocess.run(container_create_command, check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print("Complete.")
break
elif build_type == "delete":
container_delete_command = f"./delete_container.sh {ecr_uri} {region} {awscli_profile}"
print("Deleting in progress")
subprocess.run(container_delete_command, check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print("Complete.")
break
else:
print("Invalid operation type.")
Expand All @@ -99,15 +103,19 @@ def create_setup():
subprocess.run(terraform_init_command, check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Terraform apply 명령 실행
terraform_apply_command = f"terraform apply --auto-approve --var region={region} --var awscli_profile={awscli_profile} --var container_registry={ecr_uri} --var main_suffix={main_suffix}"
print("It takes about 20 minutes to create.")
subprocess.run(terraform_apply_command, check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print("Complete.")
break
elif terraform_type == "delete":
# Terraform init 명령 실행
terraform_init_command = f"terraform init"
subprocess.run(terraform_init_command, check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Terraform destroy 명령 실행
terraform_destroy_command = f"terraform destroy --auto-approve --var region={region} --var awscli_profile={awscli_profile} --var container_registry={ecr_uri} --var main_suffix={main_suffix}"
print("It takes about 20 minutes to delete.")
subprocess.run(terraform_destroy_command, check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print("Complete.")
break
else:
print("Invalid operation type.")
Expand Down

0 comments on commit aafdb02

Please sign in to comment.