Skip to content

Commit

Permalink
improve terraform generation by loading the qovery terraform provider…
Browse files Browse the repository at this point in the history
… documentation
  • Loading branch information
evoxmusic committed Sep 14, 2024
1 parent dc11f9f commit cef2f94
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module qovery-ai-migration
go 1.22.5

require (
github.com/Qovery/qovery-migration-ai-agent v0.0.0-20240914150846-431dbb7a76b4
github.com/Qovery/qovery-migration-ai-agent v0.0.0-20240914152523-dc11f9fa0095
github.com/joho/godotenv v1.5.1
github.com/schollz/progressbar/v3 v3.14.6
github.com/spf13/cobra v1.8.1
Expand Down
2 changes: 2 additions & 0 deletions cli/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/Qovery/qovery-migration-ai-agent v0.0.0-20240914141434-ca2b24132660 h
github.com/Qovery/qovery-migration-ai-agent v0.0.0-20240914141434-ca2b24132660/go.mod h1:BK4dodrSYDAJySssVnQDgzCjaR1yvonA3hNYsDigYLQ=
github.com/Qovery/qovery-migration-ai-agent v0.0.0-20240914150846-431dbb7a76b4 h1:TFpTH6EqVmmwCYmKVB6lAXAKkHuLLMkrdkFHmaJPAeY=
github.com/Qovery/qovery-migration-ai-agent v0.0.0-20240914150846-431dbb7a76b4/go.mod h1:BK4dodrSYDAJySssVnQDgzCjaR1yvonA3hNYsDigYLQ=
github.com/Qovery/qovery-migration-ai-agent v0.0.0-20240914152523-dc11f9fa0095 h1:4VI/HIGPztd1bKEmOpWc6uTvBrCKdRNfwwaDSjq5epE=
github.com/Qovery/qovery-migration-ai-agent v0.0.0-20240914152523-dc11f9fa0095/go.mod h1:BK4dodrSYDAJySssVnQDgzCjaR1yvonA3hNYsDigYLQ=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
21 changes: 12 additions & 9 deletions pkg/migration/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,18 @@ Use the following Terraform examples as reference:
Provide two separate configurations:
1. A main.tf file containing the full Terraform configuration for all apps.
2. A variables.tf file containing the Qovery API token and the necessary credentials for the %s cloud provider.
Format the response as a tuple of two strings with a "|||" separator: (main_tf_content|||variables_tf_content).
Don't use Buildpacks, only use Dockerfiles for build_mode.
Don't format the output by using backticks.
Export secrets or sensitive information from the main.tf file into the variables.tf and don't include the sensitive data.
Do not include anything else.
Try to optimize the configuration as much as possible.
Include comment to explain the configuration if needed - users are technical but can be not familiar with Terraform.
Refer to the Qovery Terraform Provider Documentation below to see all the options of the provider and how to use it:
Format the response as a tuple of two strings with a "|||" separator: (main_tf_content|||variables_tf_content) without anything else.
I need to be able to parse the response to extract the Terraform configurations.
Instructions:
- Don't use Buildpacks, only use Dockerfiles for build_mode.
- Export secrets or sensitive information from the main.tf file into the variables.tf with no default value.
- If an application refer to a database that is created by another application, make sure to use the same existing database in the Terraform configuration.
- If an application to another application via the environment variables, make sure to use the "environment_variable_aliases" from the Qovery Terraform Provider resource (if available. cf doc).
- If in the service you see an application that can be provided by a container image from the DockerHub, use the "container_image" from the Qovery Terraform Provider resource (if available. cf doc).
- Include comment into the Terraform files to explain the configuration if needed - users are technical but can be not familiar with Terraform.
- Try to optimize the Terraform configuration as much as possible.
- Refer to the Qovery Terraform Provider Documentation below to see all the options of the provider and how to use it:
%s`, string(configJSON), destination, string(examplesJSON), destination, string(qoveryTerraformDocMarkdownJSON))

response, err := claudeClient.Messages(prompt)
Expand Down

0 comments on commit cef2f94

Please sign in to comment.