Testing manifests with the deployment system
After locally testing the Terraform manifests and before uploading the service package to the store, it is recommended to test the plans/<PLAN_NAME>/deployment/deploy.tf manifests with the deployment system. This will make sure that all described resources can be created by the deployment system.
The testing process will require:
- A key for API access. The key is displayed in the cloud platform management console on the project settings page (the tab with information about API access).
- The domain name of the cloud platform —
https://cloud.vk.ru.
To test a Terraform manifest with the deployment system:
-
In the cloud platform management console, enable two-factor authentication (2FA) and API access (for more details, see the section Managing 2FA).
-
Perform the API requests:
- Upload the manifest to the deployment system.
- Check the current configuration of the uploaded manifest.
- Create a service instance.
- Delete the service instance.
The API request parameters are described in the following sections.
To upload the plans/<PLAN_NAME>/deployment/deploy.tf manifest to the deployment system, make a request with the parameters given in table 1.
Parameter | Value |
|---|---|
Request method |
|
Request path |
Here:
|
Request body ( | The contents of the If additional provider resources are required for testing, add them to the request body |
|
|
curl -v -X POST https://cloud.vk.ru/marketplace/api/infra-api/api/v1-public/hoe/config/test_1.0 \-H 'x-auth-token: <AUTH_TOKEN>' \--data-binary "@deploy.tf"
HTTP response codes are given in table 2.
Code | Description |
|---|---|
201 | The manifest has been uploaded or updated |
400, 500 | Request execution error |
401 | Authorization error |
When sending a request with a manifest name that already exists in the deployment system, the configuration of that manifest will be updated.
Manifests are uploaded within a single user account.
All previously uploaded manifest configurations are stored in the deployment system to ensure correct Terraform operation. The service instance is deployed with the current manifest configuration, which can be viewed using the GET request /hoe/config/<MANIFEST_NAME> (for more details, see the section Checking the current Terraform manifest configuration).
To check the current Terraform manifest configuration stored in the deployment system, make a request with the parameters given in table 3.
Parameter | Value |
|---|---|
Request method |
|
Request path |
Here:
|
|
|
curl https://cloud.vk.ru/marketplace/api/infra-api/api/v1-public/hoe/config/test_1.0 \-H 'x-auth-token: <AUTH_TOKEN>'
HTTP response codes are given in table 4.
Code | Description |
|---|---|
200 | The request has been completed. The response contains the current configuration of the specified Terraform manifest |
401 | Authorization error |
404 | Manifest not found |
500 | Request execution error |
To create a service instance, make a request with the parameters given in table 5. The resources of the current Terraform manifest configuration will be created.
Parameter | Value |
|---|---|
Request method |
|
Request path |
Here |
|
|
Request body ( | Specify the following parameters:
|
|
|
curl -v -X POST https://cloud.vk.ru/marketplace/api/infra-api/api/v1-public/hoe/object \-H "Content-Type: application/json" \-H 'x-auth-token: <AUTH_TOKEN>' \--data '{"uuid": "675f6f08-XXXX-f02311f795d7","config": "test_1.0","vars": {"sub_network": "a793470c-XXXX-67af6c178c8e","image_uuid": "163ff752-XXXX-b0001e3e65d3","volume_type": "ceph-ssd","flavor_uuid": "6e61564f-XXXX-08df5fd84514"}}'
Here:
sub_network— the subnet ID.image_uuid— the service image ID.volume_type— the disk type.flavor_uuid— the VM flavor ID.
HTTP response codes are given in table 6.
Code | Description |
|---|---|
201 | The service instance has been created |
400, 500 | Request execution error |
401 | Authorization error |
To delete the service instance created as a result of executing the Terraform manifest, make a request with the parameters given in table 7.
Parameter | Value |
|---|---|
Request method |
|
Request path |
Here:
|
|
|
curl -v -X DELETE https://cloud.vk.ru/marketplace/api/infra-api/api/v1-public/hoe/object/675f6f08-XXXX-f02311f795d7 \-H 'x-auth-token: <AUTH_TOKEN>'
HTTP response codes are given in table 8.
Code | Description |
|---|---|
201 | The service instance has been deleted |
400, 500 | Request execution error |
401 | Authorization error |
404 | Manifest not found |
To check the service instance state, make a request with the parameters given in table 9.
Parameter | Value |
|---|---|
Request method |
|
Request path |
Here:
|
|
|
curl https://cloud.vk.ru/marketplace/api/infra-api/api/v1-public/hoe/object/675f6f08-XXXX-f02311f795d7 \-H 'x-auth-token: <AUTH_TOKEN>'
HTTP response codes are given in table 10.
Code | Description |
|---|---|
200 | The request has been completed. The response contains the service instance status (
|
401 | Authorization error |
404 | Service instance identifier not found |
500 | Request execution error |
{"uuid": "675f6f08-XXXX-f02311f795d7","target_status": "deleted","vars": {},"out": "{}","status": "deleted","conf_name": "user@vk.team","conf_hash": "75587baeXXXX","pid": "b66dde3dXXXX","create_at": "2023-04-26T13:57:54.849565Z","update_at": "2023-04-26T14:02:42.667399Z","full_deployed": false,"attempts": 0,"max_attempts": 15}
Here:
uuid— the service instance deployment identifier.target_status— the target status of the service instance (deletedorrunning).vars— the input variables of the manifest.out— the output parameters of the manifest.status— the current status of the service instance.conf_name— the name of the user who deployed the service.conf_hash— the configuration hash of the service instance.pid— the identifier of the project of the user who deployed the service (OpenStack PID).create_at— the date and time when the service instance was created.update_at— the date and time of the last service instance update by the deployment system.full_deployed— whether the service instance has been successfully deployed (for thedeletedstatus the value isfalse).attempts— the number of retries performed when deploying the service instance.max_attempts— the maximum number of retries.
To view the service instance log, make a request with the parameters given in table 11.
Parameter | Value |
|---|---|
Request method |
|
Request path |
Here:
|
|
|
curl https://cloud.vk.ru/marketplace/api/infra-api/api/v1-public/logs/instance/675f6f08-XXXX-f02311f795d7 \-H 'x-auth-token: <AUTH_TOKEN>'
HTTP response codes are given in table 12.
Code | Description |
|---|---|
200 | The request has been completed. The response to the request contains the service instance logs in the |
401 | Authorization error |
404 | Service instance identifier not found |
500 | Request execution error |
[{"message": " Apply complete! Resources: 1 added, 0 changed, 0 destroyed. ","src": "terraform","level": "debug","created_at": "2024-05-30T08:32:24Z","uuid": "675f6f08-XXXX-f02311f795d7","broker_id": ""}]
To view the agent logs and results:
-
Connect to the VM where the agent is installed via a remote access protocol (for more details, see the section Connecting to a VM) or using the VNC console in the cloud platform management console.
-
To view the logs, run the
journalctl -u sowercommand. -
To view the results, go to the
/etc/sower/resultdirectory.