Once a user clicks “Export as Terraform code”, POST to endpoint “/validate” and JSON (with comments, severity, and recommendations) is returned.
Show scrollable text block with actual comments and recommendations in modal
Add two buttons to modal - “Edit” and “Download archive”
Start with single "error" to try out UI
Examples of JSON responses from modules.tf /validate endpoint:
When there are errors:
{
"comments": [
{"severity": "INFO", "text": "Network load-balancer does not have Terraform module yet, and it will not be exported"},
{"severity": "ERROR", "text": "VPC 'vpcname' can't span across multiple regions (eu-west-1, eu-west-2, us-east-1). VPC can be only in one region."},
{"severity": "ERROR", "text": "VPC 'vpcname' and resources it contains should be in the same region."}
],
"summary": "Please correct blueprint and try again",
"valid": false
}
When success:
{
"comments": [
{"severity": "INFO", "text": "Network load-balancer does not have Terraform module yet, and it will not be exported"},
],
"summary": "Validation passed",
"valid": true
}
Description:
If there is at least one hard-failure valid is set to false. This means the user can't see the "Continue" button and get zip-archive.
Validation flow:
Examples of JSON responses from modules.tf
/validate
endpoint:When there are errors:
When success:
Description:
valid
is set tofalse
. This means the user can't see the "Continue" button and get zip-archive.summary
- is a human-friendly text to show.comments
- is a list of severity and text.