Modules¶
-
GET
/terraform/repositories
¶ Get the list of Terraform repositories.
Response JSON Object: - repositories[key].url (string) – A URL fetchable with go-getter. (https://github.com/hashicorp/go-getter)
Example response:
{ "repositories": { "cluster": { "url": "file:///C:/genvid/gv-version/bastion-services/terraform/modules/cluster" }, "game": { "url": "file:///C:/genvid/gv-version/bastion-services/terraform/modules/game" }, "genvid": { "url": "file:///C:/genvid/gv-version/bastion-services/terraform/modules/genvid" } } }
-
PUT
/terraform/repositories
¶ Update all the Terraform repositories.
-
GET
/terraform/repository/{repositoryID}
¶ Get the body of a Terraform repository.
Parameters: - repositoryID – The name of a Terraform repository. Must be a valid folder name using only lowercase letters.
Request JSON Object: - url (string) – A URL fetchable with go-getter. (https://github.com/hashicorp/go-getter)
Response JSON Object: - repository.url (string) – A URL fetchable with go-getter. (https://github.com/hashicorp/go-getter)
Example query:
{ "url": "" }
Example response:
{ "repository": { "url": "" } }
-
POST
/terraform/repository/{repositoryID}
¶ Set the URL for a Terraform repository and update it.
Parameters: - repositoryID – The name of a Terraform repository. Must be a valid folder name using only lowercase letters.
Request JSON Object: - url (string) – A URL fetchable with go-getter. (https://github.com/hashicorp/go-getter)
Response JSON Object: - repository.url (string) – A URL fetchable with go-getter. (https://github.com/hashicorp/go-getter)
Example query:
{ "url": "" }
Example response:
{ "repository": { "url": "" } }
-
PUT
/terraform/repository/{repositoryID}
¶ If a body is given, update the repository definition. In all cases, update the repository.
Parameters: - repositoryID – The name of a Terraform repository. Must be a valid folder name using only lowercase letters.
Request JSON Object: - url (string) – A URL fetchable with go-getter. (https://github.com/hashicorp/go-getter)
Response JSON Object: - repository.url (string) – A URL fetchable with go-getter. (https://github.com/hashicorp/go-getter)
Example query:
{ "url": "" }
Example response:
{ "repository": { "url": "" } }
-
DELETE
/terraform/repository/{repositoryID}
¶ Remove a Terraform repository.
Parameters: - repositoryID – The name of a Terraform repository. Must be a valid folder name using only lowercase letters.
Response JSON Object: - repository.url (string) – A URL fetchable with go-getter. (https://github.com/hashicorp/go-getter)
Example response:
{ "repository": { "url": "" } }
-
GET
/terraform/modules
¶ Get the list of modules available. Only returns valid modules.
Response JSON Object: - modules[] (object) – A list of Terraform modules.
- modules[].repository (string) – The Terraform repository containing this module.
- modules[].path (string) – The relative path from the bastion root modules of this module.
- modules[].capabilities[] (string) – Array of capabilities.
Example response:
{ "modules": [ { "repository": "cluster", "path": "cluster/default", "capabilities": [ "cluster-api" ] } ] }
-
GET
/terraform/modules/{prefix}
¶ Get the list of modules available under the provided prefix. Only returns valid modules.
Parameters: - prefix – The prefix to filter with. Only returns modules inside this prefix. Doesn’t return partial matches.
Response JSON Object: - modules[] (object) – A list of Terraform modules.
- modules[].repository (string) – The Terraform repository containing this module.
- modules[].path (string) – The relative path from the bastion root modules of this module.
- modules[].capabilities[] (string) – Array of capabilities.
Example response:
{ "modules": [ { "repository": "cluster", "path": "cluster/default", "capabilities": [ "cluster-api" ] } ] }
-
GET
/terraform/module/{module}
¶ Get the description of a Terraform module.
Parameters: - module – The relative path of a module.
Response JSON Object: - module.path (string) – The relative path from the bastion root modules of this module.
- module.variable[key].type (string) – The type of the variable.
- module.variable[key].description (string) – A description of the variable.
- module.variable[key].default – A default value for the variable. Type can be any of string,array,object,null.
- module.output[key].value – The value of the output. Type can be any of string,array,object,null.
- module.output[key].description (string) – A description of the output.
- module.output[key].sensitive (boolean) – If the output value is sensitive.
- module.output[key].depends_on[] (string) – Explicit dependencies of the output value.
Example response:
{ "module": { "path": "cluster/default", "variable": { "game_az": { "description": "AWS Availability Zone where the game instance is to be created.\n", "default": "a" }, "game_count": { "description": "Number of game instance to spawn", "default": 1 } }, "output": { "game_private_ips": { "value": "${module.game.private_ips}" }, "game_public_ips": { "value": "${module.game.public_ips}" } } } }
Terraform¶
-
GET
/terraform/instances
¶ Get all Terraform instances.
Response JSON Object: - [] (object) –
- [].instanceID (string) –
- [].modulePath (string) –
- [].destination (string) –
- [].bastionID (string) –
- [].clusterID (string) –
- [].serverIPs (string) –
Example response:
[ { "instanceID": "mycluster", "modulePath": "cluster/default", "destination": "C:\\Users\\myuser\\.genvid\\terraform\\workdir\\mycluster\\tf", "clusterID": "hd" } ]
-
GET
/terraform/instance/{instanceID}
¶ Get the specified Terraform instance.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - instanceID (string) –
- modulePath (string) –
- destination (string) –
- bastionID (string) –
- clusterID (string) –
- serverIPs (string) –
Example response:
{ "instanceID": "mycluster", "modulePath": "cluster/default", "destination": "C:\\Users\\myuser\\.genvid\\terraform\\workdir\\mycluster\\tf", "clusterID": "hd" }
-
GET
/terraform/instance/{instanceID}/status
¶ Get the status of the instance.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - status (string) –
The status of the cluster.
- VOID: The cluster doesn’t exist.
- EMPTY: The cluster is not initialized.
- DOWN: The cluster has no resource instantiated.
- UP: The cluter has some resources instantiated.
- BUSY: The cluster is currently running a command.
- ERROR: An error occured while retrieving the status.
- INVALID: The current status is unknown or invalid.
Example response:
{ "status": "VOID" }
-
GET
/instance/{instanceID}/tfvars/default
¶ Get the default Terraform variables.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - [key] – Type can be any of boolean,integer,number,object,string,null.
Example response:
{ "keyA": "valueA", "keyB": "valueB" }
-
GET
/terraform/instance/{instanceID}/tfvars
¶ Get the Terraform variables. This is the content of the ‘terraform.tfvars’ file.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - [key] – Type can be any of boolean,integer,number,object,string,null.
Example response:
{ "keyA": "valueA", "keyB": "valueB" }
-
POST
/terraform/instance/{instanceID}/tfvars
¶ Set the Terraform variables. This is the content of the ‘terraform.tfvars’ file.
Parameters: - instanceID – The instance ID. An opaque string.
Request JSON Object: - [key] – Type can be any of boolean,integer,number,object,string,null.
Example query:
{ "keyA": "valueA", "keyB": "valueB" }
-
POST
/terraform/instance/{instanceID}/get
¶ Execute the terraform get command.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - data (string) –
Example response:
{ "data": "" }
-
POST
/terraform/instance/{instanceID}/importmodule
¶ Import a module into Terraform.
Parameters: - instanceID – The instance ID. An opaque string.
Query Parameters: - force – Force the operation even if the cluster is in an error state.
Request JSON Object: - modulePath (string) – The module path.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example query:
{ "modulePath": "" }
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/init
¶ Execute the ‘terraform init’ command.
Parameters: - instanceID – The instance ID. An opaque string.
Query Parameters: - force – Force the operation even if the cluster is in an error state.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/plan
¶ Execute the ‘terraform plan’ command.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/refresh
¶ Execute the ‘terraform refresh’ command.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/apply
¶ Execute the ‘terraform apply’ command.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/apply/{planFileName}
¶ Execute the ‘terraform apply’ command on the specified plan.
Parameters: - instanceID – The instance ID. An opaque string.
- planFileName – The plan file name.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/destroy
¶ Execute the ‘terraform destroy’ command.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
POST
/terraform/instance/{instanceID}/output
¶ Execute the ‘terraform output’ command.
Parameters: - instanceID – The instance ID. An opaque string.
Response JSON Object: - sensitive (boolean) –
- type (string) –
- value (undefined) –
Example response:
{ "sensitive": false, "type": "" }
-
GET
/instance/{instanceID}/content/{contentID}
¶ Get the content of a ‘{contentID}.tf.json’ file.
Parameters: - instanceID – The instance ID. An opaque string.
- contentID – The content ID. An opaque string.
Response JSON Object: - [key] – Type can be any of boolean,integer,number,object,string,null.
Example response:
{ "keyA": "valueA", "keyB": "valueB" }
-
POST
/instance/{instanceID}/content/{contentID}
¶ Set the content of a ‘{contentID}.tf.json’ file.
Parameters: - instanceID – The instance ID. An opaque string.
- contentID – The content ID. An opaque string.
Request JSON Object: - [key] – Type can be any of boolean,integer,number,object,string,null.
Example query:
{ "keyA": "valueA", "keyB": "valueB" }
-
DELETE
/instance/{instanceID}/content/{contentID}
¶ Delete a ‘{contentID}.tf.json’ file.
Parameters: - instanceID – The instance ID. An opaque string.
- contentID – The content ID. An opaque string.
Commands¶
-
GET
/terraform/instance/{instanceID}/commands
¶ Get the commands.
Parameters: - instanceID – The instance ID. An opaque string.
Query Parameters: - current – If true, only return executing commands.
Response JSON Object: - [] (object) –
- [].data (string) –
- [].instanceID (string) –
- [].category (string) –
- [].command (string) –
- [].args (string) –
- [].error (string) –
- [].start (string) –
- [].end (string) –
Example response:
[ { "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" } ]
-
GET
/terraform/instance/{instanceID}/command/{commandID}
¶ Get the command data.
Parameters: - instanceID – The instance ID. An opaque string.
- commandID – The command ID. An opaque string.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
GET
/terraform/instance/{instanceID}/log/{commandID}
¶ Get a command log.
Parameters: - instanceID – The instance ID. An opaque string.
- commandID – The command ID. An opaque string.
Query Parameters: - origin – Either ‘start’ or ‘end’.
- offset – The offset to the origin.
- size – The max size of the return value.
Response JSON Object: - offset (integer) –
- data (string) –
- isDone (boolean) –
Example response:
{ "data": "", "isDone": false }
-
GET
/terraform/instance/{instanceID}/wait/{commandID}
¶ Wait until the command finishes and returns the command runner.
Parameters: - instanceID – The instance ID. An opaque string.
- commandID – The command ID. An opaque string.
Response JSON Object: - data (string) –
- instanceID (string) –
- category (string) –
- command (string) –
- args (string) –
- error (string) –
- start (string) –
- end (string) –
Example response:
{ "data": "", "instanceID": "", "category": "", "command": "", "args": "", "error": "", "start": "", "end": "" }
-
GET
/instance/{instanceID}/terminate/{commandID}
¶ Terminate a command.
Parameters: - instanceID – The instance ID. An opaque string.
- commandID – The command ID. An opaque string.
-
GET
/instance/{instanceID}/kill/{commandID}
¶ Kill a command.
Parameters: - instanceID – The instance ID. An opaque string.
- commandID – The command ID. An opaque string.