A spring-boot-based project which aims to provide a RESTful API for Terraform CLI.
Server can be compiled and started as below
./mvmw clean install -DskipTests
java -jar target/terraform-boot-*.jar
API can be accessed using the following URLs
http://localhost:9090
http://localhost:9090/swagger-ui/index.html
- deploy - This wraps the Terraform
plan
andapply
methods. - destroy - This wraps the Terraform
destroy
method. - validate - This wraps the Terraform
validate
method.
The terraform-boot
application must have access to the root module folder under which each sub-folder is a module
used per API request.
The default root folder where all module sub-folders will exist is the temp folder of the user running the server.
This configuration can be changed by updating the terraform.root.module.directory
property.
The below property names can be changed in the following ways
- passing the property values to the server startup command as
--${property-name}=${property-value}
- Setting corresponding environment variables before starting the server.
property name | environment variable | default value | description |
---|---|---|---|
terraform_binary_path | TERRAFORM_BINARY_PATH | Terraform available on syspath | The path to the terraform binary |
terraform.root.module.directory | TERRAFORM_ROOT_MODULE_DIRECTORY | /tmp on Linux \AppData\Local\Temp on Windows |
The path to the parent directory where all terraform module directories will be stored at as subdirs |
log.terraform.stdout.stderr | LOG_TERRAFORM_STDOUT_STDERR | true | Controls if the command execution output must be logged. If disabled, the output is only returned in the API response |
terraform.log.level | TERRAFORM_LOG_LEVEL | INFO | Controls the log level of the terraform binary. Allowed values are INFO, DEBUG, TRACE, WARN and ERROR |